Skip to content

Commit be992bf

Browse files
committed
refactor(metadata-protocol): move the sealed overlay boot report out of protocol.ts (#25467 cut 21)
Move the body of reportSealedOverlayRows unedited into protocol-sealed-overlay-report.ts. It reads no member of the class, so the method's stub calls the plain function directly. The class keeps the method, its docblock and declared signature; its one caller keeps calling the class method. Claude-Session: https://claude.ai/code/session_016SP1spj613tyGCgxoD1An6 Co-authored-by: Claude <noreply@anthropic.com>
1 parent 61c0798 commit be992bf

2 files changed

Lines changed: 60 additions & 24 deletions

File tree

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.
2+
3+
/**
4+
* [#25467 cut 21] The boot report of `ObjectStackProtocolImplementation`
5+
* that says out loud which stored ENVIRONMENT `sys_metadata` rows no read
6+
* serves because they overlay sealed managed content
7+
* (`reportSealedOverlayRows`, ADR-0131 D6): per type, a capped sample of
8+
* names and the two remedies. Moved out of `protocol.ts` whole.
9+
*
10+
* A MOVE, not a redesign. The function below is the body of the
11+
* `ObjectStackProtocolImplementation` method of the same name as it stood,
12+
* re-indented one level and otherwise unedited: the same grouping by type,
13+
* the same sample cap, and the same warning text.
14+
*
15+
* ## How the moved body reaches the class
16+
*
17+
* The shape #23050 set for `rest-server.ts` (its `data-action-routes.ts`
18+
* header carries the full reasoning). The class keeps the method — the
19+
* published `dist/*.d.ts` lists its name, docblock and declared signature.
20+
* The body reads no member of the class, so there is no host: the method's
21+
* stub calls the plain function directly, as `namesWithOwnStoredRow`'s does
22+
* in `protocol-stored-overlay-reads.ts`. Its one caller keeps calling the
23+
* class method.
24+
*
25+
* The body reads none of `protocol.ts`'s module-level declarations and
26+
* imports nothing. Nothing re-exports this module, so the published surface
27+
* does not move.
28+
*/
29+
30+
/** The body of `ObjectStackProtocolImplementation#reportSealedOverlayRows`; the method's docblock there is its contract. */
31+
export function reportSealedOverlayRows(rows: ReadonlyArray<{ type: string; name: string }>): void {
32+
if (rows.length === 0) return;
33+
const SAMPLE_PER_TYPE = 5;
34+
const byType = new Map<string, string[]>();
35+
for (const { type, name } of rows) {
36+
const names = byType.get(type) ?? [];
37+
names.push(name);
38+
byType.set(type, names);
39+
}
40+
const detail = Array.from(byType.entries())
41+
.map(([type, names]) => {
42+
const shown = names.slice(0, SAMPLE_PER_TYPE);
43+
const more = names.length > shown.length ? `, +${names.length - shown.length} more` : '';
44+
return `${type}×${names.length} (${shown.join(', ')}${more})`;
45+
})
46+
.join('; ');
47+
console.warn(
48+
`[Protocol] [metadata_sealed_overlay_unserved] ${rows.length} active environment sys_metadata row(s) ` +
49+
`overlay an item a managed package ships, on a type that is sealed against overlays (ADR-0131 D6): ` +
50+
`${detail}. No read serves them — the package's own definition is served. ` +
51+
`Each row is kept at rest, untouched (an object's table and its columns stay as they are). To keep ` +
52+
`the change, re-express it as a new item under a new ` +
53+
`name (a linkage-free clone of the managed item), then delete the stored row; otherwise delete the ` +
54+
`stored row.`,
55+
);
56+
}

‎packages/metadata-protocol/src/protocol.ts‎

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,8 @@ import { flowSaveReplaysRetired } from './protocol-flow-save-replay.js';
406406
import { resolveWritePackageScope } from './protocol-write-package-scope.js';
407407
// [#25467 cut 20] The code-layer read through the `metadata` service: package-scoped, singular/plural fallback, a stored object row's copy not counted as code.
408408
import { readItemFromMetadataService } from './protocol-metadata-service-read.js';
409+
// [#25467 cut 21] The boot report of the stored overlay rows no read serves because they overlay sealed managed content.
410+
import { reportSealedOverlayRows } from './protocol-sealed-overlay-report.js';
409411

410412
/**
411413
* Canonical Zod schema per metadata type lives in
@@ -28655,30 +28657,8 @@ export class ObjectStackProtocolImplementation implements
2865528657
* sealed overlays are still not served.
2865628658
*/
2865728659
private reportSealedOverlayRows(rows: ReadonlyArray<{ type: string; name: string }>): void {
28658-
if (rows.length === 0) return;
28659-
const SAMPLE_PER_TYPE = 5;
28660-
const byType = new Map<string, string[]>();
28661-
for (const { type, name } of rows) {
28662-
const names = byType.get(type) ?? [];
28663-
names.push(name);
28664-
byType.set(type, names);
28665-
}
28666-
const detail = Array.from(byType.entries())
28667-
.map(([type, names]) => {
28668-
const shown = names.slice(0, SAMPLE_PER_TYPE);
28669-
const more = names.length > shown.length ? `, +${names.length - shown.length} more` : '';
28670-
return `${type}×${names.length} (${shown.join(', ')}${more})`;
28671-
})
28672-
.join('; ');
28673-
console.warn(
28674-
`[Protocol] [metadata_sealed_overlay_unserved] ${rows.length} active environment sys_metadata row(s) ` +
28675-
`overlay an item a managed package ships, on a type that is sealed against overlays (ADR-0131 D6): ` +
28676-
`${detail}. No read serves them — the package's own definition is served. ` +
28677-
`Each row is kept at rest, untouched (an object's table and its columns stay as they are). To keep ` +
28678-
`the change, re-express it as a new item under a new ` +
28679-
`name (a linkage-free clone of the managed item), then delete the stored row; otherwise delete the ` +
28680-
`stored row.`,
28681-
);
28660+
// [#25467 cut 21] The body moved to `protocol-sealed-overlay-report.ts`.
28661+
return reportSealedOverlayRows(rows);
2868228662
}
2868328663

2868428664
// ==========================================

0 commit comments

Comments
 (0)