From d406c10ba31da3ca83bb94b9001d10b188f00879 Mon Sep 17 00:00:00 2001 From: DongHyeonka Date: Sat, 21 Nov 2026 05:35:33 +0900 Subject: [PATCH 1/3] =?UTF-8?q?test(telemetry):=20=EA=B9=8A=EC=9D=B4=20?= =?UTF-8?q?=EC=A0=9C=ED=95=9C=20=EC=8B=9C=ED=97=98=EC=9D=B4=20=EC=9E=98?= =?UTF-8?q?=EB=A6=B0=20=EB=AA=A8=EC=96=91=EA=B3=BC=20=EC=88=9C=ED=99=98=20?= =?UTF-8?q?payload=EB=A5=BC=20=EB=8B=A8=EC=96=B8=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 「깊이·폭·배열·문자열을 제한한다」 시험의 깊이 쪽 단언은 결과 JSON에 TRUNCATED가 있다는 것 하나였다. 5,000자 text를 자를 때도 TRUNCATED가 붙으므로 redact-telemetry.ts의 깊이 검사를 지워도 시험이 통과했다. 깊이 제한은 순환 payload를 멈추는 장치인데 이를 보는 시험이 없었다. 같은 시험이 result.deep을 { next: { next: { next: TRUNCATED } } }로 단언하고, text도 16자와 TRUNCATED로 정확히 단언한다. a.self = a 꼴 payload를 기본 예산으로 정제하면 maxDepth 단계에서 잘린 모양이 나오는 시험을 더한다. 검증은 PR 본문에 적는다(깊이 검사를 지운 변이에서 두 시험 모두 실패). Refs: REV-FE-0030 --- .../platform/telemetry/redact-telemetry.test.ts | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/tests/platform/telemetry/redact-telemetry.test.ts b/tests/platform/telemetry/redact-telemetry.test.ts index 108528d5..a224a653 100644 --- a/tests/platform/telemetry/redact-telemetry.test.ts +++ b/tests/platform/telemetry/redact-telemetry.test.ts @@ -164,10 +164,22 @@ describe("redactTelemetryPayload", () => { { maxDepth: 4, maxKeys: 10, maxArrayItems: 5, maxStringLength: 16 }, ) as Record; - expect(JSON.stringify(result)).toContain(TRUNCATED); + // `deep` sits at depth 1, so maxDepth 4 copies three objects and cuts the fourth. + expect(result["deep"]).toEqual({ next: { next: { next: TRUNCATED } } }); expect(Object.keys(result["wide"] as object).length).toBeLessThanOrEqual(10); expect(result["list"]).toHaveLength(5); - expect((result["text"] as string).length).toBeLessThanOrEqual(16 + TRUNCATED.length); + expect(result["text"]).toBe(`${"x".repeat(16)}${TRUNCATED}`); + }); + + it("stops a self-referencing payload at the depth limit", () => { + const cycle: Record = { id: 1 }; + cycle["self"] = cycle; + + let expected: unknown = TRUNCATED; + for (let depth = 0; depth < DEFAULT_TELEMETRY_PAYLOAD_BUDGET.maxDepth; depth += 1) { + expected = { id: 1, self: expected }; + } + expect(redactTelemetryPayload(cycle)).toEqual(expected); }); it("does not let prototype keys pollute the copy", () => { -- 2.54.0 From 0190b6312e791cef5f2026c233b0d5587e23acdd Mon Sep 17 00:00:00 2001 From: DongHyeonka Date: Sat, 21 Nov 2026 05:58:09 +0900 Subject: [PATCH 2/3] =?UTF-8?q?fix(telemetry):=20payload=20=EC=A0=95?= =?UTF-8?q?=EC=A0=9C=EA=B0=80=20=EB=B3=B5=EC=82=AC=ED=95=98=EB=8A=94=20?= =?UTF-8?q?=EA=B0=92=EC=9D=98=20=EC=B4=9D=EC=88=98=EB=A5=BC=20maxNodes?= =?UTF-8?q?=EB=A1=9C=20=EB=A7=89=EB=8A=94=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit redactTelemetryPayload의 상한은 값 하나마다(깊이 6, key 64, 배열 32)였다. 같은 객체를 여러 key가 가리키면 경로마다 따로 복사하므로, 객체 4개가 key 64개로 다음 객체를 가리키는 payload 하나가 1,680만 개 값을 만들었다 (약 18초). 서로를 16개씩 가리키는 엔티티 50개는 emit 한 번이 1.5초, 24개면 heap OOM이었다. emit은 호출한 쪽 스택에서 동기로 정제하고, 이 비용은 256 KB 바이트 상한보다 먼저 들며 OOM은 emit의 try/catch가 못 잡는다. TelemetryPayloadBudget에 maxNodes(기본 512, 양의 안전 정수)를 더한다. 큐에 넣는 값마다 하나씩 센다. 자식이 있는데 자리가 하나도 없으면 그 값이 TRUNCATED다(빈 객체·배열은 그대로라 예산에 딱 맞는 payload도 값이 같다). 자식을 다 넣을 자리가 없으면 들어가는 마지막 자리에 TRUNCATED를 둔다. 그래서 복사본의 값 수는 maxNodes를 넘지 않는다. 여러 경로가 가리키는 객체의 자식 목록은 WeakMap에 두고 한 번만 만든다. 그래서 일의 양은 방문 maxNodes 번과 서로 다른 객체마다 key 목록 한 번이다. 순회를 스택에서 큐로 바꿔 너비 우선으로 돈다. 상한이 차면 얕은 필드가 남고 깊은 값이 잘린다. key 자리를 먼저 잡아 두어 복사본 객체의 key 순서가 원본 순서가 된다(전에는 거꾸로). fingerprint는 key를 정렬하므로 같다. createTelemetryPipeline은 payload.maxNodes가 양의 안전 정수가 아니면 다른 예산처럼 TypeError를 던진다. 버린 안: WeakSet으로 본 객체를 [circular]로 바꾸는 안은 서로 다른 객체의 넓은 트리가 여전히 곱으로 돌고, 같은 값을 두 번 넣은 정상 payload의 fingerprint가 바뀐다. maxKeys·maxDepth만 낮추는 안도 곱 꼴 증가가 남는다. 값 수를 꺼낼 때 세는 안(bounded-json.ts 방식)은 이미 큐에 든 자식이 TRUNCATED로 남아 복사본이 maxNodes x maxKeys까지 커진다. 위험·한계: TelemetryPayloadBudget을 직접 만든 코드는 maxNodes를 더해야 typecheck가 통과한다. 서로 다른 큰 객체(예: 큰 typed array 여러 개)는 객체마다 Object.keys가 key 전부를 읽는다. 그 비용은 payload가 실제로 든 메모리 크기에 비례한다. 시험: 공유 사슬(4단계 x key 64)의 복사본 값 수 <= maxNodes와 최상위 key 64개 유지, 상한이 찬 자리의 TRUNCATED, 너비 우선과 key 순서, 공유 객체의 key 목록 1회(Proxy ownKeys로 센다), 예산에 딱 맞는 payload의 빈 객체· 배열 유지, 파이프라인에 엔티티 50개 x 16 graph를 넣으면 accepted 1, dropped 0, batch 1개, payload에 entities 배열, 값 수 <= maxNodes, 잘못된 maxNodes 거절. 시간은 단언하지 않는다. RED·GREEN은 PR 본문에 적는다. 기준선: 정제 코드가 초기 번들에 들어가 initial JavaScript가 gzip +271 B (194339 -> 194610)다. config/scale/feature-shape-ceilings.json의 initialJavascript를 손으로 고치지 않고 measure-feature-shape-growth.ts --initial-baseline --write로 다시 썼다(.claude/rules/gates-and-budgets.md 기준선 기록 줄). 예산 206848 B, 기능 하나 1 KiB, context 하나 512 B 상한은 그대로이고 새 값(firstFeature 6210, perFeature 546, perContext 2)은 그 안이다. Refs: REV-FE-0029 --- config/scale/feature-shape-ceilings.json | 8 +- src/platform/telemetry/redact-telemetry.ts | 106 ++++++++++---- src/platform/telemetry/telemetry-pipeline.ts | 6 + .../telemetry/redact-telemetry.test.ts | 134 +++++++++++++++++- 4 files changed, 220 insertions(+), 34 deletions(-) diff --git a/config/scale/feature-shape-ceilings.json b/config/scale/feature-shape-ceilings.json index c4e412a1..38d15aba 100644 --- a/config/scale/feature-shape-ceilings.json +++ b/config/scale/feature-shape-ceilings.json @@ -45,11 +45,11 @@ } ], "initialJavascript": { - "gzipBytes": 194339, + "gzipBytes": 194610, "files": 15, - "firstFeatureGzipBytes": 6221, - "perFeatureGzipBytes": 521, - "perContextGzipBytes": 7 + "firstFeatureGzipBytes": 6210, + "perFeatureGzipBytes": 546, + "perContextGzipBytes": 2 }, "serviceWorkerPrecache": { "assets": 22, diff --git a/src/platform/telemetry/redact-telemetry.ts b/src/platform/telemetry/redact-telemetry.ts index 9cc55159..a584c5fe 100644 --- a/src/platform/telemetry/redact-telemetry.ts +++ b/src/platform/telemetry/redact-telemetry.ts @@ -5,12 +5,26 @@ * preserves prototypes and never invokes getters or `toJSON` on untrusted * payloads. Traversal is iterative and capped by a structural budget, so an * adversarial payload cannot make telemetry itself unbounded. + * + * The per-value caps (depth, keys, array items, string length) do not bound + * the copy on their own: an object reached from many keys is copied once per + * path, so 4 levels of 64 keys pointing at one shared object copy 16.8 million + * values. `maxNodes` caps the whole copy. Values are visited breadth first, so + * when that cap runs out the shallow fields are kept and the deeper ones become + * `TRUNCATED`. Each copied value is one visit, and an object's own keys are + * listed once however many paths reach it, so the work is at most `maxNodes` + * visits plus one key listing per distinct object. */ export type TelemetryPayloadBudget = Readonly<{ maxDepth: number; maxKeys: number; maxArrayItems: number; maxStringLength: number; + /** + * Values in the whole copy: objects, arrays, leaves and `TRUNCATED` markers. + * A positive safe integer (the pipeline rejects anything else). + */ + maxNodes: number; }>; export const DEFAULT_TELEMETRY_PAYLOAD_BUDGET: TelemetryPayloadBudget = @@ -19,6 +33,7 @@ export const DEFAULT_TELEMETRY_PAYLOAD_BUDGET: TelemetryPayloadBudget = maxKeys: 64, maxArrayItems: 32, maxStringLength: 256, + maxNodes: 512, }); export const REDACTED = "[redacted]"; @@ -127,12 +142,44 @@ type Pending = Readonly<{ assign: (value: unknown) => void; }>; +type Child = readonly [slot: string | number, value: unknown]; + +type Copy = unknown[] | Record; + +function place(copy: Copy, slot: string | number, value: unknown): void { + if (Array.isArray(copy)) copy[Number(slot)] = value; + else copy[String(slot)] = value; +} + +/** The own data values a copy of `source` keeps, before the node budget. */ +function childrenOf(source: object, budget: TelemetryPayloadBudget): Child[] { + const children: Child[] = []; + if (Array.isArray(source)) { + const length = Math.min(source.length, budget.maxArrayItems); + for (let index = 0; index < length; index += 1) { + const item = readOwnData(source, String(index)); + children.push([index, item.ok ? item.value : null]); + } + return children; + } + for (const key of Object.keys(source).slice(0, budget.maxKeys)) { + if (key === "__proto__" || key === "constructor" || key === "prototype") { + continue; + } + if (isSecretTelemetryKey(key)) continue; + const entry = readOwnData(source, key); + if (entry.ok) children.push([key, entry.value]); + } + return children; +} + export function redactTelemetryPayload( payload: unknown, budget: TelemetryPayloadBudget = DEFAULT_TELEMETRY_PAYLOAD_BUDGET, ): unknown { let result: unknown = null; - const stack: Pending[] = [ + // A queue, not a stack: breadth first, so a spent node budget cuts the deepest values. + const queue: Pending[] = [ { source: payload, depth: 0, @@ -141,8 +188,12 @@ export function redactTelemetryPayload( }, }, ]; - while (stack.length > 0) { - const { source, depth, assign } = stack.pop() as Pending; + // Every queued entry becomes exactly one value of the copy. + let nodes = 1; + // A shared object is reached from many paths; list its own keys once. + const listed = new WeakMap(); + for (let head = 0; head < queue.length; head += 1) { + const { source, depth, assign } = queue[head] as Pending; if (source === null || typeof source !== "object") { assign(source === undefined ? null : sanitizeLeaf(source, budget)); continue; @@ -151,37 +202,34 @@ export function redactTelemetryPayload( assign(TRUNCATED); continue; } - if (Array.isArray(source)) { - const length = Math.min(source.length, budget.maxArrayItems); - const copy: unknown[] = new Array(length).fill(null); - assign(copy); - for (let index = 0; index < length; index += 1) { - const item = readOwnData(source, String(index)); - if (!item.ok) continue; - stack.push({ - source: item.value, - depth: depth + 1, - assign: (value) => { - copy[index] = value; - }, - }); - } + let children = listed.get(source); + if (children === undefined) { + children = childrenOf(source, budget); + listed.set(source, children); + } + const room = budget.maxNodes - nodes; + if (children.length > 0 && room <= 0) { + assign(TRUNCATED); continue; } - const copy: Record = {}; + // Without room for every child, the last slot that fits holds the marker. + const kept = Math.min(children.length, room); + nodes += kept; + const copy: Copy = Array.isArray(source) ? new Array(kept).fill(null) : {}; assign(copy); - for (const key of Object.keys(source).slice(0, budget.maxKeys)) { - if (key === "__proto__" || key === "constructor" || key === "prototype") { - continue; + for (let index = 0; index < kept; index += 1) { + const [slot, value] = children[index] as Child; + if (kept < children.length && index === kept - 1) { + place(copy, slot, TRUNCATED); + break; } - if (isSecretTelemetryKey(key)) continue; - const entry = readOwnData(source, key); - if (!entry.ok) continue; - stack.push({ - source: entry.value, + // Holds the key's place so the copy keeps the source's key order. + place(copy, slot, null); + queue.push({ + source: value, depth: depth + 1, - assign: (value) => { - copy[key] = value; + assign: (copied) => { + place(copy, slot, copied); }, }); } diff --git a/src/platform/telemetry/telemetry-pipeline.ts b/src/platform/telemetry/telemetry-pipeline.ts index 37d11dff..af9039ae 100644 --- a/src/platform/telemetry/telemetry-pipeline.ts +++ b/src/platform/telemetry/telemetry-pipeline.ts @@ -25,6 +25,11 @@ import { createDeterministicSampler } from "./telemetry-sampler.ts"; * * Every stage has an explicit ceiling, and no stage can throw or reject into * the business caller: internal failures become dropped-event counters. + * Redaction runs inside `emit` on the caller's stack, so its ceiling is the + * payload budget's `maxNodes` (values in the whole copy, plus one own-key + * listing per distinct object), not the byte ceiling that applies after it: a + * payload whose objects share references would otherwise be copied once per + * path before any byte count is taken. * * A duplicate inside the dedup window is not sent on its own. Its count is held * per fingerprint and delivered as `occurrences` on the next flush, or on a @@ -153,6 +158,7 @@ export function createTelemetryPipeline( assertPositive("maxBatchEvents", budget.maxBatchEvents); assertPositive("maxSendsPerMinute", budget.maxSendsPerMinute); const payloadBudget = budget.payload ?? DEFAULT_TELEMETRY_PAYLOAD_BUDGET; + assertPositive("payload.maxNodes", payloadBudget.maxNodes); const now = options.now ?? (() => performance.now()); const schedule = options.schedule ?? queueMicrotask; const setTimer = diff --git a/tests/platform/telemetry/redact-telemetry.test.ts b/tests/platform/telemetry/redact-telemetry.test.ts index a224a653..0b346c23 100644 --- a/tests/platform/telemetry/redact-telemetry.test.ts +++ b/tests/platform/telemetry/redact-telemetry.test.ts @@ -6,6 +6,35 @@ import { redactTelemetryPayload, TRUNCATED, } from "../../../src/platform/telemetry/redact-telemetry.ts"; +import { + createTelemetryPipeline, + DEFAULT_TELEMETRY_PIPELINE_BUDGET, +} from "../../../src/platform/telemetry/telemetry-pipeline.ts"; +import type { TelemetryBatchItem } from "../../../src/platform/telemetry/telemetry-pipeline.ts"; + +/** Values in a copied tree: objects, arrays and leaves. */ +function countNodes(value: unknown): number { + let count = 0; + const pending: unknown[] = [value]; + while (pending.length > 0) { + const current = pending.pop(); + count += 1; + if (current !== null && typeof current === "object") { + for (const child of Object.values(current)) pending.push(child); + } + } + return count; +} + +/** `levels` objects, each pointing at the next one from `width` keys. */ +function sharedChain(levels: number, width: number): unknown { + let next: unknown = "leaf"; + for (let level = 0; level < levels; level += 1) { + const target = next; + next = Object.fromEntries(Array.from({ length: width }, (_, key) => [`k${key}`, target])); + } + return next; +} describe("redactTelemetryPayload", () => { it.each([ @@ -161,7 +190,7 @@ describe("redactTelemetryPayload", () => { ); const result = redactTelemetryPayload( { deep, wide, list: Array.from({ length: 1_000 }, (_, i) => i), text: "x".repeat(5_000) }, - { maxDepth: 4, maxKeys: 10, maxArrayItems: 5, maxStringLength: 16 }, + { maxDepth: 4, maxKeys: 10, maxArrayItems: 5, maxStringLength: 16, maxNodes: 512 }, ) as Record; // `deep` sits at depth 1, so maxDepth 4 copies three objects and cuts the fourth. @@ -182,6 +211,70 @@ describe("redactTelemetryPayload", () => { expect(redactTelemetryPayload(cycle)).toEqual(expected); }); + it("bounds the whole copy when many keys share one object", () => { + // 4 objects, each pointing at the next from 64 keys: 16.8 million paths. + const result = redactTelemetryPayload(sharedChain(4, 64)) as Record; + + expect(countNodes(result)).toBeLessThanOrEqual(DEFAULT_TELEMETRY_PAYLOAD_BUDGET.maxNodes); + // Breadth first: every top-level key survives the cut. + expect(Object.keys(result)).toHaveLength(64); + }); + + it("marks the slot where the node budget runs out", () => { + const budget = { ...DEFAULT_TELEMETRY_PAYLOAD_BUDGET, maxNodes: 4 }; + expect(redactTelemetryPayload({ list: [1, 2, 3, 4, 5] }, budget)).toEqual({ + list: [1, TRUNCATED], + }); + expect(redactTelemetryPayload({ a: 1, b: 2, c: 3, d: 4 }, budget)).toEqual({ + a: 1, + b: 2, + c: TRUNCATED, + }); + expect(redactTelemetryPayload({ a: { b: { c: 1 } }, d: 2 }, { ...budget, maxNodes: 3 })).toEqual({ + a: TRUNCATED, + d: 2, + }); + }); + + it("spends the node budget breadth first and keeps the source key order", () => { + // Depth first would copy b.d.e and cut a: { a: TRUNCATED, b: { d: { e: TRUNCATED } } }. + const result = redactTelemetryPayload( + { a: { c: 1 }, b: { d: { e: { f: 1 } } } }, + { ...DEFAULT_TELEMETRY_PAYLOAD_BUDGET, maxNodes: 5 }, + ); + expect(result).toEqual({ a: { c: 1 }, b: { d: TRUNCATED } }); + + const cut = redactTelemetryPayload( + { a: 1, b: 2, c: 3, d: 4 }, + { ...DEFAULT_TELEMETRY_PAYLOAD_BUDGET, maxNodes: 4 }, + ); + expect(JSON.stringify(cut)).toBe(`{"a":1,"b":2,"c":"${TRUNCATED}"}`); + }); + + it("lists a shared object's keys once however many paths reach it", () => { + let listings = 0; + const counted = new Proxy( + { x: 1 }, + { + ownKeys(target) { + listings += 1; + return Reflect.ownKeys(target); + }, + }, + ); + + redactTelemetryPayload({ list: Array.from({ length: 32 }, () => counted) }); + expect(listings).toBe(1); + }); + + it("copies a payload that fills the node budget exactly as it is", () => { + // c spends the last slot, so the empty a and b are visited with no room left. + const payload = { c: { d: 1 }, a: {}, b: [] }; + expect(redactTelemetryPayload(payload, { ...DEFAULT_TELEMETRY_PAYLOAD_BUDGET, maxNodes: 5 })).toEqual( + payload, + ); + }); + it("does not let prototype keys pollute the copy", () => { const payload = JSON.parse('{"__proto__":{"polluted":true},"ok":1}') as unknown; const result = redactTelemetryPayload(payload) as Record; @@ -200,3 +293,42 @@ describe("redactTelemetryPayload", () => { ).toEqual({ n: null, f: null, u: null, b: null }); }); }); + +describe("redaction inside the telemetry pipeline", () => { + it("admits an entity graph that shares references in one bounded emit", async () => { + // 50 entities, each pointing at the next 16: a normalized graph with cycles. + const entities = Array.from({ length: 50 }, (_, id): Record => ({ id })); + for (const [id, entity] of entities.entries()) { + for (let link = 1; link <= 16; link += 1) entity[`peer${link}`] = entities[(id + link) % 50]; + } + const batches: TelemetryBatchItem[][] = []; + const pipeline = createTelemetryPipeline({ + transport: { send: (batch) => void batches.push([...batch]) }, + }); + + await pipeline.emit({ kind: "graph.loaded", severity: "error", payload: { entities } }); + await pipeline.flush(); + + // emit redacts on the caller's stack: one visit per copied value and one + // key listing per distinct object, so the node count bounds its work + // without a wall-clock assertion. + expect(pipeline.stats()).toMatchObject({ accepted: 1, dropped: 0 }); + expect(batches).toHaveLength(1); + expect(batches[0]?.[0]?.event.payload).toMatchObject({ entities: expect.any(Array) }); + expect(countNodes(batches[0]?.[0]?.event.payload)).toBeLessThanOrEqual( + DEFAULT_TELEMETRY_PAYLOAD_BUDGET.maxNodes, + ); + }); + + it.each([0, -1, 2.5, Number.NaN])("rejects a payload maxNodes of %s", (maxNodes) => { + expect(() => + createTelemetryPipeline({ + transport: { send: () => {} }, + budget: { + ...DEFAULT_TELEMETRY_PIPELINE_BUDGET, + payload: { ...DEFAULT_TELEMETRY_PAYLOAD_BUDGET, maxNodes }, + }, + }), + ).toThrow(/payload\.maxNodes/u); + }); +}); -- 2.54.0 From e9d5f5e1a936998bb407c267aef79683ea6c9902 Mon Sep 17 00:00:00 2001 From: DongHyeonka Date: Sat, 21 Nov 2026 05:58:10 +0900 Subject: [PATCH 3/3] =?UTF-8?q?docs(changelog):=20telemetry=20=EC=A0=95?= =?UTF-8?q?=EC=A0=9C=EC=9D=98=20=EC=A0=84=EC=B2=B4=20=EA=B0=92=20=EC=83=81?= =?UTF-8?q?=ED=95=9C=20maxNodes=EB=A5=BC=20=EC=A0=81=EB=8A=94=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit TelemetryPayloadBudget에 필수 필드가 생겨 직접 만든 값은 typecheck가 실패하므로 먼저 할 일에 옮기는 법을 적고, 보안·계약 변경 표에 0190b631·d406c10b 행을 더한다. Refs: REV-FE-0029, REV-FE-0030 --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6bc1f5f8..9c94ebac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -78,6 +78,10 @@ Gitea runner에서 merge 단계를 초록으로 만들고, worker를 늘리지 - 입력의 실패 보고: `result.error.kind !== "REQUEST_ABORTED"`를 `!isAbortFailure(result.error)`(`src/contracts/errors.ts`)로 바꾼다. - 목록의 개수: `message(…resultCount, { count: number(query.data.total) })`처럼 `useLocale().number`로 넘긴다. - 옮긴 뒤 확인: 그 기능의 시험과 `scripts/verify.sh merge`. +- telemetry payload 예산 `TelemetryPayloadBudget`(`src/platform/telemetry/redact-telemetry.ts`)에 필수 필드 `maxNodes`가 생긴다. + - 옮기기 전: 그 타입 값을 직접 만들어 `createTelemetryPipeline`의 `budget.payload`에 넘기면 `check:types`가 `maxNodes`가 없다며 실패한다. + - 옮기는 법: `{ ...DEFAULT_TELEMETRY_PAYLOAD_BUDGET, … }`로 만들거나 `maxNodes`를 적는다(기본 512). 양의 안전 정수가 아니면 `createTelemetryPipeline`이 `TypeError`를 던진다. + - 옮긴 뒤 확인: `scripts/verify.sh script check:types`. ### 보안·계약 변경 @@ -113,6 +117,7 @@ Gitea runner에서 merge 단계를 초록으로 만들고, worker를 늘리지 | [계약] | `dependency-cache` 단계를 main job(`main_gate`)에도 둔다. 키·경로·main run만 저장·frozen install은 merge job과 같다. release·promotion·provider job은 그대로 거절한다. 위 `7ed0af3d` 행의 「merge job 셋에만」을 바꾼다(decisions.md FE-7) | `config/ci/gates.json`, `scripts/contracts/ci-gates.ts`, `.gitea/workflows/quality-gates.yml`, `tests/unit/ci-workflow-generation.test.ts`, `docs/operations/ci-quality-gates.md` | `d254d70a` | | [계약] | FE-GATE-005의 명령이 `test:coverage`·`check:scale:pr` 둘이 된다. `tests/unit`·`tests/contract`의 JUnit 증거(`unit.xml`·`contract.xml`, 이름·형식 그대로)는 coverage 실행 안의 reporter가 쓰고, 두 증거의 producer는 `test-coverage`다. 한 폴더에서 시험 파일이 하나도 돌지 않거나 보고서가 그 폴더에서 돈 파일과 다른 파일을 담으면 그 실행이 실패한다. unit·contract 시험은 이제 coverage 계측 아래에서만 돈다. FE-GATE-004·006·007은 자기 실행을 그대로 둔다(decisions.md FE-4) | `config/ci/gates.json`, `package.json`, `scripts/lib/coverage-bundle-junit-reporter.ts`, `scripts/lib/feature-scaffold-drill.ts`, `tests/unit/coverage-bundle-junit-reporter.test.ts`, `docs/operations/ci-quality-gates.md` | `6cba1f50` | | [계약] | `check:ci:gating`(FE-GATE-029)이 Playwright 실행의 `--grep`·`--grep-invert`·파일 필터를 읽는다. testDir은 필터 없는 gated 실행이 있거나, `--grep-invert P` 실행마다 같은 testDir을 `--grep P`(같은 글자)로 도는 gated 실행이 있을 때만 게이트 안으로 센다. 파일 필터가 있는 실행, `--grep`·`--grep-invert`를 합쳐 둘 이상 쓴 실행, 설정(또는 그 설정이 import한 설정)에 `grep`·`grepInvert`가 있는 실행은 부분 실행으로 센다. 그 testDir의 게이트 밖 파일은 testDir·실행·빠진 짝을 대는 한 줄로 실패한다. 전에는 009의 Playwright 실행을 빼도 통과해, 시험이 모두 `@a11y`인 `tests/e2e/accessibility.spec.ts`가 어느 게이트에서도 돌지 않았다. `-c X`·`-cX`·`--config=X`로 고른 설정도 이제 읽는다(전에는 e2e 설정의 testDir로 셌다). 위 "먼저 할 일" | `scripts/lib/playwright-test-args.ts`, `scripts/lib/ungated-tests.ts`, `scripts/check-ci-gating.ts`, `playwright.a11y.config.ts`, `tests/unit/playwright-test-args.test.ts`, `tests/unit/ungated-tests.test.ts`, `tests/unit/playwright-result-paths.test.ts`, `docs/operations/ci-quality-gates.md` | `32982e55` | +| [보안] | telemetry payload 정제가 복사하는 값의 총수를 `maxNodes`(기본 512)로 막는다. 같은 객체를 여러 key가 가리키는 payload(정규화된 엔티티 graph 등)를 경로마다 따로 복사해, `emit` 한 번이 호출 스택을 수 초 막거나 heap OOM으로 탭을 죽였다. 여러 경로가 가리키는 객체의 key는 한 번만 읽는다. 순회가 너비 우선이 되어 상한이 차면 얕은 필드가 남고 깊은 값이 `[truncated]`가 된다. 복사본 객체의 key 순서가 원본 순서가 된다(전에는 거꾸로, fingerprint는 그대로). 깊이 제한 시험이 잘린 모양과 순환 payload를 단언한다 | `src/platform/telemetry/redact-telemetry.ts`, `src/platform/telemetry/telemetry-pipeline.ts`, `tests/platform/telemetry/redact-telemetry.test.ts`, `config/scale/feature-shape-ceilings.json` | `d406c10b`, `0190b631` | ### 그 밖의 변경 -- 2.54.0