[PR #3809] [MERGED] fix(comparison): keep unnamed reference endpoints distinct or unknown #5914

Closed
opened 2026-10-31 01:10:24 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/3809
Author: @kaoru0822-kitauji
Created: 10/15/2026
Status: ✅ Merged
Merged: 10/15/2026
Merged by: @kaoru0822-kitauji

Base: main ← Head: fix/3388-unnamed-reference-endpoints


📝 Commits (2)

  • 2949c8c fix(comparison): keep unnamed reference endpoints distinct or unknown
  • 28b5e16 fix(comparison): report known reference-kind changes before unnamed-endpoint uncertainty

📊 Changes

3 files changed (+142 additions, -21 deletions)

View changed files

📝 src/domain/functionComparison.test.ts (+56 -2)
📝 src/domain/functionComparisonDimensions.ts (+34 -5)
📝 src/domain/functionComparisonNormalization.ts (+52 -14)

📄 Description

Fixes #3388

Root cause

referenceProjection (functionComparisonNormalization.ts) reduced each reference edge to { direction, source: source_procedure?.name ?? null, target: target_procedure?.name ?? null }. When neither target belongs to a named procedure, two edges to different addresses both become target: null. Their projections and digests match, and compare_functions reports references and the overall result as unchanged, with no limitation. The edge's own source_address / target_address were never consulted.

Change

Endpoint identity is now decided once, where the projection is built:

  • Named endpoint: its procedure name, unchanged. This still tolerates relocation, so the same-name control stays unchanged.
  • Unnamed endpoint, same artifact (equal subject digests): { address }. In one artifact an address names one location, so different targets compare changed and identical ones unchanged.
  • Unnamed endpoint, different artifacts: null, i.e. unknown. If the projections are otherwise equal, the references dimension is unknown with the limitation "Unnamed reference endpoints have no stable identity across different artifacts, so equal named endpoints do not establish equal references." It is no longer an unqualified unchanged. Projections that differ in named endpoints still report changed.

Validation

Tests (src/domain/functionComparison.test.ts):

  • New distinguishes unnamed reference targets by address within one artifact:
    • same artifact, 0x1010 vs 0x1020 → changed
    • same artifact, same address → unchanged
    • different artifacts, same address → unknown
  • preserves duplicate Unicode collections and nullable endpoints asserted that unnamed endpoints at relocated addresses in different artifacts compare unchanged, which is the behavior this issue reports. Its calls and strings_names assertions are unchanged. references is now unknown with the limitation, and the overall status is unknown.
  • Both tests fail on main; I checked by restoring main's comparison sources.
  • Function-comparison-related domain tests pass (130), as do 8 MCP boundary files covering compare_functions (61 tests: coverage, call directions, comparison unknowns, inline Evidence, Ghidra Evidence, investigation analysis), and npm run check:fast.

Cost: a constant per-edge choice; no new passes. Output size is unchanged except for the one added limitation string when the dimension is unknown.

The public MCP repro in the issue uses hand-built dossier Evidence; the new domain test reproduces the same comparison through compareFunctions, which the MCP tool calls.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/3809 **Author:** [@kaoru0822-kitauji](https://github.com/kaoru0822-kitauji) **Created:** 10/15/2026 **Status:** ✅ Merged **Merged:** 10/15/2026 **Merged by:** [@kaoru0822-kitauji](https://github.com/kaoru0822-kitauji) **Base:** `main` ← **Head:** `fix/3388-unnamed-reference-endpoints` --- ### 📝 Commits (2) - [`2949c8c`](https://github.com/morluto/rea/commit/2949c8c3715c19c8cc0a98b739f781a8c6eaccb8) fix(comparison): keep unnamed reference endpoints distinct or unknown - [`28b5e16`](https://github.com/morluto/rea/commit/28b5e169fd67ef9dfa23b6d75416ccb4f409f64e) fix(comparison): report known reference-kind changes before unnamed-endpoint uncertainty ### 📊 Changes **3 files changed** (+142 additions, -21 deletions) <details> <summary>View changed files</summary> 📝 `src/domain/functionComparison.test.ts` (+56 -2) 📝 `src/domain/functionComparisonDimensions.ts` (+34 -5) 📝 `src/domain/functionComparisonNormalization.ts` (+52 -14) </details> ### 📄 Description Fixes #3388 ## Root cause `referenceProjection` (`functionComparisonNormalization.ts`) reduced each reference edge to `{ direction, source: source_procedure?.name ?? null, target: target_procedure?.name ?? null }`. When neither target belongs to a named procedure, two edges to **different addresses** both become `target: null`. Their projections and digests match, and `compare_functions` reports `references` and the overall result as `unchanged`, with no limitation. The edge's own `source_address` / `target_address` were never consulted. ## Change Endpoint identity is now decided once, where the projection is built: - **Named endpoint:** its procedure name, unchanged. This still tolerates relocation, so the same-name control stays `unchanged`. - **Unnamed endpoint, same artifact** (equal subject digests): `{ address }`. In one artifact an address names one location, so different targets compare `changed` and identical ones `unchanged`. - **Unnamed endpoint, different artifacts:** `null`, i.e. unknown. If the projections are otherwise equal, the `references` dimension is `unknown` with the limitation "Unnamed reference endpoints have no stable identity across different artifacts, so equal named endpoints do not establish equal references." It is no longer an unqualified `unchanged`. Projections that differ in named endpoints still report `changed`. ## Validation **Tests** (`src/domain/functionComparison.test.ts`): - New `distinguishes unnamed reference targets by address within one artifact`: - same artifact, `0x1010` vs `0x1020` → `changed` - same artifact, same address → `unchanged` - different artifacts, same address → `unknown` - `preserves duplicate Unicode collections and nullable endpoints` asserted that unnamed endpoints at relocated addresses in **different** artifacts compare `unchanged`, which is the behavior this issue reports. Its `calls` and `strings_names` assertions are unchanged. `references` is now `unknown` with the limitation, and the overall status is `unknown`. - Both tests **fail on `main`**; I checked by restoring main's comparison sources. - Function-comparison-related domain tests pass (130), as do 8 MCP boundary files covering `compare_functions` (61 tests: coverage, call directions, comparison unknowns, inline Evidence, Ghidra Evidence, investigation analysis), and `npm run check:fast`. **Cost:** a constant per-edge choice; no new passes. Output size is unchanged except for the one added limitation string when the dimension is unknown. The public MCP repro in the issue uses hand-built dossier Evidence; the new domain test reproduces the same comparison through `compareFunctions`, which the MCP tool calls. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-31 01:10:24 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#5914
No description provided.