fix(own): post-merge nits — ledger completeness, CLI guard, test robustness - #3
Conversation
- own_fix: duplicate-site dedupe now records the dropped finding as 'duplicate-site' in the skipped ledger (preserves the no-silent-drops contract) instead of silently continuing. - cli: validate after.findings.json exists (the CLI re-audits via it for both appliers); fail fast with a clear error instead of crashing later in ReplayReaudit on suggest-only fixtures like own001-lambda. - tests: replace 'assert False' with 'raise AssertionError' (B011, survives -O); assert the duplicate finding lands in the skipped ledger. 10/10 + 7/7, incl -O. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LLHz4cevQyXHKZnjzCqhoa
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe CLI now checks for ChangesFixarm validation and planning
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit:7bf9755e22
ℹ️ 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".
| # The CLI re-audits via the recorded after.findings.json (both appliers), so it must | ||
| # exist. Suggest-only fixtures (e.g. own001-lambda) have none — they're unit-tested, | ||
| # not run through the CLI; fail fast rather than crash later in ReplayReaudit. | ||
| if not os.path.isfile(os.path.join(args.fixture, "after.findings.json")): |
There was a problem hiding this comment.
Defer after.findings check until re-audit is needed
When using a fixture that intentionally has only before.findings.json and --applier own, this guard now returns 2 before run_fix() can handle cases that never call ReplayReaudit, such as an absent rule (no-op, documented as exit 0 in this CLI) or a detect-only T3 rule (unfixable). For example, main(['--fixture', 'fix/fixtures/own001-lambda', '--rule', 'RCS9999', '--applier', 'own']) now fails solely because after.findings.json is missing, even though the wrapper would return a no-op ledger without reading it.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
@codex Fixed in 8063e62. Removed the eager after.findings.json guard and deferred the check to when re-audit is actually reached: ReplayReaudit reads the file lazily, so no-op (absent rule) and unfixable (T3) rules — which return before re-audit — never touch it and still exit 0. A fixable rule on a fixture without after.findings.json now surfaces a clean exit-2 error (caught FileNotFoundError) instead of a stacktrace. Your exact example --fixture own001-lambda --rule RCS9999 --applier own now exits 0. Tests: test_cli_no_op_does_not_need_after_findings, test_cli_missing_after_findings_fails_cleanly_when_reaudit_needed.
Generated by Claude Code
There was a problem hiding this comment.
To use Codex here, create an environment for this repo.
…needed Codex P2 on PR #3: the upfront after.findings.json guard was too eager — it returned 2 even for rules that short-circuit before re-audit (absent rule -> no-op exit 0; detect-only T3 -> unfixable). Removed the eager guard; ReplayReaudit reads the file lazily, so no-op/unfixable never touch it, and a fixable rule on a fixture without after.findings.json now surfaces a clean exit-2 error (caught FileNotFoundError) instead of a stacktrace. +2 CLI tests; 12/12 + 7/7, incl -O. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LLHz4cevQyXHKZnjzCqhoa
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@fix/tests/test_own_fix.py`:
- Around line 224-240: The new CLI tests rely on bare assert equality checks, so
they become no-ops under optimized execution. Update
test_cli_no_op_does_not_need_after_findings and
test_cli_missing_after_findings_fails_cleanly_when_reaudit_needed to validate
the return code with an explicit conditional that raises AssertionError when
main(...) returns an unexpected value, and align the existing nearby rc checks
in the same test module that still use assert rc == ... so all CLI exit-code
tests remain -O-safe.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 0cec52d7-1340-4d72-9dd7-82ff7b02b202
📒 Files selected for processing (2)
fix/fixarm/cli.pyfix/tests/test_own_fix.py
🚧 Files skipped from review as they are similar to previous changes (1)
- fix/fixarm/cli.py
Uh oh!
There was an error while loading. Please reload this page.
CodeRabbit: the new CLI tests asserted rc via bare 'assert rc == N', which is stripped under python -O, so they were vacuous in optimized runs (the very mode the PR claims to support). Added an _expect(actual, expected) helper that raises AssertionError, and routed all four CLI exit-code checks through it. Verified _expect raises under -O. 12/12 normal and -O. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LLHz4cevQyXHKZnjzCqhoa
Uh oh!
There was an error while loading. Please reload this page.
Post-merge follow-up nits for the T4 OWN fixer (PR #2)
Three minor CodeRabbit findings landed as PR #2 was being merged, so they're collected here. All 🟡 Minor / quick wins; no behaviour change to the happy path.
own_fix.py— keep the ledger complete. The duplicate-site dedupecontinued without recording anything, so a repeated finding on the same+=line appeared in neitherappliednorskipped— a silent drop that contradicts the function's own no-silent-drops contract (docs/fix-arm.md §8). It's now recorded asskippedwith reasonduplicate-site.cli.py— fail fast on a missingafter.findings.json. The CLI re-audits via the recordedafter.findings.jsonfor both appliers, but only theafter/tree was validated. A suggest-only fixture likeown001-lambda(noafter.findings.json) would crash later insideReplayReaudit; now it returns 2 with a clear error.test_own_fix.py— robust assertions. Replacedassert False(stripped underpython -O, Ruff B011) withraise AssertionError, and added a ledger assertion that the duplicate finding lands inskipped.Test plan
🤖 Generated with Claude Code
Generated by Claude Code
Summary by CodeRabbit
after.findings.jsonis missing: prints a clear error and exits with status code2(no stacktrace/crash later).after.findings.jsonis absent.skippedwith reasonduplicate-site, keeping the applied/skipped ledger complete.after.findings.json, plus coverage for duplicate handling and safer failure checks.