Repository navigation
fix(pm): the scratch-dir scan does not read a declaration as a directory-creating site - #23304
Merged
objectstack-fleet[bot] merged 2 commits intoOct 13, 2026
Merged
Conversation
…ory-creating site A module shim's `export function mkdtempSync(prefix: string): string;` matched SCRATCH_CALL as a call whose base (`prefix: string`) no resolver can read, so the live-tree case "no mkdtempSync site in this tree takes a base the scan cannot read" redded the full battery on main. The declaration is correct; the reader was wrong. scratchDirSitesInSource now skips the two declaration shapes: a declaration file (.d.ts / .d.mts / .d.cts, which admits no statement), and a match the `function` keyword precedes (its parameter list is declared, not passed). Every other match is judged exactly as before. Measured at bae5841: 1764 raw matches; 1764 -> 1762 sites, the two removed being the showcase node:fs shim's mkdirSync and mkdtempSync signatures; in-tree 63 -> 63, exposed 0 -> 0, unresolved 315 -> 313, unresolved mkdtempSync 1 -> 0. The self-test pins each rule on a fixture only it can clear, plus three controls: a real mkdtempSync(someUnreadableBase) call in a .ts source is still UNRESOLVED, alone, beside a same-name declaration, and in a same-name wrapper's body. They are in-process, so they sit in the fast tier. Claude-Session: https://claude.ai/code/session_012zwsLMxQBwHUYJgPyrpEvx Co-authored-by: Claude <noreply@anthropic.com>
…ratch-scan-declarations
objectstack-fleet
Bot
deleted the
claude/issue-23294-scratch-scan-declarations
branch
October 13, 2026 17:25
This was referenced Oct 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #23294
Clause-②: no
main's hourly full battery is red onLint · PM dispatch-gates(the card behind it is #23274). The live-tree case "no mkdtempSync site in this tree takes a base the scan cannot read" readsexamples/app-showcase/types/node-shim.d.ts:30as a call. That line is a type declaration,export function mkdtempSync(prefix: string): string;, and the scan cannot resolve its "base",prefix: string. The declaration is correct and the reader is wrong, so this PR fixes the reader. The shim is not touched, and no gate is added.The change
scratchDirSitesInSource(scripts/pm/dispatch-gates.mjs) no longer counts a declaration as a directory-creating site. It recognises two shapes:.d.ts,.d.mts,.d.cts). TypeScript admits no statement in an ambient context, so every match in one is a signature, and the function returns zero sites for it.functionkeyword precedes. This coversdeclare function,export function, an overload, and the head of a same-file wrapper. What follows the name there is a parameter list being declared, not an argument being passed.singleCallSiteParametersalready uses the same test to skip its own declarations.Every other match is judged exactly as before.
SCRATCH_CALL, the resolver and the verdict are unchanged. A wrapper's body is still read, because the calls inside it are calls.Deliberately narrow. An interface method signature, an object-literal method or a class method in an ordinary
.ts/.mjssource is still read as a site. The text that would clear one (a name, an argument list, then:) is also the text of a ternary's call, and this scan's bias is to report a site rather than clear it. A shape this rule does not clear fails loud, with its file and line. None of those shapes occurs in the tree today (measured below).What moved on the tree
A probe listed every raw
SCRATCH_CALLmatch in the tracked JS/TS sources, with the module's own classification of each. "Before" is the basebae5841bceand "after" is the fix, measured both before and after the merge ofmain(the same numbers both times):mkdtempSyncThe in-tree, covered, exposed and unresolved lists from
exposedScratchDirswere also diffed field by field between the base tree and the fix. They differ by two unresolved entries, both in the shim, and by nothing else:mkdtempSyncwithprefix: string, which is the red;mkdirSyncwithpath: string, which has been there since24964153e2. It was silent only because themkdirSynchalf is not held to completeness.No in-tree, covered or outside site moved.
Other declaration shapes. Across all 1764 raw matches, 2 sit in a declaration file, and the same 2 are
function-keyword declarations. Outside the shim, no match is followed by:or{after its argument list, and no match has a type-annotated first argument. So the tree has nodeclare function, overload, interface signature or method in a.tssource to handle today.Self-test: six new cases, in the fast tier
The six new cases are in-process fixtures, so they sit in the fast tier, which is the tier this PR's lane runs. Each rule is pinned on a fixture only it can clear, and three controls keep both rules honest:
.d.tsare no site..d.mts, with nofunctionkeyword, is no site.declare function,export functionand an overload in a.tssource are no site.const dir = mkdtempSync(someUnreadableBase);in a.tssource is still UNRESOLVED. The case asserts the call name and the expression.function mkdirSync(dir)whose body callsfs.mkdirSync(dir, …), the head is not a site and the body's call is, UNRESOLVED on line 2.The live-tree case is unchanged and stays in the slow tier.
The battery, both tiers (
node scripts/pm/dispatch-gates.mjs --self-test, the equivalent of the schedule and push runs):bae5841bce:✗ dispatch-gates self-test: 1 of 2093 case(s) failed., exit 1. The one red is the card's case, word for word.82522ac6a8(this PR's head):✓ dispatch-gates self-test: 2099 cases pass., exit 0, withfast 1839 case(s) in 428.5s · slow 260 case(s) in 1253.3s. The live-tree cases now read:✓ the sweep really read this tree (1762 directory-creating site(s) across 8973 tracked source(s))✓ and it really found in-tree fixture roots (63)✓ no mkdtempSync site in this tree takes a base the scan cannot readThe six-case difference is these cases: the tier-partition pin moved from
1817 fast + 260 slowto1823 fast + 260 slow.Ablations (one-time proofs, nothing left in the tree)
Each mutation went through
node scripts/ablation-replace.mjsin wrap mode, onscripts/pm/dispatch-gates.mjs, with the fast tier as the wrapped command. Every leg reported the anchor going from 1 to 0 and a changed blob hash. Every restore reported a blob equal to HEAD (c7096603fe14) and an emptygit diff HEAD. A driver script re-checked both after each leg, and the tree held zero ablation markers at the end..d.mtssignature as an UNRESOLVED site.function-keyword skip removedscanned: 0Local verification, at
82522ac6a8node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstackderived 29 commands, and all 29 exited 0. The reconciliation (--ran) reads:29 derived famil(ies) accounted for — 29 run, 0 NOT-MEASURED (a DERIVED zero …).pnpm check:pm-dispatch-gatesruns the wrapper self-test and then the dev-box fast tier. It exited 0 with 1839 fast cases.pull_requestevent, also selectsbare_root_worklist, which is not among the 29.node scripts/pm/bare-root-worklist.mjs --self-testexited 0.eslint.config.mjslints both, and neither came back ignored.eslint --no-inline-config --format jsonreports 2 files, 0 errors and 0 warnings.parserOptions.project, noprojectService), so this diff cannot move the verdict for any untouched file.pnpm lintis CI's.pnpm check:nul-bytes: OK, 11261 text files, no raw control bytes.Whether
Lint · PM dispatch-gatesruns on this PRIt does.
scripts/ci/select-gate-families.sh, run locally as apull_requestevent against this branch, printsrun pm_dispatch_gates reads scripts/pm/dispatch-gates.mjs (M, scripts), becausescripts/pm/*is in that family's read-set.On
pull_requestandmerge_group, though, the lane runs the fast tier only. So this PR's CI reads the six new cases, but not the live-tree case, which runs onpushtomainand on the hourly schedule. The both-tiers result above is the local equivalent of that run.PR #23273's paths were outside the read-set: whole-tree content reads are off the PR path by a ruled narrowing. That is why only the hourly run caught the red.
Changeset
None, with label
skip-changeset. Both touched files belong to the repository root package,@objectstack/spec-monorepo, which is"private": trueand declares nofiles, so nothing here is published. The nearestpackage.jsonabove each file is the root's.Positive control: the same lookup on
packages/spec/src/data/field.zod.tslands on@objectstack/spec. That package is not private, and itsfileslist includessrc/**/*.zod.ts, so that file does publish.Acceptance notes (observations, not filed)
ci-failure.mjs --runmisses a roster member.node scripts/pm/ci-failure.mjs --run 38411694784, re-run for this PR, still exits 2. It says thatLint & Repo Gateshas "NONE of its members … among this sha's check-runs". The red member is there: three check-runs namedLint · PM dispatch-gatesexist on042ef51530, a success (run38409754946), the failure (115345404875, run38411694784) and a later cancelled one (115345950501, run38411617233). The likeliest reading, not verified in the code, is that grouping by name across every run on the sha keeps the later cancelled row, and that row is not in the asked run. This is out of this card's scope and is handed to the seat with the evidence above.Generated by Claude Code