Skip to content

Commit dc55e25

Browse files
committed
wip(spec): dropped-refinements header totals and the file-description demotion count follow the retirement
Claude-Session: https://claude.ai/code/session_01T5pRzjp4QpCwioKZ9Gt5tC Co-authored-by: Claude <noreply@anthropic.com>
1 parent 5db0dbf commit dc55e25

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

‎packages/spec/dropped-refinements.baseline.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
"description": "Shrink-only ledger of every PUBLISHED JSON Schema that is STILL WIDER than the Zod type it was generated from, because a rule written as `.refine()` reaches the runtime and not the file (#18670). `z.toJSONSchema()` has no arm for a `custom` check: a plain record, the same record with a `.refine()`, and the same record with an ABORTING `.refine()` all project byte-identically (measured on zod 4.4.3, the version packages/spec resolves). So a document one of these files ACCEPTS can still be refused at parse time, and an author -- or an AI -- validating against packages/spec/json-schema/** finds out a release later. Each `sites` path is a position under that schema at which a refinement is dropped; the same paths are written onto the artifact itself as `x-dropped-refinements`. Item 2 closed the first patterns: a refinement DECLARED through the closed list in src/shared/refinement-projection.ts is emitted into the published file, reads `projected` rather than `dropped`, and its row LEAVES this ledger in the same PR -- which is why the ledger shrinks and never grows on a repair. Every refinement outside that closed list stays here, and adding an arm to the list is a public-contract decision, not a refactor. Hand-edited on purpose and with no `gen:` script: a generator would let a new gap be admitted by running a command instead of by a decision, which is the silence this ledger exists to end. Adding, removing or moving a site fails packages/spec/scripts/build-schemas.ts until the line moves with it, and the failure prints the corrected entry in full. ⛔ Do not delete or weaken a refinement to shorten this file -- the runtime rule is correct; it is the projection that is silent, and the remedy is to teach the closed list a NAMED pattern, never to drop the rule.",
33
"measured": {
44
"zod": "4.4.3",
5-
"publishedSchemasWithDroppedRefinements": 245,
6-
"droppedRefinementSites": 835,
5+
"publishedSchemasWithDroppedRefinements": 243,
6+
"droppedRefinementSites": 831,
77
"refinementSitesThatDidProject": 369,
88
"refinementSitesWithNoJsonFormToCompare": 0
99
},

‎packages/spec/scripts/file-description.test.ts‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2223,10 +2223,12 @@ describe('corpus — every rendered description is well-formed markdown', () =>
22232223
// `marketplace-admin` and the `environment-artifact` re-export; `tenant`
22242224
// opened at level 2 and was never counted. `marketplace.zod.ts`, the one
22252225
// level-1 opener among the four modules that moved to `marketplace/`,
2226-
// still counts.)
2227-
expect(shifted.length).toBe(31);
2226+
// still counts. 31 -> 30: `kernel/package-upgrade.zod.ts` — a level-1
2227+
// opener (`# Package Upgrade Protocol`) — was removed whole by #25608's
2228+
// ADR-0049 retirement.)
2229+
expect(shifted.length).toBe(30);
22282230
// …and every one of them was shifted because it opened at level 1.
2229-
expect(shifted.filter(d => /^ {0,3}#(?:[ \t]|$)/m.test(withoutFences(d.untouched)))).toHaveLength(31);
2231+
expect(shifted.filter(d => /^ {0,3}#(?:[ \t]|$)/m.test(withoutFences(d.untouched)))).toHaveLength(30);
22302232
});
22312233

22322234
it('never opens a page on the `@module` marker (#13796)', () => {

0 commit comments

Comments
 (0)