Repository navigation
feat(lint): SAFETY-comment assertion ratchet + repo deslop skill - #124359
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs changes before merge. Reviewed August 16, 2026, 12:57 AM ET / 04:57 UTC. ClawSweeper reviewWhat this changesAdds a TypeScript AST-based assertion-safety ratchet with a shrink-only baseline, wires it into preflight checks, adds an internal diff-cleanup skill, and stabilizes a Control UI E2E wait. Merge readinessKeep open: one Priority: P3 Review scores
Verification
How this fits togetherContributor preflight checks inspect changed and full-repository TypeScript before code lands. The new scanner compares unsafe assertions with a baseline ledger and reports failures through aggregate and changed-file validation. flowchart LR
A[Production TypeScript] --> B[Assertion scanner]
C[Baseline ledger] --> B
D[Changed-file planner] --> E[Preflight command]
B --> E
E --> F[Contributor feedback]
Before merge
Findings
Agent review detailsSecurityNone. PR surfaceTests +155, Docs +24, Config +1, Other +4973. Total +5153 across 12 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Copy recommended automerge instructionTechnical reviewBest possible solution: Associate each SAFETY marker with exactly one assertion node, retain the approved shrink-only ledger, and cover same-line and preceding-line multi-assertion cases. Do we have a high-confidence way to reproduce the issue? Yes, from source: place two non-const assertions on one line with one trailing SAFETY marker, and both pass the line-membership check. Is this the best way to solve the issue? No. The baseline and shared scope are coherent under the documented exception, but line-level marker tracking is too broad for the stated per-assertion contract. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against f1ca5e20d8a4. LabelsLabel justifications:
EvidenceAcceptance criteria:
What I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (8 earlier review cycles)
|
|
Addressing the ClawSweeper rank-up moves before landing:
No code change is needed for the remaining review item because changing to a narrow clean scope would contradict the approved deliverable. |
|
Land-ready verification for head
ClawSweeper's clean-scope move is intentionally skipped under the explicit maintainer policy exception documented in the PR body and #124359 (comment). Known proof gaps: none. |
447e8ca to
df912c8
Compare
|
@clawsweeper re-review The branch was rebased after |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review The prior exact-head run exposed deterministic current-main UI E2E owner races outside this PR's original scope. The tests now wait for the stable capability/adoption boundaries instead of a lazy-mounted panel or a pre-armed timer. Focused UI E2E proof (11 tests), expanded |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
891e2dc to
70f6cc4
Compare
|
@clawsweeper re-review Rebased again onto current main. Main's latest file-specific assertion exclusions are preserved in the shared scope, the initial SAFETY baseline is regenerated (4,425 files / 14,285 assertions), and main's independently landed browser E2E fix is retained. Our remaining Claude terminal test now waits for session adoption before advancing the readiness deadline. Focused UI E2E, expanded |
|
🦞🧹 I asked ClawSweeper to review this item again. |
70f6cc4 to
127578f
Compare
|
@clawsweeper re-review All known chained-assertion drain PRs are now landed and preserved as file-specific exclusions in the shared scope. The initial SAFETY baseline is regenerated at 4,439 files / 14,386 assertions, the remaining Claude terminal adoption wait is green alongside main's independently landed browser E2E fix, and 21 focused tests, expanded |
|
🦞🧹 I asked ClawSweeper to review this item again. |
127578f to
8520e54
Compare
|
Final ClawSweeper disposition and land-ready verification for head
The clean-scope/no-baseline policy remains the explicit maintainer exception documented in the PR body, with the shrink-only ledger owned by the checker and removed at zero entries. Known proof gaps: none. |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
Merged via squash.
|
…nclaw#124359) * feat(lint): add SAFETY-comment assertion ratchet * feat(skills): add repo deslop skill * fix(lint): refresh initial assertion baseline * chore(lint): align assertion baseline with main * chore(lint): sync baseline with current assertion ledger * test(ui): stabilize Control UI E2E waits * chore(lint): sync narrowed assertion ledger * chore(lint): sync fully drained assertion ledger * fix(lint): close assertion ratchet bypasses
What Problem This Solves
New TypeScript assertions can silently add type-trust debt because the repository has no prospective guard requiring authors to document the invariant that makes an assertion safe. Existing assertion debt is too broad to fix atomically, and AI cleanup passes are not currently available as a concise repo-local workflow.
Why This Change Was Made
This adds a TypeScript-AST assertion ratchet that shares the chained-assertion production roots, test exclusions, and debt ledger; existing unannotated assertions are grandfathered by deterministic per-file counts, while every new non-const assertion requires a
// SAFETY:invariant. It also adds the repo-local/deslopchecklist for behavior-preserving diff cleanup before autoreview.The initial baseline contains 4,439 files and 14,386 grandfathered assertions. This is intentionally a debt ledger: counts can only shrink after the baseline lands, verified renames retain their allowance, and
--pruneremoves reduced debt.This PR is an explicit maintainer-approved exception to the usual clean-scope/no-baseline rule for new lint checks. The requested invariant is repository-wide prospective enforcement:
scripts/check-assertion-safety-ratchet.mtsowns the debt,config/assertion-safety-baseline.txtis its shrink-only burn-down ledger, and the removal condition is zero remaining baseline entries. Narrowing to a clean subtree would not enforce the requested repository-wide contract.AI-assisted: yes. I reviewed the implementation and ran the repository autoreview workflow to a clean result.
User Impact
There is no runtime behavior change. Contributors get an actionable preflight failure when new production assertions lack a stated safety invariant, and agents can run a focused repo-local cleanup pass before autoreview.
Evidence
Real in-tree failure demo (scratch file removed afterward):
node --import tsx scripts/check-assertion-safety-ratchet.mtsnode scripts/run-vitest.mjs test/scripts/check-assertion-safety-ratchet.test.ts test/scripts/check.test.ts test/scripts/oxlint-boundary-guards.test.ts— 10 tests passed across 2 shards.node scripts/run-vitest.mjs test/scripts/check-assertion-safety-ratchet.test.ts test/scripts/changed-lanes.test.ts test/scripts/check.test.ts— 157 tests passed, including staged/worktree planner selection and inline-comment bypass coverage.node scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts --configLoader runner ui/src/e2e/config-controls-visual.e2e.test.ts ui/src/e2e/claude-sessions.e2e.test.ts— 11 tests passed after repairing two current-main E2E owner races exposed by CI.node scripts/check-changed.mjs— passed scripts/test typechecks, scripts lint, formatting, package guards, and boundary checks. No remote provider was ready, so the wrapper used its documented local fallback after lock backoff.AUTOREVIEW=.claude/skills/autoreview/scripts/autoreview "$AUTOREVIEW" --mode branch --base origin/main— clean; no accepted/actionable findings.Baseline determinism: 4,439 sorted nonzero entries, totaling 14,386 assertions.
Exact-head CI: https://github.com/openclaw/openclaw/actions/runs/31927289672 — green at
8520e54803a0283f1289e31ba38e45fd367177cf.