Skip to content

chore: enforce max-lines suppression ratchet#107315

Merged
steipete merged 19 commits into
mainfrom
codex/max-lines-ratchet
Jul 14, 2026
Merged

chore: enforce max-lines suppression ratchet#107315
steipete merged 19 commits into
mainfrom
codex/max-lines-ratchet

Conversation

@steipete

@steipete steipete commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

Resolves a maintainer tooling problem where changed-file line-count gates created refactor and generated-file friction while still leaving no durable control over new lint suppressions.

Why This Change Was Made

This replaces changed-file LOC comparisons with a suppression-baseline ratchet:

  • Oxlint enforces file budgets of 700 lines for normal JS/TS and JSX/TSX, 800 for MJS/CJS, and 1000 for tests/specs across src/, ui/src/, packages/, and extensions/.
  • Generated output is excluded.
  • The 1,231 current over-budget files carry an explicit TODO suppression and live in a checked-in baseline.
  • The baseline may only shrink. New suppressions fail, including disable-all and multiline directives; staged checks read the index snapshot.
  • Changed checks and CI run the ratchet against an authenticated base. The release-gate fallback validates the selected PR's current synthetic merge tree before dependency setup.

This is lower friction than the prior changed-file LOC gate: renames and refactors pass unless they add a new suppression, generated files never enter the policy, and existing debt does not block unrelated work. Maintainer confirmation: this is the explicitly requested replacement design; landing remains gated on exact-head hosted CI.

AI-assisted: yes (Codex). I understand and reviewed the implementation.

User Impact

No end-user behavior change. Contributors get predictable file-size enforcement: split new oversized files instead of adding a suppression, while existing debt can only decrease.

Evidence

  • Exact head: e92c4b3c8db5036605a7781688aa4a805a87a35c
  • Hosted exact-head CI 29348526544: 48 jobs passed, including the ratchet, lint, test types, build, QA smoke, and all test shards; 8 jobs skipped by scope.
  • AWS Crabbox run run_b55d7d37048c: 6 focused files / 385 tests passed after the final rebase.
  • AWS Crabbox run run_af3e4f6869a5: full UI i18n verification and all Oxlint shards passed after pruning debt resolved by main.
  • Blacksmith Testbox lease tbx_01kxgjn5art64s9f07zdn5s5we: 6 focused files / 385 tests, test types, the prior 1,232-entry ratchet, and full governed-tree Oxlint passed on the preceding clean rebase.
  • Blacksmith Testbox run 29343115204: generated-locale exclusion, 80 focused tests, full governed-tree Oxlint, and the 1,232-entry ratchet passed.
  • Blacksmith Testbox run 29337793947: 58 CI workflow tests passed for exact PR merge-parent validation.
  • Blacksmith Testbox run 29339046361: 11 ratchet tests, scoped Oxlint, older-Git staged framing, and the then-current baseline check passed.
  • Fresh autoreview of the final debt-pruning delta: clean. Whole-branch review had no accepted/actionable finding; one diagnostic-location claim was rejected against direct Oxlint source and the full-tree pinned-binary run because the rule deliberately anchors its diagnostic at EOF for this suppression form.
  • git diff --check

The separate precise OpenGrep scan reports six existing Discord test literals because the baseline comments make those files part of the PR diff. The aggregate CodeQL check reports an existing process-local HMAC as a password hash for the same reason. No scanner suppression or runtime change is included.

@steipete
steipete requested a review from a team as a code owner July 14, 2026 08:55
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation channel: discord Channel integration: discord channel: imessage Channel integration: imessage channel: line Channel integration: line channel: matrix Channel integration: matrix channel: mattermost Channel integration: mattermost channel: msteams Channel integration: msteams channel: signal Channel integration: signal channel: slack Channel integration: slack channel: telegram Channel integration: telegram channel: tlon Channel integration: tlon channel: voice-call Channel integration: voice-call channel: whatsapp-web Channel integration: whatsapp-web channel: zalo Channel integration: zalo channel: zalouser Channel integration: zalouser app: web-ui App: web-ui gateway Gateway runtime extensions: diagnostics-otel Extension: diagnostics-otel extensions: memory-core Extension: memory-core extensions: memory-lancedb Extension: memory-lancedb cli CLI command changes scripts Repository scripts commands Command implementations docker Docker and sandbox tooling agents Agent runtime and tooling channel: feishu Channel integration: feishu extensions: device-pair extensions: phone-control extensions: acpx labels Jul 14, 2026
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Jul 14, 2026
@clawsweeper

