Repository navigation
fix(comparison)!: preserve same-entry correspondence across renames - #8263
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
[Medium impact] The PR appears safe to merge; no blocking issue remains from this review. SummaryPreserves function correspondence across renames when artifact identity, mapping, architecture and selected-image commitments establish the same entry.
Diagram%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Two function observations] --> B[Check shared coordinate context once]
B --> C[Compare function entries]
B --> D[Compare calls and references]
C --> E[Same entry: matched with canonical address]
C --> F[Different entries: mismatched]
C --> G[Unestablished coordinates: conservative name matching]
E --> H[Compare metadata and text separately]
Reviews (2) · Last reviewed commit: "docs(comparison): align rename guidance ..." · Reviewed by Greptile |
Summary
Fixes #8213. Comparing one function before and after an in-session rename now preserves its authenticated same-entry correspondence while independently reporting metadata and exact-text changes.
Problem and expected behavior
Real Ghidra previously reported both a renamed function and a genuinely different entry as
mismatched / explicit. Matching considered names without the stronger same-artifact coordinate evidence. A rename must not invalidate correspondence; equal numeric addresses without applicable coordinate commitments must remain insufficient.Change and scope
same-entryresult includes its canonicalentry_address; different entries in that common context remain mismatched. Inapplicable or unestablished same-artifact coordinates do not turn differing names into a mismatch.Executed validation
Focused domain, call-path, five MCP comparison suites and compiled Evidence replay: 178 passed across 8 files.
Final MCP reference suite: 24 passed. The full focused selection covers retained-reference parity, distinct entries, unknown/malformed profiles, mapping/architecture/format/provider differences, qualified coordinates and selected-image controls.
The named
compare_functionscontract was registered with the actual MCP SDK; its converted schema passes Ajv2020 validation and a client call accepts the real comparison result. Removing the required same-entry address is rejected. Only that tool is registered for this schema check.npm run check:fast— typecheck/lint passed.npm run docs:check— passed, including 9 README consistency checks.Real provider: Ghidra 12.1.4, supplied JDK 21, Linux x64, locally compiled unexecuted ELF. One public stdio MCP session each before/after: open → analyze
evaluateandadjust→ renameevaluate→ analyze again → compare retained references → close. Baseline reproducedmismatched; fixed output reportsmatched / same-entryat0x101129, with identity/pseudocode changed and assembly unchanged. The different-entry control remains mismatched. Target SHA-256d738e59a5ddee9f07fd1f915d95c478e18e17b6e87228a2c974eda89cce8293dremained unchanged; both closes succeeded.Real-Evidence handoff: after closing Ghidra, imported those complete observations into a fresh target-free MCP server with no provider configured. Retained-reference comparison returned the identical normalized result and original source links without opening the target.
Real application: repeated the public rename/compare workflow on unexecuted
/usr/bin/true(coreutils 9.1-1, ELF64 x86-64). Ghidra entry0x1023d0remainedmatched / same-entry; the distinct_DT_INITcontrol remained mismatched, with identity/pseudocode changed and assembly unchanged. SHA-256c79bf44242829108e323378531f4ac839513ca1fba45efd6583643526e1e9fd2stayed unchanged and close succeeded. Independentreadelfidentifies the ELF file entry as0x23d0; the comparison uses the provider-committed analysis coordinates.Comparisons add no provider queries and reuse one coordinate-applicability observation. No speedup, token reduction, agent-discovery or other-provider claim is made. Real Ghidra verification above covers the selected ephemeral-session ELF workflow, not every format or existing-project mode.
Compatibility and evidence
BREAKING CHANGE:
compare_functionscan now returnfunction_match: {status: "matched", method: "same-entry", entry_address, left_name, right_name}. Older closed result schemas accepting only matched/symbol reject this new variant. Update consumers to the current result schema or handle matched/same-entry and its canonical address explicitly; continue inspecting dimensions for metadata/text changes. For a previously valid before/after rename request, correspondence now matches while the overall observed metadata/text result remains changed. Existing symbol/explicit variants and request forms remain valid. Calling coordinate-based proof a symbol match would misstate its provenance; retaining the old mismatch would preserve the bug. Partial/unknown coverage and original Evidence remain intact. Validation used an existing local Ghidra/JDK installation; no tools were installed, and the target binary was not executed.Author readiness
Human owner: @gensokyo-dev
The user explicitly authorized ready PRs and integration, including bypass of human-readiness gates. Personal human-review attestations remain unchecked.