Skip to content

fix(platform): hash daemon inputs for static checks - #4280

Merged
yannickmonney merged 1 commit into
mainfrom
fix/hash-daemon-inputs-static-checks
Oct 4, 2026
Merged

yannickmonney merged 1 commit into
mainfrom
fix/hash-daemon-inputs-static-checks

Conversation

@yannickmonney

@yannickmonney yannickmonney commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

What changed

services/platform/turbo.json now gives @tale/platform#lint and @tale/platform#typecheck an inputs list: $TURBO_EXTENDS$, $TURBO_DEFAULT$, then the sandbox daemon's file-ops.ts and protocol.ts.

  • Two platform sources import stageFiles from services/sandbox-runtime/daemon/src/file-ops.ts: backend/domains/files/sandbox-blob-routes.test.ts and backend/domains/tasks/agent-review-files.integration.ts.
  • file-ops.ts imports WORKSPACE_ROOT from ./protocol.ts. Its other imports are node: builtins, and protocol.ts imports nothing. No further daemon file is in the closure.
  • tsc --noEmit (the platform's include covers both importers) and oxlint --type-aware type both files as part of the platform's program.
  • Before this change only test hashed them. An edit to either file alone kept the lint and typecheck hashes, so CI replayed their cached verdicts.

tests/guards/turbo-inputs.guard.test.ts gains a describe.each over lint and typecheck.

  • It asks the real turbo run <task> --filter=@tale/platform --dry=json whether each task hashes both files, and whether it still hashes its own workspace ($TURBO_DEFAULT$).
  • The existing prefix case already walks every task's inputs list, so it now also holds the two new lists to $TURBO_EXTENDS$, $TURBO_DEFAULT$.
  • The test inputs, every task name and the task settings are unchanged.

.agents/repo.md describes the two new lists next to the platform's test inputs.

How I verified it

Reproduction on main (ffa15e019):

  • I ran real turbo --dry=json --cache=local:,remote: runs in my own worktree, which is not shared.
  • I appended a probe comment to one daemon file at a time and restored it afterwards. Each restored file has the same blob as before, and git status is clean.
tree lint typecheck test
main 89c1de98e90016a5 d90aff31a0a52a5c ae0fcbe2ed6788e7
main + probe in file-ops.ts 89c1de98e90016a5 (stale) d90aff31a0a52a5c (stale) 6eb40a0b77879725
main + probe in protocol.ts 89c1de98e90016a5 (stale) d90aff31a0a52a5c (stale) 188b9e7d87108410
this branch 03da3d51b1605bb7 854d8552c1680c08 930a6f48758cf659
branch + probe in file-ops.ts a81b90d036b01669 a719fb313f74eeca c11ee2744f211021
branch + probe in protocol.ts 2e0940d40b616c27 f3456551c9cee35e 7ffd79017fc29004
branch, probes restored 03da3d51b1605bb7 854d8552c1680c08 930a6f48758cf659

Dry-run diff, main versus this branch (lint typecheck test test:ui test:browser):

  • The same six task ids appear in both.
  • lint and typecheck go from 4,520 to 4,522 inputs: exactly the two daemon files are added, and none is dropped.
  • test (5,991), test:ui and test:browser (5,492 each) and setup keep identical input sets.
  • Every resolved task definition other than inputs is equal: dependsOn: ["setup"], outputs: [], cache on.

The consuming tasks (not only the JSON):

  • tsc --listFilesOnly with the platform's own tsconfig.json options takes both daemon files into the program when it is rooted at backend/domains/files/sandbox-blob-routes.test.ts.
  • tsc --noEmit on that program passes on the head. A probe type error appended to daemon/src/protocol.ts or daemon/src/file-ops.ts fails it, with TS2322 reported inside the daemon file. So the platform typecheck verdict depends on both files.
  • oxlint --type-aware backend/domains/files/sandbox-blob-routes.test.ts, run from services/platform, passes on the head. A probe that leaves stageFiles's parameters alone but makes its result non-thenable (in file-ops.ts only) fails the platform file with typescript(await-thenable) at line 234. So the platform lint verdict depends on file-ops.ts.
  • protocol.ts reaches the lint verdict only through the types it lends that same program. Today that is WORKSPACE_ROOT, plus any global declaration it might add. It is hashed because it is a member of the program, not because of a flip I produced.
  • Every probe was restored to the same blob. The temporary config was deleted, and no .turbo cache exists in the worktree.

Guard:

  • bunx vitest run tests/guards/turbo-inputs.guard.test.ts passes 41 of 41 (35 before).
  • Each mutant was applied to turbo.json alone and then restored:
    • main's turbo.json: 4 failures, the two files for each of lint and typecheck.
    • lint without $TURBO_DEFAULT$: 2 failures, the prefix case and the lint self-hash case.
    • typecheck without protocol.ts: 1 failure.

Static checks on the changed files:

  • oxfmt --check passes, and the JSON parses.
  • oxlint --type-aware on the guard passes.
  • An isolated tsc --noEmit passes on a temporary config holding only the guard file, which I deleted afterwards.
  • The pre-commit hooks passed: conflict markers, oxfmt, opengrep and commitlint.

Left out on purpose

  • The same import scan finds two files outside the daemon that platform sources import and that lint and typecheck still don't hash. Fixing them is out of this change's scope, so they are recorded on TALE-619 for routing:
    • knip.config.ts, imported by tests/guards/frontend-entry-discovery.guard.test.ts. It in turn imports packages/{ui,shared,marketing-ui}/package.json.
    • services/sandbox-runtime/build-gemini-settings.ts, imported by lib/harnesses/gemini-settings-build.test.ts.
  • Imports through a workspace package name stay with the ^ dependency gap that .agents/repo.md already records.
  • Open fix(sandbox): reduce agent overhead and harden session recovery #4173 adds daemon/src/exec-journal.ts to the test inputs, because backend/core/chat/external_turn_shared.test.ts imports it. Whichever of the two lands second should list it in lint and typecheck as well, along with a STATIC_IMPORTS entry.

Follow-up from #4101 (the "turbo inputs" LOW).

Two platform suites import the sandbox daemon's file-ops.ts, which
imports its protocol.ts. Only the test task hashed the two files, so an
edit to either alone replayed the cached lint and typecheck verdicts,
although tsc and oxlint's type-aware rules both type them as part of the
platform's program.

The lint and typecheck tasks now list both files after $TURBO_EXTENDS$
and $TURBO_DEFAULT$. The turbo inputs guard asks turbo's dry run whether
both tasks hash them and still hash their own workspace.
@yannickmonney

Copy link
Copy Markdown
Contributor Author

ACCEPT — independent source/local review of PR #4280 (TALE-619)

Exact head: e8cb55c4c9b80089e2debb4b38b8129d936f3c5e. Reviewer: agent #12 31b27429-fe64-4694-86de-4169cb2067f3, TALE-632, run 97c1774d-6227-40c7-9f16-c6b32ae26bd0; distinct from author agent #5/run 4bcf766d. Contract: TALE-619 / #4101 child D. No blocking source finding found. This is not a merge, native task approval, deployment or parent-issue closure.

Independently observed

  • lint and typecheck inputs start with $TURBO_EXTENDS$, $TURBO_DEFAULT$, then exactly the two required daemon files. Closure parsed from source: file-ops.ts imports ./protocol.ts plus five node: modules; protocol.ts imports nothing. Both platform importers were inspected.
  • Only the existing tests/guards/turbo-inputs.guard.test.ts is extended; no second repository guard or cache setting change. Real Turbo resolved definitions are unchanged except these two input lists, with cache still enabled.
  • Real turbo run lint typecheck test test:ui test:browser --filter=@tale/platform --dry=json comparisons against parent ffa15e019: same six task IDs; lint/typecheck each gain exactly two inputs (4,520 → 4,522), dropping none. Input-path sets for test (5,991), test:ui/test:browser (5,492 each), and setup are identical to the parent. Test hashes may change because their existing workspace inputs include the edited guard/config; no test input was added or removed.
Owned isolated tree lint hash typecheck hash test hash
Exact head 03da3d51b1605bb7 854d8552c1680c08 930a6f48758cf659
Only file-ops.ts probe 4e27a448ca54183a bdb4f33a5620bbbf b2c92bd11d7ece8f
Only protocol.ts probe e7b3d79514b8757f 413dd2308c0d0fd1 e40f254ca55e2275
Probes restored 03da3d51b1605bb7 854d8552c1680c08 930a6f48758cf659
  • Guard: 41/41 pass at the head. Keeping the head's guard but substituting the parent's turbo.json causes exactly four expected failures: both daemon files missing from each static task. Config restored. Parent's original guard separately passes 35/35.
  • Actual consumer, not merely JSON: installed tsc --noEmit with the platform's inherited settings, a bounded include rooted at backend/domains/files/sandbox-blob-routes.test.ts, and incremental output disabled passes. Its 462-file closure includes both owned daemon files. A planted type error in either daemon file fails with TS2322 in that file. Installed oxlint --type-aware --threads=1 on that real platform consumer passes; a file-ops-only mutation making stageFiles non-thenable fails at platform line 234 with typescript(await-thenable). These are focused real tools, not a full platform task execution. The same consumer's unit suite passes 25/25 with local synthetic fixtures, no database.
  • Changed-file checks: guard targeted typecheck and type-aware lint pass; configured oxfmt check passes (two matched code/config files; Markdown is not formatted by that invocation). Both JSON configurations parse through actual Turbo/guard execution.
  • Restoration: tracked diff is empty; both daemon blobs and turbo.json equal their committed objects, and all six restored hashes equal the initial head hashes. All probes were confined to my owned checkout. No shared worktree/cache writes, dependency install, database, browser, image work, CI rerun/cancellation or card move. Owned checkout contains zero Turbo cache files.

Unrun proof / remaining gate

  • G1 — hosted exact-head CI: five candidate-source checks remain queued at the pre-post readback. No CI execution/cache receipt is available; this PR is not merge-ready until normal required checks finish and the platform Lint/Type check execution-versus-replay receipts are verified. I did not wait, rerun or cancel CI. TALE-359/root owns this gate.
  • Full platform lint/typecheck, whole-workspace suites/check, native database integration and browser/image gates were not run in this light 4-GiB review. The second integration importer was source-inspected, not executed. No protocol-only lint-verdict flip was demonstrated; its hash sensitivity and actual TypeScript program consumption were demonstrated, and the direct daemon import closure is covered conservatively.
  • Out-of-scope package/global-dependency debt is not repaired or accepted here. If fix(sandbox): reduce agent overhead and harden session recovery #4173 changes this daemon import closure before merge, revalidate/add exec-journal.ts where required; this receipt only covers the exact head above.

Root's 08:15Z rule is preserved: a later blocking finding overrides ACCEPT until independently closed at the exact source with proof. No earlier PR review/comment blocker was present at readback.

Evidence in TALE-632 delivery: pr.diff, hashes.log, five dry-*.json snapshots, guard.log, guard-mutant.log, consumer-tsc.log, tsc-probe-*.log, consumer-lint.log, lint-probe-file-ops.log, consumer-unit.log, guard static/format logs, import-closure.log, restoration.log, and reproducibility scripts/configs. The temporary owned checkout is removed after the receipts; retained evidence is under /agent/output/bb955c68-8b87-4a90-926b-97ceeca88bb2/.

@yannickmonney
yannickmonney merged commit ca8d03c into main Oct 4, 2026
@yannickmonney
yannickmonney deleted the fix/hash-daemon-inputs-static-checks branch October 4, 2026 16:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant