Remediation cookbook (first-failure playbooks)¶
Use this page after your first failed SDETKit command in an external repository.
It is intentionally compact: identify the failed step, run the safest next command, fix one class of issue, rerun.
If you came from a downloaded GitHub Actions artifact, first map file -> next section in Adoption troubleshooting, then use the matching playbook here.
0) Start with machine-readable failure output¶
python -m sdetkit gate fast --format json --stable-json --out build/gate-fast.json
cat build/gate-fast.json
Why: failed_steps tells you exactly which playbook to use next.
1) gate fast failed on ruff¶
What failed
gate fast: FAIL and failed_steps includes ruff or ruff_format.
Likely meaning
Your repo has lint and/or formatting debt. This is common on first adoption.
Safest next commands
# inspect only
python -m ruff check .
python -m ruff format --check .
# optional minimal auto-fix pass
python -m sdetkit gate fast --only ruff,ruff_format --fix
Smallest fix path
- Run
ruff checkto see exact rule IDs/files. - Apply small fixes (or scoped
--fix) and review the diff. - Rerun
python -m sdetkit gate fast.
Stay lightweight vs tighten later
- Lightweight now: keep
gate fastas the PR gate while you reduce lint debt. - Tighten later: move to release gating only after
gate fastis consistently green.
2) gate fast failed on mypy¶
What failed
gate fast: FAIL and failed_steps includes mypy.
Likely meaning
Type errors were found in the checked target (default: src).
Safest next commands
# rerun exactly what gate fast runs by default
python -m mypy src
# narrow while adopting (example)
python -m sdetkit gate fast --only mypy --mypy-args "src/your_package"
Smallest fix path
- Fix one error class at a time (for example missing annotations or incompatible return types).
- Rerun
python -m mypy ...until clean. - Rerun full
python -m sdetkit gate fast.
Stay lightweight vs tighten later
- Lightweight now: scope mypy to the package you are actively stabilizing.
- Tighten later: expand back to full
srccoverage.
3) gate fast failed on pytest¶
What failed
gate fast: FAIL and failed_steps includes pytest.
Likely meaning
Tests failed in the fast lane's default subset.
Safest next commands
# run default fast subset
python -m sdetkit gate fast --only pytest
# or run your own focused subset while triaging
python -m sdetkit gate fast --only pytest --pytest-args "-q tests/path_or_file.py"
Smallest fix path
- Isolate one failing test module/class.
- Fix deterministic failures first (assertions, setup, fixtures).
- Rerun focused pytest, then rerun full
gate fast.
Stay lightweight vs tighten later
- Lightweight now: keep PR enforcement on fast gate.
- Tighten later: use
--full-pytestin stricter stages once flakiness is under control.
4) security enforce failed due to strict thresholds¶
What failed
"ok": false and exceeded shows counts over configured limits.
Likely meaning
Policy is stricter than your current baseline (often info findings first).
Safest next commands
# strict check
python -m sdetkit security enforce --format json --max-error 0 --max-warn 0 --max-info 0
# temporary adoption budget (example)
python -m sdetkit security enforce --format json --max-error 0 --max-warn 0 --max-info 200
Smallest fix path
- Keep
--max-error 0 --max-warn 0(do not normalize serious findings). - Set
--max-infoclose to current baseline. - Ratchet
--max-infodown on a schedule.
Stay lightweight vs tighten later
- Lightweight now: realistic info budget to avoid blocking all adoption.
- Tighten later: progressively lower budget until strict target is feasible.
5) gate release / doctor --release failed¶
What failed
gate release: FAIL and failed_steps includes doctor_release, playbooks_validate, or gate_fast.
Likely meaning
Release prerequisites are not met yet (often because fast gate is not green).
Safest next commands
# inspect release prerequisites directly
python -m sdetkit doctor --release --format json
# inspect release gate breakdown
python -m sdetkit gate release --format json --out build/gate-release.json
cat build/gate-release.json
Smallest fix path
- Read
failed_stepsand clear them in order. - If
gate_fastfailed, fix that before retrying release gate. - Re-run release gate after prerequisites pass.
Stay lightweight vs tighten later
- Lightweight now: enforce only
gate faston PRs. - Tighten later: apply
gate releaseon release branches/tags.
Guardrails (important)¶
- These playbooks are triage paths, not auto-fix guarantees.
- If the target repository has real code/test/security debt, the correct action is to fix the repository.
- Threshold tuning is for staged adoption, not permanent masking of failures.