Skip to content

feat: add change-signature types and constants - #2042

Closed
vitali87 wants to merge 1 commit into
mainfrom
pr-split/split-pr1548-rebased/pr-1
Closed

vitali87 wants to merge 1 commit into
mainfrom
pr-split/split-pr1548-rebased/pr-1

Conversation

@vitali87

@vitali87 vitali87 commented Sep 20, 2026 •

Copy link
Copy Markdown
Owner

Public report/spec types, shared constants, and literal/type validation helpers.

Files changed

  • codebase_rag/constants/ast_nodes.py
  • codebase_rag/constants/ast_python.py
  • codebase_rag/constants/cli.py
  • codebase_rag/constants/graph.py
  • codebase_rag/constants/mcp.py
  • codebase_rag/editing/signature_types.py
  • codebase_rag/editing/signature_literals.py

Diff stats

+211 additions, -0 deletions (211 LOC)

Dependency graph

Merge in this order:

pr-1: feat: add change-signature types and constants  <-- this PR
├── pr-2: feat: parse and render signature parameters
│   ├── pr-4: feat: rewrite signature definitions and call sites
│   │   └── pr-5: feat: plan change-signature graph edits
│   │       └── pr-6: feat: expose change-signature via API, CLI, and MCP
│   │           ├── pr-7: test: cover change-signature units
│   │           │   ├── pr-8: test: cover change-signature acceptance flows
│   │           │   └── pr-9: test: cover change-signature regressions
│   │           └── pr-10: docs: document change-signature architecture
│   └── pr-5: feat: plan change-signature graph edits
│       └── pr-6: feat: expose change-signature via API, CLI, and MCP
│           ├── pr-7: test: cover change-signature units
│           │   ├── pr-8: test: cover change-signature acceptance flows
│           │   └── pr-9: test: cover change-signature regressions
│           └── pr-10: docs: document change-signature architecture
├── pr-3: feat: map change-signature call arguments
│   ├── pr-4: feat: rewrite signature definitions and call sites
│   │   └── pr-5: feat: plan change-signature graph edits
│   │       └── pr-6: feat: expose change-signature via API, CLI, and MCP
│   │           ├── pr-7: test: cover change-signature units
│   │           │   ├── pr-8: test: cover change-signature acceptance flows
│   │           │   └── pr-9: test: cover change-signature regressions
│   │           └── pr-10: docs: document change-signature architecture
│   └── pr-5: feat: plan change-signature graph edits
│       └── pr-6: feat: expose change-signature via API, CLI, and MCP
│           ├── pr-7: test: cover change-signature units
│           │   ├── pr-8: test: cover change-signature acceptance flows
│           │   └── pr-9: test: cover change-signature regressions
│           └── pr-10: docs: document change-signature architecture
├── pr-4: feat: rewrite signature definitions and call sites
│   └── pr-5: feat: plan change-signature graph edits
│       └── pr-6: feat: expose change-signature via API, CLI, and MCP
│           ├── pr-7: test: cover change-signature units
│           │   ├── pr-8: test: cover change-signature acceptance flows
│           │   └── pr-9: test: cover change-signature regressions
│           └── pr-10: docs: document change-signature architecture
└── pr-5: feat: plan change-signature graph edits
    └── pr-6: feat: expose change-signature via API, CLI, and MCP
        ├── pr-7: test: cover change-signature units
        │   ├── pr-8: test: cover change-signature acceptance flows
        │   └── pr-9: test: cover change-signature regressions
        └── pr-10: docs: document change-signature architecture

Summary by CodeRabbit

  • New Features
    • Added support definitions for a new signature-change operation, including new-parameter specifications and structured result reporting.
    • Added validation for parameter mappings, defaults, annotations, literal values, splat arguments, variadic parameters, and other signature-rewrite conditions.
    • Added reporting fields for unmapped call sites and operation verdicts.
    • Added identifiers for accessing the signature-change tool and its new-parameters input.

@coderabbitai

coderabbitai Bot commented Sep 20, 2026 •

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: vitali87/code-graph-rag/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 642b5224-11b1-4332-960f-200cc91aa8b2

📥 Commits

Reviewing files that changed from the base of the PR and between 25ff67c and 53a3f8f.

📒 Files selected for processing (7)
  • codebase_rag/constants/ast_nodes.py
  • codebase_rag/constants/ast_python.py
  • codebase_rag/constants/cli.py
  • codebase_rag/constants/graph.py
  • codebase_rag/constants/mcp.py
  • codebase_rag/editing/signature_literals.py
  • codebase_rag/editing/signature_types.py

Included review availability: Your plan provides up to 8 included reviews per hour; 3 remain after this review.


📝 Walkthrough

Walkthrough

The change adds constants and enum identifiers for change_signature, introduces parameter parsing and signature report types, and adds literal-to-annotation compatibility checks.

Changes

Signature change support

Layer / File(s) Summary
Signature identifiers and report contracts
codebase_rag/constants/*, codebase_rag/editing/signature_types.py
Adds tree-sitter, CLI, graph, and MCP identifiers. Defines parameter specifications, site records, signature reports, parsing, and site serialization.
Parameter specification validation
codebase_rag/editing/signature_literals.py
Classifies Python literals and checks compatibility with builtin annotations, unions, optional values, and non-builtin annotations.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~15 minutes

Change: Feature

Merge Risk: ⚪ Minimal · up to 53a3f

No actionable issue remains in the reviewed change; it is ready to merge.

🚥 Pre-merge checks | ✅ 3 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description accurately summarizes the change and lists the affected files, but it omits the required Type of Change, Related Issues, Test Plan, and Checklist sections. Add all template sections. Select the applicable change type, provide related issue references or state that none apply, document test execution and results, and complete each checklist item.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: adding change-signature types and constants. It is concise and follows Conventional Commits format.
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 💡 1
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
🛠️ Fix failing CI checks 💡
  • 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@greptile-apps

greptile-apps Bot commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 2/5

Not safe to merge until valid parameter defaults and mappings are handled correctly.

Findings

  1. P1 Preserve quoted at signs ▶
  2. P1 Accept bytes defaults ▶
  3. P1 Allow broad null defaults ▶

Summary

This change adds shared constants and foundational helpers for signature changes. Valid quoted @ defaults, bytes defaults, and None defaults for broad annotations currently fail or are interpreted incorrectly, so valid signature-change requests can be rejected or mapped to the wrong parameter.

Reviews (1) · Last reviewed commit: "feat: add change-signature types and con..."

_SPEC_RE = re.compile(
r"^(?P<name>[A-Za-z_][A-Za-z0-9_]*)"
r"(?::(?P<annotation>[^=@]+))?"
r"(?:=(?P<default>[^@]+))?"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Preserve quoted at signs

A quoted default such as email:str="a@b" is split at the @: the default becomes "a and b" is recorded as the source parameter. This rejects or incorrectly remaps valid email-like string defaults when changing a signature.

Artifacts

Quoted at-sign reproduction

  • The focused reproduction supplies a quoted default containing an at sign and asserts that it remains intact.

Quoted at-sign output

  • The output shows the default was truncated and the remainder was treated as a source mapping, confirming the parsing failure.

Quoted default reference parser

  • The reference parser demonstrates the expected intact quoted-default interpretation.

Quoted default reference output

  • The reference output retains the complete default without creating a source mapping.

View artifacts

T-Rex Ran code and verified through T-Rex

"dict": frozenset({"dict"}),
"set": frozenset({"set"}),
"tuple": frozenset({"tuple"}),
"bytes": frozenset(),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Accept bytes defaults

bytes is listed as a supported builtin annotation but has no accepted literal kind, and byte literals are not classified. As a result, a valid default such as b"data" cannot be used for a bytes parameter, blocking valid signature changes.

Artifacts

Bytes default reproduction

  • The reproduction evaluates a bytes literal against the new compatibility helper.

Bytes reproduction source

  • The captured source shows the exact bytes literal and annotation evaluated by the reproduction.

Bytes default output

  • The output reports `literal_kind=None` and `accepted=False`, confirming that the valid bytes default is rejected.

View artifacts

T-Rex Ran code and verified through T-Rex

def _compatible(kind: str, annotation: str) -> bool:
"""Whether a literal of `kind` fits `annotation` (builtin names only)."""
text = annotation.strip()
if kind == "None":

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Allow broad null defaults

The early None branch rejects None before broad annotations reach the conservative unknown-type fallback. Valid defaults for Any and object are therefore refused, preventing otherwise valid nullable signature changes.

Artifacts

Broad null-default reproduction

  • The reproduction evaluates a `None` literal with broad annotations including `Any` and `object`.

Broad null-default output

  • The output shows `None` is rejected for `Any` and the expected compatibility assertion fails.

View artifacts

T-Rex Ran code and verified through T-Rex

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 review overview

🟡 Changes recommended

Unresolved MCP registration and literal/spec validation issues block approval.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 High severity · 2 Medium severity

Open (3)
What changed in this PR

Adds foundational types, constants, parsing, and literal/type validation for the planned change_signature operation.

Changes:

  • Adds signature specifications, reports, and site result types.
  • Adds literal/type compatibility helpers.
  • Adds AST, CLI, graph, and MCP constants.
File Summary
codebase_rag/​editing/​signature_types.py Defines signature reports, parameter specifications, and parsing.
codebase_rag/​editing/​signature_literals.py Adds literal/type compatibility validation.
codebase_rag/​constants/​mcp.py Adds change-signature MCP identifiers.
codebase_rag/​constants/​graph.py Adds graph report keys.
codebase_rag/​constants/​cli.py Adds signature-operation messages.
codebase_rag/​constants/​ast_python.py Adds Python call-splat constants.
codebase_rag/​constants/​ast_nodes.py Adds the spread-element node constant.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

TESTS_REACHING = "tests_reaching"
# Graph-driven edit operations (issue #1532).
RENAME = "rename"
CHANGE_SIGNATURE = "change_signature"
Comment on lines +8 to +18
_KIND_OF = {
bool: "bool",
int: "int",
float: "float",
str: "str",
list: "list",
dict: "dict",
set: "set",
tuple: "tuple",
type(None): "None",
}
Comment on lines +15 to +16
r"(?:=(?P<default>[^@]+))?"
r"(?:@(?P<source>.+))?$"
@vitali87
vitali87 removed this pull request from stack #2054 September 22, 2026 22:08
@vitali87
vitali87 changed the base branch from feat/postcondition-contract to main September 22, 2026 22:08
@vitali87
vitali87 added this pull request to stack #2132 September 22, 2026 22:09
@vitali87

Copy link
Copy Markdown
Owner Author

Superseded: change_signature lands through the split of #1912, which replaces #1548, as the stack #2163 → #2161 → #2162 → #2166 → #2164 → #2169 → #2168 → #2165 → #2167 on main. Closing this split-pr1548 stack at the owner's direction.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants