Skip to content

test(ci-workflows): add file-size ratchet gate - #4636

Merged
lidge-jun merged 13 commits into
codex/m2k-l1-roadmapfrom
codex/m2k-l2-ratchet
Sep 14, 2026
Merged

lidge-jun merged 13 commits into
codex/m2k-l1-roadmapfrom
codex/m2k-l2-ratchet

Conversation

@lidge-jun

Copy link
Copy Markdown
Owner

Summary

새 파일이 2,000줄 이상으로 태어나거나 기존 초과 파일이 더 길어지는 것을 CI에서 막는다. 지금 dev에는 사람이 유지하는 2,000줄 이상 파일이 51개 있고, 이 PR은 그것들을 현재 길이로 고정하기만 한다. 파일을 쪼개지는 않는다.

bun test에 얹는 이유는 base SHA를 git으로 구할 수 없기 때문이다. .github/workflows/ci.ymlactions/checkout은 전부 기본 fetch-depth: 1이고(:289-293fetch-depth: 0을 명시적으로 거부한다) PR 체크아웃은 refs/pull/N/merge 단일 커밋이라 origin/dev도 merge-base도 없다. 그래서 기준선을 저장소에 커밋된 숫자로 둔다.

판정은 다섯 가지다. 기준선에 없고 2,000줄 이상이면 NEW_OVERSIZED로 실패, 기준선보다 길어지면 GREW로 실패, 줄어들면 통과하고 bun run ratchet:update가 캡을 내려 되돌아올 수 없게 한다. generated 12경로는 면제다. devlog/, assets/, docs-site 정적 자산, gui/dist, bun.lock과 화이트리스트 밖 확장자는 애초에 스캔하지 않는다.

면제는 정확 경로만 받고 glob은 쓰지 않는다. src/adapters/cursor/gen/ 아래에 손으로 쓴 파일이 새로 생기면 그것은 면제 대상이 아니라 새 초과 파일이어야 하기 때문이다.

scripts/test-layout/layout.jsonci-workflows 시드 정규식에는 file-를 넣지 않았다. 넣으면 앞으로 생길 다른 file-*.test.ts까지 이 도메인으로 끌어들인다. 대신 explicit 목록 양쪽에 한 줄씩만 추가했고, tests/test-layout-tooling.test.ts가 두 목록의 완전일치를 요구하므로 한쪽만 고치면 적색이 된다.

Verification

  • bun scripts/file-size-ratchet.tsfile-size ratchet passed
  • bun scripts/file-size-ratchet.ts --updatewrote tests/fixtures/file-size-baseline.json (51 caps), generated 12경로 / files 51항목
  • 세 JSON 파일 파싱 확인
  • 로컬 full suite·typecheck·install은 실행하지 않았다. 이 워크트리에 node_modules가 없고 사용자 환경에서 스위트를 돌리지 않는 제약이 있어, 나머지 검증은 이 PR head의 hosted CI가 증거다.
  • prepush 문자열을 고정하는 tests/ci-workflows/ci-workflows.test.ts:5294는 건드리지 않았다. ratchet:update는 키 추가만 한다.

Checklist

  • Scope stays focused and avoids unrelated cleanup.
  • Docs or release notes were updated when needed.
  • Security-sensitive changes were reviewed for secrets, auth, and unsafe defaults.

Fails when a new tracked text file lands at 2000+ lines or an already-oversized file grows past its committed cap. Seeds 51 caps and 12 exact generated exemptions. No file is split here.
@lidge-jun
lidge-jun requested a review from Ingwannu as a code owner September 14, 2026 15:02
@coderabbitai

coderabbitai Bot commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

🗂️ Base branches to auto review (2)
  • ^dev$
  • ^preview$

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Advanced

Run ID: d03b9574-3194-4472-8f35-f66734eec261

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 14, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-14T15:06:34.825260Z 45fca0a PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions github-actions Bot added the chore Maintenance, CI, tests, refactors, or build changes (not a user-facing bug or feature). label Sep 14, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Deterministic PR hygiene checks passed.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 45fca0ad62

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +196 to +198
const baseline = loadBaseline(
readFileSync(repoPath("tests/fixtures/file-size-baseline.json"), "utf8"),
);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Validate cap changes against the previous baseline

When a PR grows a grandfathered file and edits file-size-baseline.json to the new line count, this repository test loads only that modified fixture, so evaluate() reports UNCHANGED and CI passes. The restriction in ratchet:update does not enforce the invariant because the JSON can be edited directly; compare fixture changes with a trusted base revision and reject increased or newly grandfathered caps.

Useful? React with 👍 / 👎.

