xpd enhance harden
Run xpd enhance harden to find silent failures, fixed waits, retries, and unreliable tests, and verify every fix against a reliability checklist and determinism gate. See the hardening guide for a full walkthrough.
| Group | Finding kinds |
|---|---|
| Silent failure and reliability errors | swallowed-exception, import-fallback, dual-key-fallback, fallback-on-exception, rule-issue |
| Fixed waits and retries | sleep-or-retry |
| Disabled or unreliable tests | disabled-test, flaky-test |
Go and Rust source can surface empty error branches, fixed waits, and skipped tests.
Each module with a finding, including test files, gets six checklist items. Run xpd enhance harden --questions to read the questions and the facts that inform them. Set goal to design for a checklist fix.
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 |
xpd enhance harden gate |
Gate a fix that is committed: 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: swallowed-exception, import-fallback, dual-key-fallback, fallback-on-exception, rule-issue, sleep-or-retry, disabled-test, flaky-test, private-test-assertion. |
|
--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 stable finding IDs and checklist item IDs with
xpd enhance harden . --format json. - Plan: record ordered fixes, accepted findings, and checklist verdicts (
pass,na, oraccepted) with reasons usingxpd 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. Adesignfix must edit a file that owns a cited checklist item. - 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, a new finding without an accepted reason, or an unanswered checklist item causes exit 1.
Example
Section titled “Example”Replace a swallowed exception with a failure the caller can handle.
def load_count(raw): try: return int(raw) except ValueError: pass$ 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 '{kinds: [.findings[].kind], items: (.checklist | length)}'{"kinds":["swallowed-exception"],"items":6}$ printf '%s\n' '{"fixes":[{"id":"propagate","title":"Propagate invalid input","goal":"design","questions":["loader.py/fails-loudly"]}]}' | xpd enhance harden plan - --format json | jq -c .next.stage"fix"$ sed -i 's/ pass/ raise/' loader.py && git -c user.name=xpd -c user.email=xpd@example.com -c commit.gpgsign=false commit -qam "Propagate invalid input"$ xpd enhance harden gate propagate --format json | jq -c '.run.answered["loader.py/fails-loudly"].verdict'"fixed"$ 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 5 -> 5trueExit status
Section titled “Exit status”A successful list or recorded stage exits 0. A rejected gate or a finish blocked by findings or checklist items exits 1. Invalid input exits 2.