Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/qa/dogfood/test/authz-conformance.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1631,7 +1631,8 @@ describe('#9084 — the rest-server.ts transport tripwire keys off mechanics', (
// [#23050 slice 7] Length 7 → 8 (`discovery-routes.ts`), still 0 over it.
// [#23050 slice 8] Length 8 → 9 (`email-routes.ts`), still 0 over it.
// [#23050 slice 9] Length 9 → 10 (`search-routes.ts`), still 0 over it.
expect(REST_SERVER_REGISTRAR_FILES).toHaveLength(10);
// [#23050 slice 10] Length 10 → 11 (`ui-routes.ts`), still 0 over it.
expect(REST_SERVER_REGISTRAR_FILES).toHaveLength(11);
expect(REST_SERVER_REGISTRAR_PATHS[0]).toBe(REST_SERVER);
const listed = REST_SERVER_REGISTRAR_PATHS.map((file) => readFileSync(join(REPO_ROOT, file), 'utf8'));
for (const probe of [MECHANICS, ROUTES]) {
Expand Down
29 changes: 21 additions & 8 deletions packages/qa/dogfood/test/authz-probe-blind-spot.census.ts
Original file line number Diff line number Diff line change
Expand Up @@ -520,12 +520,12 @@ export const PROBE_FILE_CENSUS: readonly ProbeFileReading[] = [
'terminator spelling), PLUS `registerPerItemRoute(` call sites; counted over this file AND every ' +
'module on the registrar list (`packages/rest/src/rest-server-registrar-files.ts`) — ' +
'`data-action-routes.ts`, `batch-routes.ts`, `approvals-routes.ts`, `sharing-routes.ts`, ' +
'`analytics-routes.ts`, `security-routes.ts`, `discovery-routes.ts`, `email-routes.ts` and ' +
'`search-routes.ts`, the modules the bodies of `registerDataActionEndpoints`, `registerBatchEndpoints`, ' +
'`registerApprovalsEndpoints`, `registerSharingEndpoints`, `registerSharingRuleEndpoints`, ' +
'`registerAnalyticsEndpoints`, `registerSecurityExplainEndpoints`, `registerSecurityEndpoints`, ' +
'`registerDiscoveryEndpoints`, `registerOpenApiEndpoints`, `registerEmailEndpoints` and ' +
'`registerSearchEndpoints` moved to; ' +
'`analytics-routes.ts`, `security-routes.ts`, `discovery-routes.ts`, `email-routes.ts`, ' +
'`search-routes.ts` and `ui-routes.ts`, the modules the bodies of `registerDataActionEndpoints`, ' +
'`registerBatchEndpoints`, `registerApprovalsEndpoints`, `registerSharingEndpoints`, ' +
'`registerSharingRuleEndpoints`, `registerAnalyticsEndpoints`, `registerSecurityExplainEndpoints`, ' +
'`registerSecurityEndpoints`, `registerDiscoveryEndpoints`, `registerOpenApiEndpoints`, ' +
'`registerEmailEndpoints`, `registerSearchEndpoints` and `registerUiEndpoints` moved to; ' +
'reachable = those inside registerMetadataEndpoints',
// [#15542 / #15854] ⭐ THE POPULATION RULE LEARNED A SECOND SPELLING, and
// the numbers it produces did NOT move: 80 / 19 / 61, exactly as before.
Expand Down Expand Up @@ -758,10 +758,22 @@ export const PROBE_FILE_CENSUS: readonly ProbeFileReading[] = [
// new occurrences are this slice's seam, the same two spellings once (the
// host literal's forwarder, two; the host interface's member, two). No call
// site was added.
// [#23050 slice 10] 70 / 19 / 51 UNCHANGED, the same measurement again:
// `registerUiEndpoints`' body (one registration site, `GET
// {base}/ui/view/:object/:type`, outside `registerMetadataEndpoints`, so in
// the blind spot) moved to `ui-routes.ts`, which joins the list (length
// 10 -> 11) with its own control. `this.routeManager.register(` stays 63
// over the eleven files (20 here + 9 + 5 + 7 + 8 + 1 + 6 + 4 + 1 + 1 + 1),
// `private register*Endpoints(` stays 16 (the registrar is still declared
// here), and `enforceAuth` 104 -> 108 is RE-ANCHORED, not relaxed: the one
// call site moved with its route and is counted in both readings; the four
// new occurrences are this slice's seam, the same two spellings once (the
// host literal's forwarder, two; the host interface's member, two). No call
// site was added.
controls: {
'private register*Endpoints(': 16,
'this.routeManager.register(': 63,
'registrar list length': 10,
'registrar list length': 11,
'data-action-routes.ts: this.routeManager.register(': 9,
'batch-routes.ts: this.routeManager.register(': 5,
'approvals-routes.ts: this.routeManager.register(': 7,
Expand All @@ -771,14 +783,15 @@ export const PROBE_FILE_CENSUS: readonly ProbeFileReading[] = [
'discovery-routes.ts: this.routeManager.register(': 4,
'email-routes.ts: this.routeManager.register(': 1,
'search-routes.ts: this.routeManager.register(': 1,
'ui-routes.ts: this.routeManager.register(': 1,
// Both halves of the new rule carry their own control, so neither can go
// silently to zero: a helper deleted and its routes inlined back would
// still read population 80, and only these two controls would notice the
// shape moved and force this provenance to be re-read.
'registerPerItemRoute(': 8,
'const registerPerItemRoute =': 1,
'forwarder slice: this.routeManager.register(': 1,
enforceAuth: 104,
enforceAuth: 108,
},
note:
'The single non-tripwire probe names ONE registrar of 16. The other 15 can never mint a key: ' +
Expand Down
23 changes: 19 additions & 4 deletions packages/rest/src/execctx-consumer-census.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ const SOURCE = readFileSync(resolve(HERE, 'rest-server.ts'), 'utf8');
*
* [#23050 slice 9] …and `registerSearchEndpoints`' body to `search-routes.ts`,
* with its one.
*
* [#23050 slice 10] …and `registerUiEndpoints`' body to `ui-routes.ts`, with
* its one.
*/
const SITE_FILES = REST_SERVER_REGISTRAR_FILES;
const SOURCES = new Map<string, string>(SITE_FILES.map((file) => [
Expand All @@ -123,8 +126,9 @@ const siteKey = (file: string, line: number) => `${file}:${line}`;
* `registerSharingRuleEndpoints`, `registerAnalyticsEndpoints`,
* `registerSecurityExplainEndpoints`, `registerSecurityEndpoints`,
* `registerOpenApiEndpoints`, `registerEmailEndpoints`,
* `registerSearchEndpoints`) hands its moved body forwards each member to the
* server with `(...a) => this.<member>(...a)`, so a moved site's stack shows
* `registerSearchEndpoints`, `registerUiEndpoints`) hands its moved body
* forwards each member to the server with `(...a) => this.<member>(...a)`, so
* a moved site's stack shows
* that forwarder above the site itself. The site is the first censused frame
* that is not one. Found by their spelling, and §2 pins ONE per moved
* REGISTRAR whose body reads the seam — one per moved module, plus
Expand Down Expand Up @@ -680,9 +684,20 @@ describe('[#13160] §2 the consumer surface, counted from the tree', () => {
// mentions in). Eleven forwarders now: (10 - 1) + 3 - 1, the module
// carrying one registrar that reads the seam, so neither map gains an
// entry.
expect(SITE_FILES).toHaveLength(10);
//
// [#23050 slice 10] 62 sites UNCHANGED / 121 → 125 mentions — the same MOVE.
// `registerUiEndpoints`' body left for `ui-routes.ts` with its one BARE
// site (guarded on its next line, as before):
// 22 + 9 + 5 + 7 + 8 + 1 + 5 + 2 + 1 + 1 + 1 = 62 sites. The four new
// mentions are this slice's seam, the two spellings once (its host
// literal's forwarder, two; its host interface's member, two):
// `rest-server.ts` goes 59 → 60 (one site out, one forwarder's two
// mentions in). Twelve forwarders now: (11 - 1) + 3 - 1, the module
// carrying one registrar that reads the seam, so neither map gains an
// entry.
expect(SITE_FILES).toHaveLength(11);
expect(SITES.length).toBe(62);
expect([...SOURCES.values()].reduce((n, text) => n + text.split('resolveExecCtx').length - 1, 0)).toBe(121);
expect([...SOURCES.values()].reduce((n, text) => n + text.split('resolveExecCtx').length - 1, 0)).toBe(125);
const extraMovedRegistrars = Object.values(EXTRA_MOVED_REGISTRARS).reduce((n, k) => n + (k ?? 0), 0);
expect(extraMovedRegistrars).toBe(3);
const registrarsReadingNoExecCtx = Object.values(MOVED_REGISTRARS_READING_NO_EXECCTX).reduce((n, k) => n + (k ?? 0), 0);
Expand Down
4 changes: 3 additions & 1 deletion packages/rest/src/meta-draft-read-door-census.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,9 @@ describe('[#20338] census: every draft switch in rest-server.ts is ledgered', ()
// 8 = 6 + 0 + 0 + 0 + 0 + 2 + 0 + 0 + 0, length 8 → 9. [#23050 slice 9]
// Nor does the global search body (`search-routes.ts`):
// 8 = 6 + 0 + 0 + 0 + 0 + 2 + 0 + 0 + 0 + 0, length 9 → 10.
expect(REST_SERVER_REGISTRAR_FILES).toHaveLength(10);
// [#23050 slice 10] Nor does the UI view body (`ui-routes.ts`):
// 8 = 6 + 0 + 0 + 0 + 0 + 2 + 0 + 0 + 0 + 0 + 0, length 10 → 11.
expect(REST_SERVER_REGISTRAR_FILES).toHaveLength(11);
expect(SOURCE_FILES.map((file) => file.fileName)).toEqual([...REST_SERVER_REGISTRAR_FILES]);
expect(SITES).toHaveLength(8);
});
Expand Down
9 changes: 8 additions & 1 deletion packages/rest/src/rest-server-canonical-query-ast.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,11 @@ interface CensusEntry {
* body (`search-routes.ts`) builds no `query:` literal either — it hands
* `searchAll` a `q` / `objects` / `limit` / `perObject` request read off
* `req.query`, never a `query:` slot.
*
* [#23050 slice 10] 4 = 1 + 3 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0: the UI view
* body (`ui-routes.ts`) builds no `query:` literal either — it hands
* `getUiView` an `{ object, type }` request read off the path, never a
* `query:` slot.
*/
const REGISTRAR_QUERY_SLOT_FLOORS: Readonly<Record<RestServerRegistrarFile, number>> = {
'rest-server.ts': 1,
Expand All @@ -166,6 +171,7 @@ const REGISTRAR_QUERY_SLOT_FLOORS: Readonly<Record<RestServerRegistrarFile, numb
'discovery-routes.ts': 0,
'email-routes.ts': 0,
'search-routes.ts': 0,
'ui-routes.ts': 0,
};

const CENSUS: CensusEntry[] = [
Expand Down Expand Up @@ -359,7 +365,8 @@ describe('[#16638] §1 CONTROLS on the census instrument itself', () => {
// [#23050 slice 7] Length 7 → 8, the sum unchanged.
// [#23050 slice 8] Length 8 → 9, the sum unchanged.
// [#23050 slice 9] Length 9 → 10, the sum unchanged.
expect(REST_SERVER_REGISTRAR_FILES).toHaveLength(10);
// [#23050 slice 10] Length 10 → 11, the sum unchanged.
expect(REST_SERVER_REGISTRAR_FILES).toHaveLength(11);
expect(Object.keys(REGISTRAR_QUERY_SLOT_FLOORS).sort()).toEqual([...REST_SERVER_REGISTRAR_FILES].sort());
expect(CENSUS.filter(({ file }) => REGISTRAR_SOURCES.has(file)).map(({ file }) => file))
.toEqual([...REST_SERVER_REGISTRAR_FILES]);
Expand Down
13 changes: 11 additions & 2 deletions packages/rest/src/rest-server-docblock-position.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,13 @@ describe('rest-server.ts docblock position', () => {
* the module header, the host interface's block and the function's. The global
* search body held no TSDoc block of its own, so `rest-server.ts` keeps every
* block it had (164).
*
* [#23050 slice 10] `ui-routes.ts` carries four, as `data-action-routes.ts`
* does: the module header, the moved alias's block (`TransportScopedMetaRequest`
* went with the UI view body, as `ServerScopedDataRequest` went with slice 1's),
* the host interface's block and the function's. The UI view body held no TSDoc
* block of its own, so `rest-server.ts` gives up only the alias's block
* (164 → 163 there, still far above its floor).
*/
const MOVED_FILE_FLOORS: Readonly<Record<Exclude<RestServerRegistrarFile, typeof FILE>, number>> = {
'data-action-routes.ts': 4,
Expand All @@ -186,6 +193,7 @@ const MOVED_FILE_FLOORS: Readonly<Record<Exclude<RestServerRegistrarFile, typeof
'discovery-routes.ts': 5,
'email-routes.ts': 3,
'search-routes.ts': 3,
'ui-routes.ts': 4,
};
const MOVED_FILES: ReadonlyArray<{ file: string; minBlocks: number }> = REST_SERVER_REGISTRAR_FILES
.filter((file): file is Exclude<RestServerRegistrarFile, typeof FILE> => file !== FILE)
Expand Down Expand Up @@ -219,9 +227,10 @@ describe('[#23050 slice 3] the registrar list this pin reads', () => {
// [#23050 slice 7] 4 + 3 + 3 + 8 + 3 + 8 + 5 = 34 over seven, length 7 → 8.
// [#23050 slice 8] 4 + 3 + 3 + 8 + 3 + 8 + 5 + 3 = 37 over eight, length 8 → 9.
// [#23050 slice 9] 4 + 3 + 3 + 8 + 3 + 8 + 5 + 3 + 3 = 40 over nine, length 9 → 10.
expect(REST_SERVER_REGISTRAR_FILES).toHaveLength(10);
// [#23050 slice 10] 4 + 3 + 3 + 8 + 3 + 8 + 5 + 3 + 3 + 4 = 44 over ten, length 10 → 11.
expect(REST_SERVER_REGISTRAR_FILES).toHaveLength(11);
expect(Object.keys(MOVED_FILE_FLOORS).sort())
.toEqual(REST_SERVER_REGISTRAR_FILES.filter((file) => file !== FILE).sort());
expect(MOVED_FILES.reduce((n, { minBlocks }) => n + minBlocks, 0)).toBe(40);
expect(MOVED_FILES.reduce((n, { minBlocks }) => n + minBlocks, 0)).toBe(44);
});
});
5 changes: 4 additions & 1 deletion packages/rest/src/rest-server-query-number-census.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,10 @@ describe('#20139 census — every numeric coercion in rest-server.ts is classifi
// Nor does the global search body (`search-routes.ts`): it READS its two
// caps through `readDeclaredQueryNumber`, never coerces one:
// 9 = 8 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0, length 9 → 10.
expect(REST_SERVER_REGISTRAR_FILES).toHaveLength(10);
// [#23050 slice 10] Nor does the UI view body (`ui-routes.ts`): it reads
// only the two path parameters, as strings:
// 9 = 8 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0, length 10 → 11.
expect(REST_SERVER_REGISTRAR_FILES).toHaveLength(11);
expect(SOURCES.map(([file]) => file)).toEqual([...REST_SERVER_REGISTRAR_FILES]);
expect(sites).toHaveLength(9);
});
Expand Down
2 changes: 2 additions & 0 deletions packages/rest/src/rest-server-registrar-files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ export const REST_SERVER_REGISTRAR_FILES = [
'email-routes.ts',
// [#23050 slice 9] `registerSearchEndpoints`' body.
'search-routes.ts',
// [#23050 slice 10] `registerUiEndpoints`' body.
'ui-routes.ts',
] as const;

/** One file on {@link REST_SERVER_REGISTRAR_FILES}. */
Expand Down
Loading
Loading