Skip to content

Commit 976a6ee

Browse files
committed
fix: the dropped-refinements ledger header counts this PR's sites; a test record names no error code
The ledger gained two entries and 26 dropped-refinement sites (the seed record value's refinement) without its measured totals; they now read 247 and 866. A bundle test's record field named code read as an error-code literal to the casing guard; it is a name. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012eJQ8dtut5bZsnhFE3XGHF
1 parent 6c5c49c commit 976a6ee

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

‎packages/cli/src/utils/bundle-seed-files.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ describe('collectSeedFiles / placeSeedFiles', () => {
8585
it('refuses a path that names no file, saying where the reference sits', () => {
8686
const result = collectSeedFiles(
8787
packageRoot({}),
88-
{ data: [{ object: 'x', records: [{ code: 'a' }, { file: seedFile('fixtures/missing.pdf') }] }] },
88+
{ data: [{ object: 'x', records: [{ name: 'a' }, { file: seedFile('fixtures/missing.pdf') }] }] },
8989
);
9090
expect(result.issues).toHaveLength(1);
9191
expect(result.issues[0].location).toBe('data[0].records[1].file');

‎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": 840,
5+
"publishedSchemasWithDroppedRefinements": 247,
6+
"droppedRefinementSites": 866,
77
"refinementSitesThatDidProject": 369,
88
"refinementSitesWithNoJsonFormToCompare": 0
99
},

0 commit comments

Comments
 (0)