Skip to content

Commit 0ba4e56

Browse files
committed
test(rest): re-point the readers of registerSearchEndpoints' moved lines
Every reader whose reading included a moved line now reads it in search-routes.ts, each with its sum unchanged: - the nine registrar-list readers pin length 10 (execctx census 62 sites, 117 -> 121 mentions, 11 forwarders; ui-view pair 58 / 73; docblock floors 37 -> 40; query-number 9, canonical query 4, meta-draft 8, realtime tripwires 0); - the dogfood blind-spot row: 70 / 19 / 51 unchanged, this.routeManager.register( 63 over ten files, a new search-routes.ts control (1), enforceAuth 100 -> 104 re-anchored; - check-route-envelope declares search-routes.ts at stringError 0 / siblingCode 0, and rest-server.ts keeps 16 / 14 (sums 39 and 54). Claude-Session: https://claude.ai/code/session_018t6a5rvqPRvEDMCVVW9kYT Co-authored-by: Claude <noreply@anthropic.com>
1 parent 6a57870 commit 0ba4e56

10 files changed

Lines changed: 106 additions & 25 deletions

‎packages/qa/dogfood/test/authz-conformance.test.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1630,7 +1630,8 @@ describe('#9084 — the rest-server.ts transport tripwire keys off mechanics', (
16301630
// [#23050 slice 6] Length 6 → 7 (`security-routes.ts`), still 0 over it.
16311631
// [#23050 slice 7] Length 7 → 8 (`discovery-routes.ts`), still 0 over it.
16321632
// [#23050 slice 8] Length 8 → 9 (`email-routes.ts`), still 0 over it.
1633-
expect(REST_SERVER_REGISTRAR_FILES).toHaveLength(9);
1633+
// [#23050 slice 9] Length 9 → 10 (`search-routes.ts`), still 0 over it.
1634+
expect(REST_SERVER_REGISTRAR_FILES).toHaveLength(10);
16341635
expect(REST_SERVER_REGISTRAR_PATHS[0]).toBe(REST_SERVER);
16351636
const listed = REST_SERVER_REGISTRAR_PATHS.map((file) => readFileSync(join(REPO_ROOT, file), 'utf8'));
16361637
for (const probe of [MECHANICS, ROUTES]) {

‎packages/qa/dogfood/test/authz-probe-blind-spot.census.ts‎

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -520,11 +520,12 @@ export const PROBE_FILE_CENSUS: readonly ProbeFileReading[] = [
520520
'terminator spelling), PLUS `registerPerItemRoute(` call sites; counted over this file AND every ' +
521521
'module on the registrar list (`packages/rest/src/rest-server-registrar-files.ts`) — ' +
522522
'`data-action-routes.ts`, `batch-routes.ts`, `approvals-routes.ts`, `sharing-routes.ts`, ' +
523-
'`analytics-routes.ts`, `security-routes.ts`, `discovery-routes.ts` and `email-routes.ts`, the modules ' +
524-
'the bodies of `registerDataActionEndpoints`, `registerBatchEndpoints`, `registerApprovalsEndpoints`, ' +
525-
'`registerSharingEndpoints`, `registerSharingRuleEndpoints`, `registerAnalyticsEndpoints`, ' +
526-
'`registerSecurityExplainEndpoints`, `registerSecurityEndpoints`, `registerDiscoveryEndpoints`, ' +
527-
'`registerOpenApiEndpoints` and `registerEmailEndpoints` moved to; ' +
523+
'`analytics-routes.ts`, `security-routes.ts`, `discovery-routes.ts`, `email-routes.ts` and ' +
524+
'`search-routes.ts`, the modules the bodies of `registerDataActionEndpoints`, `registerBatchEndpoints`, ' +
525+
'`registerApprovalsEndpoints`, `registerSharingEndpoints`, `registerSharingRuleEndpoints`, ' +
526+
'`registerAnalyticsEndpoints`, `registerSecurityExplainEndpoints`, `registerSecurityEndpoints`, ' +
527+
'`registerDiscoveryEndpoints`, `registerOpenApiEndpoints`, `registerEmailEndpoints` and ' +
528+
'`registerSearchEndpoints` moved to; ' +
528529
'reachable = those inside registerMetadataEndpoints',
529530
// [#15542 / #15854] ⭐ THE POPULATION RULE LEARNED A SECOND SPELLING, and
530531
// the numbers it produces did NOT move: 80 / 19 / 61, exactly as before.
@@ -745,10 +746,22 @@ export const PROBE_FILE_CENSUS: readonly ProbeFileReading[] = [
745746
// new occurrences are this slice's seam, the same two spellings once (the
746747
// host literal's forwarder, two; the host interface's member, two). No call
747748
// site was added.
749+
// [#23050 slice 9] 70 / 19 / 51 UNCHANGED, the same measurement again:
750+
// `registerSearchEndpoints`' body (one registration site, `GET
751+
// {base}/search`, outside `registerMetadataEndpoints`, so in the blind spot)
752+
// moved to `search-routes.ts`, which joins the list (length 9 -> 10) with
753+
// its own control. `this.routeManager.register(` stays 63 over the ten
754+
// files (21 here + 9 + 5 + 7 + 8 + 1 + 6 + 4 + 1 + 1),
755+
// `private register*Endpoints(` stays 16 (the registrar is still declared
756+
// here), and `enforceAuth` 100 -> 104 is RE-ANCHORED, not relaxed: the one
757+
// call site moved with its route and is counted in both readings; the four
758+
// new occurrences are this slice's seam, the same two spellings once (the
759+
// host literal's forwarder, two; the host interface's member, two). No call
760+
// site was added.
748761
controls: {
749762
'private register*Endpoints(': 16,
750763
'this.routeManager.register(': 63,
751-
'registrar list length': 9,
764+
'registrar list length': 10,
752765
'data-action-routes.ts: this.routeManager.register(': 9,
753766
'batch-routes.ts: this.routeManager.register(': 5,
754767
'approvals-routes.ts: this.routeManager.register(': 7,
@@ -757,14 +770,15 @@ export const PROBE_FILE_CENSUS: readonly ProbeFileReading[] = [
757770
'security-routes.ts: this.routeManager.register(': 6,
758771
'discovery-routes.ts: this.routeManager.register(': 4,
759772
'email-routes.ts: this.routeManager.register(': 1,
773+
'search-routes.ts: this.routeManager.register(': 1,
760774
// Both halves of the new rule carry their own control, so neither can go
761775
// silently to zero: a helper deleted and its routes inlined back would
762776
// still read population 80, and only these two controls would notice the
763777
// shape moved and force this provenance to be re-read.
764778
'registerPerItemRoute(': 8,
765779
'const registerPerItemRoute =': 1,
766780
'forwarder slice: this.routeManager.register(': 1,
767-
enforceAuth: 100,
781+
enforceAuth: 104,
768782
},
769783
note:
770784
'The single non-tripwire probe names ONE registrar of 16. The other 15 can never mint a key: ' +

‎packages/rest/src/execctx-consumer-census.test.ts‎

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,9 @@ const SOURCE = readFileSync(resolve(HERE, 'rest-server.ts'), 'utf8');
106106
*
107107
* [#23050 slice 8] …and `registerEmailEndpoints`' body to `email-routes.ts`,
108108
* with its one.
109+
*
110+
* [#23050 slice 9] …and `registerSearchEndpoints`' body to `search-routes.ts`,
111+
* with its one.
109112
*/
110113
const SITE_FILES = REST_SERVER_REGISTRAR_FILES;
111114
const SOURCES = new Map<string, string>(SITE_FILES.map((file) => [
@@ -119,12 +122,13 @@ const siteKey = (file: string, line: number) => `${file}:${line}`;
119122
* `registerApprovalsEndpoints`, `registerSharingEndpoints`,
120123
* `registerSharingRuleEndpoints`, `registerAnalyticsEndpoints`,
121124
* `registerSecurityExplainEndpoints`, `registerSecurityEndpoints`,
122-
* `registerOpenApiEndpoints`, `registerEmailEndpoints`) hands its moved body
123-
* forwards each member to the server with `(...a) => this.<member>(...a)`, so
124-
* a moved site's stack shows that forwarder above the site itself. The site is
125-
* the first censused frame that is not one. Found by their spelling, and §2
126-
* pins ONE per moved REGISTRAR whose body reads the seam — one per moved
127-
* module, plus {@link EXTRA_MOVED_REGISTRARS}, less {@link MOVED_REGISTRARS_READING_NO_EXECCTX}
125+
* `registerOpenApiEndpoints`, `registerEmailEndpoints`,
126+
* `registerSearchEndpoints`) hands its moved body forwards each member to the
127+
* server with `(...a) => this.<member>(...a)`, so a moved site's stack shows
128+
* that forwarder above the site itself. The site is the first censused frame
129+
* that is not one. Found by their spelling, and §2 pins ONE per moved
130+
* REGISTRAR whose body reads the seam — one per moved module, plus
131+
* {@link EXTRA_MOVED_REGISTRARS}, less {@link MOVED_REGISTRARS_READING_NO_EXECCTX}
128132
* — so a respelt forwarder — or a module moved without joining `SITE_FILES` —
129133
* is a control failure there rather than every moved site silently attributed
130134
* to it.
@@ -666,9 +670,19 @@ describe('[#13160] §2 the consumer surface, counted from the tree', () => {
666670
// `rest-server.ts` goes 57 → 58 (one site out, one forwarder's two
667671
// mentions in). Ten forwarders now: (9 - 1) + 3 - 1, the module carrying
668672
// one registrar that reads the seam, so neither map gains an entry.
669-
expect(SITE_FILES).toHaveLength(9);
673+
//
674+
// [#23050 slice 9] 62 sites UNCHANGED / 117 → 121 mentions — the same MOVE.
675+
// `registerSearchEndpoints`' body left for `search-routes.ts` with its one
676+
// BARE site: 23 + 9 + 5 + 7 + 8 + 1 + 5 + 2 + 1 + 1 = 62 sites. The four
677+
// new mentions are this slice's seam, the two spellings once (its host
678+
// literal's forwarder, two; its host interface's member, two):
679+
// `rest-server.ts` goes 58 → 59 (one site out, one forwarder's two
680+
// mentions in). Eleven forwarders now: (10 - 1) + 3 - 1, the module
681+
// carrying one registrar that reads the seam, so neither map gains an
682+
// entry.
683+
expect(SITE_FILES).toHaveLength(10);
670684
expect(SITES.length).toBe(62);
671-
expect([...SOURCES.values()].reduce((n, text) => n + text.split('resolveExecCtx').length - 1, 0)).toBe(117);
685+
expect([...SOURCES.values()].reduce((n, text) => n + text.split('resolveExecCtx').length - 1, 0)).toBe(121);
672686
const extraMovedRegistrars = Object.values(EXTRA_MOVED_REGISTRARS).reduce((n, k) => n + (k ?? 0), 0);
673687
expect(extraMovedRegistrars).toBe(3);
674688
const registrarsReadingNoExecCtx = Object.values(MOVED_REGISTRARS_READING_NO_EXECCTX).reduce((n, k) => n + (k ?? 0), 0);

‎packages/rest/src/meta-draft-read-door-census.test.ts‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,8 +251,10 @@ describe('[#20338] census: every draft switch in rest-server.ts is ledgered', ()
251251
// length 6 → 7. [#23050 slice 7] Nor do the discovery and OpenAPI bodies
252252
// (`discovery-routes.ts`): 8 = 6 + 0 + 0 + 0 + 0 + 2 + 0 + 0, length 7 → 8.
253253
// [#23050 slice 8] Nor does the email send body (`email-routes.ts`):
254-
// 8 = 6 + 0 + 0 + 0 + 0 + 2 + 0 + 0 + 0, length 8 → 9.
255-
expect(REST_SERVER_REGISTRAR_FILES).toHaveLength(9);
254+
// 8 = 6 + 0 + 0 + 0 + 0 + 2 + 0 + 0 + 0, length 8 → 9. [#23050 slice 9]
255+
// Nor does the global search body (`search-routes.ts`):
256+
// 8 = 6 + 0 + 0 + 0 + 0 + 2 + 0 + 0 + 0 + 0, length 9 → 10.
257+
expect(REST_SERVER_REGISTRAR_FILES).toHaveLength(10);
256258
expect(SOURCE_FILES.map((file) => file.fileName)).toEqual([...REST_SERVER_REGISTRAR_FILES]);
257259
expect(SITES).toHaveLength(8);
258260
});

‎packages/rest/src/rest-server-canonical-query-ast.test.ts‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,11 @@ interface CensusEntry {
149149
* [#23050 slice 8] 4 = 1 + 3 + 0 + 0 + 0 + 0 + 0 + 0 + 0: the email send body
150150
* (`email-routes.ts`) builds no `query:` literal either — it hands the email
151151
* service the caller's own JSON body, never a `query:` slot.
152+
*
153+
* [#23050 slice 9] 4 = 1 + 3 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0: the global search
154+
* body (`search-routes.ts`) builds no `query:` literal either — it hands
155+
* `searchAll` a `q` / `objects` / `limit` / `perObject` request read off
156+
* `req.query`, never a `query:` slot.
152157
*/
153158
const REGISTRAR_QUERY_SLOT_FLOORS: Readonly<Record<RestServerRegistrarFile, number>> = {
154159
'rest-server.ts': 1,
@@ -160,6 +165,7 @@ const REGISTRAR_QUERY_SLOT_FLOORS: Readonly<Record<RestServerRegistrarFile, numb
160165
'security-routes.ts': 0,
161166
'discovery-routes.ts': 0,
162167
'email-routes.ts': 0,
168+
'search-routes.ts': 0,
163169
};
164170

165171
const CENSUS: CensusEntry[] = [
@@ -352,7 +358,8 @@ describe('[#16638] §1 CONTROLS on the census instrument itself', () => {
352358
// [#23050 slice 6] Length 6 → 7, the sum unchanged.
353359
// [#23050 slice 7] Length 7 → 8, the sum unchanged.
354360
// [#23050 slice 8] Length 8 → 9, the sum unchanged.
355-
expect(REST_SERVER_REGISTRAR_FILES).toHaveLength(9);
361+
// [#23050 slice 9] Length 9 → 10, the sum unchanged.
362+
expect(REST_SERVER_REGISTRAR_FILES).toHaveLength(10);
356363
expect(Object.keys(REGISTRAR_QUERY_SLOT_FLOORS).sort()).toEqual([...REST_SERVER_REGISTRAR_FILES].sort());
357364
expect(CENSUS.filter(({ file }) => REGISTRAR_SOURCES.has(file)).map(({ file }) => file))
358365
.toEqual([...REST_SERVER_REGISTRAR_FILES]);

‎packages/rest/src/rest-server-docblock-position.test.ts‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,11 @@ describe('rest-server.ts docblock position', () => {
170170
* analytics modules do: the module header, the host interface's block and the
171171
* function's. The email send body held no TSDoc block of its own, so
172172
* `rest-server.ts` keeps every block it had.
173+
*
174+
* [#23050 slice 9] `search-routes.ts` carries three, as the email module does:
175+
* the module header, the host interface's block and the function's. The global
176+
* search body held no TSDoc block of its own, so `rest-server.ts` keeps every
177+
* block it had (164).
173178
*/
174179
const MOVED_FILE_FLOORS: Readonly<Record<Exclude<RestServerRegistrarFile, typeof FILE>, number>> = {
175180
'data-action-routes.ts': 4,
@@ -180,6 +185,7 @@ const MOVED_FILE_FLOORS: Readonly<Record<Exclude<RestServerRegistrarFile, typeof
180185
'security-routes.ts': 8,
181186
'discovery-routes.ts': 5,
182187
'email-routes.ts': 3,
188+
'search-routes.ts': 3,
183189
};
184190
const MOVED_FILES: ReadonlyArray<{ file: string; minBlocks: number }> = REST_SERVER_REGISTRAR_FILES
185191
.filter((file): file is Exclude<RestServerRegistrarFile, typeof FILE> => file !== FILE)
@@ -212,9 +218,10 @@ describe('[#23050 slice 3] the registrar list this pin reads', () => {
212218
// [#23050 slice 6] 4 + 3 + 3 + 8 + 3 + 8 = 29 over six, length 6 → 7.
213219
// [#23050 slice 7] 4 + 3 + 3 + 8 + 3 + 8 + 5 = 34 over seven, length 7 → 8.
214220
// [#23050 slice 8] 4 + 3 + 3 + 8 + 3 + 8 + 5 + 3 = 37 over eight, length 8 → 9.
215-
expect(REST_SERVER_REGISTRAR_FILES).toHaveLength(9);
221+
// [#23050 slice 9] 4 + 3 + 3 + 8 + 3 + 8 + 5 + 3 + 3 = 40 over nine, length 9 → 10.
222+
expect(REST_SERVER_REGISTRAR_FILES).toHaveLength(10);
216223
expect(Object.keys(MOVED_FILE_FLOORS).sort())
217224
.toEqual(REST_SERVER_REGISTRAR_FILES.filter((file) => file !== FILE).sort());
218-
expect(MOVED_FILES.reduce((n, { minBlocks }) => n + minBlocks, 0)).toBe(37);
225+
expect(MOVED_FILES.reduce((n, { minBlocks }) => n + minBlocks, 0)).toBe(40);
219226
});
220227
});

‎packages/rest/src/rest-server-query-number-census.test.ts‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -326,8 +326,11 @@ describe('#20139 census — every numeric coercion in rest-server.ts is classifi
326326
// the discovery and OpenAPI bodies (`discovery-routes.ts`):
327327
// 9 = 8 + 1 + 0 + 0 + 0 + 0 + 0 + 0, length 7 → 8. [#23050 slice 8] Nor
328328
// does the email send body (`email-routes.ts`):
329-
// 9 = 8 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0, length 8 → 9.
330-
expect(REST_SERVER_REGISTRAR_FILES).toHaveLength(9);
329+
// 9 = 8 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0, length 8 → 9. [#23050 slice 9]
330+
// Nor does the global search body (`search-routes.ts`): it READS its two
331+
// caps through `readDeclaredQueryNumber`, never coerces one:
332+
// 9 = 8 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0, length 9 → 10.
333+
expect(REST_SERVER_REGISTRAR_FILES).toHaveLength(10);
331334
expect(SOURCES.map(([file]) => file)).toEqual([...REST_SERVER_REGISTRAR_FILES]);
332335
expect(sites).toHaveLength(9);
333336
});

‎packages/rest/src/ui-view-route-identity.measurement.test.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,9 @@ describe('[#13214] §1 the REST seam — absent context vs entitled context', ()
353353
// neither term, so its literal forwards neither).
354354
// [#23050 slice 8] 8 → 9 (`email-routes.ts`): 57 and 72, +1 each for
355355
// that slice's forwarder.
356-
expect(REST_SERVER_REGISTRAR_FILES).toHaveLength(9);
356+
// [#23050 slice 9] 9 → 10 (`search-routes.ts`): 58 and 73, +1 each for
357+
// that slice's forwarder.
358+
expect(REST_SERVER_REGISTRAR_FILES).toHaveLength(10);
357359
expect(REGISTRAR_SOURCES.split('this.enforceAuth(').length - 1).toBeGreaterThan(40);
358360
expect(REGISTRAR_SOURCES.split('this.resolveExecCtx(').length - 1).toBeGreaterThan(40);
359361
});

‎packages/rest/src/ui-view-route-tenancy.measurement.test.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1122,7 +1122,9 @@ describe('[#13214] §4 preconditions', () => {
11221122
// still 1.
11231123
// [#23050 slice 8] 8 → 9 (`email-routes.ts`): 57 and 72, +1 each for
11241124
// that slice's forwarder; the ownership guard still 1.
1125-
expect(REST_SERVER_REGISTRAR_FILES).toHaveLength(9);
1125+
// [#23050 slice 9] 9 → 10 (`search-routes.ts`): 58 and 73, +1 each for
1126+
// that slice's forwarder; the ownership guard still 1.
1127+
expect(REST_SERVER_REGISTRAR_FILES).toHaveLength(10);
11261128
expect(REGISTRAR_SOURCES.split('this.enforceAuth(').length - 1).toBeGreaterThan(40);
11271129
expect(REGISTRAR_SOURCES.split('this.resolveExecCtx(').length - 1).toBeGreaterThan(40);
11281130
// ...and the ownership guard is NOT sprayed across the file — it is a

‎scripts/check-route-envelope.mjs‎

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,13 @@ const MODULES = {
370370
// body's 400 `INVALID_REQUEST`, `'JSON body required'`) left this file with
371371
// that body for `email-routes.ts`, declared below at the count it had here;
372372
// the sum is unchanged (16 + 13 + 8 + 1 + 0 + 0 + 0 + 0 + 1 = 39).
373+
//
374+
// 16 → 16 (#23050 slice 9): the global search body left this file for
375+
// `search-routes.ts` carrying NO literal string `error` body (its one
376+
// hand-built refusal, the 501 `{ code, message }`, has no `error` key, and
377+
// its catch sends `mapDataError`'s computed body), so this count does not
378+
// move and that module declares 0 below; the sum is unchanged
379+
// (16 + 13 + 8 + 1 + 0 + 0 + 0 + 0 + 1 + 0 = 39).
373380
stringError: 16,
374381
// 77 → 75 (#7981): registerSecurityEndpoints' two `handleError` arms moved
375382
// off the `{ code, error }` sibling-code literal onto the shared
@@ -450,6 +457,11 @@ const MODULES = {
450457
// `INVALID_REQUEST` and `VALIDATION_FAILED`, and its 500 `EMAIL_SEND_FAILED`)
451458
// left with that body for `email-routes.ts`, declared below; the sum is
452459
// unchanged (14 + 15 + 8 + 9 + 4 + 1 + 0 + 0 + 3 = 54).
460+
//
461+
// 14 → 14 (#23050 slice 9): the global search body left this file for
462+
// `search-routes.ts` carrying NO `{ code, error }` body, so this count does
463+
// not move and that module declares 0 below; the sum is unchanged
464+
// (14 + 15 + 8 + 9 + 4 + 1 + 0 + 0 + 3 + 0 = 54).
453465
siblingCode: 14,
454466
},
455467

@@ -632,6 +644,23 @@ const MODULES = {
632644
stringError: 1,
633645
siblingCode: 3,
634646
},
647+
648+
// [#23050 slice 9] `RestServer#registerSearchEndpoints`' body — the global
649+
// cross-object search door, `GET /search` — moved out of `rest-server.ts`
650+
// whole, on exactly slice 1's terms above: a MOVE, no wire answer changed, so
651+
// it inherits `dialectOnly` and the two dialect facts, and no write-site
652+
// count. Both counts were measured on the moved file and equal what left
653+
// `rest-server.ts` in the same PR (stringError 16 → 16, siblingCode 14 → 14:
654+
// none), so each sum is unchanged. Both only ever tick down. Discovered by
655+
// the `*-routes.ts` convention and declared in the same PR that created the
656+
// module, so the gap never exists.
657+
'packages/rest/src/search-routes.ts': {
658+
dialectOnly:
659+
'moved out of `rest-server.ts` by #23050 slice 9 and held to exactly the guarantee it had there — the two dialect facts, never a write-site count',
660+
ratchet: '#9559 (option 1: convert onto the shared sendOk/sendError)',
661+
stringError: 0,
662+
siblingCode: 0,
663+
},
635664
};
636665

637666
/** Identifiers whose `.json()` READS a request rather than writing a response. */

0 commit comments

Comments
 (0)