ADR-0621: Scaffold Audit P3 — six cleanup items + state drift¶
- Status: Accepted
- Date: 2026-05-19
- Deciders: lusoris, Claude (Anthropic)
- Tags: hygiene, ai, python, test, docs, ci, fork-local
Context¶
The scaffold / stub / dead-code audit of 2026-05-19 (docs/research/scaffold-audit-2026-05-19.md) surfaced six P3 (cleanup / cosmetic) items and two state-drift gaps that were safe to bundle into a single housekeeping PR without touching any functional path:
- P3-1 —
scripts/dev/permutation_importance.py:22had a hardcoded/home/kilian/dev/vmafpath that fails on any other machine. - P3-2 — Roughly 13 scripts under
ai/scripts/*.pystill defaulted corpus roots to.workingdir2/<corpus>/; data migrated to.corpus/in PR #983 (ADR-0547) but the default paths were never updated. - P3-3 — Four
@unittest.skipdecorators carried vague or incorrect rationales (wrong ADR citation, "numerical value has changed" without explanation). - P3-4 — Several non-bootstrap tests asserted VMAF scores at
places=1without an inline comment explaining why 1-decimal precision is correct for those paths. - P3-5 — Six registry entries with
smoke: true(CI-only test fixtures) and onesmoke: falseentry (lpips_sq_v1) lacked a model card or had a card-name mismatch. No ADR-0042 bar applies to smoke fixtures; the lpips_sq_v1 mismatch is documented. - P3-6 — Three upstream cJSON
TODO/FIXMEmarkers incore/src/mcp/3rdparty/cJSON/cJSON.cwere firing the semgrep TODO-hunter rule. Fixing them would diverge from upstream cJSON; the correct action is to exclude the file.
State drift gaps:
- SD-1 —
T-VULKAN-MOTION-LAVAPIPE-INITwas referenced in two CI YAML comments and twocontinue-on-error: truesteps but had no Open-bugs row indocs/state.md. - SD-2 —
T-PYTHON-PERMUTATION-IMPORTANCE-HARDCODED-PATHwas in the Open-bugs table but is resolved by this PR; moved to Recently closed.
Decision¶
- Replace the hardcoded
REPOpath inpermutation_importance.pywithPath(__file__).resolve().parents[2]. - Update all
.workingdir2/<corpus>/fallback defaults inai/scripts/*.pyto.corpus/<corpus>/usingPath(__file__).resolve().parents[2]anchoring. Env-var overrides (added by ADR-0547) are preserved unchanged. - Rewrite each stale
@unittest.skiprationale to precisely name the root cause: XML attribute ordering (result_test), numpy RNG API drift (routine_test), deprecatedvmaf_featurebinary (feature_extractor_test), and missingfps/formatfilter-key additions (asset_test). Correct the false ADR-0326 citation. - Add inline justification comments at each
places=1assertion explaining that the score passes through libsvm's int→float32 SVM head (deterministic but lossy at 1 dp) or through bootstrap resampling that accumulates rounding across seeds. - Add a "CI-only smoke fixtures" section to
docs/ai/model-registry.mdlisting the sixsmoke: trueentries and explaining why they are exempt from ADR-0042. Document thelpips_sq_v1/lpips_sq.mdname mismatch as a tracked cosmetic gap. - Add
core/src/mcp/3rdparty/cJSON/cJSON.cto.semgrepignorewith an explanatory comment, preserving upstream cJSON parity. - Add an Open-bugs row for
T-VULKAN-MOTION-LAVAPIPE-INITindocs/state.mdwith a stated closure condition (promote both advisory CI steps to required once the kernel init error on lavapipe is resolved). - Move
T-PYTHON-PERMUTATION-IMPORTANCE-HARDCODED-PATHfrom Open to Recently closed.
Alternatives considered¶
| Option | Pros | Cons | Why not chosen |
|---|---|---|---|
| Fix all items in one bundle (this decision) | Single PR overhead; items are trivially independent. | Larger diff. | Chosen — all items are non-functional cleanups; batching is safe. |
| Separate PR per item | Smaller, easier to bisect. | Seven PRs for one-liner changes; PR overhead dominates. | Overhead outweighs the benefit for audit-cleanup items. |
| Modify cJSON to fix upstream TODOs | Silences the lint rule without ignoring. | Diverges from upstream cJSON 1.7.x; breaks the next vendor bump. | Not chosen — silencing is the correct policy for vendored upstream code. |
| Delete stale @skip tests instead of rewriting rationales | Removes dead weight. | Loses the intention signal; the tests document real gaps (deprecated binary, unimplemented filter keys). | Kept with precise rationale so the gap is visible; deletion is a follow-up decision. |
Consequences¶
- Positive:
permutation_importance.pyworks on any checkout; AI scripts default to the correct.corpus/layout matching ADR-0547; skip rationales now accurately describe actionable gaps;places=1assertions are self-documenting; CI smoke-fixture exempt status is documented; semgrep is clean without diverging from upstream cJSON;docs/state.mdcorrectly reflects the Vulkan motion lavapipe gap. - Negative: None; all changes are non-functional.
- Neutral / follow-ups: The
fps_cmd/format_cmd/get_filter_cmdgap (addingfpsandformattoAsset.ORDERED_FILTER_LIST) remains open for a future PR. Thelpips_sq_v1card-name mismatch is documented but not renamed here (deferred to a dedicated model-card cleanup PR). TheT-VULKAN-MOTION-LAVAPIPE-INITkernel fix is a separate engineering task.
References¶
docs/research/scaffold-audit-2026-05-19.md— source audit document.- ADR-0547 —
VMAF_<NAME>_DIRenv-var overrides (precursor to P3-2). - ADR-0042 — tiny-AI docs-required-per-PR (smoke fixtures are exempt).
- ADR-0165 —
docs/state.mdbug-tracking rule (SD-1, SD-2 updates). - PR #983 —
.corpus/data migration. - Source: per user direction (scaffold-audit-p3-cleanup task brief, 2026-05-19).