Ship the gate recorder: the command group jacked tests with run,
record, seen, profile, history,
prune and loss. The recorder measures each gate of a repository and
keeps a local history. A session can ask seen before it starts a full gate, and a
tree that passed does not run again. This plan also repairs the Codex policy file for the two
user-only skills that jacked ships today.
Spec: 2026-11-25-test-diet-design.html (approved by the owner on 2026-11-26), Part 1 and Part 3. Research: 2026-11-25-test-suite-diet-research.html. The executor reads both.
Tech stack: Python 3.11+ (requires-python of this package), click,
pytest. No new third-party package.
Two review cycles read the plan of the full feature on 2026-11-26. Each cycle found new defects, and the defects of the second cycle were in the parts that the first cycle added. The review limit of two cycles is reached. The full plan is now three documents.
| Document | Holds | State |
|---|---|---|
| This plan | The recorder, the loss report, the Codex policy file, the reference text. | Ready to build. Each task gets its own review when it is built. |
| The skill plan | The ledger, the ID
check, the skill /test-diet. | Not ready. It needs a smaller design. |
| The gate machine plan | jacked tests run --on. | On hold. The mechanism is not decided. |
These are the changes of the second review that this plan holds. No other part of the second review touches the recorder.
| Finding | Change | Task |
|---|---|---|
The hash of the gate command held the report path. A gate line makes a new report
folder for each run, so seen could never say yes. | The caller writes
{junit} in the command. run makes the folder and puts the path in.
The hash is the hash of the command as the caller typed it. | 3 |
| A record with no exit code had no verdict. | The verdict unknown.
It never satisfies seen. | 2 |
The sample reports hold the path /work and the reader gets a real
folder. | read_junit has report_root: a path of the report
that starts with it is a path under the root. | 1 |
The check for private values refused text that only contains a login name
(jack in jacked). | A host name and a login name match as a whole word. A home path matches as a prefix. | 1 |
| The rule for a DOCTYPE named a mechanism that Python does not have. | A parser
target whose doctype method raises. Tried on 2026-11-26: it stops a DOCTYPE and
an entity declaration before a test case is read. | 1 |
| Small findings. | A flaky test needs a pass and a failure, not a pass and a
skip. A fixed report path is fresh when its content changed. The machine identity is a random
value, not a hash of the host. Git runs with GIT_OPTIONAL_LOCKS=0. The lint step
does not read the sample projects. The fixtures repo and store have
a home. | 1 to 4 |
One new package, jacked/testdiet/, holds the mechanical work: it reads JUnit XML,
gives each tree an identity, and keeps a local history. The commands print numbers. They never
decide that a test is slow, junk or flaky.
flowchart LR
CLI[jacked tests: cli.py group] --> REC[record.py: run, record, seen]
CLI --> VIEW[views.py: profile, history]
CLI --> LOSS[loss.py: loss report]
REC --> JU[junit.py + ids.py]
REC --> TREE[tree.py: tree identity]
REC --> HIST[(history.py: git common dir)]
VIEW --> HIST
LOSS --> GIT[(git)]
jacked tests (cli.py group) -> record.py (run, record, seen) -> junit.py + ids.py, tree.py, history.py views.py (profile, history) -> history.py loss.py -> git
Each task's requirements include this section.
jacked/testdiet/. Use the helpers that
jacked has, and do not write them again: jacked.atomic_io.atomic_write_bytes
(atomic_io.py:332) for each file of the history;
jacked.packs.jacked_home (packs.py:97; it is the home folder, and
jacked keeps its state in .claude/ under it);
jacked.git_guard.run_git for a git read that needs no filter;
jacked.findbin.find_bin; jacked.regular_file.open_regular_fd for each
path that a caller gives.shell=True.test_ in the package, and no class
name starts with Test.None,
null). It is never zero.jacked tests run returns the exit code of the command that it
wraps. A recorder error never changes that code. The one exception is the flag
--strict.gate.example and the root /work.[A-Za-z0-9._-]+, checked
with re.fullmatch..github/workflows/tests.yml). Write text files as bytes or with
newline="". A value that a system does not give is empty there.real_process and real_process_tree in tests/conftest.py
before you write a test that starts git or a child process, and follow a present
test that does the same (tests/unit/test_git_reality.py).uv run python -m pytest <files>. Each task runs its
own test files plus grep -rl <changed module or directory name> tests/, and
uv run ruff check on the files that it changed. The full suite runs one time, in
Task 11. Each task reports --durations=10 of its new test files.pkill -f /
killall a generic pattern (pytest, python, node,
layout_qa.py, ci_local.py --layout, a server name) on this machine; stop
only processes you started, by PID.uptime before each test run. Above a load of 15 on this
machine, run the targeted files with no parallel workers and say so.seen, and an old file is never read as this run. Tests in Task 3.|| true). Expected: a conflict, printed, never a pass. Tests in Task 3.seen never says yes for a
tree that did not run, and a tree that changed is named. Tests in Tasks 2 and 3.seen says yes. Tests in Task 3.| File | Responsibility |
|---|---|
jacked/testdiet/__init__.py, model.py | CaseResult, RunData, TreeId, RunMeta. |
jacked/testdiet/junit.py, ids.py | Read JUnit XML. One normalized test ID for each runner. Parse a listing. |
jacked/testdiet/tree.py | The identity of a tree, the fingerprint of input files, the common git directory, the machine identity. |
jacked/testdiet/history.py | The local store of runs. |
jacked/testdiet/record.py | run_gate, record_files, seen, the repeat-failure notice. |
jacked/testdiet/views.py | The numbers of profile and history. |
jacked/testdiet/loss.py | The loss report from git. |
jacked/cli.py | The group jacked tests, after the dcr group (cli.py:6874). Each command imports its module inside the function. tests joins the commands that _maybe_prompt_first_run skips (cli.py:179). |
jacked/data/skills/review-animations/agents/openai.yaml | The Codex policy file for a skill that only the user starts. |
jacked/codex/_generate.py, _fsutil.py, installer.py | The Codex policy file for a command that has disable-model-invocation. |
README.md, jacked/data/rules/jacked-reference.md | The new command group and the gate line. |
tests/_testdiet.py | Shared test helpers, imported as from tests._testdiet import ... (the pattern of tests/_platform.py): make_repo(path) (follows tests/unit/test_git_reality.py:45), fixture_reports(runner), fixture_project(runner), fixture_listing(runner), REPORT_ROOT = "/work", provenance(), private_hits(text, *, host, login, home) (Task 1), and fill_store(path) (Task 4, because it needs the history module). Each test module that needs repo or store defines that fixture from these helpers. |
tests/unit/test_testdiet_*.py, test_cli_tests_group.py, test_codex_implicit_invocation.py, test_tests_reference.py | The tests. |
tests/fixtures/testdiet/ | reports/ (real JUnit files, listings and console totals), projects/ (the source files of the small projects), capture.py, PROVENANCE.json. |
tests/conftest.py, pyproject.toml | collect_ignore_glob for fixtures/testdiet/projects/*; [tool.ruff] extend-exclude for the same folder. |
These are the builder's calls. Task 9 puts them into the spec with that label.
| Subject | Decision | Reason |
|---|---|---|
| History format | Two files for each run in <git common dir>/jacked-tests/runs/:
<id>.tests.json.gz first, then <id>.meta.json. The meta file
is the commit marker: a run with no meta file does not exist. The ID is
<UTC time>-<8 random hex>. | No shared file, so parallel sessions cannot damage a record. |
| Retention | Nothing is deleted automatically. history always prints
the size of the store. jacked tests prune --before DATE deletes on request and prints each
deleted run. | An automatic limit drops data silently. |
| Tree identity | TreeId(commit, tree, clean). A clean tree uses
HEAD^{tree}. A tree with changes uses a copy of the index
(git rev-parse --git-path index) and a temporary object directory
(GIT_OBJECT_DIRECTORY, with the real one in
GIT_ALTERNATE_OBJECT_DIRECTORIES), then git add -A and
git write-tree. Each git call has GIT_OPTIONAL_LOCKS=0. The real index
and the real object store do not change. The clean and smudge filters stay on, because the hash
must be equal to the tree of a commit. A repository with no commit, or a bare one, has no
tree. | Two commits with the same content are one tree. Changes that are not committed are in the identity. |
| Limits of the identity | It does not hold a file that git ignores, and it does
not hold a change inside the work tree of a submodule. --input GLOB adds a
fingerprint of named files (path, size, modification time in nanoseconds, not content) to the
record and to seen. With git-lfs, the clean filter can write a copy of a new large
file into the lfs folder of the clone. The reference text says these limits. | In the owner's data service a stale ignored file changed the result of a gate. |
| The gate command and the report path | The record holds command_sha:
the SHA-256 of the arguments as the caller typed them, joined by a NUL. An argument can hold
the text {junit}. Then run makes a private folder with
tempfile.mkdtemp, puts <folder>/junit.xml in place of each
{junit}, reads that file after the gate, and removes the folder before it reads
the tree a second time. seen hashes the same typed command.
--kind full|targeted is a label for the views only. | A label that the caller picks cannot prove which command ran. A path that changes for each run must not be in the hash. |
| A report at a fixed path | --junit GLOB, one or more times, for a
runner that writes its report where its own configuration says. Before the run, the recorder
takes the SHA-256 of the content of each match. After the run it reads a match that is new or
whose content changed, and prints one line for each match that it did not read. | A clock or a coarse file system must not hide a fresh report. An old report must not become this run. |
| Verdict of a run | passed: exit code 0, a JUnit file was read, no
failed and no error test, at least one test. failed: exit code not 0.
conflict: exit code 0 and a failed or an error test. no-data: exit
code 0 and no JUnit data, or no test in it. unknown: no exit code (a
record with no --exit-code). | A pipe can turn a red gate into exit code 0. |
| One ID two times | One CaseResult for each ID. attempts
counts the attempts that the report shows. The seconds are the sum. The state is
flaky when one attempt passed and one attempt failed or had an error. If not, it
is the worst state (error, failed, passed, skipped). A flaky test is not in the failing set.
If the real report of a rerun tool does not show the first attempt, the state is the state
that the report shows, and the task report says so. | A rerun tool can write one test more than one time. |
| pytest file names | A pytest JUnit file has a dotted class name and no file path.
The reader finds the file by a lookup in the tree: the longest dotted prefix that is a
.py file inside the root. A value that would leave the root gives
file=None. | The profile works by file. |
| A report of a different root | read_junit(..., report_root=None).
When it is given, an absolute path of the report that starts with it is a path under
root. The match is on text with / separators, so it works for a
POSIX path on Windows. jacked tests record --report-root PATH gives it for a
report that a different machine made. | The sample reports hold /work. A
report of hosted CI holds the path of the runner. |
| Machine | machine is a label: local for a wrapped run,
or the value of record --machine. machine_id is 32 random hex
characters, made one time in jacked_home()/.claude/jacked-tests-machine-id with
mode 0600 where the system has modes. No command prints it. A record that
record --machine made has no machine_id. | One clone can be open on the host and in a container. A hash of the host name is a private value in a second form. |
| Setup share | profile prints a setup share only when the record
holds one. A JUnit file does not. | A value that a file does not hold stays empty. |
| Default branch | on_default_branch is set when the record is written,
with no fetch: the tree is clean and the commit is an ancestor of the ref that
refs/remotes/origin/HEAD names. With no such ref it is empty. | The notice must not start a network call. |
| Processor time | The difference of RUSAGE_CHILDREN around the child.
It holds only the processes that the gate waited for. It is empty on Windows. | The system gives no more. |
| The gate line | A gate line of a repository checks
jacked tests run --help and runs the bare gate command, with one printed line,
when it fails. The reference text holds the line and a test runs it. | A gate script must not break on a machine that has an older jacked. |
| The sample projects | The repository holds the source files of each small
project and no dependency manifest of npm. capture.py holds the exact tool
versions, builds each project in a temporary folder, and installs there with scripts off.
| A manifest in the repository starts dependency alerts for packages that jacked does not ship. |
| Codex policy file | For a skill: a real file agents/openai.yaml in the
skill directory, and a test that fails when a skill has the key and no file. For a command:
the generator writes the file into the skill that it makes from the command. | The
installer refuses a target file that the source does not have
(install_manifest.py:238), so a file that only the installer adds would send each
jacked skill to the backup folder. |
Files. Create jacked/testdiet/__init__.py, model.py,
junit.py, ids.py, tests/fixtures/testdiet/,
tests/_testdiet.py, tests/unit/test_testdiet_junit.py,
tests/unit/test_testdiet_ids.py; modify tests/conftest.py,
pyproject.toml.
@dataclass(frozen=True)
class CaseResult:
id: str # normalized, see ids.normalize
file: str | None # repo-relative POSIX path, always inside the root
seconds: float | None
state: str # "passed" | "failed" | "error" | "skipped" | "flaky"
failure_type: str | None # the `type` attribute of the failure element; never its message
attempts: int
@dataclass(frozen=True)
class RunData:
runner: str # "pytest" | "vitest" | "jest" | "playwright" | "go" | "nextest" | "unknown"
tests: tuple[CaseResult, ...]
seconds_reported: float | None
class JUnitError(ValueError): ...
class ListingError(ValueError): ...
def read_junit(paths: Sequence[Path], *, root: Path, report_root: str | None = None,
runner: str | None = None) -> RunData
def normalize(runner: str, classname: str, name: str, file: str | None, *, root: Path,
report_root: str | None = None) -> tuple[str, str | None]
def ids_from_listing(runner: str, text: str, *, root: Path) -> list[str] # raises ListingError on an error line
def detect_runner(suite_attributes: Mapping[str, str], first_case: Mapping[str, str]) -> str
# tests/_testdiet.py
def private_hits(text: str, *, host: str, login: str, home: str) -> list[str]
Rules of the reader. Open each path with open_regular_fd. Parse
with xml.etree.ElementTree.XMLParser(target=T) and feed the file in blocks.
T.start reads the attributes that the fields need. T.data does nothing,
so the reader never holds the text of an element. T.doctype raises
JUnitError. A ParseError becomes a JUnitError. No size limit.
The message attribute of a failure element goes into no field.
Rule of private_hits. It returns each private value that the text
holds. The home path matches as text, with either separator. The host name (the full name and its
first part) and the login name match as a whole word: the character before and the character after
are not a letter, a digit or an underscore. The match ignores case. The capture script calls it
with the values of the machine that captures, and stops when it returns a hit.
tests/fixtures/testdiet/projects/ (pytest, Vitest, Jest with
jest-junit, Playwright with tests that open no browser, Go with gotestsum, Rust with
cargo-nextest). Each project has: a passing test, a failing test, a skipped test, a parametrized
or table test, a test in a class or a nested suite, and a test named
sleeps_half_a_second that sleeps for 0.5 seconds. Add for pytest: a run with
pytest-rerunfailures in which one test fails and then passes, and a second project with a module
that cannot import (its JUnit file and its --collect-only -q output). Add for
Playwright: a second report of the same tests after one test moved down in its file.capture.py. It copies each project to
a temporary folder, writes the dependency manifest there with exact versions that are 14 days
old or more, installs there with install scripts off, and runs the project. It rewrites the
absolute root prefix to /work, sets each hostname attribute to
gate.example, calls private_hits on each output and stops on a hit. It
keeps the JUnit file, the listing and the console total in reports/, and writes
PROVENANCE.json: the tool versions, the commands, the date, and the two rewrites as
the only changes. Read each command in the runner's own documentation first. Use a release
binary of gotestsum and of cargo-nextest; do not compile a tool. Add the
collect_ignore_glob entry and the extend-exclude entry.feat(testdiet): read JUnit of six runners into one form.RUNNERS = ["pytest", "vitest", "jest", "playwright", "go", "nextest"]
LISTED_BY_NAME = ("pytest", "vitest", "playwright", "nextest") # this tuple is fixed by the plan
@pytest.mark.parametrize("runner", RUNNERS)
def test_real_report_gives_the_normalized_fields(runner): ... # passed, failed and skipped are present
@pytest.mark.parametrize("runner", RUNNERS)
def test_a_test_that_sleeps_half_a_second_reads_as_half_a_second(runner):
data = read_junit(fixture_reports(runner), root=fixture_project(runner), report_root=REPORT_ROOT)
slept = [t for t in data.tests if "sleeps_half_a_second" in t.id]
assert len(slept) == 1 and 0.4 <= slept[0].seconds <= 5.0
@pytest.mark.parametrize("runner", RUNNERS)
def test_each_case_of_a_real_report_has_a_file_inside_the_project(runner): ... # report_root maps /work to the folder
def test_a_report_path_outside_the_report_root_gives_no_file(tmp_path): ...
@pytest.mark.parametrize("runner", LISTED_BY_NAME)
def test_ids_of_the_report_equal_ids_of_the_listing(runner): ...
def test_jest_lists_files_only_and_each_report_file_is_listed(): ...
def test_go_lists_top_level_tests_and_each_report_id_starts_with_a_listed_name(): ...
def test_pytest_class_parametrized_and_nested_ids_have_the_file(): ...
def test_a_playwright_id_has_no_line_or_column(): ...
def test_a_playwright_test_that_moved_down_keeps_its_id(): ... # the two real reports
@pytest.mark.parametrize("runner", RUNNERS)
def test_no_message_and_no_text_of_a_failure_is_kept(runner): ... # take each message attribute and element text
# from the raw file; none is in repr(data)
def test_the_failure_type_is_kept_as_a_class_name(): ...
def test_a_test_that_failed_and_passed_on_a_rerun_is_flaky(): ... # the real rerun report
def test_a_passed_and_a_skipped_attempt_is_not_flaky(tmp_path): ...
def test_a_testcase_with_failure_and_error_is_an_error(): ...
def test_two_report_files_with_one_id_give_one_case(): ...
def test_a_truncated_file_raises_junit_error(tmp_path): ...
def test_a_file_with_a_doctype_raises_junit_error(tmp_path): ...
def test_a_file_with_an_entity_declaration_raises_before_a_case_is_read(tmp_path): ...
def test_a_class_name_that_leaves_the_root_gives_no_file(tmp_path): ... # "..", an absolute value, an empty part
def test_a_listing_of_a_module_that_cannot_import_raises_listing_error(): ...
def test_the_report_of_a_collection_error_has_an_error_case_for_the_module(): ...
def test_no_fixture_holds_a_host_name_or_a_home_path(): ... # each hostname= is gate.example; no /Users/, /home/, \Users\
def test_private_hits_finds_a_login_as_a_whole_word(): ... # login "jack": "by jack." is a hit
def test_private_hits_accepts_a_word_that_only_contains_the_login(): ... # login "jack": "jacked" is no hit
def test_private_hits_finds_the_home_path_with_either_separator(): ...
def test_pytest_collects_nothing_under_the_fixture_projects(): ... # a child pytest --collect-only on that folder
def test_the_fixture_folder_has_no_npm_manifest(): ... # no package.json, no lock file
Files. Create jacked/testdiet/tree.py, history.py;
extend model.py; create tests/unit/test_testdiet_tree_history.py.
@dataclass(frozen=True)
class TreeId:
commit: str; tree: str; clean: bool
@dataclass(frozen=True)
class RunMeta:
id: str; started: str; source: str # "run" | "record"
wall_seconds: float | None; exit_code: int | None
verdict: str # "passed" | "failed" | "conflict" | "no-data" | "unknown"
kind: str | None; label: str | None; runner: str | None
command_sha: str | None; inputs_sha: str | None
machine: str; machine_id: str | None
tree: TreeId | None; tree_changed: bool | None; on_default_branch: bool | None
counts: dict[str, int] | None; seconds_reported: float | None
load_start: float | None; load_end: float | None; child_cpu_seconds: float | None
failing: tuple[str, ...]; flaky: tuple[str, ...]; failing_sig: str | None
def tree_state(cwd: Path, *, objects: Path | None = None) -> tuple[TreeId | None, str] # built as tree_id; the review moved callers here (the str says why there is no tree)
def changed_paths(cwd: Path, a: TreeId, b: TreeId) -> list[str]
def inputs_fingerprint(cwd: Path, globs: Sequence[str]) -> str | None # None when no glob is given
def common_dir(cwd: Path) -> Path
def store_dir(cwd: Path) -> Path # common_dir / "jacked-tests"
def machine_id(home: Path | None = None) -> str | None # None when the file cannot be read or made
def on_default_branch(cwd: Path, tree: TreeId) -> bool | None # no fetch; None with no refs/remotes/origin/HEAD
def command_sha(argv: Sequence[str]) -> str
def failing_signature(cases: Iterable[CaseResult]) -> str | None # sha256 of the sorted (id, failure_type) pairs
def verdict_of(exit_code: int | None, data: RunData | None) -> str
def write_run(store: Path, meta: RunMeta, data: RunData | None) -> None
def iter_runs(store: Path) -> Iterator[RunMeta] # newest first; a damaged file is skipped with a warning
def load_tests(store: Path, run_id: str) -> RunData | None
def prune(store: Path, before: date) -> list[str]
Rule. A meta file that holds a field that this version does not know is still read. A field that the file does not hold is empty. So a later version can add a field.
feat(testdiet): tree identity and a local history that no session can damage.def test_a_clean_tree_is_clean_and_has_the_head_tree(repo): ...
def test_an_edit_that_is_not_committed_changes_the_tree_and_is_not_clean(repo): ...
def test_a_new_file_that_git_does_not_ignore_changes_the_tree(repo): ...
def test_an_ignored_file_does_not_change_the_tree(repo): ...
def test_two_commits_with_the_same_content_have_one_tree(repo): ...
def test_tree_id_does_not_change_the_real_index(repo): ...
def test_tree_id_in_a_linked_worktree_does_not_change_its_index(repo): ...
def test_tree_id_of_a_dirty_tree_writes_no_object_into_the_repository(repo): ... # git count-objects before and after
def test_each_git_call_of_tree_id_has_optional_locks_off(repo, monkeypatch): ...
def test_a_repository_with_no_commit_has_no_tree(tmp_path): ...
def test_changed_paths_names_the_file_that_differs(repo): ...
def test_the_inputs_fingerprint_changes_when_an_ignored_input_changes(repo): ...
def test_two_worktrees_of_one_clone_share_one_store(repo): ...
def test_the_store_is_outside_the_work_tree(repo): ...
def test_a_run_comes_back_the_same(tmp_path): ...
def test_a_value_that_is_absent_comes_back_as_none_not_zero(tmp_path): ...
def test_a_meta_file_with_a_field_of_a_later_version_is_read(tmp_path): ...
def test_a_run_with_no_meta_file_does_not_exist(tmp_path): ... # only the tests file was written
def test_two_processes_write_runs_at_once_and_both_are_readable(tmp_path): ...
def test_a_damaged_meta_file_is_skipped_and_the_others_are_listed(tmp_path): ...
def test_prune_deletes_only_runs_before_the_date_and_names_them(tmp_path): ...
@pytest.mark.parametrize("code,failed,expected", [(0, 0, "passed"), (1, 2, "failed"), (1, 0, "failed"),
(0, 2, "conflict"), (0, None, "no-data"), (None, 0, "unknown"), (None, 2, "unknown")])
def test_verdict_of(code, failed, expected): ... # failed None means no report
def test_a_run_with_no_test_is_not_passed(): ... # exit 0, a report with zero cases
def test_the_failing_signature_differs_when_the_failure_type_differs(): ...
def test_the_command_sha_differs_when_one_argument_is_split_in_two(): ... # ["a b"] and ["a", "b"]
def test_on_default_branch_is_true_for_a_clean_tree_at_an_ancestor_of_the_remote_head(repo): ...
def test_on_default_branch_is_false_for_a_dirty_tree_and_for_a_commit_that_is_not_an_ancestor(repo): ...
def test_on_default_branch_is_empty_with_no_remote_head(repo): ...
def test_the_machine_id_is_made_one_time_and_read_back(tmp_path): ...
def test_the_machine_id_holds_no_part_of_the_host_name(tmp_path, monkeypatch): ...
def test_the_machine_id_file_is_for_the_user_only(tmp_path): ... # POSIX: mode 0600
run, record, seen and the command groupFiles. Create jacked/testdiet/record.py,
tests/unit/test_testdiet_run.py, tests/unit/test_cli_tests_group.py;
modify jacked/cli.py.
JUNIT_PLACEHOLDER = "{junit}"
def run_gate(argv: Sequence[str], *, cwd: Path, junit: Sequence[str] = (), inputs: Sequence[str] = (),
kind: str | None = None, label: str | None = None, runner: str | None = None,
strict: bool = False) -> int
def record_files(junit: Sequence[Path], *, cwd: Path, kind: str | None, label: str | None, runner: str | None,
commit: str | None, exit_code: int | None, wall_seconds: float | None,
machine: str | None, report_root: str | None) -> RunMeta # source "record"; tree is None
# when commit is None
def seen(store: Path, tree: TreeId, command_sha: str, *, inputs_sha: str | None,
machine_id: str | None, any_machine: bool = False) -> RunMeta | None
def repeat_notice(store: Path, meta: RunMeta) -> str | None
# jacked tests run [--junit GLOB]... [--input GLOB]... [--kind full|targeted] [--label TEXT] [--runner NAME] [--strict] -- CMD...
# jacked tests record --junit PATH... [--kind ..] [--exit-code N] [--wall SECONDS] [--commit SHA] [--machine LABEL]
# [--report-root PATH]
# jacked tests seen [--input GLOB]... [--any-machine] [--json] -- CMD... exit 0: passed before. exit 1: not seen.
Rules of run. The order is: read the tree; hash the typed command;
make the report folder when an argument holds {junit}; start the child; wait; read the
report; remove the report folder; read the tree a second time; write the record. The child inherits
standard output and standard error. The record holds the tree identity from before the child. When
the two identities differ, tree_changed is true and run prints the
changed paths. After an interrupt of the parent, run waits for the child. A child
that a signal stops gives 128 plus the signal number. A command that cannot start gives 127.
Outside a git repository, run runs the command, prints one line, records nothing and
returns the exit code. On a conflict it prints one line on standard error that says that the gate
returned 0 and that the report holds failures; with --strict it returns 1.
Rule of seen. It returns a run only when all of these are true:
source is run; verdict is passed;
tree_changed is false (not empty); the tree hash, the command SHA and the inputs
fingerprint are equal; the machine identity is equal and not empty, unless
--any-machine.
Rule of the notice. It states facts: how many earlier records hold the same
failing signature, the first and the last date, the number of trees, and how many of those records
have on_default_branch true. It does not say whose defect it is.
sys.executable -c with a small script that writes a copy of a real fixture to the
path that it gets and exits with a chosen code. Run them. Expected: FAIL.record.py and the group. Exempt
tests in _maybe_prompt_first_run (cli.py:179).tests/unit/test_cli_dcr.py, tests/unit/test_cli_first_run_and_tray.py.
Expected: PASS.feat(testdiet): jacked tests run wraps a gate and keeps its exit code.@pytest.mark.parametrize("code", [0, 1, 2, 5])
def test_run_returns_the_exit_code_of_the_gate(repo, code): ...
def test_run_records_counts_failing_ids_the_tree_and_the_command_sha(repo): ...
def test_the_store_holds_the_sha_of_the_command_and_not_its_text(repo): ...
def test_run_puts_a_report_path_in_place_of_the_placeholder(repo): ... # the child gets a real path
def test_two_runs_with_different_junit_folders_have_one_command_sha(repo): ... # focus 5
def test_seen_is_true_for_the_same_command_with_a_new_junit_folder(repo): ... # focus 5
def test_the_placeholder_folder_is_outside_the_tree_and_is_removed(repo): ...
def test_a_gate_that_writes_no_report_at_the_placeholder_is_no_data(repo): ... # focus 1
def test_run_without_junit_is_no_data_and_keeps_the_exit_code(repo): ...
def test_run_reads_a_fixed_report_whose_content_changed(repo): ... # same size, mtime set back; focus 1
def test_run_does_not_read_a_fixed_report_that_did_not_change_and_says_so(repo, capsys): ... # focus 1
def test_run_with_a_truncated_junit_keeps_the_exit_code_and_is_no_data(repo): ... # focus 1
def test_a_junit_path_that_is_a_fifo_does_not_block_the_run(repo): ... # POSIX
def test_exit_0_with_failures_in_the_report_is_a_conflict_and_is_printed(repo, capsys): ... # focus 2
def test_strict_returns_1_on_a_conflict_and_the_gate_code_in_each_other_case(repo): ...
def test_a_recorder_error_does_not_change_the_exit_code(repo, monkeypatch): ...
def test_a_command_that_cannot_start_returns_127(repo): ...
def test_a_child_that_a_signal_stops_returns_128_plus_the_signal(repo): ... # POSIX
def test_run_outside_a_git_repository_records_nothing_and_keeps_the_exit_code(tmp_path): ...
def test_a_gate_that_writes_a_file_into_the_tree_is_named_and_never_seen(repo, capsys): ... # focus 3
def test_seen_is_false_for_a_dirty_tree_whose_head_passed(repo): ... # focus 3
def test_seen_is_false_when_the_gate_command_differs(repo): ...
def test_seen_is_false_for_a_conflict_and_for_no_data(repo): ...
def test_seen_is_false_for_a_green_record_that_was_not_wrapped(repo): ... # jacked tests record
def test_record_without_an_exit_code_is_unknown(repo): ...
def test_seen_is_false_when_a_declared_input_changed(repo): ...
def test_seen_is_false_for_a_record_of_a_different_machine_without_the_flag(repo): ...
def test_seen_is_false_when_this_machine_has_no_identity(repo, monkeypatch): ...
def test_seen_is_true_for_a_second_commit_with_the_same_content(repo): ...
def test_record_without_a_commit_has_no_tree(repo): ...
def test_record_maps_a_report_of_a_different_root(repo): ... # --report-root
def test_a_red_run_with_a_failing_set_in_two_earlier_records_prints_them(repo, capsys): ...
def test_a_red_run_with_a_new_failing_set_prints_no_notice(repo, capsys): ...
def test_the_notice_counts_default_branch_records_and_gives_no_cause(repo, capsys): ...
def test_the_load_and_the_processor_time_are_recorded_or_empty_on_windows(repo): ...
def test_record_writes_to_no_tracked_file(repo): ...
def test_the_store_holds_no_failure_text(repo): ... # read the gzip file, then search
def test_a_printed_id_has_no_escape_sequence(repo, capsys): ...
def test_a_label_with_a_newline_at_its_end_is_refused(repo): ...
def test_cli_run_passes_the_exit_code_through(repo): ...
def test_cli_seen_exits_0_after_a_green_run_and_1_before_it(repo): ...
def test_cli_tests_does_not_ask_to_install(repo): ...
profile, history and pruneFiles. Create jacked/testdiet/views.py,
tests/unit/test_testdiet_views.py; modify jacked/cli.py and
tests/_testdiet.py (add fill_store(path) -> Path: a store with runs of two
machines, two trees, green and red verdicts, and one failing set in three runs).
def profile(store: Path, run_id: str | None = None, *, machine: str | None = None, top: int | None = 20) -> dict
# keys: run, machine, total_test_seconds, files_for_half, file_count, files: [{file, seconds, tests}],
# tests: [{id, seconds}], hidden_rows, setup_share: None,
# repeats: [{tree, command_sha, runs, wall_min, wall_max, test_seconds_min, test_seconds_max}]
def history(store: Path, *, machine: str | None = None, days: int | None = None) -> dict
# keys: machine, labelled_full_runs, verdicts: {passed, failed, conflict, no-data, unknown}, failing_counts: [int],
# repeated_green: [{tree, command_sha, runs}], failing_sets: [{sig, runs, first, last, trees, on_default_branch, ids}],
# flaky: [{id, runs}], other_machines: [labels], size_bytes
# jacked tests profile [--run ID] [--machine LABEL] [--top N] [--json]
# jacked tests history [--machine LABEL] [--days N] [--json] (the size line always prints)
# jacked tests prune --before YYYY-MM-DD
Rules. With no --machine, a view uses the machine of the newest
run with the label full and prints which machine it used. A group never mixes two
machines (label and identity). --json prints every row; --top shortens
the text output only, and the text says how many rows it hides. No output holds a
machine_id.
fill_store makes. Run them. Expected: FAIL.feat(testdiet): profile and history show where the gate time is.def test_files_for_half_counts_the_fewest_files_that_hold_half_the_seconds(store): ... # 10,5,3,1,1 gives 1
def test_profile_uses_the_machine_of_the_newest_full_run_and_prints_it(store): ...
def test_profile_reads_a_record_of_a_different_machine_with_the_machine_flag(store): ...
def test_a_group_never_mixes_two_machines_with_one_label(store): ... # same label, two identities
def test_repeats_need_two_runs_of_one_tree_and_one_command(store): ...
def test_setup_share_is_none_for_a_junit_record(store): ...
def test_json_output_is_not_shortened_and_the_text_says_what_it_hides(store): ...
def test_no_view_prints_a_machine_id(store, capsys): ... # text and --json
def test_history_groups_red_runs_by_failing_set(store): ...
def test_history_lists_a_tree_that_ran_green_two_times(store): ...
def test_history_counts_each_verdict(store): ...
def test_a_test_with_no_seconds_is_not_counted_as_zero_seconds(store): ...
def test_cli_prune_prints_each_run_that_it_deletes(repo): ...
@pytest.mark.parametrize("runner", RUNNERS)
def test_a_real_report_goes_through_record_and_profile(repo, runner): ... # record_files, then profile
Files. Create jacked/testdiet/loss.py,
tests/unit/test_testdiet_loss.py; modify jacked/cli.py.
@dataclass(frozen=True)
class LossReport:
base: str; added: tuple[str, ...]; removed: tuple[str, ...]; net: int # names are "path::name"
fewer_assertions: tuple[str, ...]; skips_added: tuple[str, ...]
def loss_report(cwd: Path, base: str | None = None) -> LossReport # base default: merge-base with the default branch
def declarations(path: str, text: str) -> list[str]
# jacked tests loss [--base REF] [--json] always exits 0
Rules. A Python file is read with ast (functions and methods named
test*); a file that does not parse uses the line pattern. TypeScript and JavaScript:
the first string argument of test( and it(, with .each,
.skip and .only. Go: func TestXxx(. Rust: the function after
#[test]. A name that leaves one touched file and arrives in a different touched file
is not in removed. The working tree counts, not only the commits.
fewer_assertions names a test that is in both versions and has fewer assertion
statements or calls now. skips_added names a test that has a skip mark now and had
none. Both are report lines. They are not a verdict.
feat(testdiet): loss reports the tests that a change removes or weakens.def test_a_removed_test_is_named_and_net_is_minus_one(repo): ...
def test_a_renamed_file_with_the_same_tests_reports_no_loss(repo): ...
def test_a_test_moved_to_a_different_file_reports_no_loss(repo): ...
def test_an_edited_parameter_value_reports_no_loss(repo): ...
def test_added_tests_are_reported_as_growth(repo): ...
def test_a_method_in_a_test_class_is_a_declaration(repo): ...
def test_a_test_with_one_assertion_less_is_named(repo): ...
def test_a_new_skip_mark_is_named(repo): ...
def test_a_change_that_is_not_committed_counts(repo): ...
@pytest.mark.parametrize("ext,body", TS_GO_RUST_CASES)
def test_declarations_of_typescript_go_and_rust(ext, body): ...
def test_cli_loss_exits_0_with_a_loss_and_with_none(repo): ...
def test_a_python_file_with_a_syntax_error_still_gives_declarations(repo): ...
Files. Create jacked/data/skills/review-animations/agents/openai.yaml,
tests/unit/test_codex_implicit_invocation.py; modify
jacked/codex/_generate.py, _fsutil.py, installer.py.
# the file, exact content (Codex documentation, read 2026-11-26: with false, "Codex won't implicitly invoke the
# skill based on user prompt; explicit $skill invocation still works")
policy:
allow_implicit_invocation: false
CODEX_NO_IMPLICIT = "policy:\n allow_implicit_invocation: false\n"
def _command_codex_policy(cmd: Path) -> str | None # uses _split_command_frontmatter and skill_listing._truthy
def _sha_solo_skill(content: str, extras: Mapping[str, str] | None = None) -> str
def _write_solo_skill(skill_dir: Path, content: str, extras: Mapping[str, str] | None = None) -> None
Rules. _sha_solo_skill must give the value that
_sha_dir (_fsutil.py:120) gives for the written folder on each system:
sort the same Path objects in the same way, because that order is different on
Windows. Write SKILL.md and each extra file as bytes, so that Windows does not write
a carriage return that the hash does not have. Each part of an extra path must pass
_is_safe_name; an absolute path or a path with .. is refused. The DCR
reference tells a reviewer to invoke review-animations by name
(jacked/data/skills/dcr/references/conditional.md). An invocation by name still works
with the policy file; say that in the commit.
review-animations. Change
the generator, the two helpers and the call in install_codex.tests/unit/test_codex_installer.py
and tests/unit/test_no_dual_shipped_names.py, and each file that
grep -rlE "_sha_solo_skill|_write_solo_skill|review-animations" tests prints.
Expected: PASS.fix(codex): a skill that only the user starts stays that way in Codex.def test_each_skill_with_the_key_ships_the_policy_file_with_the_exact_content(): ...
def test_install_gives_review_animations_the_policy_file(tmp_path): ...
def test_install_gives_the_cleanup_command_skill_the_policy_file(tmp_path): ...
def test_a_command_without_the_key_gets_no_policy_file(tmp_path): ...
def test_sha_solo_skill_with_extras_equals_sha_dir_of_the_written_folder(tmp_path): ... # runs on each system
def test_write_solo_skill_refuses_an_extra_path_outside_the_skill_folder(tmp_path): ...
def test_a_second_install_moves_nothing_aside(tmp_path): ...
def test_the_claude_install_of_review_animations_still_passes_its_manifest_check(tmp_path): ...
Files. Modify jacked/data/rules/jacked-reference.md,
README.md; create tests/unit/test_tests_reference.py. The count of skills
does not change in this plan.
The reference text gets one section, "Gate recorder (jacked tests)": what each
command does; where the history is and how to delete it; the limits of seen (files
that git ignores, submodules, --input, git-lfs); the placeholder
{junit} and --junit; the rule for a red gate (a failure of the same tests
on the base branch means: repair the checkout or the base, then run again; it never clears the
branch); and the gate line. The gate line is an sh block that comes directly after
the comment <!-- gate-line -->:
if jacked tests run --help >/dev/null 2>&1; then
jacked tests run --kind full -- uv run python -m pytest -n auto --junitxml={junit}
else
echo "jacked tests is not installed: the gate runs with no record" >&2
uv run python -m pytest -n auto
fi
Tried on 2026-11-26 with a stand-in jacked that has no tests group:
the bare command ran and its exit code came back.
grep -rlE "README|jacked-reference" tests/unit prints. Expected: PASS.docs: jacked tests, the gate recorder.def test_the_gate_line_runs_the_bare_command_and_prints_one_line_with_an_older_jacked(tmp_path): ...
# Write the block as bytes. Put a stand-in `jacked` that exits 2 and a stand-in `uv` that exits 3 first on PATH.
# The exit code is 3 and standard error has one line. Skip where `sh` does not exist.
def test_the_gate_line_uses_jacked_tests_run_when_it_exists(tmp_path): ...
# The stand-in `jacked` exits 0 for `tests run --help` and 7 for each other call. The exit code is 7 and
# the stand-in got the argument `--junitxml={junit}`.
def test_each_jacked_tests_command_in_the_reference_exists_in_the_cli(): ...
def test_each_command_of_the_group_is_in_the_reference(): ...
def test_the_new_sections_have_no_em_dash_and_name_no_host(): ...
Approved by the owner on 2026-11-26: the wording table below, and the sentence for the gate
cadence rule. That sentence was written before the placeholder {junit} existed; this
is the same sentence in the form of the recorder that this plan builds. It goes at the end of the
gate cadence rule (jacked/data/rules/jacked_behaviors.md:7), after "A brief that asks
for a full suite per milestone is wrong: fix the brief.":
When `jacked tests run --help` works, run that one full suite through it (`jacked tests run --kind full -- <the test command, with its JUnit report option set to {junit}>`), and ask `jacked tests seen -- <the same command>` first: a tree that passed that command on this machine does not run it again.
The last sentence of the new rule line names /test-diet ("To cut or speed up a
suite that exists, the user runs /test-diet."). That sentence ships with the skill, not with this
plan. The pin for it moves with it.
tests/unit/test_command_whats_next_goal.py:217 to
assert "with a test at the owning boundary for each contract of a done milestone" in s.
Add tests/unit/test_test_cost_guidance.py (below). Run both. Expected: FAIL./test-diet. The two files under .claude/skills/
are the wrappers of this repository; a test requires the shipped text word for word in them
(test_command_whats_next_goal.py:371). Add the cadence sentence.grep -rlE "goal-maker|whats-next|bhag|jacked_behaviors|test-coverage|commands/dc|skills/dcr" tests/unit
prints. Expected: PASS. A pin that fails on old wording gets the new wording. A pin that guards a
rule that this change did not touch stays.feat(rules): a test has a cost, and a removed thing gets no test.FORGERS = ("commands/goal-maker.md", "skills/whats-next/SKILL.md", "commands/bhag.md")
@pytest.mark.parametrize("relative", FORGERS)
def test_no_brief_template_asks_for_new_tests_for_each_milestone(relative):
assert "NEW tests" not in _read(relative)
def test_bhag_keeps_the_ban_on_a_weakened_test_and_names_the_one_exception():
text = _read("commands/bhag.md")
assert "NEVER delete, skip, weaken, or loosen an existing test or assertion to go green" in text
assert "removes behavior on purpose" in text
def test_the_rules_block_has_the_test_cost_rule_between_its_markers():
text = _read("rules/jacked_behaviors.md")
assert "A test has a cost" in text.split("# end-jacked-behaviors")[0]
def test_the_gate_cadence_rule_runs_the_full_suite_through_the_recorder_and_asks_seen_first():
rule = next(line for line in _read("rules/jacked_behaviors.md").splitlines() if "Gate cadence" in line)
assert "jacked tests run --kind full" in rule and "{junit}" in rule and "jacked tests seen" in rule
def test_the_repository_wrappers_have_the_new_wording(): ... # .claude/skills/whats-next and .claude/skills/dcr
The main session does this task.
seen, the five verdicts, the placeholder
{junit}, the machine identity, the setup share, the Codex policy file as a real
file, and the split into three plans. Say in the section that the owner has not read these
changes.docs(spec): what the plan review changed in the recorder.The main session does this task. Each command is uv run jacked tests ... in the
feature worktree, so it is the build of this branch.
review-animations and of cleanup with
agents/openai.yaml, and a second install that moves nothing aside. Where the Codex
program is installed: a prompt that matches the description does not select the skill, and an
invocation by name does.history, profile, seen with exit 0 for
that command, exit 1 for a different command, and exit 1 after an edit that is not
committed.loss on a scratch branch that
removes one test, and record on a report with --report-root.grep -rl hit of the changed modules..github/workflows/*.yml and run each
step in order. The full suite runs one time, wrapped by the build of this worktree:
uv run jacked tests run --kind full -- uv run python -m pytest -n auto --junitxml={junit} > log 2>&1; rc=$?.
Quote the summary line of the log and show the record with
uv run jacked tests history./dcr on the combined tree beside that
gate. A fix that changes code costs one more gate./pr (the owner approved the push of the
research, the spec and the plans on 2026-11-26). The body says that the skill and the gate machine are in the two other plans, and links
the issue that tracks each one. Read the summary line of each operating system's job before the
word green. Stop at the pull request.The owner approved this wording on 2026-11-26. A reviewer compared each old text with its file, character by character. Task 8 makes these changes, plus the gate cadence sentence of Task 8. The last sentence of the first row ("To cut or speed up a suite that exists, the user runs /test-diet.") ships with the skill, not with this plan.
| File and line | Old | New |
|---|---|---|
jacked/data/rules/jacked_behaviors.md, a new line after line 7 (the gate
cadence rule) | (no line) | - **A test has a cost: each gate pays for it
again.** Before you add a test, name the defect that it catches and say why the present tests
miss it. Put it at the boundary that owns the behavior, one test for each contract. When a
change removes behavior on purpose, delete the tests of that behavior in the same change and
name them in the commit; do not add a test that asserts that a removed thing stays removed.
Never delete, skip or weaken a test to get a green run. To cut or speed up a suite that
exists, the user runs /test-diet. |
jacked/data/commands/goal-maker.md:53 | the repo's real test
command green; NEW tests covering every milestone and its edge cases. | the
repo's real test command green; a test at the boundary that owns each new behavior, one for
each contract, and the tests that the change made obsolete deleted in the same change (never
kept as "stays removed" checks). |
jacked/data/commands/goal-maker.md:133,
jacked/data/skills/whats-next/SKILL.md:313 and
.claude/skills/whats-next/SKILL.md:363 (the end of the line) | , with
NEW tests covering the behavior of each done milestone and its edge cases |
, with a test at the owning boundary for each contract of a done milestone, the tests
that a milestone made obsolete deleted, and the run time of the added tests
reported |
jacked/data/commands/bhag.md:63 | and show passing output; add
NEW tests covering the change. NEVER delete, skip, weaken, or loosen an existing test or
assertion to go green: a cell counts as done only when it passes end-to-end, not when the test
was removed; gutting a test to pass is a BLOCKED condition, not a merge. | and
show passing output; add a test at the boundary that owns each new contract of the change.
NEVER delete, skip, weaken, or loosen an existing test or assertion to go green: a cell counts
as done only when it passes end-to-end, not when the test was removed; gutting a test to pass
is a BLOCKED condition, not a merge. The one exception: when the cell removes behavior on
purpose, delete the tests of that behavior in the same commit and name them in the commit
message. |
jacked/data/skills/dcr/SKILL.md:90 and
.claude/skills/dcr/SKILL.md:161 | | 7 | **Testing** | Unit test
coverage, edge case tests, regression detection, test quality | | | 7 |
**Testing** | Unit test coverage, edge case tests, regression detection, test quality, test
cost (a new test that repeats an existing proof, pins the implementation, asserts that a
removed thing stays removed, or is slow for what it proves) | |
jacked/data/commands/dc.md:55 | | 8 | **Testing** | Unit test
coverage, edge case tests, regression detection, test quality | | | 8 |
**Testing** | Unit test coverage, edge case tests, regression detection, test quality, test
cost (a new test that repeats an existing proof, pins the implementation, asserts that a
removed thing stays removed, or is slow for what it proves) | |
jacked/data/agents/test-coverage-engineer.md, a new paragraph after the
paragraph that ends "not that a test would *catch a bug*." (line 114) | (no paragraph) | **A test has a cost.** Each test runs in each gate from now on. Before
you add one, name the defect that it catches and say why the present tests miss it, and put it
at the boundary that owns the behavior. Do not add a second test for a contract that a present
test proves. Do not add a test that asserts that removed code stays removed. Report the run
time of the tests that you added. |
jacked/data/agents/test-coverage-improver.md, two new lines after "-
Duplicate existing test coverage" (line 170) | (no lines) | - Assert that
removed code or a removed feature stays removed- Have no defect that you can
name before you write them |
Generated with the jacked HTML artifact template. Edit freely.