fix(scale): 기능 복사본이 외부 패키지를 고정하고 선언하게 한다 (1101/07-04)
문제: 1101/07-04 이후 조립 단계는 reference feature 밖의 TEMPLATE_FIXTURE 기여를 거부한다. 규모 측정 생성기는 reference feature를 그대로 복사하므로 +25/+100 측정이 ContractContributionError로 멈췄고, 기준선 source가 작업 트리 SHA(2be973a)로 남아 있었다. 방법: renameReferenceFeature가 복사본의 source를 EXTERNAL_PACKAGE (@feature-shape/<id>)로 바꾸고, 같은 패키지를 contracts.contractPackages에도 선언한다. 제품 기능이 실제로 거치는 경로와 같다. 조립 검사에 측정용 예외를 두는 안은 버렸다. 측정이 제품과 다른 경로를 재게 된다. 위험: reference feature의 source 블록 형태가 바뀌면 정규식이 맞지 않는다. 그때는 조립이 같은 오류로 실패하므로 조용히 틀린 값을 기록하지 않는다. 검증: node scripts/scale/measure-feature-shape-growth.ts --sizes=0,25,100 --repeats=2 --write 성공(초기 JS +0: 203,816 B, +25: 219,508 B, +100: 264,841 B), tests/unit/feature-shape-growth.test.ts 6/6 통과.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"measuredAt": "2026-11-01T13:47:49.428Z",
|
||||
"measuredAt": "2026-11-01T14:29:42.148Z",
|
||||
"command": "node scripts/scale/measure-feature-shape-growth.ts --sizes=0,25,100 --repeats=2",
|
||||
"environment": {
|
||||
"node": "24.14.0",
|
||||
@@ -13,7 +13,7 @@
|
||||
"vite": "vite/8.1.5 linux-x64 node-v24.14.0"
|
||||
},
|
||||
"source": {
|
||||
"commit": "2be973a13416b834e6690928e72433c0b3061105",
|
||||
"commit": "373b27b09c7c24c50ea81fca0238138f6b8189a8",
|
||||
"modifiedPaths": [
|
||||
"scripts/scale/measure-feature-shape-growth.ts",
|
||||
"tests/unit/feature-shape-growth.test.ts"
|
||||
@@ -28,29 +28,29 @@
|
||||
"tsc": {
|
||||
"passed": true,
|
||||
"firstError": null,
|
||||
"files": 843,
|
||||
"types": 287932,
|
||||
"symbols": 805529,
|
||||
"instantiations": 720060,
|
||||
"memoryKb": 523871,
|
||||
"wallMs": 2025
|
||||
"files": 844,
|
||||
"types": 287435,
|
||||
"symbols": 794593,
|
||||
"instantiations": 721205,
|
||||
"memoryKb": 521732,
|
||||
"wallMs": 811
|
||||
},
|
||||
"build": {
|
||||
"wallMs": 440,
|
||||
"wallMs": 428,
|
||||
"initialJavascriptFiles": 16,
|
||||
"initialJavascriptGzipBytes": 202509,
|
||||
"initialJavascriptGzipBytes": 203816,
|
||||
"lazyJavascriptFiles": 17,
|
||||
"lazyJavascriptGzipBytes": 28204
|
||||
"lazyJavascriptGzipBytes": 28413
|
||||
},
|
||||
"loadBefore": [
|
||||
28.38,
|
||||
18.41,
|
||||
14.76
|
||||
2.97,
|
||||
7.82,
|
||||
8.57
|
||||
],
|
||||
"loadAfter": [
|
||||
26.67,
|
||||
18.22,
|
||||
14.72
|
||||
2.97,
|
||||
7.82,
|
||||
8.57
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -60,29 +60,29 @@
|
||||
"tsc": {
|
||||
"passed": true,
|
||||
"firstError": null,
|
||||
"files": 843,
|
||||
"types": 287932,
|
||||
"symbols": 805529,
|
||||
"instantiations": 720060,
|
||||
"memoryKb": 524012,
|
||||
"wallMs": 1056
|
||||
"files": 844,
|
||||
"types": 287435,
|
||||
"symbols": 794593,
|
||||
"instantiations": 721205,
|
||||
"memoryKb": 521779,
|
||||
"wallMs": 789
|
||||
},
|
||||
"build": {
|
||||
"wallMs": 425,
|
||||
"wallMs": 400,
|
||||
"initialJavascriptFiles": 16,
|
||||
"initialJavascriptGzipBytes": 202509,
|
||||
"initialJavascriptGzipBytes": 203816,
|
||||
"lazyJavascriptFiles": 17,
|
||||
"lazyJavascriptGzipBytes": 28204
|
||||
"lazyJavascriptGzipBytes": 28413
|
||||
},
|
||||
"loadBefore": [
|
||||
26.67,
|
||||
18.22,
|
||||
14.72
|
||||
2.97,
|
||||
7.82,
|
||||
8.57
|
||||
],
|
||||
"loadAfter": [
|
||||
26.67,
|
||||
18.22,
|
||||
14.72
|
||||
2.97,
|
||||
7.82,
|
||||
8.57
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -92,29 +92,29 @@
|
||||
"tsc": {
|
||||
"passed": true,
|
||||
"firstError": null,
|
||||
"files": 1394,
|
||||
"types": 1061481,
|
||||
"symbols": 2870282,
|
||||
"instantiations": 3646451,
|
||||
"memoryKb": 1431472,
|
||||
"wallMs": 4271
|
||||
"files": 1395,
|
||||
"types": 1062647,
|
||||
"symbols": 2897351,
|
||||
"instantiations": 3645516,
|
||||
"memoryKb": 1438408,
|
||||
"wallMs": 2362
|
||||
},
|
||||
"build": {
|
||||
"wallMs": 1451,
|
||||
"wallMs": 556,
|
||||
"initialJavascriptFiles": 16,
|
||||
"initialJavascriptGzipBytes": 218010,
|
||||
"initialJavascriptGzipBytes": 219508,
|
||||
"lazyJavascriptFiles": 218,
|
||||
"lazyJavascriptGzipBytes": 235404
|
||||
"lazyJavascriptGzipBytes": 239901
|
||||
},
|
||||
"loadBefore": [
|
||||
26.67,
|
||||
18.22,
|
||||
14.72
|
||||
3.13,
|
||||
7.78,
|
||||
8.55
|
||||
],
|
||||
"loadAfter": [
|
||||
28.86,
|
||||
18.82,
|
||||
14.93
|
||||
3.13,
|
||||
7.78,
|
||||
8.55
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -124,29 +124,29 @@
|
||||
"tsc": {
|
||||
"passed": true,
|
||||
"firstError": null,
|
||||
"files": 1394,
|
||||
"types": 1061481,
|
||||
"symbols": 2870282,
|
||||
"instantiations": 3646451,
|
||||
"memoryKb": 1431193,
|
||||
"wallMs": 6960
|
||||
"files": 1395,
|
||||
"types": 1062647,
|
||||
"symbols": 2897351,
|
||||
"instantiations": 3645516,
|
||||
"memoryKb": 1438614,
|
||||
"wallMs": 2453
|
||||
},
|
||||
"build": {
|
||||
"wallMs": 1722,
|
||||
"wallMs": 546,
|
||||
"initialJavascriptFiles": 16,
|
||||
"initialJavascriptGzipBytes": 218010,
|
||||
"initialJavascriptGzipBytes": 219508,
|
||||
"lazyJavascriptFiles": 218,
|
||||
"lazyJavascriptGzipBytes": 235404
|
||||
"lazyJavascriptGzipBytes": 239901
|
||||
},
|
||||
"loadBefore": [
|
||||
28.86,
|
||||
18.82,
|
||||
14.93
|
||||
3.13,
|
||||
7.78,
|
||||
8.55
|
||||
],
|
||||
"loadAfter": [
|
||||
29.79,
|
||||
19.35,
|
||||
15.15
|
||||
3.2,
|
||||
7.71,
|
||||
8.52
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -156,29 +156,29 @@
|
||||
"tsc": {
|
||||
"passed": true,
|
||||
"firstError": null,
|
||||
"files": 3044,
|
||||
"types": 3366002,
|
||||
"symbols": 9084067,
|
||||
"instantiations": 12399171,
|
||||
"memoryKb": 4224229,
|
||||
"wallMs": 11353
|
||||
"files": 3045,
|
||||
"types": 3373621,
|
||||
"symbols": 9115707,
|
||||
"instantiations": 12392128,
|
||||
"memoryKb": 4264554,
|
||||
"wallMs": 8403
|
||||
},
|
||||
"build": {
|
||||
"wallMs": 878,
|
||||
"wallMs": 944,
|
||||
"initialJavascriptFiles": 16,
|
||||
"initialJavascriptGzipBytes": 263119,
|
||||
"initialJavascriptGzipBytes": 264841,
|
||||
"lazyJavascriptFiles": 818,
|
||||
"lazyJavascriptGzipBytes": 857445
|
||||
"lazyJavascriptGzipBytes": 873479
|
||||
},
|
||||
"loadBefore": [
|
||||
29.4,
|
||||
19.44,
|
||||
15.2
|
||||
3.2,
|
||||
7.71,
|
||||
8.52
|
||||
],
|
||||
"loadAfter": [
|
||||
26.66,
|
||||
19.18,
|
||||
15.16
|
||||
6.72,
|
||||
8.32,
|
||||
8.71
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -188,29 +188,29 @@
|
||||
"tsc": {
|
||||
"passed": true,
|
||||
"firstError": null,
|
||||
"files": 3044,
|
||||
"types": 3366002,
|
||||
"symbols": 9084067,
|
||||
"instantiations": 12399171,
|
||||
"memoryKb": 4224168,
|
||||
"wallMs": 13664
|
||||
"files": 3045,
|
||||
"types": 3373621,
|
||||
"symbols": 9115707,
|
||||
"instantiations": 12392128,
|
||||
"memoryKb": 4263823,
|
||||
"wallMs": 9717
|
||||
},
|
||||
"build": {
|
||||
"wallMs": 2302,
|
||||
"wallMs": 933,
|
||||
"initialJavascriptFiles": 16,
|
||||
"initialJavascriptGzipBytes": 263119,
|
||||
"initialJavascriptGzipBytes": 264841,
|
||||
"lazyJavascriptFiles": 818,
|
||||
"lazyJavascriptGzipBytes": 857445
|
||||
"lazyJavascriptGzipBytes": 873479
|
||||
},
|
||||
"loadBefore": [
|
||||
26.66,
|
||||
19.18,
|
||||
15.16
|
||||
6.72,
|
||||
8.32,
|
||||
8.71
|
||||
],
|
||||
"loadAfter": [
|
||||
23.48,
|
||||
18.92,
|
||||
15.16
|
||||
6.3,
|
||||
8.17,
|
||||
8.66
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
@@ -58,7 +58,27 @@ export function renameReferenceFeature(
|
||||
context: Readonly<{ id: string; routeRoot: string }>,
|
||||
): string {
|
||||
const upper = id.toUpperCase();
|
||||
let renamed = text;
|
||||
// 1101/07-04. Assembly refuses the reference fixture source in any other
|
||||
// feature, so a copy pins an external package and declares it in its
|
||||
// contracts, as a product feature would.
|
||||
const contractPackage = [
|
||||
"Object.freeze({",
|
||||
` packageId: "@feature-shape/${id}",`,
|
||||
' version: "1.0.0",',
|
||||
' digest: `sha256:${"0".repeat(64)}`,',
|
||||
" runtimeProtocolVersion: 1 as const,",
|
||||
' sourceRevision: "0000000",',
|
||||
" })",
|
||||
].join("\n");
|
||||
let renamed = text
|
||||
.replace(
|
||||
/source: Object\.freeze\(\{\s*kind: "TEMPLATE_FIXTURE" as const,\s*fixtureId: "REFERENCE_FEATURE_V1" as const,\s*revision: 1 as const,\s*\}\)/u,
|
||||
`source: Object.freeze({\n kind: "EXTERNAL_PACKAGE" as const,\n package: ${contractPackage},\n })`,
|
||||
)
|
||||
.replace(
|
||||
"contractPackages: Object.freeze([]),",
|
||||
`contractPackages: Object.freeze([${contractPackage}]),`,
|
||||
);
|
||||
PLATFORM_TOKENS.forEach((token, index) => {
|
||||
renamed = renamed.replaceAll(token, `\u0000${index}\u0000`);
|
||||
});
|
||||
|
||||
@@ -55,6 +55,27 @@ describe("feature-shape growth measurement (11-04)", () => {
|
||||
expect(renamed).toContain("S007NoRequest");
|
||||
});
|
||||
|
||||
// 1101/07-04 made assembly refuse a TEMPLATE_FIXTURE contribution outside
|
||||
// the reference feature, so every copy must pin an EXTERNAL_PACKAGE the way
|
||||
// a product feature does.
|
||||
it("turns the copied fixture source into an external package", () => {
|
||||
const source = [
|
||||
" source: Object.freeze({",
|
||||
' kind: "TEMPLATE_FIXTURE" as const,',
|
||||
' fixtureId: "REFERENCE_FEATURE_V1" as const,',
|
||||
" revision: 1 as const,",
|
||||
" }),",
|
||||
" contractPackages: Object.freeze([]),",
|
||||
].join("\n");
|
||||
|
||||
const renamed = renameReferenceFeature(source, "s007", context);
|
||||
|
||||
expect(renamed).not.toContain("TEMPLATE_FIXTURE");
|
||||
expect(renamed).toContain('kind: "EXTERNAL_PACKAGE" as const');
|
||||
expect(renamed.match(/packageId: "@feature-shape\/s007"/gu)).toHaveLength(2);
|
||||
expect(renamed).not.toContain("contractPackages: Object.freeze([])");
|
||||
});
|
||||
|
||||
it("keeps platform-owned names that only contain the word", () => {
|
||||
const source =
|
||||
"REFERENCE_EXTERNAL_BEARER REFERENCE_FEATURE_V1 supportReference";
|
||||
|
||||
Reference in New Issue
Block a user