const current = scanRepo(repoRoot);
if (process.argv.includes("--update")) {
const next = updateBaseline(current, baseline, !existed);
writeFileSync(baselinePath, `${JSON.stringify(next, null, 2)}\n`);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Write the baseline using atomic replacement

If ratchet:update is interrupted or the write fails after truncation, this direct overwrite can leave the committed baseline as partial JSON, after which both the test and subsequent update attempts fail in loadBaseline() and require manual recovery. Write a temporary file in the same directory and rename it over the baseline only after the complete write succeeds.

AGENTS.md reference: scripts/AGENTS.md:L16-L16

Useful? React with 👍 / 👎.

@lidge-jun

Copy link
Copy Markdown
Owner Author

리뷰 · 우선순위 55 / 80

이 PR은 #4546 비용 가드 스택이 아니라 godfile round2 / 파일 크기 ratchet 레인입니다. base는 codex/m2k-l1-roadmap이고, 형제 #4635(docs plan)는 이미 grok-bot 리뷰가 있습니다. 지금 dev에 2,000줄 초과 파일이 51개 있다는 전제 아래, 새로 태어나는 초과·기존 초과 파일의 추가 성장을 CI에서 막습니다. 쪼개기는 하지 않고 기준선만 고정합니다.

actions/checkout이 fetch-depth 1·refs/pull/N/merge라 git merge-base를 못 쓰는 제약을 정직하게 적었고, 그래서 기준선을 저장소에 커밋된 tests/fixtures/file-size-baseline.json으로 둡니다. bun test에 얹는 이유도 그 제약 때문입니다.

판정은 다섯 가지입니다. 기준선에 없고 2,000줄 이상이면 NEW_OVERSIZED, 기준선보다 길어지면 GREW, 줄어들면 통과 후 ratchet:update로 캡을 내려 되돌리지 못하게 합니다. generated 12경로는 정확 경로 면제(glob 없음)라서 src/adapters/cursor/gen/ 아래 손 파일이 면제로 새지 않게 한 것도 좋습니다. test 1/4·2/4·3/4·4/4는 이미 녹색입니다.

라인 CI enforce-target - 이 PR base가 dev/preview가 아니라 codex/m2k-l1-roadmap이라 enforce-target이 실패합니다. 스택·로드맵 기차면 예상 가능하지만, dev에 랜딩할 때는 base를 dev로 옮긴 뒤 게이트를 다시 봐야 합니다.

경로 tests/fixtures/file-size-baseline.json - 51개 캡이 한 번에 들어갑니다. 기준선 생성 시각·커밋 SHA를 픽스처나 스크립트 주석에 남겨 두면, 나중에 「왜 이 숫자인가」 논쟁을 줄입니다.

경로 scripts/file-size-ratchet.ts - devlog/·정적 자산·bun.lock 제외는 타당합니다. 다만 structure/ 마크다운이 스캔 대상인지 한 번만 확인하세요. 문서가 기준선을 불필요하게 키우면 ratchet 신호가 흐려집니다.

메인테이너의 판단이 필요한 지점

너의 추천
방향은 좋습니다. base를 dev로 맞추거나 로드맵 기차를 명시한 뒤, test 샤드가 이미 녹색인 상태를 유지한 채 enforce-target만 정리하고 머지하세요. #4546 스택이 core.ts를 더 키우기 전에 ratchet이 먼저 있으면 「더 길어지기만 하는 것」을 초기에 막을 수 있습니다.

이 댓글은 grok-bot이 작성했습니다

Pure move. state.ts 2432 -> 1355 with five leaves under src/responses/state/, shim.ts 2466 -> 1246 with six shim-* leaves. Public export surfaces are byte-identical in name; consumers keep their import paths.
Pure move. inject.ts 2342 -> 987 with five leaves, catalog/sync.ts 2698 -> 52 with seven leaves. INV-TOML-01 moves to inject/config-toml.ts and INV-AGENT-01 to catalog/subagent-roster.ts. Three source oracles that read these files as text are repointed in the same commit.
Pure move. routing.ts 3507 -> 1475 with six leaves, quota.ts 3313 -> 558 with five leaves. Dispatchers that would close a cycle stay on the facade. Retry budget scope is unchanged; no new attempt counter exists in any leaf.
Three identifiers lost their binding when the leaves were cut: the spill write-status types were re-exported from state.ts but never imported for local use, snapshot-codec lost OcxProviderContinuationState, and spill-queue lost existsSync. Caught by the translator-budget typecheck fixture on CI.
lidge-jun and others added 7 commits September 15, 2026 01:30
The inject and catalog leaves imported six symbols from modules that never exported them. Each one is re-pointed at where it is actually defined: parsing, account-models, subagent-roster, paths, desired-state. Import paths only; no declaration moved.
…ta split

Fifteen symbols lost their binding: leaves that defined a symbol never exported it, quota type imports pointed at src/types instead of providers/quota-types, and isModelDetourAffinityScope lost its definition entirely while its call site survived. Imports and exports only; no declaration was moved or rewritten.
The leaf sits one directory deeper than routing.ts, so ../config resolved to src/codex/config, which does not exist. Every test shard that loaded the routing graph failed at import time.
refactor(codex,providers): split routing and quota behind facades
refactor(codex): split inject and catalog sync behind facades
refactor(responses,codex): split state and shim behind facades
@lidge-jun
lidge-jun merged commit f9e2ee0 into codex/m2k-l1-roadmap Sep 14, 2026
27 checks passed
@lidge-jun
lidge-jun deleted the codex/m2k-l2-ratchet branch September 14, 2026 17:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore Maintenance, CI, tests, refactors, or build changes (not a user-facing bug or feature).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant