Uh oh!
There was an error while loading. Please reload this page.
spec: generate declaration-map/ — TS declaration names to spec registry names (docs-audit option D, spec half) - #13939
Conversation
…egistry name WIP: generator + artifact; wiring (scripts, check:generated row, merge-driver routing, pins, changeset) follows. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PBjwYLS6BciTQW3c9xQiD2
…pins, changeset - package.json: gen:declaration-map / check:declaration-map (self-test + --check) - check-generated.ts: GATED row after its two input artifacts - .gitattributes + regen-artifacts.mjs: merge=os-regen routing - scripts/declaration-map.test.ts: pins ObjectSchemaBase→data/Object, DatasourceSchema→data/Datasource, non-empty floor, positive control, manifest cross-consistency - changeset (patch) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PBjwYLS6BciTQW3c9xQiD2
📓 Docs Drift Check
What this run could not see
Coarse fallback — 128 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): |
Uh oh!
There was an error while loading. Please reload this page.
Fixes#13712
What
A new generated artifact,
packages/spec/declaration-map/(14 category shards), mapping TS declaration names of authorable containers to their spec registry names — produced by the spec generation chain, covered bycheck:generated, never hand-edited. It unblocks docs-audit option D (#13713, which isBlocked-by:the card this PR closes): diff-side tooling holds a changed line's enclosing declaration name (ObjectSchemaBase) and can now ask which authorable container it declares (data/Object).Phase discipline per the card and triage: the ruled first deliverable was a cost estimate, posted before any code as issue comment 5480770862 (verdict SMALL, with measurements). This PR is the implementation it green-lit.
Clause-②: no — emitting a new generated artifact neither changes an accept/reject verdict nor widens the authorable surface (triage reading, adopted in the claim).
How the mapping is derived (no manual entries — the card's premise holds)
Composition of two committed artifacts plus one bounded syntactic pass, in
scripts/build-declaration-map.ts:json-schema.manifest/supplies every def key;export-origins/supplies which source declaration each entry-point export resolves to. The export-key candidates for a def are the closed inverse ofschemaNameFromExportKey(bare name, and name plus theSchemasuffix). Measured: all 1,597 def keys reverse-resolve with zero misses.ObjectSchemaBasecase) are recovered by syntactically unwinding the exported declaration's initializer —lazySchemafactories,Object.assignfirst argument, method-chain receivers, returned identifiers — recording same-file top-level consts so reached. Singlets.createSourceFile, no type checker. Survivors on this tree:ObjectSchemaBase,BaseQuerySchema,FormFieldBaseSchema,MetadataTypeRegistryEntryBaseSchema.src/CATEGORY/segment), and otherwise recorded in the shard'scollisionslist (5 names on this tree, e.g.RetryPolicy, declared insrc/shared/and published under bothsystem/andautomation/). A lookup miss therefore means "not known to be an authorable container" — precision over recall, the right trade for the consumer.Premise nuance recorded on the card: the card's example declaration
DatasourceDefdoes not exist in spec source — the declaration enclosingschemaModeisDatasourceSchema(src/data/datasource.zod.ts), so the second pin isDatasourceSchemaresolving todata/Datasource.Executable criterion (path per implementation)
node -e "console.log(require('./packages/spec/declaration-map/data.json').entries['ObjectSchemaBase'])"printsdata/Object— verified on this branch.check:generatedcovers the artifact via a new GATED ledger row (check:declaration-map/gen:declaration-map), same regime as the other artifacts.Wiring (every registry has its own reconciliation gate)
packages/spec/package.json:gen:declaration-map/check:declaration-map(self-test then byte-compare)packages/spec/scripts/check-generated.ts: GATED row placed after its two input artifacts, so a--fixregenerates inputs first — ledger reconciles (15 gated).gitattributes+scripts/regen-artifacts.mjs:merge=os-regenrouting, reconciled bycheck:merge-driverpackages/spec/scripts/declaration-map.test.ts: pins over the committed bytes —ObjectSchemaBasetodata/Object,DatasourceSchematodata/Datasource, a 1,000-entry non-empty floor, a positive control (the known-absentDatasourceDefspelling really misses), manifest cross-consistency (every value is a published def key), and entry/collision disjointnessfileswhitelist — same posture asexport-origins/)Verification — all at head eee4548 (the final commit; no code changed after these runs)
check:declaration-mapself-test: every unwinding rule pinned on fixtures (wrapper chains, nested returns, imports and inline shapes stop the walk, precedence, home rule, collision drop) — greengit statusclean; check mode green ("declaration-map/ is current: 2978 declaration name(s) across 14 categor(ies), 5 dropped as ambiguous")pnpm --filter @objectstack/spec run check:generated: all 15 gated artifacts green,check:declaration-mapamong thempnpm --filter @objectstack/spec typecheck(src + scripts + test programs): greenvitest run scripts/declaration-map.test.ts— 6 passed (6)check-generated-ledger.test.ts+build-schemas-check-mode.test.ts— 71 passed;liveness/check-liveness.test.ts— 37 passedscripts/pm/dispatch-gates.mjs, changeset derived from merge base 9b21037): 55 commands — 50 green, 5 PREREQUISITE NOT MET by the gates' own printed verdicts, none a red:check-dev-prereqs,check:dual-build-cjs-loads,check:type-check-debtre-measure (all three need the whole-workspace build CI performs; the coverage half of the last is green),check-test-completeness(grades a saved CI test log; its own text says record NOT MEASURED locally),check-half-states(needs repo-scoped REST this session's gate refuses, measured 403)CI convergence review is the PM's per the dispatch contract; gate status as of this report is the local evidence above. Authored in session
session_01PBjwYLS6BciTQW3c9xQiD2.Generated by Claude Code