harness: close the cache-blind check class (H-CHECK-CACHE-BLIND) - #2148
Conversation
…port Two defects in .github/workflows/orchestrator.yml found while reconciling today's runs, filed against the orchestrator-automation track (their correct home -- they are workflow defects, not harness tooling, and harness.md is being edited concurrently by PR #2148). A-BUDGET-ORPHAN is the mechanism behind the 31-record backfill in the previous commit. A-SUMMARY-STALE-FALLBACK explains why two runs today exited green having written no summary at all.
…port Two defects in .github/workflows/orchestrator.yml found while reconciling today's runs, filed against the orchestrator-automation track (their correct home -- they are workflow defects, not harness tooling, and harness.md is being edited concurrently by PR #2148). A-BUDGET-ORPHAN is the mechanism behind the 31-record backfill in the previous commit. A-SUMMARY-STALE-FALLBACK explains why two runs today exited green having written no summary at all.
Audited all 25 check scripts whose body contains an actual repo_root()/ _repo_root() call site (2 already covered). Of the remaining 23: added (universe) to 20 rules that genuinely needed it; recorded 3 as provably exempt with evidence (universe_deps_exceptions.conf) -- record_qc_audit.sh and write_audit.sh (every one of the 24 invocations inside record_qc_audit_test.sh's dune rule uses a REPO_ROOT fixture override, verified mechanically) and deep_scan_followup_count_check.sh (its repo_root()-derived reads are already covered by other explicit deps on the same rule). Added a mechanical guard (check_universe_deps.sh + self-test) wired into dune runtest so the class stays closed: FAILs on any script with a repo_root() call site whose owning rule lacks (universe) and isn't exempted. The guard's own rule declares (universe) for itself. Verified with a warm-_build re-run test (not just direct script invocation): reverting no_python_check.sh's rule to drop (universe) and adding a real outside-workspace .py file reproduced the exact #2143 bug live -- the rule was silently skipped, no invocation line, stale cached PASS. Restoring (universe) under the same warm build caused it to re-execute and correctly catch the violation. Filed H-CHECK-EXEMPTION-DRIFT as a residual: the 3 exemptions rely on a point-in-time audit the guard cannot re-verify mechanically. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
dayfine
left a comment
There was a problem hiding this comment.
Reviewed SHA: 1b3f809
Structural QC — H-CHECK-CACHE-BLIND guard
Checklist Status
| # | Check | Status | Notes |
|---|---|---|---|
| H1 | dune build @fmt (format check) | PASS | Code is properly formatted; no violations in diff or guard script execution |
| H2 | dune build | INCOMPLETE | CI still in_progress at review time; cannot gate on expectation |
| H3 | dune runtest | INCOMPLETE | CI still in_progress. Guard script runs locally: 23 OK, 3 SKIP (exceptions), exit 0 |
| P1 | Functions ≤ 50 lines (linter) | NA | Harness infrastructure PR; no new functions added |
| P2 | No magic numbers (linter) | NA | No hardcoded values added |
| P3 | Config completeness | NA | No new config parameters |
| P4 | Public-symbol export hygiene (linter) | NA | No new exported symbols |
| P5 | Internal helpers prefixed per convention | PASS | Helper functions (_repo_root, strip_comments) properly prefixed |
| P6 | Tests conform to project test-patterns rules | PASS | check_universe_deps_test.sh: 5 assertions covering all edge cases (missing universe, universe added, exceptions-list skip, dep-only resolution, false-positive guard) |
| A1 | Core module modifications | NA | No changes to Portfolio/Orders/Position/Strategy/Engine |
| A2 | Dependency-direction rules respected | PASS | Harness PR; no analysis/ imports into trading/trading/ |
| A3 | No unnecessary existing module modifications | PASS | Only 5 files touched (dune, two new check scripts, exceptions conf, status file); no drift |
Focus Area Findings
-
Guard self-coverage (critical) — PASS
- Line 524:
check_universe_deps.shrule declares(universe)✓ - Line 541:
check_universe_deps_test.shrule declares(universe)✓ - The guard's own dune wiring prevents cache-blindness in itself — exact pattern #2143's reviewer required.
- Line 524:
-
Exceptions file review_at question
- Three exemptions recorded (
deep_scan_followup_count_check.sh,record_qc_audit.sh,write_audit.sh) - My call: PROVEN EXEMPTIONS (do not require review_at triggers)
- Evidence: dune file lines 287-294 and 454-462 document why each script's
repo_root()reads are already covered or always fixture-scoped. These are structural/permanent facts (test infrastructure designed to never touch real outside-workspace files), not deferrals ("we'll fix this later"). Unlike a deferral, a proven exemption is load-bearing architecture that doesn't age. - Minor improvement: dune comments could cite the exact exemption evidence (e.g., "REPO_ROOT always overridden to temp fixture on all call sites"); current prose is clear but a future auditor would benefit from line-number pointers. Not a finding; suggestion only.
- Three exemptions recorded (
-
Parser robustness — PASS
- Test assertions 1–5 cover: missing universe (FAIL), universe added (PASS), exceptions-list skip, dep-only resolution, false-positive guard
- Fixes for two real bugs confirmed in code:
- Lines 91–110: RS order (read exceptions/candidates first under default RS="\n", then switch to paragraph mode) — prevents getline corruption. Test line 88 documents this.
- Line 57:
grep -lE 'repo_root\)'pattern — matches "repo_root" followed by closing paren only, not bare substring. Test assertion 5 (lines 184–191) verifies false-positive guard against comment mentions.
- Regex at line 117 extracts run-target from
%{dep:...}, handles nested parens and extraction edge cases correctly.
-
set -e hygiene — PASS
- Lines 72–77:
set +e/ awk /CODE=$?/set -ebracket is correct; explicitly cites H-CHECK-SETE-DIAGNOSTICS item. - Test file (lines 119–121, 135–138, etc.): same correct pattern.
- No diagnostic-swallowing risk.
- Lines 72–77:
-
A3 scope verification — PASS
- PR file list (gh pr view API): dev/status/harness.md, trading/devtools/checks/{check_universe_deps.sh, check_universe_deps_test.sh, dune, universe_deps_exceptions.conf}
- No
dev/status/_index.mdtouched (correct; that's orchestrator-owned) - Exactly 5 files as stated
Structural Verdict
All structural gates pass. No FAIL items. No A1/A2/A3 violations. No core-module drift.
Code quality: Guard script uses solid awk + shell patterns, test covers all edge cases, comments are clear and link to authority (dune rules, universe_deps_exceptions.conf).
Cannot issue APPROVED: build-and-test CI check still in_progress at review time. Per .claude/rules/pr-merge-gates.md, "if CI has not completed when you must decide, mark the gate incomplete and say so — do NOT issue an APPROVED that rests on expectation." Perf-tier1-smoke is completed/success.
Quality Score
4 — Implementation is solid, all structural requirements met, edge cases handled; only note is that exceptions file could reference dune line numbers for future audit clarity (cosmetic improvement, not a finding).
dayfine
left a comment
There was a problem hiding this comment.
Reviewed SHA: 1b3f809
Behavioral QC — harness/check-universe-deps (H-CHECK-CACHE-BLIND)
Reviewed in a detached worktree at the tip. CI gate complete on the exact tip:
build-and-test completed/success, perf-tier1-smoke completed/success. No local
dune runtest was run as a gate; the dune runs below are mutation instruments only.
Contract Pinning Checklist
| # | Check | Status | Notes |
|---|---|---|---|
| CP1 | Each non-trivial claim in new .mli docstrings has an identified test that pins it |
NA | No .mli in this PR — the diff is two POSIX shell scripts, a dune file, a .conf, and a status-file entry. |
| CP2 | Each claim in the PR body "Test plan" has a corresponding committed test | PASS | Every claim reproduced independently — see the ledger below. check_universe_deps_test.sh → 5/5, exit 0. Guard against the real dune file → exit 0, 23 OK + 3 SKIP = 26 candidates (consistent with the body's "25 audited, _check_lib.sh excluded, +2 new scripts"). "20 fixed" verified arithmetically: 23 OK − run_in_env_root_check.sh (pre-existing from #2143) − the 2 new guard scripts = 20. Guard demonstrated RED via direct invocation (M1, M3); its wiring into dune runtest observed executing inside @devtools/checks/runtest. |
| CP3 | Pass-through / identity / invariant tests pin identity, not just size | NA | No pass-through or identity semantics in this feature. |
| CP4 | Each guard called out explicitly in code docstrings has a test exercising the guarded-against scenario | PASS | (a) "does NOT match on the bare substring repo_root" → assertion 5, plus fixture helper_with_repo_root.sh. (b) dep-only (non-run-target) resolution → assertion 4. (c) exceptions-list skip → assertion 3. (d) "this rule's OWN dune wiring declares (universe)" → pinned mechanically, not by the self-test: M3 below shows the guard flags its own rule when (universe) is stripped, and the guard runs against the real dune under runtest. (e) the set +e/set -e bracketing (H-CHECK-SETE-DIAGNOSTICS shape) → exercised by assertions 1 and 4, which both take the non-zero-awk-exit path and still print diagnostics. |
Behavioral Checklist (Weinstein domain)
Entire A1 / S* / L* / C* / T* block — NA. Pure harness / build-tooling PR;
touches no strategy, screener, stops, portfolio, or simulation logic. Per
.claude/rules/qc-behavioral-authority.md §"When to skip this file entirely", CP1–CP4
is the full review. qc-structural did not flag A1.
Warm-build skip/re-execute pair — independently reproduced ✅
I did not take the author's experiment on trust. Reproduced both directions with a
throwaway dev/__qcb2148_probe.py (outside the dune workspace root, inside repo_root()):
Positive — (universe) present, @devtools/checks/runtest warmed to green, then the
.py created with no dune-tracked dep touched:
(cd _build/.sandbox/4db11cf2b02801bcfd651861321f6dd7/default/devtools/checks && /usr/bin/sh ./no_python_check.sh)
FAIL: no-python check -- unexpected *.py files found:
/__w/trading/wt-qcb2148/dev/__qcb2148_probe.py
DUNE_EXIT=1
The rule re-executed and caught it.
Negative control — (universe) stripped from that rule (and the script exempted so the
guard itself doesn't confound the exit code), warm build with no .py first to cache a
clean PASS, then the .py re-created with nothing dune-tracked changed:
count of "no_python_check.sh" mentions in dune output: 1 (the guard's own SKIP line only —
NO `(cd _build/.sandbox/... && sh ./no_python_check.sh)` invocation)
STEP_D_DUNE_EXIT=0
The rule was never invoked and dune returned exit 0 with a real violation on disk — the
#2143 bug class reproduced live, exactly as the PR body describes. The fix is real, not decorative.
Probe file deleted; find . -name '*.py' → 0; git status --porcelain → clean.
(.claude/rules/no-python.md respected — nothing committed.)
Mutation ledger
| # | Mutation | Verbatim exit | Result |
|---|---|---|---|
| M1 | Strip (universe) from status_file_integrity.sh's rule |
GUARD_EXIT=1 |
KILLED — FAIL: status_file_integrity.sh calls repo_root() ... does not declare (universe), names the script + the remediation. |
| M2 | Strip (universe) from no_python_check.sh's rule and add one bare line to universe_deps_exceptions.conf |
GUARD_EXIT=0 |
SURVIVED (by design) → FLAG-1 below. |
| M3 | Strip (universe) from the guard's own rule |
GUARD_EXIT=1 (guard); SELFTEST_EXIT=0 |
KILLED by the guard itself. Self-coverage is genuinely pinned, not merely present-in-the-file-today: the guard scans the real dune and flags its own rule. The self-test correctly stays fixture-only and does not (and should not) assert on real dune content. Editing the rule also invalidates dune's own cache key for it, so the removal can't hide behind a warm build. |
| M4 | Add a deep_scan/zz_probe_check.sh with a genuine $(repo_root) call site, wired as a run-target with no (universe) |
GUARD_EXIT=0 |
SURVIVED → FLAG-2 below. |
Findings — all FLAG, none blocking
FLAG-1 — universe_deps_exceptions.conf is entirely unconstrained (M2).
One bare filename silently disables the guard for any script, forever. The file's header says
"Do NOT add an entry just to make the guard pass — see .claude/rules/code-health-discipline.md",
but nothing enforces it, and that rule requires path exceptions to carry "a clear review_at
trigger (date or PR number)" — the conf's documented format has no review_at field at all.
The repo already has the machinery for this on the analogous file: linter_exceptions.conf is
expiry-checked by deep_scan_linter_expiry_check.sh / deep_scan/check_11_linter_expiry.sh.
The PR is partially honest here: H-CHECK-EXEMPTION-DRIFT (filed, dev/status/harness.md)
covers the three existing entries going stale, but not unbounded future additions. Suggest
folding a review_at column + expiry check into that item.
FLAG-2 — the candidate scan is non-recursive; deep_scan/*.sh is uncovered (M4, undisclosed).
grep -lE 'repo_root\)' ./*.sh misses subdirectories. Two live subdirectory callers exist:
deep_scan/_lib.sh (REPO_ROOT="$(repo_root)", line 28) and deep_scan/main.sh (line 23).
Neither is mis-covered today — _lib.sh is an explicit dep of the exempted followup-count
rule, and main.sh is not a dune run-target at all (orchestrator-invoked, outside dune runtest,
same out-of-scope-by-construction reasoning the PR applies to record_qc_audit.sh). So this
does not reopen the class for anything currently wired; it is a prospective hole confined to one
subdirectory. Not covered by the filed residual. A one-line fix (grep -rlE ... --include='*.sh',
or globbing ./*.sh ./*/*.sh) would close it.
FLAG-3 — doc nit. check_universe_deps.sh lines 87-90 credit "assertion 5" with catching the
awk RS-ordering bug. Under that mutation the candidates file collapses to one record, so no
candidate resolves and the guard exits 0 silently — the assertion that actually fails is
assertion 1 (which expects a non-zero exit naming sample_check.sh). Comment-only.
Why this clears the bar
The PR's central claim is unusually load-bearing — its subject matter is "a check that silently
doesn't run", the exact defect #2143's reviewer caught in a 174-line check that returned exit 0
with zero output. I reproduced that failure mode live and confirmed (universe) is what fixes it.
The guard is self-covering (M3), its parser is pinned against fixtures rather than against the
file it polices, the false-positive risk is real and is tested (assertion 5), and the three
exemptions carry evidence in two places (inline dune comments + the conf) plus a filed
residual. Status quo is 23 exposed rules; this leaves 0 exposed among currently-wired top-level
rules. Both surviving mutations are prospective future-proofing gaps with zero live instances —
FLAG, not blocker, per the calibration for "leaves the class still open / introduces a new
false-green".
Quality Score
4 — Good: a genuinely well-evidenced infra PR whose load-bearing warm-build claim reproduced exactly in both directions, with a self-covering guard and fixture-isolated self-test; two prospective coverage gaps (unconstrained exceptions file, non-recursive scan) keep it off 5.
Verdict
APPROVED
Automated daily orchestrator run 3 for 2026-07-28 (GHA run [30393663268](https://github.com/dayfine/trading/actions/runs/30393663268)). Full summary: `dev/daily/2026-07-28-run3.md`. **Three PRs merged this run:** #2149 (`f44e5bb2`), #2152 (`14270b57`), #2148 (`751de67d`). **The finding worth reading:** run 2 (`30380136239`) is the **first orchestrator run observed with `conclusion: failure`**, and nothing surfaced it. Its Step 9 bundling step hit `fatal: 'ops/daily-2026-07-28-run2' is already checked out at '/tmp/ops-run2'` (exit 128) — because run 2's own Step 8 worktree was still holding the branch. Critically, the step's `git checkout` had **already removed** the generated budget record before the fatal, so run 2's `$36.82` reached neither its PR nor the `ops/budget-*` orphan fallback: it was destroyed, not stranded. Reconstructed here from the job log. Step 10 (`Fail on escalations`) is `skipped` when step 9 fails, so the escalation gate never ran either. This is systemic rather than a slip: Step 4's GHA guidance (`git checkout -b` in the shared tree) is wrong, so every recent run overrides it with `git worktree add` — while the bundling step was written against the checkout-based assumption it replaced. Filed as `A-WORKTREE-BLOCKS-BUNDLE` in `dev/status/orchestrator-automation.md` with three fix options. Interim mitigation applied by this run: no worktree left on the summary branch. Contents: the run-3 summary, two audit records, two `dev/reviews/*` combined results (written by the orchestrator, not the QC agents, per the PR-D'c migration), the fast health report, the reconstructed budget record, and the Step 5.5 index reconcile. 🤖 Generated by the GHA orchestrator. --------- Co-authored-by: claude-orchestrator <noreply@github.com> Co-authored-by: GitHub Actions Bot <bot@github-actions>
…w_at on exceptions) (#2155) ## What it does Closes the two FLAG residuals qc-behavioral raised on PR #2148 (`check_universe_deps.sh`, the H-CHECK-CACHE-BLIND mechanical guard), plus the doc nit: **FLAG-2 (M4) — candidate scan was non-recursive.** `check_universe_deps.sh` scanned only `trading/devtools/checks/*.sh`, missing `deep_scan/_lib.sh` and `deep_scan/main.sh` (both call `repo_root()`). Switched the scan to a recursive `find -exec grep -lE 'repo_root\)' {} +`. Candidate names below the top level now come back path-qualified (e.g. `deep_scan/_lib.sh`); the existing awk dep-matching and exceptions-list lookup already accept `/` in script names, so no further parser change was needed there. Resolved the two newly-visible candidates: - `deep_scan/_lib.sh` — added to `universe_deps_exceptions.conf`. Its only dune reference is as an explicit dep of `deep_scan_followup_count_check.sh`'s rule, which (per the existing exemption comment on that rule) always invokes its scripts with `REPO_ROOT` overridden to a synthetic fixture — same evidence already recorded for that rule's other two dep-only candidates. - `deep_scan/main.sh` — added to `universe_deps_exceptions.conf` with the honest evidence: it's not a dune run-target or dep at all, by construction (it's the deep-scan orchestrator entrypoint, invoked directly or via the `deep_scan.sh` shim, outside `dune runtest` entirely — same "weekly tool, not a per-PR gate" reasoning already applied to the other `deep_scan_*_check.sh` structural smoke tests in the dune file). Also improved the guard's "not referenced by any runtest rule" FAIL message to point at the exceptions-file escape hatch for this exact case (a script that's intentionally never wired into dune). **FLAG-1 (M2) — `universe_deps_exceptions.conf` was entirely unconstrained.** A bare filename with no expiry field could silently disable the guard for any script forever, and nothing enforced the file's own header instruction ("don't add an entry just to make the guard pass" per `.claude/rules/code-health-discipline.md`). Fixed by extending the file's format to require a trailing `# review_at: <never|M1-M7|YYYY-MM-DD>` annotation, same convention as the sibling `linter_exceptions.conf`: - `check_universe_deps.sh` itself now hard-FAILs if any exceptions entry has a missing or unparseable `review_at` — per-PR enforcement, so a bad entry can never land in the first place. - `deep_scan/check_11_linter_expiry.sh` (the weekly deep scan's existing T1-K expiry checker for `linter_exceptions.conf`) now also scans `universe_deps_exceptions.conf` with the same milestone/date logic, emitting a new `## Universe-Deps Exception Expiry` report section. The shared per-entry scanning logic was extracted into a `_scan_exceptions_conf()` function so both conf files reuse the same milestone-lookup / date-comparison code. **Placement rationale (presence vs. expiry):** presence/parseability is enforced in the per-PR guard (cheap, blocks the "unconstrained forever" hole at the exact point a bad entry would be added — this is what FLAG-1 was actually about). Expiry (has the milestone/date actually passed) is left to the weekly deep scan, matching the established `linter_exceptions.conf` precedent and cadence, and because it's a "should someone look at this" signal rather than a hard per-PR gate. **FLAG-3 (doc nit).** A comment in `check_universe_deps.sh` credited "assertion 5" with catching the awk `RS`-ordering bug; reproducing the mutation shows assertion 1 is the one that actually fails (assertion 5 was never touched by that mutation). Fixed the attribution. All three existing pre-`review_at` entries (`deep_scan_followup_count_check.sh`, `record_qc_audit.sh`, `write_audit.sh`) were given `review_at: never` with a one-line reason (their exemption is an architectural invariant of the governing rule's fixture-override wiring, not time-bound). Updated `dev/status/harness.md`'s `H-CHECK-EXEMPTION-DRIFT` item to record that the "unconstrained future additions" half of that residual is now closed, while the "evidence-correctness of existing entries" half remains open (still needs a stronger mechanical check or periodic manual re-audit if drift is ever observed in practice — unchanged from before this PR). ## Test plan - `check_universe_deps_test.sh` extended from 5 to 7 assertions: - #6 (FLAG-2): a subdirectory script (`subdir/nested_check.sh`, a dep — not run-target — of another rule) that calls `repo_root()` and whose owning rule lacks `(universe)` is caught by the recursive scan, named path-qualified in the FAIL output. - #7 (FLAG-1): a `universe_deps_exceptions.conf` entry with no `review_at` annotation is rejected with a FAIL naming the entry. - All 7 pass: `sh trading/devtools/checks/check_universe_deps_test.sh`. - Ran the guard directly against the real tree: `sh trading/devtools/checks/check_universe_deps.sh` exits 0, and now shows `SKIP (exceptions list): deep_scan/_lib.sh` and `SKIP (exceptions list): deep_scan/main.sh` in its output (previously invisible to the pre-fix non-recursive scan). - **D1 live before/after:** added a throwaway `deep_scan/zz_probe_check.sh` (real `$(repo_root)` call site, no `(universe)` anywhere). With the OLD non-recursive `./*.sh`-only scan temporarily restored, the guard silently exits 0 (misses it). With the fix restored, the guard FAILs, naming `deep_scan/zz_probe_check.sh`. Probe file removed after confirming both directions. - **D2 live before/after:** appended a bare `zz_probe_no_review_at.sh` line (no `review_at`) to the real `universe_deps_exceptions.conf` — guard FAILs naming it with a review_at-specific message. Reverted the conf to the committed version (diffed identical) — guard exits 0 again. - `sh trading/devtools/checks/deep_scan/check_11_linter_expiry.sh <tmp> <tmp>` run standalone: emits both `## Linter Exception Expiry` (existing 2 findings, unchanged) and the new `## Universe-Deps Exception Expiry` section (0 findings, since all current entries are `review_at: never`). - `sh trading/devtools/checks/deep_scan_linter_expiry_check.sh` (the structural smoke test pinning Check 11's markers) still passes. - `dune build -j 2 && dune runtest` clean (see CI / run log for this PR). 🤖 Dispatched by GHA orchestrator run [30405186411](https://github.com/dayfine/trading/actions/runs/30405186411) Co-authored-by: Docker <docker@example.com>
Summary
Closes the systemic version of PR #2143's qc-behavioral finding
(H-CHECK-CACHE-BLIND): a dune
(deps ...)list cannot express a pathabove the dune workspace root, so any
trading/devtools/checks/*.shscript that reads such a path via
repo_root()had a dune rule thatcould silently serve a stale cached PASS on a warm
_buildafter thereal file it reads regressed. #2143 fixed exactly one rule this way
(
run_in_env_root_check.sh); this PR closes the class.What changed
trading/devtools/checks/whosebody contains an actual
repo_root()/_repo_root()call site(tightened detection — see "false positive" note below). 2 were
already covered (
_check_lib.shdefines the helper and is never adune run-target;
run_in_env_root_check.shalready had(universe)from harness: fix run-in-env.sh false-green on worktree builds (H-RUNENV-WORKTREE-BLIND) #2143).
(universe)to their owning dune rule's deps:agent_compliance_check.sh,agent_compliance_test.sh,jj_workspace_smoke.sh,status_file_integrity.sh,index_size_linter.sh,orchestrator_plan_check.sh, all 6deep_scan_*_check.shstructuralsmoke tests,
consolidate_day_check.sh,rule_promotion_check.sh,budget_rollup_check.sh,posix_sh_check.sh,no_python_check.sh,extract_metrics_gate_smoke.sh,sweep_worktrees_smoke.sh,perf_catalog_check.sh.trading/devtools/checks/universe_deps_exceptions.conf+ inline dunecomments. Evidence per script (see "Exemption evidence" below).
check_universe_deps.sh(+ self-testcheck_universe_deps_test.sh), wired intodune runtest, closes theclass going forward: FAILs on any script with a
repo_root()callsite whose owning rule lacks
(universe)and isn't in the exceptionslist. The guard's own dune rule declares
(universe)for itself — acache-blindness linter that is itself cache-blind was exactly what
harness: fix run-in-env.sh false-green on worktree builds (H-RUNENV-WORKTREE-BLIND) #2143's reviewer caught.
Exemption evidence (the part QC will probe hardest)
record_qc_audit.sh+write_audit.sh— both ARE invoked inproduction outside of dune (the orchestrator's Step 5 calls them every
run against the real
dev/reviews//dev/audit/). That productioninvocation is not gated by any dune rule — it happens outside
dune runtestentirely, so it is out of scope for a dune-cache-stalenessguard by construction. The only dune rule that references either script
is the smoke test governed by
record_qc_audit_test.sh. I verifiedmechanically (not just by inspection) that every one of the 24
invocations of
record_qc_audit.sh/write_audit.shinsiderecord_qc_audit_test.shis preceded by an explicitREPO_ROOT="${TMP_REPO}"override pointing at a freshly-mktemp -dfixture repo (grep + line-proximity check, not one exception). So the
dune rule that exists never reads the real
dev/reviews//dev/audit/content — there is nothing for a warm
_buildto serve stale. If afuture edit to
record_qc_audit_test.shever invokes either scriptwithout the override, this exemption goes stale silently (dune has no
way to detect that on its own) — flagged as a residual follow-up in
dev/status/harness.md.deep_scan_followup_count_check.sh— readsdeep_scan/check_05_followup_items.shanddeep_scan/check_08_trends.shviarepo_root()(an absolute,sandbox-escaping path), but both files are already declared as
explicit deps on the same dune rule (
deep_scan/_lib.sh deep_scan/check_05_followup_items.sh deep_scan/check_08_trends.sh) —dune tracks their content hash regardless of how the script re-derives
their path at runtime. Internally, the rule always invokes both check
scripts with
REPO_ROOToverridden to amktemp -dsynthetic fixturetree, never real repo content.
False-positive guard (caught during development)
A naive
grep -l repo_root *.shcandidate scan flags any script thatmerely mentions another script's filename in a comment or echo string
(e.g. a hypothetical
helper_with_repo_root.shreference). Tighteneddetection to require an actual call-site pattern (
repo_root)/_repo_root)— i.e. the name immediately followed by a closing paren,matching both
$(repo_root)command-substitution call sites andrepo_root()-style definitions/calls, but not a bare filenamesubstring). Pinned by
check_universe_deps_test.shassertion 5.Warm-build re-run evidence (the property #2143 actually caught)
RED/GREEN on the guard alone only proves detection. The separate,
load-bearing property is that a rule with
(universe)re-executesagainst a warm
_buildwhen the real outside-workspace file changes —rather than serving a cached PASS. Demonstrated by:
dune runtestwarm (full build green, exit 0).dev/<tmp>.pyfile (outside the dune workspace,inside
repo_root()) with NO dune-tracked dep changed.dune runtest—no_python_check.sh's rule (has(universe))re-executed and FAILed, naming the new file.
(universe)fromno_python_check.sh's rule, re-added the throwaway.pyfile,warm-rebuilt — the rule was skipped,
dune runtestreturnedexit 0 with the stale PASS, reproducing the exact bug class
harness: fix run-in-env.sh false-green on worktree builds (H-RUNENV-WORKTREE-BLIND) #2143 fixed for one rule. Restored
(universe), confirmed FAILreturns, then cleaned up.
Verbatim exit codes/output for both directions are in the session
transcript; summarized in the PR discussion if requested.
Test plan
sh trading/devtools/checks/check_universe_deps_test.sh— 5/5assertions pass.
dune build && dune runtestgreen in-container (full suite, not justscoped).
dune build @fmtgreen.(universe), named the offendingscript) and GREEN (fixed) both via direct script invocation and via
dune runtestitself.(
(universe)present → re-runs, catches regression) and a negativecontrol (
(universe)absent → silently stale-passes), see above.🤖 Dispatched by GHA orchestrator run 30393663268