The scale evidence came from stub features, so the cost of one app growing towards its declared ceiling was never measured. Copies of the reference feature at 25 and 100 are now the baseline, and the acceptance matrix says what the ceilings rest on and which axes stay unverified. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
104 lines
3.8 KiB
TypeScript
104 lines
3.8 KiB
TypeScript
import { readFile } from "node:fs/promises";
|
|
|
|
import { describe, expect, it } from "vitest";
|
|
|
|
import {
|
|
FEATURE_SHAPE_BASELINE_PATH,
|
|
renameReferenceFeature,
|
|
} from "../../scripts/scale/measure-feature-shape-growth.ts";
|
|
|
|
/**
|
|
* 11-04 (D-18). The scale evidence used to come from stub features that only
|
|
* differ by name, so the cost of one app growing towards its declared ceiling
|
|
* (20 contexts x 200 features) was never measured. The committed baseline is a
|
|
* measurement with copies of the real reference feature.
|
|
*/
|
|
const context = { id: "shape-context-0", routeRoot: "shape-0" } as const;
|
|
|
|
type Run = Readonly<{
|
|
addedFeatures: number;
|
|
routes: number;
|
|
tsc: Readonly<{ passed: boolean; instantiations: number; wallMs: number }>;
|
|
build: Readonly<{
|
|
wallMs: number;
|
|
initialJavascriptGzipBytes: number;
|
|
lazyJavascriptFiles: number;
|
|
}>;
|
|
loadBefore: readonly number[];
|
|
}>;
|
|
|
|
describe("feature-shape growth measurement (11-04)", () => {
|
|
it("renames every feature-owned identifier of a reference copy", () => {
|
|
const source = [
|
|
'featureId: "reference-feature"',
|
|
'path: "/examples/reference-resources/:id"',
|
|
"REFERENCE_RESOURCE_LIST",
|
|
"ReferenceResourcePage",
|
|
'contextId: "reference-context"',
|
|
'topic: "qinv.01k10f7m3w9p6r2c8v5n4x"',
|
|
"NoRequest",
|
|
].join("\n");
|
|
|
|
const renamed = renameReferenceFeature(source, "s007", context);
|
|
|
|
expect(renamed).not.toMatch(/reference/iu);
|
|
expect(renamed).toContain('featureId: "s007-feature"');
|
|
expect(renamed).toContain('path: "/shape-0/s007-resources/:id"');
|
|
expect(renamed).toContain("S007_RESOURCE_LIST");
|
|
expect(renamed).toContain("S007ResourcePage");
|
|
expect(renamed).toContain('contextId: "shape-context-0"');
|
|
expect(renamed).toContain('topic: "qinv.shape.s007"');
|
|
expect(renamed).toContain("S007NoRequest");
|
|
});
|
|
|
|
it("keeps platform-owned names that only contain the word", () => {
|
|
const source =
|
|
"REFERENCE_EXTERNAL_BEARER REFERENCE_FEATURE_V1 supportReference";
|
|
|
|
expect(renameReferenceFeature(source, "s001", context)).toBe(source);
|
|
});
|
|
|
|
it("commits a baseline measured at 25 and 100 real-shape features, twice each", async () => {
|
|
const baseline = JSON.parse(
|
|
await readFile(FEATURE_SHAPE_BASELINE_PATH, "utf8"),
|
|
) as Readonly<{
|
|
environment: Readonly<Record<string, unknown>>;
|
|
runs: readonly Run[];
|
|
}>;
|
|
expect(baseline.environment).toMatchObject({
|
|
cpuModel: expect.any(String),
|
|
logicalCpus: expect.any(Number),
|
|
});
|
|
|
|
const bySize = (size: number) =>
|
|
baseline.runs.filter((run) => run.addedFeatures === size);
|
|
const [origin] = bySize(0);
|
|
expect(origin?.tsc.passed).toBe(true);
|
|
for (const size of [25, 100]) {
|
|
const runs = bySize(size);
|
|
// A failed typecheck is the result and is not repeated.
|
|
expect(runs.length).toBeGreaterThanOrEqual(runs[0]?.tsc.passed ? 2 : 1);
|
|
for (const run of runs) {
|
|
// Every copy contributes the reference feature's own routes.
|
|
expect((run.routes - origin!.routes) % size).toBe(0);
|
|
expect(run.routes).toBeGreaterThan(origin!.routes);
|
|
expect(run.build.lazyJavascriptFiles).toBeGreaterThan(
|
|
origin!.build.lazyJavascriptFiles,
|
|
);
|
|
expect(run.loadBefore).toHaveLength(3);
|
|
}
|
|
// Compiler counts are deterministic; only times vary with the host.
|
|
expect(new Set(runs.map((run) => run.tsc.instantiations)).size).toBe(1);
|
|
}
|
|
});
|
|
|
|
it("states in the acceptance matrix what the ceilings rest on", async () => {
|
|
const acceptance = await readFile(
|
|
"docs/reviews/2026-09-23-extreme-scale-acceptance.md",
|
|
"utf8",
|
|
);
|
|
expect(acceptance).toContain(FEATURE_SHAPE_BASELINE_PATH);
|
|
expect(acceptance).toMatch(/\| Growth axis \| Verified \| Condition \| Not verified \|/u);
|
|
});
|
|
});
|