clawsweeper Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge. Reviewed July 14, 2026, 9:09 AM ET / 13:09 UTC.

Summary
The PR replaces changed-file TypeScript line-count checks with Oxlint max-lines budgets, a 1,236-file grandfathered suppression baseline, staged/worktree ratchet checks, and authenticated release-gate CI routing.

Reproducibility: yes. from source and routing evidence: a PR that only changes a fast-only governed TypeScript file can push it over 700 effective lines without a suppression, causing the suppression ratchet to pass while the full lint shard is skipped. This review did not execute the fixture because the checkout is read-only.

Review metrics: 2 noteworthy metrics.

  • Grandfathered suppression debt: 1,236 baseline entries. This is the initial debt surface the new policy must keep monotonic and auditable without allowing new suppressions.
  • Release-gate dispatch contract: 1 workflow input renamed. Existing maintainer commands using pr_number require a refreshed PR head and the new pull_request_number input.

Stored data model
Persistent data-model change detected: migration/backfill/repair: config/max-lines-baseline.txt, unknown-truncated-pull-files. Confirm migration or upgrade compatibility proof before merge.

Merge readiness
Overall: 🦐 gold shrimp
Proof: 🦞 diamond lobster ✨ media proof bonus
Patch quality: 🦐 gold shrimp
Result: needs maintainer review before merge.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • [P2] Add fast-only CI enforcement for the underlying max-lines rule and a regression fixture that fails on an unsuppressed over-budget governed file.
  • [P2] Re-run exact-head hosted CI after the repair.

Risk before merge

  • [P1] A PR routed only through the fast Node path can grow a governed file beyond its Oxlint budget without adding a suppression, because the suppression ratchet and actual max-lines lint are separate checks.
  • [P1] The release-gate workflow input rename means older PR heads and copied operator commands using pr_number stop working until the head is refreshed and the invocation is updated.

Maintainer options:

  1. Close the fast-lane gap (recommended)
    Run Oxlint max-lines enforcement for changed governed files in the fast ratchet lane and add a fast-only routing regression fixture before merge.
  2. Accept partial enforcement
    Merge with an explicit maintainer decision that fast-only changes may exceed the budget until a later full-lint run catches them.

Next step before merge

  • [P2] A focused automated repair can close the concrete fast-only enforcement gap without revisiting the maintainer-confirmed suppression-ratchet direction.

Security
Cleared: The workflow changes use read-only repository permissions and authenticated PR/merge-tree validation, with no concrete new secret, permission, dependency, or third-party code-execution concern found.

Review findings

  • [P2] Run max-lines lint in every governed fast lane — .oxlintrc.json:291
Review details

Best possible solution:

Keep the suppression-only debt ratchet, but make every governed fast path execute the actual max-lines check on changed files and add a fixture proving an unsuppressed fast-only file over budget fails; retain authenticated merge-tree validation and the documented release-gate refresh path.

Do we have a high-confidence way to reproduce the issue?

Yes, from source and routing evidence: a PR that only changes a fast-only governed TypeScript file can push it over 700 effective lines without a suppression, causing the suppression ratchet to pass while the full lint shard is skipped. This review did not execute the fixture because the checkout is read-only.

Is this the best way to solve the issue?

No, not yet: replacing the old LOC comparison with a suppression ratchet is the better direction, but it is only complete when all governed CI routes also run the underlying max-lines rule.

Full review comments:

  • [P2] Run max-lines lint in every governed fast lane — .oxlintrc.json:291
    The fast-only route can execute the suppression-baseline ratchet while skipping the full Oxlint shard, so a changed governed file can exceed its configured budget without adding a suppression and still pass CI. Make this lane run the actual max-lines rule on changed governed files and cover a fast-only over-budget fixture; this re-raises the still-applicable concern already posted in the PR discussion.
    Confidence: 0.94

Overall correctness: patch is incorrect
Overall confidence: 0.93

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against a34bed409d49.

Label changes

Label changes:

  • add P2: This is a normal-priority maintainer tooling improvement with a bounded CI enforcement defect and no end-user runtime impact.
  • add merge-risk: 🚨 automation: The PR changes CI routing, lint enforcement, and release-gate dispatch behavior, and one fast-only route can miss the new max-lines policy.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR provides linked exact-head Testbox output demonstrating the ratchet, Git fixtures, staged/worktree behavior, Windows handling, full Oxlint, and relevant CI lanes; the remaining fast-only defect is a correctness gap rather than absence of real proof.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦞 diamond lobster and patch quality is 🦐 gold shrimp.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Sufficient (linked_artifact): The PR provides linked exact-head Testbox output demonstrating the ratchet, Git fixtures, staged/worktree behavior, Windows handling, full Oxlint, and relevant CI lanes; the remaining fast-only defect is a correctness gap rather than absence of real proof.

Label justifications:

  • P2: This is a normal-priority maintainer tooling improvement with a bounded CI enforcement defect and no end-user runtime impact.
  • merge-risk: 🚨 automation: The PR changes CI routing, lint enforcement, and release-gate dispatch behavior, and one fast-only route can miss the new max-lines policy.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦞 diamond lobster and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Sufficient (linked_artifact): The PR provides linked exact-head Testbox output demonstrating the ratchet, Git fixtures, staged/worktree behavior, Windows handling, full Oxlint, and relevant CI lanes; the remaining fast-only defect is a correctness gap rather than absence of real proof.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR provides linked exact-head Testbox output demonstrating the ratchet, Git fixtures, staged/worktree behavior, Windows handling, full Oxlint, and relevant CI lanes; the remaining fast-only defect is a correctness gap rather than absence of real proof.
Evidence reviewed

Acceptance criteria:

  • [P1] node scripts/run-vitest.mjs max-lines-ratchet.
  • [P1] pnpm check:max-lines-ratchet.
  • [P1] Run the focused CI workflow-routing tests covering runNodeFastOnly and checks-fast-max-lines-ratchet.
  • [P1] Run exact-head hosted CI and confirm both the ratchet and relevant lint enforcement pass.

What I checked:

  • Fast-only enforcement gap: The review discussion identifies a concrete path where runNodeFastOnly skips the full lint shard and checks-fast-max-lines-ratchet checks suppression growth without executing the configured Oxlint max-lines rule; the final two commits after that comment are described as debt pruning and a Windows fixture skip rather than a CI-lane enforcement repair. (.github/workflows/ci.yml, 2dfd8cbfe6c2)
  • Configured budgets: The PR adds 700-line normal JS/TS and JSX/TSX budgets, an 800-line MJS/CJS budget, and a 1,000-line test/spec budget under the governed trees while excluding generated output. (.oxlintrc.json:274, 2dfd8cbfe6c2)
  • Grandfathered debt ratchet: The checked-in baseline contains 1,236 existing oversized paths and states that entries may only be removed, while matching files receive explicit TODO suppressions. (config/max-lines-baseline.txt:1, 2dfd8cbfe6c2)
  • Exact-head proof: The PR body links repeated Blacksmith Testbox runs for the exact head, including focused ratchet tests, staged/worktree checks, Windows portability coverage, full governed-tree Oxlint, format, and repository test lanes; this strongly proves the exercised paths but not the fast-only bypass scenario. (2dfd8cbfe6c2)
  • Current-main necessity: The supplied repository state identifies current main as a34bed409d490d13a6ccab496f81f4542ee714ec, while this open PR head contains the new baseline, Oxlint overrides, scripts, and workflow changes; the replacement is not already implemented on main. (.oxlintrc.json:274, a34bed409d49)
  • Workflow compatibility change: The release-gate dispatch input changes from pr_number to pull_request_number, and the maintainer skill instructions require older PR heads to refresh from main before using the fallback. (.github/workflows/ci.yml:18, 2dfd8cbfe6c2)

