fix(scale): perContext 기록 대조 바닥을 64 B로 넓힌다 #87

Merged
donghyeon.kang merged 3 commits from donghyeon.kang/fix/per-context-record-floor AGit into main 2026-11-21 06:37:45 +00:00
4 changed files with 41 additions and 10 deletions
+1
View File
@@ -175,6 +175,7 @@ Gitea runner에서 merge 단계를 초록으로 만들고, worker를 늘리지
| 제거 drill의 사본 준비(`prepareRemovalFixture`)가 checkout에 없는 `optional` 등록부 항목(`recipes`)을 건너뛴다. 없는 필수 경로에서는 cp의 ENOENT 스택 대신, 사본 폴더를 비우기 전에 그 경로와 고르는 등록부 항목, 고칠 곳(경로를 되살리거나 항목을 지우거나 그 항목의 `setPaths`에서 빼기)을 대고 멈춘다. 등록부가 고르지 않는 경로도 이름으로 댄다. 매뉴얼 03 R1이 추적하는 항목도 drill 사본이나 제품 사본에 없을 수 있으면 `optional`로 적으라고 한다 | `scripts/lib/removal-fixture.ts`, `tests/unit/removal-fixture.test.ts`, `docs/manual/03-outside-feature-folder.md` | `44453592` |
| FE-GATE-013의 시스템 컨테이너 래퍼(`scripts/run-in-system-container.sh`)가 게이트 도중 TERM·INT·HUP(시간 초과, Ctrl-C, 터미널 끊김)을 받으면 그때까지 쌓인 `artifacts/`를 되가져오고 컨테이너를 지운 뒤 그 신호로 끝난다. 게이트 전에 받으면 컨테이너만 지우고 그 신호로 끝난다. 고치기 전에는 게이트 도중 TERM·HUP에 증거 없이 끝났고, 게이트 전 Ctrl-C에는 부팅·복사를 이어 가 게이트까지 돌았고, `docker run` 도중의 신호에는 컨테이너가 남았다. 컨테이너 이름은 `fe-system-container-<uuid>`이고 정리는 이름으로 지운다. 게이트 로그는 끝날 때 쓰므로 신호로 끊긴 실행에서는 오지 않는다. SIGKILL 뒤 남은 컨테이너를 찾아 지우는 명령은 운영 문서 FE-GATE-013 절에 있다 | `scripts/run-in-system-container.sh`, `tests/unit/ci-gate-host-environment.test.ts`, `docs/operations/ci-quality-gates.md` | `b5f28e52` |
| 노트북 `scripts/verify.sh docs`(`scripts/check-work-docs.py`)가, 기능 제거 드릴이 사본에서만 지우는 시험(`scripts/test-sample-removal.ts`의 `excludedFixtureTest` 목록)을 드릴 사본의 `verify:documentation`이 경로로 읽는 자리에 적으면 `file:line`으로 실패한다. 그 자리는 드릴이 복사하는 살아 있는 문서의 백틱 경로·명령 인자·상대 링크와 기록 문서 머리 블록의 「현재 정본」「대체」「대체됨」이다. 전에는 desktop FE-GATE-020에서야 드러났다. 그런 시험은 폴더와 파일 이름을 따로 적는다(`tests/unit/`의 `removal-fixture.test.ts`). 드릴은 `package.json`의 `test:sample-removal`로 찾는다. 그 script가 읽을 드릴 파일을 가리키지 않으면 「runs no drill file」, 목록을 못 찾으면 「was not found」, 목록에 큰따옴표 경로 말고 다른 것(펼침·작은따옴표)이 있으면 「holds more than double-quoted paths」로 실패한다. 이 규칙의 정본은 TypeScript이고, Python으로 다시 쓴 쪽과 어긋나면 `scripts/tests/test_check_work_docs.py`가 실패한다 | `scripts/check-work-docs.py`, `scripts/tests/test_check_work_docs.py`, `scripts/test-sample-removal.ts`, `docs/operations/adapter-remediation-ledger.md` | `d87f6792` |
| FE-GATE-005의 기능 모양 기록 대조(`initialJavascriptRecordDrift`)가 `perContextGzipBytes` 칸만 바닥 64 B로 본다(전에는 16 B). 이 칸은 커밋 사이에서 2~28 B를 오가, 초기 청크를 바꾼 PR이 먼저 병합된 뒤 다른 PR이 낡은 base에서 잰 기록을 쓰면 main이 빨강이 됐다. 다른 칸의 16 B, 합계 256 B, context 상한 512 B는 그대로다. 소유자 결정 DES-DEC-0002(`docs/work/reference/decisions.md` 2.2절) | `scripts/scale/measure-feature-shape-growth.ts`, `tests/unit/feature-shape-growth.test.ts`, `docs/work/reference/decisions.md` | `e21a8355` |
## 미출시 — `8327e221` → 하네스와 작업 매뉴얼
+1
View File
@@ -76,6 +76,7 @@
| FE-6 `@a11y` 시험은 FE-GATE-009에서만 | 2026-11-20 | round9 R9-D11을 바꾼다. FE-GATE-008의 `test:e2e`는 이름에 `@a11y`가 붙은 시험을 빼고(`--grep-invert @a11y`) 돈다. 그 시험은 FE-GATE-009의 `test:a11y`가 자기 실행으로 돈다. `test:a11y`의 설정(`playwright.a11y.config.ts`)은 e2e 설정을 펼치고 결과 경로만 바꾼다(2026-11-20, 008의 e2e 결과를 덮던 것을 고침). 그래서 그 시험이 도는 project(chromium·firefox·webkit)도 같고, 결과 경로 시험(`tests/unit/playwright-result-paths.test.ts`)이 결과 경로 밖 설정이 같은지 본다. 전제(게이트마다 증거를 새로 만든다)는 그대로다. 버린 안(FE-GATE-009가 FE-GATE-008 결과를 읽기)도 계속 버린다. 이유: merge browser job이 같은 `@a11y` 시험 33개를 두 번 돌았다. 대가: FE-GATE-008만 돌리면 `@a11y` 시험(axe 스캔, 생성 기능 목록의 빈·오류 상태 화면)은 돌지 않는다. 재검토: CI run에서 FE-GATE-008이 돌고 FE-GATE-009가 돌지 않는 경우(단계에서 009를 빼기, 두 게이트를 다른 조건의 job으로 나누기, PR 경로표)가 생기면 그 run에서 `@a11y` 시험이 돌지 않으므로 되돌린다. a11y 설정이 결과 경로 밖에서 e2e 설정과 달라지면 그 시험이 도는 브라우저를 다시 대조한다 | 총괄(2026-11-20): 소유자 2026-11-19 CI 속도 지시, design-docs `ci/06-frontend-ci-speed-handoff.md` 4.1절 |
| FE-7 main job도 의존성 캐시 | 2026-11-20 | 2026-11-13 「의존성 캐시는 merge job만」을 바꾼다. main job(`main_gate`, FE-GATE-029·030)도 merge job 셋과 같은 키·경로로 캐시를 복원한다. 저장은 그대로 main run만 하고, 설치는 그대로 `--frozen-lockfile`이다. release·promotion·provider job은 그대로 매번 새로 설치한다. 이유: main job만 install이 15~24초였다(merge job은 1~2초). main job은 공급망 증거를 만들지 않는다. 재검토: main job이 공급망 증거를 만들게 되면 release·promotion job처럼 매번 새로 설치하게 되돌린다. main run 로그의 install step이 캐시를 복원해도 줄지 않으면 캐시 step을 뺀다 | 총괄(2026-11-20): design-docs `ci/06-frontend-ci-speed-handoff.md` 4.2절 |
| FE-4 005 안 일반 실행 빼기 | 2026-11-20 | FE-GATE-005는 `tests/unit`·`tests/contract`를 `test:coverage`에서 한 번만 돈다. `test:unit`·`test:contract` 명령을 게이트에서 빼고, 같은 coverage 실행에서 `scripts/lib/coverage-bundle-junit-reporter.ts`가 `artifacts/tests/unit.xml`·`contract.xml`을 쓴다. 증거 이름과 게이트 ID는 그대로이고, 두 증거는 FE-GATE-005의 명령이 그 실행 중에 새로 만든다. 전제(게이트마다 증거를 새로 만든다)는 그대로다. 버린 안: coverage 실행 한 번이 FE-GATE-004·006·007의 증거까지 내기(design-docs `ci/04-…` R-3 (가), 약 −1:30). 그 세 게이트가 FE-GATE-005의 결과를 읽게 되어 FE-6에서 버린 꼴과 같다: coverage 실행이 죽으면 세 게이트도 판정을 못 내고, 혼자 돌릴 수 없다. 004는 005보다 앞이라 차례도 바꿔야 했다. 이유: FE-GATE-005 안에서 같은 시험 파일을 두 번 돌았다(약 0:57). 대가: unit·contract 시험은 이제 coverage 계측 아래에서만 돈다. 시간에 기대는 시험이 가려질 수 있다. 004·006·007의 묶음은 coverage에서 한 번 더 돈다(약 0:33). 재검토: coverage 실행에서 안 보이고 일반 실행에서만 보이는 unit·contract 실패가 나오면 일반 실행을 되돌린다. Vitest를 올릴 때는 reporter가 그 JUnit reporter에 기대므로 분할한 보고서를 일반 실행과 다시 대조한다 | 총괄(2026-11-20): 소유자 2026-11-19 CI 속도 지시, design-docs `ci/06-frontend-ci-speed-handoff.md` 4.3·6.2절 |
| DES-DEC-0002 perContext 기록 대조 바닥 | 2026-11-21 | FE-GATE-005의 기록 대조(`initialJavascriptRecordDrift`, `scripts/scale/measure-feature-shape-growth.ts`)에서 perContextGzipBytes 칸만 바닥을 16 B에서 64 B로 넓힌다(`PER_CONTEXT_RECORD_TOLERANCE_BYTES`). 다른 비용 칸의 16 B, 합계 256 B, context 상한 512 B·기능 상한 1 KiB, `config/scale/feature-shape-ceilings.json`은 그대로다. D-6(프론트 main 뒤처짐 막기 끔)도 그대로 둔다: 2026-11에 센 다시 볼 조건(합치면 깨지는 변경으로 한 주 두 번 넘게 빨강)이 W46 1회·W47 0회로 채워지지 않았다. 이유(확인한 사실): 이 칸은 한 커밋에서는 같은 값이고 커밋 사이에서는 2~28 B(잰 값과 기록, 최대 차 26 B)를 오간다. 초기 청크를 바꾼 PR이 먼저 병합된 뒤 다른 PR이 낡은 base에서 잰 기록을 쓰면 main이 빨강이 됐다(#56 병합 `e98d8ee9`, 기록 28·빌드 7). 64 B는 그 최대 차의 두 배 넘게, context 상한의 1/8이다. 게이트 문턱을 넓히는 일이라 소유자가 정했다(꼭 지킬 것 4). 버린 안: 둘 다 그대로(PR을 하나씩 최신 main에서 여는 관행이 깨지면 같은 빨강), 뒤처짐 막기 켬(병합마다 갱신 run 15~24분), context 여럿 평균(줄일 잡음이 있는지 모르고 측정 시간이 는다), perContext 대조 빼기(기록이 낡아도 못 잡는다). 대가: 기록이 빌드와 64 B까지 달라도 통과한다. 재검토: 64 B 바닥에서도 perContext 기록 불일치로 main이 빨강이 되거나, 합치면 깨지는 변경으로 main이 한 ISO 주에 두 번 넘게 빨강이 된다 | 소유자 결정(2026-11-21, 답 원문 「전부 권함대로」): design 허브 DES-DEC-0002(repo 밖, 항목 DES-FE-0007) |
| 구조·기술 결정 기록 | 2026-07-26~ | `VD-01`~(빈 번호 있음) | `docs/adr/` |
## 3. 결정 대기 쓰는 법
+19 -6
View File
@@ -293,14 +293,27 @@ export const INITIAL_JAVASCRIPT_RECORD_TOLERANCE_BYTES = 256;
* Fields of the record that no longer describe the build. The total may be
* INITIAL_JAVASCRIPT_RECORD_TOLERANCE_BYTES off; the first-feature,
* per-feature and per-context costs are differences of builds with the same
* id, so 10%, and at least COST_RECORD_TOLERANCE_BYTES: a context costs a few
* bytes now, and gzip moves a difference that small by a byte or two when
* the build id changes. The file count is exact.
* id, so 10%, and at least COST_RECORD_TOLERANCE_BYTES (the per-context cost
* at least PER_CONTEXT_RECORD_TOLERANCE_BYTES): a context costs a few bytes
* now, and gzip moves a difference that small by a byte or two when the
* build id changes. The file count is exact.
*/
export const COST_RECORD_TOLERANCE_BYTES = 16;
function costTolerance(bytes: number): number {
return Math.max(Math.abs(bytes) * 0.1, COST_RECORD_TOLERANCE_BYTES);
/**
* DES-DEC-0002 (owner, 2026-11-21). The per-context cost repeats on one
* commit but moves between commits: measured and recorded values run from
* 2 to 28 B, at most 26 B apart. With 16 B, a record measured on a base
* older than another merged change to the initial chunk turned main red
* (e98d8ee9: record 28, build 7). 64 B is over twice that widest gap and an
* eighth of the 512 B a context may cost, a ceiling
* tests/unit/feature-shape-growth.test.ts still asserts on the build. Under
* that ceiling 10% is at most 51 B, so this floor decides.
*/
export const PER_CONTEXT_RECORD_TOLERANCE_BYTES = 64;
function costTolerance(bytes: number, floor = COST_RECORD_TOLERANCE_BYTES): number {
return Math.max(Math.abs(bytes) * 0.1, floor);
}
export function initialJavascriptRecordDrift(
@@ -312,7 +325,7 @@ export function initialJavascriptRecordDrift(
files: 0,
firstFeatureGzipBytes: costTolerance(measured.firstFeatureGzipBytes),
perFeatureGzipBytes: costTolerance(measured.perFeatureGzipBytes),
perContextGzipBytes: costTolerance(measured.perContextGzipBytes),
perContextGzipBytes: costTolerance(measured.perContextGzipBytes, PER_CONTEXT_RECORD_TOLERANCE_BYTES),
};
return (Object.keys(allowed) as (keyof InitialJavascriptCosts)[])
.filter((field) => Math.abs(record[field] - measured[field]) > allowed[field])
+20 -4
View File
@@ -229,11 +229,27 @@ describe("feature-shape growth measurement (11-04)", () => {
expect(
initialJavascriptRecordDrift(measured, { ...measured, perFeatureGzipBytes: 800 }),
).toEqual(["perFeatureGzipBytes: record 800, build 700"]);
// A cost of a few bytes keeps a floor: gzip moves it by a byte or two.
const tiny = { ...measured, perContextGzipBytes: 4 };
// A cost of a few bytes keeps a floor. The per-context cost measured
// 2 to 28 B on different commits (DES-DEC-0002), so its floor is 64 B: a
// record written on an older base still describes the build.
const tiny = { ...measured, firstFeatureGzipBytes: 4, perFeatureGzipBytes: 4, perContextGzipBytes: 4 };
expect(initialJavascriptRecordDrift(tiny, { ...tiny, perContextGzipBytes: 6 })).toEqual([]);
expect(initialJavascriptRecordDrift(tiny, { ...tiny, perContextGzipBytes: 30 })).toEqual([
"perContextGzipBytes: record 30, build 4",
expect(initialJavascriptRecordDrift(tiny, { ...tiny, perContextGzipBytes: 30 })).toEqual([]);
expect(initialJavascriptRecordDrift(tiny, { ...tiny, perContextGzipBytes: 68 })).toEqual([]);
expect(initialJavascriptRecordDrift(tiny, { ...tiny, perContextGzipBytes: 69 })).toEqual([
"perContextGzipBytes: record 69, build 4",
]);
expect(initialJavascriptRecordDrift(tiny, { ...tiny, perContextGzipBytes: 80 })).toEqual([
"perContextGzipBytes: record 80, build 4",
]);
// The other costs keep 16 B: the per-context floor is not theirs.
expect(initialJavascriptRecordDrift(tiny, { ...tiny, perFeatureGzipBytes: 20 })).toEqual([]);
expect(initialJavascriptRecordDrift(tiny, { ...tiny, perFeatureGzipBytes: 21 })).toEqual([
"perFeatureGzipBytes: record 21, build 4",
]);
expect(initialJavascriptRecordDrift(tiny, { ...tiny, firstFeatureGzipBytes: 20 })).toEqual([]);
expect(initialJavascriptRecordDrift(tiny, { ...tiny, firstFeatureGzipBytes: 21 })).toEqual([
"firstFeatureGzipBytes: record 21, build 4",
]);
});