Repository navigation
feat(signature): parameter specs, mapping sources and the change_signature contract check (#1533, 2/9) - #2161
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk | ⚪ Minimal · up to
|
| Check name | Status | Explanation |
|---|---|---|
| Title check | ✅ Passed | The title clearly names the parameter specifications, mapping sources, and contract check added by this change. |
| Description check | ✅ Passed | The description covers the change, demo, feature type, related work, and test plan. It also states which checks were not run. |
| Linked Issues check | ✅ Passed | Check skipped because no linked issues were found for this pull request. |
| Out of Scope Changes check | ✅ Passed | Check skipped because no linked issues were found for this pull request. |
✨ Finishing Touches
-
📝 Generate docstrings
-
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
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 @coderabbitai help to get the list of available commands.
pr-split analysis
This PR has 448 LOC and could be split into 2 smaller PRs:
Run |
…ature contract check (#1533, 2/9)
…hange_signature Unit tests for signature_spec (the NEW=SOURCE mapping, the new parameter list, the literal-against-annotation check) and signature_contract (keep, undo, refused rollback, failed re-ingest and unmeasurable change), so this slice carries tests for the code it adds.
ead9a89 to
ea91e59
Compare
…test.raises Clears the 11 SonarCloud issues (python:S9073, python:S5778) that the zero-issues gate reports now that this PR targets main.
Main now refuses a read when the server root's derived project is not indexed (issue #2461), so the test's project list must include it or the tool returns that error before it searches.
…hange-signature/pr-2 # Conflicts: # codebase_rag/tests/test_context_source_root.py
…2-change-signature/pr-2
|
@greptile full review |
|
…scape `enforce_contract` caught only `TransactionConflict` from the undo of a change whose postcondition failed. Any other error from the undo (an I/O failure writing a file or the edit history) escaped past the committed edit, so the caller got an exception instead of a report saying the change is still applied, and the graph was never flagged. Catch it, keep `applied`, and set `graph_incomplete`: the reversal's own restore is best effort and only logs, so the tree may match neither the history nor the graph `measure` re-ingested. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MjwuaY7a4ES76eJUuJwrWG
|
|
@greptile review |



Summary
codebase_rag/editing/signature_spec.py: parameter specs, the--mapparser, literal type checks, and the report and site types.codebase_rag/editing/signature_contract.py: measures an applied change through the structural delta and undoes it when its postcondition fails.SignatureChangeron them and feat(signature): expose change_signature through the CLI and MCP, with docs (#1533, 5/9) #2164 exposes it ascgr change-signature.Demo
No user-visible change: this layer adds internal building blocks only. The command they feed is shown in #2164's Demo. Below are this layer's new tests run on this branch.
Animated run
e43a3e5c7, feat(signature): contract expectation, shared call-site helpers and constants for change_signature (#1533, 1/9) #2163): neither module nor its tests exist.34d367d4f, this branch): 59 tests pass across the mapping parser, parameter parsing, literal checks and the contract check.Type of Change
Related Issues
Part of #1533 (split from #1912; stack: #2163 → #2161 → #2162 → #2166 → #2164 → #2169 → #2168 → #2165 → #2167).
Test Plan
Unit tests pass (
make test-paralleloruv run pytest -n auto -m "not integration")New tests added
Integration tests pass (
make test-integration, requires Docker)Manual testing (describe below)
uv run python -m pytest codebase_rag/tests/test_signature_spec.py codebase_rag/tests/test_signature_contract.py -p no:randomly -qat34d367d4f: 59 passed.The full suite was not run locally. The CI Unit Tests run at
34d367d4fwas cancelled before it finished.Checklist
make pre-commit)# type: ignore,cast(),Any, orobjecttype hintsSKIP=no-commit-to-branch pre-commit run --from-ref e43a3e5c7 --to-ref 34d367d4f(ruff, ruff-format, ty, bandit, generate-readme and the file hygiene hooks): passed. The unit-suite step ofmake pre-commitwas not run locally.Unchecked items:
signature_spec.pydeclares_LITERAL_PREFIX = "=",_DEFINITION = "definition",_CALL = "call"and_IDENTIFIER_REas module constants rather than incodebase_rag/constants.test_signature_contract.pyusescast(StructuralDelta, delta)in a test helper. The non-test modules have none of these.Files changed
codebase_rag/editing/signature_contract.pycodebase_rag/editing/signature_spec.pycodebase_rag/tests/test_signature_contract.pycodebase_rag/tests/test_signature_spec.pyDiff stats
+873 additions, -0 deletions (873 LOC)
Dependencies
This PR depends on:
pr-1Dependency graph
Merge in this order:
Summary by CodeRabbit