Skip to content

Commit bc5156f

Browse files
os-zhuangclaude
andauthored
fix(objectql): single-quote the shadowed package id in the [Registry] Collision warning (#12790)
* fix(objectql): single-quote the shadowed package id in the [Registry] Collision warning (#12609) The cold-boot-order [Registry] Collision warning in packages/objectql/src/registry.ts double-quoted the shadowed package id, against this package's own convention (174 single-quoted vs 37 double-quoted interpolated identifiers in operator prose, measured over non-test .ts under packages/objectql/src — this line was one of the 37). #12563 already settled the same ADR-0005 shadowing fact with single quotes on the automation side. No existing pin held this message's quote character, so one is added, asserting both the corrected spelling present and the pre-fix spelling absent. * predict(ablation #12609): reverting registry.ts:3050-3051 to double quotes around ${shadowed._packageId} will: - make `packages/objectql/src/registry.ts` contain `is shipped by package "${shadowed._packageId}"` (double-quoted) instead of the single-quoted spelling, confirmed present via anchored grep for the double-quote form and absent via anchored grep for the single-quote form (both anchored on the literal `is shipped by package ` prefix, not a bare quote character) - flip RED exactly the new pin `[#12609] quotes the shadowed package id with single quotes, matching this package's own convention` in registry-collision-order.test.ts, on both of its assertions (`toContain("package '${PKG}'")` fails, `not.toContain('package "${PKG}"')` fails) - leave every OTHER test in that file GREEN, including the sibling 'COMMON COLD-BOOT ORDER — artifact first, then the sys_metadata row: warns' test's `toContain('shadows the package value')` assertion, which is the named positive control: it asserts the same warning fires with the same prose around the quote, so it cannot distinguish the two spellings and must stay green under this mutation. Restoring via `git checkout HEAD -- packages/objectql/src/registry.ts` (HEAD already carries the real fix, committed as 87ecd48 before this predict commit) is predicted to reproduce that commit's blob exactly (git hash-object match) and clear the mutation marker from the file. --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent ead7317 commit bc5156f

3 files changed

Lines changed: 70 additions & 1 deletion

File tree

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
---
2+
"@objectstack/objectql": patch
3+
---
4+
5+
fix(objectql): single-quote the shadowed package id in the `[Registry] Collision` warning (#12609)
6+
7+
`patch`: a shipped operator-facing log message changes its punctuation, and
8+
nothing in this repo parses the message beyond substring (`toContain`) test
9+
assertions — no regex or char-level match on the quote character was found
10+
(searched non-test `.ts`/`.tsx`/`.js` across the repo, and `content/`/`docs/`,
11+
for the message text; the two other hits are prose references to the warning
12+
by name, not parsers of its text). No public export, type, or behavior
13+
changes.
14+
15+
## What changed
16+
17+
`SchemaRegistry.registerItem`'s cold-boot-order `[Registry] Collision`
18+
warning (`packages/objectql/src/registry.ts`) double-quoted the shadowed
19+
package id — `` `... is shipped by package "${shadowed._packageId}" ...` ``
20+
against this package's own convention: measured over non-test `.ts` under
21+
`packages/objectql/src`, quoted identifiers in operator prose are
22+
single-quoted 174 times against 37 double-quoted, and this line was one of
23+
the 37. #12563 already settled the same ADR-0005 shadowing fact on the
24+
automation side (`service-automation`) with single quotes
25+
(`package 'crm'`), so an operator whose boot hits both packages' collision
26+
warnings previously read one story in two spellings; this line now matches.
27+
28+
Byte-identical otherwise. Only the quote character around the interpolated
29+
package id moved.
30+
31+
## Scope
32+
33+
One message, one site
34+
(`packages/objectql/src/registry.ts`'s `is shipped by package` warning —
35+
the guard that fires in the common cold-boot order, package registers
36+
first). A sibling `[Registry] Collision` warning in the same file
37+
(`ships from package`, the late-registration-order guard) also
38+
double-quotes its package id and is the same defect class, but is a
39+
different message and a different site — out of scope here, filed
40+
separately rather than swept in.
41+
42+
## Test
43+
44+
No existing pin held this message's literal quote character (`toContain(PKG)`
45+
assertions in `registry-collision-order.test.ts` matched either spelling); one
46+
is added — asserting the corrected spelling present **and** the pre-fix
47+
spelling absent, so it is red in both directions, not just green on the fix.
48+
49+
<!-- adr-0087: not-required (no-migration-prescription) Log-text punctuation only; no authorable key, schema, or stored shape changed, so there is nothing for a migration to rewrite. -->

packages/objectql/src/registry-collision-order.test.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,26 @@ describe('[#12027] SchemaRegistry collision warning is order-symmetric', () => {
9999
expect(lines[0]).toContain('shadows the package value');
100100
});
101101

102+
it('[#12609] quotes the shadowed package id with single quotes, matching this package\'s own convention', () => {
103+
// Measured over non-test `.ts` under `packages/objectql/src`: interpolated
104+
// identifiers in operator prose are single-quoted 174 times against 37
105+
// double-quoted — this line WAS one of the 37. `toContain` is not enough
106+
// on its own (a substring check can't see which quote character surrounds
107+
// it), so both directions are asserted explicitly: the correct spelling is
108+
// present, and the pre-fix spelling is not — the same "would notice a
109+
// disagreement" shape #12563 used for the sibling phrase in
110+
// `service-automation`.
111+
registry.registerItem('flow', { name: 'nightly_sync', label: 'packaged' }, 'name', PKG);
112+
113+
const lines = collisionsDuring(() => {
114+
registry.registerItem('flow', { name: 'nightly_sync', label: 'runtime' }, 'name');
115+
});
116+
117+
expect(lines).toHaveLength(1);
118+
expect(lines[0]).toContain(`package '${PKG}'`);
119+
expect(lines[0]).not.toContain(`package "${PKG}"`);
120+
});
121+
102122
it('LATE-REGISTRATION ORDER — sys_metadata row first, then the package: still warns', () => {
103123
// Unchanged behaviour, pinned so the repair cannot trade one order for the
104124
// other. This order is a marketplace install / HMR reload, not a boot.

packages/objectql/src/registry.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3048,7 +3048,7 @@ export class SchemaRegistry {
30483048
if (shadowed) {
30493049
console.warn(
30503050
`[Registry] Collision: ${type}/${baseName} is shipped by package ` +
3051-
`"${shadowed._packageId}" and a runtime-authored row with the same name has ` +
3051+
`'${shadowed._packageId}' and a runtime-authored row with the same name has ` +
30523052
`just been registered from sys_metadata. The runtime row now shadows the ` +
30533053
`package value (ADR-0005 overlay precedence): every read of ${type}/${baseName} ` +
30543054
`serves the stored row, not the packaged definition. That is the sanctioned ` +

0 commit comments

Comments
 (0)