Repository navigation
fix(spec): the top-level report alias table routes the ten block spellings it claimed to mirror - #19855
Conversation
…lings it claimed to mirror `ReportSchema`'s alias table says it is kept parallel to `JoinedReportBlockSchema`'s, but ten of the block's entries were absent: `measures`/`metrics` -> `values`, `dimensions`/`groupBy`/`groupings` -> `rows`, `sort`/`orderBy`/`sortBy` -> `order`, `objectName`/`object` -> `dataset`. Every target is a key the report declares. Measured before this change, nine of the ten were refused with no suggestion at all; `orderBy` alone reached `order` by edit distance. None drew a wrong suggestion. The table now carries every block entry, in the block's order and wording. `report.test.ts` pins each of the ten by parse (the rejection names the target, and the target parses) and derives the parity claim from the two tables at runtime. Claude-Session: https://claude.ai/code/session_013RDBh5DqXd2xnLwvHLgLFr Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013RDBh5DqXd2xnLwvHLgLFr Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 1 package(s): 1 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
What this run could not see
Coarse fallback — 136 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin a3d2e127db18cec1aba60725844cb99b5471553a && git checkout a3d2e127db18cec1aba60725844cb99b5471553a
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 8cbc3c0084a3c3c8ef5e59763ab3be96aa1a6f07 926cff321dbd78de2a834f22d21da3a05c9a8740 && git checkout -B drift-repro 8cbc3c0084a3c3c8ef5e59763ab3be96aa1a6f07 && git merge --no-ff 926cff321dbd78de2a834f22d21da3a05c9a8740
node scripts/docs-audit/affected-docs.mjs --json 8cbc3c0084a3c3c8ef5e59763ab3be96aa1a6f07
|
… the top level renames too The semantic-layer ledger recorded, as a reading it did not repair, that `measures` on a top-level report drew a bare unrecognised-key error while the joined-report block answered `measures` -> `values`. The top-level alias table now carries the block's entries, so the pin is reversed in place: both levels refuse `measures` and name `values`. The header bullet that described the asymmetry is rewritten to match. Claude-Session: https://claude.ai/code/session_013RDBh5DqXd2xnLwvHLgLFr Co-authored-by: Claude <noreply@anthropic.com>
Contract reviewServed-tier: 56/56 Isolated at-tier reviewer subagent, run by the ① Derived judgmentsInputs read: card #19822 body + all 4 comments (triage 5792313693, claim 5793125463, os-dev-report rounds 1 and 2), PR #19855 body/files/diff (
② Semver level
③ Boundary flags
Implemented-by: VERDICT: PASS Generated by Claude Code |
Fixes #19822
Clause-②: no
ReportSchema's alias table inpackages/spec/src/ui/report.zod.tssays it is "kept deliberately parallel" toJoinedReportBlockSchema's table in the same file. It was not: ten of the block's entries were missing at the top level, even though every target (values,rows,order,dataset) is a keyReportSchemadeclares. This PR adds those ten entries. After it, the top-level table carries all 17 block entries, in the block's order and wording.Measured first: what the author saw on
origin/main71ef221988Setup: a minimal valid top-level report (
name,label,type: 'summary',dataset: 'sales',rows: ['stage'],values: ['revenue']) plus one extra key, run throughReportSchema.safeParse. Each parse gave exactly one issue,unrecognized_keys. Each message then ended with the samehistorysentence ("Until this shape was closed these were dropped silently — …"), which is left out of the table.71ef221988(before)measuresUnrecognized key(s) on this report: `measures`.Did you mean `measures` → `values`?metricsUnrecognized key(s) on this report: `metrics`.Did you mean `metrics` → `values`?dimensionsUnrecognized key(s) on this report: `dimensions`.Did you mean `dimensions` → `rows`?groupByUnrecognized key(s) on this report: `groupBy`.Did you mean `groupBy` → `rows`?groupingsUnrecognized key(s) on this report: `groupings`.Did you mean `groupings` → `rows`?sortUnrecognized key(s) on this report: `sort`.Did you mean `sort` → `order`?orderByUnrecognized key(s) on this report: `orderBy`. Did you mean `orderBy` → `order`?order(edit distance), correctDid you mean `orderBy` → `order`?(now from the table)sortByUnrecognized key(s) on this report: `sortBy`.Did you mean `sortBy` → `order`?objectNameUnrecognized key(s) on this report: `objectName`.Did you mean `objectName` → `dataset`?objectUnrecognized key(s) on this report: `object`.Did you mean `object` → `dataset`?Wrong suggestions: none. No key drew a suggestion pointing at the wrong key. In particular,
objectNamedid not suggestname. Nine of the ten got no suggestion at all.orderByalone reached its target, by edit distance, and that target was correct. As a control, the same ten keys on aJoinedReportBlockSchemain the same run each got the block table's prescription.What changed
report.zod.ts:ReportSchema'saliases. AddedobjectName/object→dataset,measures/metrics→values,groupings/groupBy/dimensions→rows, andsort/orderBy/sortBy→order. They sit in the block table's order, under the block's comments, adapted from "block" to "report".guidanceline. The note also names where the two tables still differ, and why: theguidancetables. The block's three guidance entries point at keys this schema declares, anddrillDownis report-only. The existing note about the three removed entries (columns,chart,chartConfig) is unchanged and still accurate. A new paragraph records that the ten were missing and that onlyorderByreached its target by distance.guidanceentry was needed. None of the ten has a reason not to route at the top level. Each target is declared onReportSchema, and none of the ten keys is declared there. One path was checked end to end: on atype: 'joined'report,sort:is toldorder, and writingorderthere is refused by the existing refinement ("ajoinedreport orders per block — moveorderontoblocks[]"). So that chain ends with a prescription, never with silence. The comment above the ordering entries says so.Tests
packages/spec/src/ui/report.test.tshas a newdescribe, "ReportSchema — routes the block vocabulary the way a block does":unrecognized_keysissue names exactly that key, and the message containsDid you mean `KEY` → `TARGET`?.safeParseof the valid report with the target key. These are preservation pins and are green before and after this change.strictObjectDeclarations(), the same registryalias-integrity.test.tsuses, looked up bysurface, with exactly one declaration asserted per surface. Every block alias whose target is inReportSchema's shape must be routed at the top level to the same target, or be answered by a top-levelguidanceentry. A non-vacuity floor asserts that the derived set contains all ten keys this card names.Firing control. Run at
8a688435cc: the alias region was swapped back to71ef221988's withnode scripts/ablation-replace.mjs, which wraps the run and restores the file. The on-disk blob during the mutation wasfe9d289f63ba, which is exactly71ef221988's blob forreport.zod.ts, so the test ran against the file as it is on main. Result:Tests 10 failed | 40 passed (50).orderBystayed green, because edit distance already answeredorder, as measured above. Its table entry is held by the parity pin.measures → values (top level: absent)andorderBy → order (top level: absent).Restore was proven: the blob after restore equals
HEAD's452f138f054d, andgit diff HEADis empty.Runs.
926cff321d:@objectstack/specreport.test.ts+alias-integrity.test.ts+strictness-batch14.test.tsgave3 passed (3),91 passed (91). Atc78242fe05the same set plusstrict-object.test.tsgave4 passed (4),123 passed (123).926cff321d:pnpm --filter @objectstack/platform-objects test, run after rebuilding spec and its closure, gave54 passed (54)files and883 passed (883)tests.pnpm --filter @objectstack/platform-objects typecheckexits 0.@objectstack/speclocalproject at8a688435cc:523 passed (523)files,15434 passed | 1 todotests.packages/is byte-identical between8a688435ccandc78242fe05:git diff --quietexit 0.pnpm --filter @objectstack/spec typecheck: exit 0.check:test-typecheckreports OK and holds the ledger unchanged, andtsc -p tsconfig.test.json --listFilesOnlyincludessrc/ui/report.test.ts.alias-integrity.test.tsis not edited; PR #19789 holds that file. Run as-is:20 passed (20)at8a688435ccand again atc78242fe05, inside the 123 above. Its three claims hold for the new entries. No key is declared, every target is accepted, and no two keys in the table collapse onto one probe.Reading pin reversed in
@objectstack/platform-objects.packages/platform-objects/src/apps/translations/report-form-echo-decisions.test.tspinned the gap this PR closes as a reading: it asserted thatmeasureson a top-level report drew no rename suggestion. That turnedTest Core (4/6)red onc78242fe05. The test is reversed in place, not deleted. Under a retitledit, it now asserts that the top-level report refusesmeasuresAND names`measures` → `values`; the block half is unchanged. The file header bullet that described the asymmetry is rewritten to match. No other test in that file changed.Generated artifacts
pnpm --filter @objectstack/spec buildrunsgen:schema. After it,git status --porcelainwas empty: no generated file moved, as the claim predicted. Alias keys are not part ofauthorable-surface/.pnpm --filter @objectstack/spec check:generatedthen reportedAll 15 generated artifacts are up to date, measured against the dist that build produced (declaration stamp match).Changeset reading
The change ships, so it carries a
patchchangeset (.changeset/19822-report-top-level-aliases.md), withClause-②: no.@objectstack/spec'sfiles[]includesdistandsrc/**/*.zod.ts, soreport.zod.tsis published both as source and compiled intodist/ui/.measures: 'values'occurs once in71ef221988'sreport.zod.ts(block only) and twice at head, and the builtdist/ui/index.jsandindex.mjseach carry it twice.17.4.0), namely the text of a rejection. AGENTS.md makes that apatch, and ⛔ neverskip-changeset.unrecognized_keysmessage is new.check-adr-0087-registrationreads it as1 non-breaking changeset(s) seen.Gates
Derived with
node scripts/pm/dispatch-gates.mjs --repo objectstack-ai/objectstack --commandsfrom this worktree: 85 commands for the 4-path change set, the first round's 83 pluscheck:i18nandcheck:i18n-stale-fill. All 85 were run at head926cff321dafter a full package build.dispatch-gates --ranread:85 derived, 85 run, 0 NOT-MEASURED, 0 UNRUN, with every recorded exit code 0. That union coverscheck:*families only. Package test suites run in CI'sTest Core, which the tool lists as a path-scheduled CI job outside its derived total.check:dual-build-cjs-loads,check:type-check-debtandcheck:doc-formula-expressions.type-check-debtverdict line was "4 ledger entr(ies) re-measured … none above its recorded number".Lint, as a proven narrowing rather than a repo scan:
eslint --no-inline-config --format jsonat926cff321d: 3 files, 0 errors, 0 warnings.--print-config) has noparserOptions.project, andeslint.config.mjsstates that it never enables type-aware linting. So this diff cannot move the lint verdict of any untouched file.Acceptance notes
type: 'joined'report accepts top-leveldataset,rows,columnsandvalues. For example,{ type: 'joined', blocks: [...], dataset: 'sales', rows: ['stage'], columns: ['region'], values: ['revenue'] }parses clean at head. But the report's own contract says "For ajoinedreport, the data lives onblocks", and the renderer's joined branch returns before it reads any of them (objectui0cf2d66,packages/plugin-report/src/DatasetReportRenderer.tsx, thepresentation === 'joined'branch). So those keys are silently dropped.orderis the only top-level selection key the joined refinement refuses. This predates this PR: the existingfields → valuesanddataSet → datasetentries already pointed there, and so do the newmeasures,dimensionsandobjectNameroutes on a joined report. The loud fix is to extend the joined arm of the refinement the wayorderalready is. That narrows acceptance, so it needs its own card and changeset.Generated by Claude Code
Generated by Claude Code