Skip to content

docs: document change-signature architecture - #2050

Closed
vitali87 wants to merge 1 commit into
pr-split/split-pr1548-rebased/pr-6from
pr-split/split-pr1548-rebased/pr-10
Closed

vitali87 wants to merge 1 commit into
pr-split/split-pr1548-rebased/pr-6from
pr-split/split-pr1548-rebased/pr-10

Conversation

@vitali87

Copy link
Copy Markdown
Owner

Architecture guide, MCP guide row, and navigation entry for the new change-signature operation.

Files changed

  • docs/architecture/change-signature.md
  • docs/guide/mcp-server.md
  • mkdocs.yml

Diff stats

+80 additions, -0 deletions (80 LOC)

Dependencies

This PR depends on: pr-6

Dependency graph

Merge in this order:

pr-1: feat: add change-signature types and constants
├── 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  <-- this PR
│   └── 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  <-- this PR
├── 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  <-- this PR
│   └── 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  <-- this PR
├── 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  <-- this PR
└── 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  <-- this PR

@coderabbitai

coderabbitai Bot commented Sep 20, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

🗂️ Base branches to auto review (2)
  • ^feat/.*
  • ^fix/.*

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

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

Review profile: CHILL

Plan: Advanced

Run ID: e7873c4d-66df-4f8f-82b3-6317b45ce783

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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: 4/5

Safe to merge with respect to runtime behavior, but the documentation should be corrected before publication so users are not promised rewrites or validation guarantees that may not occur.

Findings

  1. P2 Correct removed-value behavior ▶
  2. P2 Qualify contract enforcement ▶

Summary

The architecture guide should clarify two conditional behaviors: calls that supply a value for a removed parameter remain unmapped, and contract enforcement, verdicts, and affected-test reporting require re-ingestion availability.

T-Rex validation blocked

The focused checks could not execute because the locked environment cannot build pymgclient without CMake, and isolated environments were missing transitive Python dependencies.

Reviews (1) · Last reviewed commit: "docs: document change-signature architec..."

Comment on lines +37 to +38
Old parameters that no spec names are dropped; the values sites passed for
them are dropped with them.

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.

P2 Correct removed-value behavior

The guide says values supplied for omitted old parameters are dropped. The mapper instead treats a remaining supplied value as a surplus argument and leaves that call site unchanged. This is a non-blocking documentation concern, but users may otherwise expect incompatible calls to be rewritten automatically.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Comment on lines +69 to +78
All edits are span-preserving [patcher](patchers.md) edits staged in one
[edit transaction](edit-transactions.md); a file that no longer parses rolls
the whole change back. Applied changes are recorded for `cgr edits undo`
and held to the [postcondition contract](postcondition-contract.md): every
call site of the changed signature must be mapped (a rewritten site is
mapped by construction) or listed as unmapped, no `too_many` finding may
remain unlisted, no site resolved by guesswork may have been rewritten
without leave, and no duplicate group or import cycle may appear. A failing
contract undoes the transaction and re-ingests the restored files; the
verdict, with the tests reaching the changed symbols, rides on the report.

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.

P2 Qualify contract enforcement

The guide promises postcondition enforcement and a verdict containing affected tests for every applied change. Without a re-ingest callback, including for an unindexed MCP project, an edit can apply without contract enforcement and return no verdict. This is a non-blocking documentation concern, but users may rely on validation and rollback guarantees that are unavailable in that configuration.

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

The new architecture doc currently states that arguments for dropped parameters are automatically dropped, but the implementation leaves such sites unmapped (surplus args), so the docs are inaccurate.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 2 Low severity

Open (2)
What changed in this PR

Adds documentation for the new change_signature edit operation, including an architecture deep-dive, an MCP tool table entry, and site navigation to surface the new page in the docs.

Changes:

  • Add a new architecture guide page describing change_signature mapping, rewrite behavior, type checks, and contract/atomicity.
  • Add the change_signature row to the MCP server “Available Tools” table.
  • Add a “Change Signature” entry to MkDocs navigation under Architecture.
File Description
mkdocs.yml Adds nav entry to expose the new architecture page.
docs/​guide/​mcp-server.md Adds the change_signature tool description to the generated MCP tools table section.
docs/​architecture/​change-signature.md New architecture documentation for how change-signature planning/rewrites/contracts work.

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

Comment on lines +37 to +38
Old parameters that no spec names are dropped; the values sites passed for
them are dropped with them.
Comment thread docs/guide/mcp-server.md
| `importers` | Modules that import a module, with each import statement's line, column, bound alias and imported symbol. Deterministic: fixed graph queries, no LLM, same graph gives the same JSON. Use this instead of query_code_graph whenever you know the exact name or location. |
| `tests_reaching` | Test functions and methods from which a qualified name is reachable through CALLS / REFERENCES / INSTANTIATES, with the distance and the symbol each test reaches it through: what to run after editing it. Deterministic: fixed graph queries, no LLM, same graph gives the same JSON. Use this instead of query_code_graph whenever you know the exact name or location. |
| `rename` | Rename a function, method, class or other definition everywhere the graph knows it is referenced: the definition, every call, reference and instantiation site, import statements (aliases kept), overrides in both directions, and Python `__all__` entries. Refuses when any site was resolved heuristically, by overload fan-out, or only by a trace, unless `allow_heuristic` is true. A class referenced by an inheritance or type annotation edge that carries no rewrite location refuses regardless of `allow_heuristic`. Every rewritten file must still parse; otherwise nothing is written. Set `dry_run` to see the plan and diff without touching the tree. Applied edits are recorded for `cgr edits undo`, and Markdown mentions of the old name are listed for a human to review. |
| `change_signature` | Change a function's or method's parameter list and rewrite every call site the graph knows per an explicit mapping. `new_params` lists the new parameters in order as `name[:annotation][=default][@source]`: `@2` takes the value from old positional index 2, `@old` from the old parameter `old`, `=literal` without a source inserts that literal where a site passes nothing (and becomes the definition's default), and a bare name is unmapped: sites passing no value for it are left untouched and listed. Overrides in the hierarchy are rewritten too; sites resolved by guesswork are listed as unmapped unless `allow_heuristic`. A default literal that does not fit the declared type is refused. Applied through one transaction and held to the postcondition contract; set `dry_run` to see the plan. |
@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