xpd enhance harden
Run xpd enhance harden to find silent failures, fixed waits, retries, and unreliable tests, and verify every fix against a determinism gate. See the hardening guide for a full walkthrough.
| Group | Finding kinds |
|---|---|
| Silent failure and reliability errors | dual-key-fallback, fallback-on-exception, rule-issue |
| Fixed waits and retries | sleep-or-retry |
| Disabled or unreliable tests | disabled-test, flaky-test |
Every finding of this track is advice: a fix may name one, and no run or audit has to clear one. A kind blocks only after an oracle that can prove a finding wrong has labelled at least 30 of its findings and at least 90% were right, and no kind has reached that.
Go and Rust source can surface fixed waits and skipped tests.
Run xpd enhance harden --questions to read the six reliability questions and the facts that inform them. Pass --all-modules to start to review every module against the questions that --questions prints.
At each gate, xpd repeats the first check after the checks pass. The exit status and the SHA-256 digest of stdout must agree with the first execution.
xpd enhance harden [OPTIONS] [PATHS]... xpd enhance harden <COMMAND>Subcommands
Section titled “Subcommands”| Subcommand | What it does |
|---|---|
xpd enhance harden start |
Start a run: record the commit it starts from, the paths, line count, checks and optional benchmark of the project |
xpd enhance harden plan |
Record the plan of a round: the fixes in order, and the findings that are right as they are |
xpd enhance harden approve |
Record that the user said yes to a fix that changes what callers or users see, or that changes files outside the paths of the run |
xpd enhance harden gate |
Gate a fix: run the checks, time --bench when set, count lines and compare the findings with the commit before it. Exit 1 when the fix is not kept |
xpd enhance harden drop |
Record that a fix was given up, after its files were restored |
xpd enhance harden status |
Print the run and the stage that comes next |
xpd enhance harden finish |
End the run: compare findings, line count and benchmark timing with the start commit. Exit 1 while a fix is open or a new finding has no reason |
Arguments
Section titled “Arguments”| Argument | What it does |
|---|---|
<PATHS>... |
Files or directories (directories respect .gitignore) |
Options
Section titled “Options”| Option | Default | What it does |
|---|---|---|
--kind <KIND> |
List only the findings of these kinds, separated by commas. Repeatable. Values: dual-key-fallback, fallback-on-exception, rule-issue, sleep-or-retry, disabled-test, flaky-test. |
|
--limit <LIMIT> |
20 |
The most findings to list of each kind, strongest first. 0 lists every finding. |
--since <COMMIT> |
Count the findings at this commit too, and print each count beside the count of today. | |
--group-by <GROUP_BY> |
none |
Group findings and checklist items by owning module or shared cause. Values: none (Keep the default flat per-kind listing), module (Group findings and checklist items by owning module path), cause (Group related findings by shared kind and anchor files). |
--packet <N> |
Emit one 1-indexed deterministic context-budgeted review packet for the Nth cluster. | |
--budget-lines <LINES> |
300 |
Maximum source lines included across excerpts inside a --packet view. |
--all-modules |
Include checklist review items for every surveyed module, not only modules with findings. | |
--format <FORMAT> |
Output format. Default: text on a terminal, json otherwise. Values: text, json. |
|
--questions |
Recorded run
Section titled “Recorded run”- Start: record the current commit, paths, and project checks from a clean tracked tree with
xpd enhance harden start . --check "your-project-check". - List: read the stable ID of each finding with
xpd enhance harden . --format json. - Plan: record the ordered fixes, each naming the findings it removes, using
xpd enhance harden plan plan.json. - Approve: record approval for an interface change with
xpd enhance harden approve fix-id. - Gate: commit one fix and run
xpd enhance harden gate fix-id. - Drop: return to the run's current commit and record a reason with
xpd enhance harden drop fix-id --reason "reason". - Status: show the current run, its recorded answers, and the next stage with
xpd enhance harden status. - Finish: compare against the starting commit with
xpd enhance harden finish. An open fix causes exit 1. Advice that is left needs no reason.
Example
Section titled “Example”Remove a silent fallback so that the real parse error reaches the caller.
def load_count(raw): try: return parse_count(raw) except Exception: return parse_count_v1(raw)
def parse_count(raw): return int(raw)
def parse_count_v1(raw): return int(raw.split("=")[1])$ git init -q && git add loader.py && git -c user.name=xpd -c user.email=xpd@example.com -c commit.gpgsign=false commit -qm start$ xpd enhance harden start loader.py --check "python3 -m py_compile loader.py" --format json | jq -c '{findings: .run.was, next: .next.stage}'{"findings":1,"next":"plan"}$ xpd enhance harden loader.py --format json | jq -c '{findings: (.findings | length), advice: [.advice[].kind]}'{"findings":0,"advice":["fallback-on-exception"]}$ xpd enhance harden loader.py --format json | jq -c '{fixes: [{id: "propagate", title: "Let the parse error surface", findings: [.advice[].id]}]}' | xpd enhance harden plan - --format json | jq -c .next.stage"fix"$ sed -i -e '10,13d' -e '2,5c\ return parse_count(raw)' loader.py && git -c user.name=xpd -c user.email=xpd@example.com -c commit.gpgsign=false commit -qam "Let the parse error surface"$ xpd enhance harden gate propagate --format json | jq -c '.run.rounds[0][0] | {outcome, fixed: (.fixed | length)}'{"outcome":"kept","fixed":1}$ xpd enhance harden finish --format json | jq -c .run.finishedxpd: 1 findings at the start, 0 now: 1 fixed, 0 added, 0 accepted, 0 left without a reason; lines 13 -> 6trueExit status
Section titled “Exit status”A successful list or recorded stage exits 0. A rejected gate or a finish with an open fix exits 1. Invalid input exits 2.