Repository navigation
refactor(devtools): streamline verification surface — fold proof-pack and obligation-diff (#1073) - #1073
Conversation
…rop inject-semantic-annotations - Delete devtools/obligation_diff.py — its only unique value was a --markdown flag; absorbed into affected_obligations.py as --markdown - Add render_affected_obligations_markdown to affected_obligations.main - Change default --base-ref from "master" to "origin/master" (matches proof_pack's operationally correct default) - Remove inject-semantic-annotations from command catalog — the underlying inject_annotations() function stays for tests, but the command was a one-shot migration tool with no ongoing callers - Regenerate docs/devtools.md and AGENTS.md after catalog change Net: -1 devtools command, -1 devtools file, 129 lines deleted. Co-Authored-By: Claude <[email protected]>
- Remove proof-pack as a user-facing devtools command; proof_pack.py stays as an internal library used by affected-obligations --full - Add --full flag to affected-obligations, delegating to proof_pack build/evaluate/render API; --check fails on blocking policy - Add --anti-vacuity flag to render-verification-catalog, replacing build_anti_vacuity_report as a command entrypoint - Update devtools verify default gate from proof-pack --check to affected-obligations --full --check - Fix all stale "devtools proof-pack" references in proof/diffing.py and tests - Regenerate docs/devtools.md and AGENTS.md Net: -1 command (proof-pack), single entry point for PR impact reports. Co-Authored-By: Claude <[email protected]>
SQLite rejects INSERT INTO fts(fts) VALUES('delete-all') on external-
content FTS5 tables — only valid on contentless tables. Use the 'rebuild'
control command instead, which repopulates from the content= source table.
Co-Authored-By: Claude <[email protected]>
📝 WalkthroughWalkthroughThis PR consolidates proof-pack and obligation-diff functionality into an expanded ChangesConsolidate proof-pack checks into affected-obligations with anti-vacuity support
FTS5 rebuild logic optimization
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
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)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
tests/unit/proof/test_diffing.py (1)
139-154:⚠️ Potential issue | 🟠 Major | ⚡ Quick winUnify proof-catalog command expectation in both tests.
test_proof_pack_test_change_routes_to_catalog_obligationsstill assertsdevtools proof-pack --check(Line 154), but routing now emitsdevtools affected-obligations --full --check. This leaves contradictory expectations for the sameproof_catalogpath kind.Suggested test fix
- assert "devtools proof-pack --check" in [check.rendered_command for check in report.inner_loop_checks] + assert "devtools affected-obligations --full --check" in [ + check.rendered_command for check in report.inner_loop_checks + ]🤖 Prompt for 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. In `@tests/unit/proof/test_diffing.py` around lines 139 - 154, The test test_proof_pack_test_change_routes_to_catalog_obligations asserts the old command "devtools proof-pack --check" but routing now emits "devtools affected-obligations --full --check"; update the expectation in that test to look for "devtools affected-obligations --full --check" (i.e., replace the assertion that checks [check.rendered_command for check in report.inner_loop_checks] contains "devtools proof-pack --check" with one that asserts it contains "devtools affected-obligations --full --check") so both tests consistently expect the new proof_catalog command.polylogue/storage/fts/fts_lifecycle.py (1)
212-223:⚠️ Potential issue | 🟠 Major | ⚡ Quick winDuplicate
FTS_REBUILD_SQLexecution whenconversation_idsisNone.Line 212 now executes
FTS_REBUILD_SQL, but line 222 still executes it again when the early-return path isn't taken. This rebuildsmessages_ftstwice in theconversation_ids is Nonecase.🔧 Proposed fix to remove redundant rebuild
await conn.execute(FTS_REBUILD_SQL) await conn.execute("DELETE FROM action_events_fts") if conversation_ids is not None: await repair_fts_index_async( conn, conversation_ids, progress_callback=progress_callback, progress_desc=progress_desc, ) return - await conn.execute(FTS_REBUILD_SQL) await conn.execute(ACTION_FTS_REBUILD_SQL)🤖 Prompt for 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. In `@polylogue/storage/fts/fts_lifecycle.py` around lines 212 - 223, The code currently calls await conn.execute(FTS_REBUILD_SQL) twice when conversation_ids is None; remove the redundant rebuild by only executing FTS_REBUILD_SQL once and keeping the existing ACTION_FTS_REBUILD_SQL execution. Concretely, adjust the control flow in the function containing conversation_ids, conn.execute, and repair_fts_index_async so that the initial await conn.execute(FTS_REBUILD_SQL) is not executed unconditionally before the conversation_ids check (or remove the later duplicate), leaving a single call to conn.execute(FTS_REBUILD_SQL) and then conn.execute(ACTION_FTS_REBUILD_SQL) in the None case, and calling repair_fts_index_async(...) then return in the conversation_ids is not None case.
🤖 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 `@devtools/affected_obligations.py`:
- Around line 37-41: Add a parse-time validation so the --check flag cannot be
used without --full: after you call parser.parse_args() (or in the function that
builds/returns args) check if args.check and not args.full and call
parser.error("The --check flag requires --full") (or raise SystemExit with the
same message) to fail fast; update the logic around parser.add_argument for
"--check" and the place where "--full" is defined to ensure the error is raised
during argument parsing rather than allowing silent success.
In `@tests/unit/devtools/test_affected_obligations.py`:
- Around line 45-60: Add a regression test in
tests/unit/devtools/test_affected_obligations.py that verifies running
affected_obligations.main with the CLI flag combination "--check" but without
"--full" exits with an error (raises SystemExit); reuse the existing monkeypatch
pattern to stub affected_obligations.changed_paths_between_refs and
affected_obligations.obligation_ids_for_ref so the test isolates argument
parsing, and assert that calling affected_obligations.main(["--check",
"--base-ref", "origin/master", "--head-ref", "HEAD"]) raises SystemExit (or
returns non-zero) to prevent future regressions in the CLI contract.
---
Outside diff comments:
In `@polylogue/storage/fts/fts_lifecycle.py`:
- Around line 212-223: The code currently calls await
conn.execute(FTS_REBUILD_SQL) twice when conversation_ids is None; remove the
redundant rebuild by only executing FTS_REBUILD_SQL once and keeping the
existing ACTION_FTS_REBUILD_SQL execution. Concretely, adjust the control flow
in the function containing conversation_ids, conn.execute, and
repair_fts_index_async so that the initial await conn.execute(FTS_REBUILD_SQL)
is not executed unconditionally before the conversation_ids check (or remove the
later duplicate), leaving a single call to conn.execute(FTS_REBUILD_SQL) and
then conn.execute(ACTION_FTS_REBUILD_SQL) in the None case, and calling
repair_fts_index_async(...) then return in the conversation_ids is not None
case.
In `@tests/unit/proof/test_diffing.py`:
- Around line 139-154: The test
test_proof_pack_test_change_routes_to_catalog_obligations asserts the old
command "devtools proof-pack --check" but routing now emits "devtools
affected-obligations --full --check"; update the expectation in that test to
look for "devtools affected-obligations --full --check" (i.e., replace the
assertion that checks [check.rendered_command for check in
report.inner_loop_checks] contains "devtools proof-pack --check" with one that
asserts it contains "devtools affected-obligations --full --check") so both
tests consistently expect the new proof_catalog command.
🪄 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: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 7e13fa5e-85c0-431a-b030-41ac9c97e723
📒 Files selected for processing (13)
AGENTS.mddevtools/affected_obligations.pydevtools/command_catalog.pydevtools/obligation_diff.pydevtools/render_verification_catalog.pydevtools/verify.pydocs/devtools.mdpolylogue/proof/diffing.pypolylogue/storage/fts/fts_lifecycle.pytests/unit/devtools/test_affected_obligations.pytests/unit/devtools/test_obligation_diff.pytests/unit/devtools/test_verify.pytests/unit/proof/test_diffing.py
💤 Files with no reviewable changes (2)
- devtools/obligation_diff.py
- tests/unit/devtools/test_obligation_diff.py
| parser.add_argument( | ||
| "--check", | ||
| action="store_true", | ||
| help="Exit non-zero when blocking policy fails (only with --full).", | ||
| ) |
There was a problem hiding this comment.
Enforce --check/--full coupling at parse time.
--check is documented as valid only with --full, but currently it silently succeeds without --full, which can bypass policy gating in automation.
Suggested fix
args = parser.parse_args(argv)
+ if args.check and not args.full:
+ parser.error("--check requires --full")
if args.full:Also applies to: 44-72
🤖 Prompt for 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.
In `@devtools/affected_obligations.py` around lines 37 - 41, Add a parse-time
validation so the --check flag cannot be used without --full: after you call
parser.parse_args() (or in the function that builds/returns args) check if
args.check and not args.full and call parser.error("The --check flag requires
--full") (or raise SystemExit with the same message) to fail fast; update the
logic around parser.add_argument for "--check" and the place where "--full" is
defined to ensure the error is raised during argument parsing rather than
allowing silent success.
| def test_main_markdown_renders_affected_obligations( | ||
| monkeypatch: pytest.MonkeyPatch, | ||
| capsys: pytest.CaptureFixture[str], | ||
| ) -> None: | ||
| monkeypatch.setattr( | ||
| affected_obligations, | ||
| "changed_paths_between_refs", | ||
| lambda base_ref, head_ref: ("docs/plans/layering.yaml",), | ||
| ) | ||
| monkeypatch.setattr(affected_obligations, "obligation_ids_for_ref", lambda ref: ()) | ||
|
|
||
| assert affected_obligations.main(["--base-ref", "origin/master", "--head-ref", "HEAD", "--markdown"]) == 0 | ||
|
|
||
| rendered = capsys.readouterr().out | ||
| assert "## Affected Verification Checks" in rendered | ||
| assert "`origin/master..HEAD`" in rendered |
There was a problem hiding this comment.
🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick win
Add a regression test for --check without --full.
Please add a test that asserts invalid usage fails (e.g., SystemExit from argparse), so the CLI contract can’t regress.
🤖 Prompt for 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.
In `@tests/unit/devtools/test_affected_obligations.py` around lines 45 - 60, Add a
regression test in tests/unit/devtools/test_affected_obligations.py that
verifies running affected_obligations.main with the CLI flag combination
"--check" but without "--full" exits with an error (raises SystemExit); reuse
the existing monkeypatch pattern to stub
affected_obligations.changed_paths_between_refs and
affected_obligations.obligation_ids_for_ref so the test isolates argument
parsing, and assert that calling affected_obligations.main(["--check",
"--base-ref", "origin/master", "--head-ref", "HEAD"]) raises SystemExit (or
returns non-zero) to prevent future regressions in the CLI contract.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4b709f5335
ℹ️ 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".
|
Historical Codex triage: evidence checked at 5ebcfe5. This records that source revision; it does not claim a fresh review of current master.
Only the rows listed above are dispositioned. Held findings remain open. |
Summary
Consolidates three overlapping verification entry-points (
proof-pack,obligation-diff,affected-obligations) into one command with flags.Removes
inject-semantic-annotationsas a command (one-shot migrationtool; underlying function stays for tests). Fixes a latent FTS5 bug.
Net: −2 commands, −2 files, cleaner operator surface.
Problem
The
devtoolscommand catalog had accumulated redundant entry points:obligation-diffwasaffected-obligations --markdownwith no otherunique behavior
proof-packoverlapped withaffected-obligationsat the PR-checklayer; having both confused which to run
inject-semantic-annotationswas a one-shot migration tool stillappearing as a first-class operator command
proof-pack --checkindevtools verifydidn't survive catalog removalSolution
devtools/obligation_diff.py— folded--markdownflag intoaffected_obligations.py--fullflag toaffected-obligationsthat delegates to theinternal
proof_packbuild/evaluate/render API;--checkfails onblocking policy
render-verification-catalog --anti-vacuityproof-packandinject-semantic-annotationsfromcommand_catalog.pydevtools verifydefault gate:proof-pack --check→affected-obligations --full --checkdevtools proof-packreferences inproof/diffing.pyand tests
fts_lifecycle.py: use FTS5rebuildinstead ofdelete-all(SQLite rejects
delete-alloncontent=tables)Verification
Ref #594
Summary by CodeRabbit
New Features
devtools affected-obligationsnow supports--markdownoutput and--fullmode for complete proof-pack impact reporting with optional--checkpolicy validation.devtools render-verification-catalognow includes--anti-vacuitymode for anti-vacuity dashboard rendering.Removed Features
devtools proof-packanddevtools obligation-diffcommands have been removed; usedevtools affected-obligations --fullinstead.Documentation