Likely related people:

  • steipete: Current repository activity shows recent CI maintenance, and this PR is explicitly assigned to steipete with maintainer-confirmed replacement design and repeated exact-head validation. (role: recent CI policy contributor; confidence: high; commits: 049f2cbc0fce, b478c5c4a002, 24a67f92051f; files: .github/workflows/ci.yml, scripts/check-max-lines-ratchet.mjs, config/max-lines-baseline.txt)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

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

Copy link
Copy Markdown
Contributor

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: 5690d3fea3

ℹ️ 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 thread .github/workflows/ci.yml
Comment on lines +487 to +489
const checksFastCoreTasks =
runNode && !frozenTarget
? [

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Badge Run the ratchet when target_ref freezes the checkout

When manual CI is dispatched from one ref with target_ref pointing at a different branch/tag/SHA (the documented gh workflow run ci.yml --ref main -f target_ref=<branch-or-sha> path in docs/ci.md), checkoutRevision !== workflowRevision, so frozenTarget is true and this condition omits the checks-fast-max-lines-ratchet task entirely. That makes the later RATCHET_MANUAL_TARGET_SHA merge-base logic unreachable for exactly those target-ref runs, allowing baseline growth or new suppressions in release-candidate/manual validations to pass without the new ratchet.

Useful? React with 👍 / 👎.

@steipete

Copy link
Copy Markdown
Contributor Author

Land-ready at e92c4b3c8db5036605a7781688aa4a805a87a35c.

Proof:

  • Hosted exact-head CI 29348526544: 48 jobs passed, including max-lines, lint, test types, build, QA smoke, and all test shards; 8 skipped by scope.
  • AWS Crabbox run_b55d7d37048c: CI=1 corepack pnpm test test/scripts/check-max-lines-ratchet.test.ts test/scripts/changed-lanes.test.ts test/scripts/ci-workflow-guards.test.ts test/scripts/lint-suppressions.test.ts test/scripts/oxlint-config.test.ts test/scripts/test-projects.test.ts — 6 files / 385 tests passed.
  • AWS Crabbox run_af3e4f6869a5: CI=1 corepack pnpm lint — UI i18n verification and all Oxlint shards passed.
  • Final debt-pruning delta autoreview: clean. Review artifacts: READY FOR /prepare-pr, zero findings.
  • OPENCLAW_TESTBOX=1 scripts/pr prepare-run 107315: passed; hosted gates accepted.

Known proof gaps: separate aggregate CodeQL and precise OpenGrep checks surface existing code because EOF grandfather comments make those files part of the diff. CodeQL flags the existing process-local HMAC as a password hash; OpenGrep flags six existing Discord test literals. No executable security code or scanner suppression changed.

@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling app: web-ui App: web-ui channel: discord Channel integration: discord channel: feishu Channel integration: feishu channel: imessage Channel integration: imessage channel: line Channel integration: line channel: matrix Channel integration: matrix channel: mattermost Channel integration: mattermost channel: msteams Channel integration: msteams channel: qqbot channel: signal Channel integration: signal channel: slack Channel integration: slack channel: telegram Channel integration: telegram channel: tlon Channel integration: tlon channel: voice-call Channel integration: voice-call channel: whatsapp-web Channel integration: whatsapp-web channel: zalo Channel integration: zalo channel: zalouser Channel integration: zalouser cli CLI command changes commands Command implementations docker Docker and sandbox tooling docs Improvements or additions to documentation extensions: acpx extensions: amazon-bedrock extensions: anthropic extensions: codex extensions: copilot extensions: crabbox extensions: device-pair extensions: diagnostics-otel Extension: diagnostics-otel extensions: diagnostics-prometheus extensions: fal extensions: firecrawl extensions: github-copilot extensions: google extensions: lmstudio extensions: memory-core Extension: memory-core extensions: memory-lancedb Extension: memory-lancedb extensions: memory-wiki extensions: oc-path extensions: ollama extensions: openai extensions: openrouter extensions: openshell extensions: phone-control extensions: policy extensions: qa-lab extensions: webhooks extensions: xai fleet gateway Gateway runtime maintainer Maintainer-authored PR merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. P2 Normal backlog priority with limited blast radius. plugin: file-transfer plugin: google-meet plugin: migrate-hermes plugin: mxc plugin: workboard plugin: workspaces Agent-composable Workspaces plugin proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. scripts Repository scripts size: XL status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant