Skip to content

chore(ratchet): tighten panic baseline from 140 to 62 - #74

Merged
KooshaPari merged 1 commit into
masterfrom
chore/ratchet-62-clean
Oct 15, 2026
Merged

KooshaPari merged 1 commit into
masterfrom
chore/ratchet-62-clean

Conversation

@KooshaPari

@KooshaPari KooshaPari commented Oct 15, 2026 •

Copy link
Copy Markdown
Owner

User description

Summary

Lowers the panic-prone baseline from 140 to 62 now that the refactor has landed, so the ratchet regains its regression-prevention value.

Why this is a separate PR

The refactor PRs (#69, #70, #71) remove 78 occurrences. That is a genuine improvement, but the ratchet gate treats a decrease as a pass without tightening the baseline — so with the baseline left at 140, 78 new panics could land before CI complains. The code would be cleaner while the gate stayed toothless.

This PR closes that gap. It depends on #69, #70 and #71 and should merge after them.

Not the anti-pattern

Raising a baseline to absorb new panics is the anti-pattern, and this is the opposite: the count only moves down, and only to a number that the merged code actually achieves.

This matches the repo's existing ratchet-tightening commits: 29c85cbdf and 660d9152c.

Effect

total:        140 -> 62
tracked files: 46 -> 20

Verification that the gate bites again

Adding a single .unwrap() to crates/jcode-render-core/src/reasoning.rs:

Panic-prone usage budget exceeded:
  - total panic-prone count grew: 62 -> 63
  - new production panic-prone usage: crates/jcode-render-core/src/reasoning.rs (1)

With that probe reverted, the gate reports Panic-prone budget OK: total=62 files=20 and exits 0.

Ledger

tx-agent: jcode
tx-task: panic-budget-ratchet
tx-validated: manual
tx-scope: scripts/panic_budget.json
tx-intent: restore the panic ratchet's regression-prevention value after the cleanup landed

Refs #69, #70, #71.


CodeAnt-AI Description

Tighten the panic-prone code limit to 62

What Changed

  • The panic-prone code limit now matches the current count of 62, so new occurrences beyond that count are blocked by the check.
  • The tracked list now reflects the files that still contain panic-prone code.

Impact

✅ CI blocks new panic-prone code regressions
✅ Panic budget reflects the cleaned-up codebase

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

The panic-prone refactor removed 78 occurrences, but the baseline stayed
at 140, leaving the ratchet toothless: 78 new panics could land before CI
complained. This lowers the baseline to the achieved count so the gate
regains its regression-prevention value.

This is the ratchet-tightening step after real cleanup, matching the
existing pattern in 29c85cb and 660d915. It is not the anti-pattern of
raising the baseline to absorb new panics.

Verified the gate bites: adding a single .unwrap() to
crates/jcode-render-core/src/reasoning.rs now fails with
"total panic-prone count grew: 62 -> 63" and
"new production panic-prone usage: crates/jcode-render-core/src/reasoning.rs (1)".

Merged state: total=62, tracked files 46 -> 20.

tx-agent: jcode
tx-task: panic-budget-ratchet
tx-validated: manual
tx-scope: scripts/panic_budget.json
tx-intent: restore the panic ratchet's regression-prevention value after the cleanup landed
Copilot AI balanced review requested due to automatic review settings October 15, 2026 06:39
@codeant-ai

codeant-ai Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

🤖 CodeAnt AI — Review Status

Status Commit Started (UTC) Finished (UTC)
✅ Reviewed your PR 103044d Oct 15, 2026 · 06:39 06:42

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@codeant-ai

codeant-ai Bot commented Oct 15, 2026

Copy link
Copy Markdown

Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@coderabbitai

coderabbitai Bot commented Oct 15, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 23 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: bcb1c821-2447-4827-87a7-d2005b07c364
📥 Commits

Reviewing files that changed from the base of the PR and between 5a54bc0 and 103044d.

📒 Files selected for processing: 1
  • scripts/panic_budget.json
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@codeant-ai codeant-ai Bot added the size:XS This PR changes 0-9 lines, ignoring generated files label Oct 15, 2026
@KooshaPari
KooshaPari merged commit 6bc421d into master Oct 15, 2026
6 checks passed
KooshaPari pushed a commit that referenced this pull request Oct 15, 2026
…arification

tx-agent:     jcode
tx-task:      B.8.80
tx-parent:    6bc421d
tx-validated: rg-ratchet-rebaseline (corrected 6 ratchets A/B/B'/C/D/E/F), git-verify (stash dropped, scripts/panic_budget.json read post-merge), cargo-test (3 restore_session tests pass on new HEAD)
tx-scope:     docs/sessions/2026-10-12-cleanup-and-release/01_AUDIT.md
tx-intent:    Record B.8.80 — Master moved to 6bc421d (PR #74 chore(ratchet): tighten panic baseline 140→62). PR #74 commit message finally explained the ratchet system: scripts/panic_budget.json tracks .expect()+.unwrap() in 20 specific production files (NOT panic! macros despite the filename). B.8.78's 'Ratchet A = 0' was misleading because the peer-agent tracked subset has 0 panic!s but the whole-tree Ratchet A is 492. Corrected 6-ratchet system: A=panic! macros (492, no gate), B=.expect/.unwrap subset (62, CI-gated), B'=.expect/.unwrap whole-tree (7447, no gate), C=swallowed-error (1585, no gate), D=prod files>500 lines (350), E=test files>500 lines (89), F=dependency boundaries (PASS). Stash dropped (now redundant). Net cleanup effect: 78 panic-prone sites removed from 26 fully-cleaned files, Ratchet B CI gate now active at 62.
@codeant-ai

codeant-ai Bot commented Oct 15, 2026

Copy link
Copy Markdown

CodeAnt Nitpicks

1 code suggestion

1. The checker counts this test-only unwrap; if it is removed while one production panic is added, the file stays at 1 and total at 62, so the regression passes.

Logic error · scripts/panic_budget.json:17

@kilo-code-bot

kilo-code-bot Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (1 files)
  • scripts/panic_budget.json

Reviewed by free · Input: 75.9K · Output: 6.3K · Cached: 347.8K

KooshaPari added a commit that referenced this pull request Oct 17, 2026
…one)

Subagent session_daisy_1792220259698_483f4ca0aa2846ee (Tier 1 M3,
read-only) scanned 109 PRs on KooshaPari/Jcode. Result: PRs #64,
#67, #75 are the SAME 3 §22-pattern PRs on BOTH the Jcode and KCode
forks — identical SHAs (4d676f0, fed2378, a1e9530), identical
parents, identical tx-intent trailers. This is because the forks
share pre-2026-10-08 history; the squash-merge commits predate the
brand split.

The §22 finding is therefore NOT fork-specific — it generalizes to
any KooshaPari/ fork with shared pre-2026-10-08 history.

16 other CLOSED+mergedAt=null PRs returned 0 commits from
'git log origin/master --grep="(#N)"'. Several are likely
superseded by merged siblings: #94→#96, #73→#74, #62→#75. 11
appear genuinely abandoned.

22-NEW-FINDING-gh-pr-view-closed-vs-merged.md extended with a
'Cross-fork audit (2026-10-17T07:00Z)' section containing:
  - The 3-PR SHA-equivalence table
  - The 16 superseded/abandoned table
  - Operator follow-up note (apply same body-scrub to Jcode fork
    PRs if a consistent record is desired; out of scope for this
    audit)

STATE.md §4 row U updated: IN FLIGHT -> DONE — 3 MATCHES.

tx-agent: jcode
tx-validated: manual
tx-task: jcode-fork-22-audit
tx-scope: docs/sessions/2026-10-15-portal-xirp-resume/{22-NEW-FINDING,STATE.md}
tx-parent: 92d6609
tx-intent: Land the Jcode-fork §22 audit so PR 103 carries the cross-fork generalization, not just the KCode single-fork evidence
@KooshaPari
KooshaPari deleted the chore/ratchet-62-clean branch November 27, 2026 09:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS This PR changes 0-9 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants