[PR #5583] [CLOSED] fix(swift): match legacy runtime names by format, not a _Tt substring #6981

Closed
opened 2026-11-01 21:44:28 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/5583
Author: @kaoru0822-kitauji
Created: 10/20/2026
Status: ❌ Closed

Base: main ← Head: fix/legacy-swift-runtime-name-matching


📝 Commits (1)

  • ffe4441 fix(swift): match legacy runtime names by format, not a _Tt substring

📊 Changes

3 files changed (+53 additions, -3 deletions)

View changed files

📝 src/domain/swiftSymbolClassification.ts (+14 -1)
📝 src/domain/symbolAnalysis.test.ts (+37 -1)
📝 src/domain/symbolAnalysis.ts (+2 -1)

📄 Description

Summary

Fixes #5576 and #5580. Objective-C method labels and message-send shims whose selector merely contains _Tt were reported as Swift observations (analyze_swift_types, e.g. -[Widget _TtReset]), and those containing _TtP as protocols (get_objc_protocols, e.g. _objc_msgSend$_TtPing). REA now recognizes an embedded legacy Swift runtime name only by its format, so these labels are ignored. Genuine legacy names such as _TtC5Hello3Foo, _TtPs5Error_ and _OBJC_PROTOCOL_$__TtP5Hello5Proto_ remain discoverable.

Problem and expected behavior

  • classifySwiftSymbol (src/domain/swiftSymbolClassification.ts) admitted any name containing _Tt as a Swift symbol with an undecoded category, so the label entered other and unclassified.
  • discoverObjcProtocols (src/domain/symbolAnalysis.ts) used name.includes("_TtP").
  • The contracts (enhancedToolContracts.ts) describe Swift manglings and protocol labels, not arbitrary selectors.

Change and scope

  • The Swift classifier owns one format rule for embedded legacy runtime names: _Tt, optional generic G, nominal kind markers [CVOPE]+, then a decimal identifier length or the standard-library module s.
  • A protocol-specific predicate containsLegacySwiftProtocolName (_TtP + length or s) is exported from the same module and used by protocol discovery instead of its own substring check.
  • objcSwiftMetadata.ts keeps its startsWith("_Tt") check over metadata entry names; that is a different input (runtime class names) and was not reported.

Contribution scope: ordinary fix within existing boundaries; maintainer scope decision not applicable.

Contract and boundary impact

  • Semantic owner and earliest changed stage: Swift symbol classification (src/domain/swiftSymbolClassification.ts).

  • Contribution scope fit and linked maintainer decision: ordinary fix; not applicable.

  • CLI and MCP/tool-catalog contract: no schema change; false Swift/protocol observations disappear.

  • Provider, bridge, target-format, or platform compatibility: provider-neutral.

  • Evidence, artifact, provenance, or reconstruction contract: none beyond the removed false matches.

  • Target selection, authority, upstream behavior, and cleanup details: not applicable.

  • Generated metadata, package, or installation impact: none.

  • Read existing files or captured data.

  • Launch or attach to a process.

  • Inject instrumentation or run scripts/code.

  • Change process memory, registers, files, or configuration.

  • Contact network services.

  • Recover protected code or work around protections.

  • Documentation or usability only; no target interaction.

  • Not sure yet; investigation or maintainer guidance needed.

Evidence and regression coverage

  • Tests added in src/domain/symbolAnalysis.test.ts:

    • For both _TtReset and _TtPing, the method label and message-send shim yield total: 0, unclassified: [] and {count: 0, protocols: []}.
    • A control keeps _OBJC_PROTOCOL_$__TtP5Hello5Proto_, _TtPs5Error_ and -[_TtC5Hello3Foo bar].
  • Base reproduction: with the two source files stashed, both selector cases fail.

  • Existing MCP fixtures (_TtC7Fixture5Class, _TtP7Fixture8Protocol, …) still pass.

  • Remaining proof gaps: the issues' Hopper MCP sessions were not rerun; the predicates are provider-neutral domain code over the same procedure names.

  • Observed, derived, and inferred claims remain distinguishable.

  • Artifact identity, source provenance, and failed attempts remain preserved.

  • Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.

Validation performed

  • npm run test:focused -- src/domain/symbolAnalysis.test.ts tests/boundary/mcp/enhancedTools.01-lists-the-complete-target-open.test.ts tests/boundary/mcp/enhancedTools.swiftTypes.test.ts: 31 passed
  • npm run test:local -- src/domain/symbolAnalysis.test.ts with the source fix stashed: 2 failed, 17 passed
  • npm run check:fast: passed

Compatibility, safety, and release

  • Breaking changes or migration steps: none.
  • Real Hopper/Ghidra, browser, or OS coverage: none; domain logic only.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: no new reads, processes or side effects.

Author readiness

Human owner: @kaoru0822-kitauji

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

🤖 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/5583 **Author:** [@kaoru0822-kitauji](https://github.com/kaoru0822-kitauji) **Created:** 10/20/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/legacy-swift-runtime-name-matching` --- ### 📝 Commits (1) - [`ffe4441`](https://github.com/morluto/rea/commit/ffe444152293698202166b522e5ecfe9b6064270) fix(swift): match legacy runtime names by format, not a _Tt substring ### 📊 Changes **3 files changed** (+53 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `src/domain/swiftSymbolClassification.ts` (+14 -1) 📝 `src/domain/symbolAnalysis.test.ts` (+37 -1) 📝 `src/domain/symbolAnalysis.ts` (+2 -1) </details> ### 📄 Description ## Summary Fixes #5576 and #5580. Objective-C method labels and message-send shims whose selector merely contains `_Tt` were reported as Swift observations (`analyze_swift_types`, e.g. `-[Widget _TtReset]`), and those containing `_TtP` as protocols (`get_objc_protocols`, e.g. `_objc_msgSend$_TtPing`). REA now recognizes an embedded legacy Swift runtime name only by its format, so these labels are ignored. Genuine legacy names such as `_TtC5Hello3Foo`, `_TtPs5Error_` and `_OBJC_PROTOCOL_$__TtP5Hello5Proto_` remain discoverable. ## Problem and expected behavior - `classifySwiftSymbol` (`src/domain/swiftSymbolClassification.ts`) admitted any name containing `_Tt` as a Swift symbol with an undecoded category, so the label entered `other` and `unclassified`. - `discoverObjcProtocols` (`src/domain/symbolAnalysis.ts`) used `name.includes("_TtP")`. - The contracts (`enhancedToolContracts.ts`) describe Swift manglings and protocol labels, not arbitrary selectors. ## Change and scope - The Swift classifier owns one format rule for embedded legacy runtime names: `_Tt`, optional generic `G`, nominal kind markers `[CVOPE]+`, then a decimal identifier length or the standard-library module `s`. - A protocol-specific predicate `containsLegacySwiftProtocolName` (`_TtP` + length or `s`) is exported from the same module and used by protocol discovery instead of its own substring check. - `objcSwiftMetadata.ts` keeps its `startsWith("_Tt")` check over metadata entry names; that is a different input (runtime class names) and was not reported. Contribution scope: ordinary fix within existing boundaries; maintainer scope decision not applicable. ## Contract and boundary impact - Semantic owner and earliest changed stage: Swift symbol classification (`src/domain/swiftSymbolClassification.ts`). - Contribution scope fit and linked maintainer decision: ordinary fix; not applicable. - CLI and MCP/tool-catalog contract: no schema change; false Swift/protocol observations disappear. - Provider, bridge, target-format, or platform compatibility: provider-neutral. - Evidence, artifact, provenance, or reconstruction contract: none beyond the removed false matches. - Target selection, authority, upstream behavior, and cleanup details: not applicable. - Generated metadata, package, or installation impact: none. - [x] Read existing files or captured data. - [ ] Launch or attach to a process. - [ ] Inject instrumentation or run scripts/code. - [ ] Change process memory, registers, files, or configuration. - [ ] Contact network services. - [ ] Recover protected code or work around protections. - [ ] Documentation or usability only; no target interaction. - [ ] Not sure yet; investigation or maintainer guidance needed. ## Evidence and regression coverage - Tests added in `src/domain/symbolAnalysis.test.ts`: - For both `_TtReset` and `_TtPing`, the method label and message-send shim yield `total: 0`, `unclassified: []` and `{count: 0, protocols: []}`. - A control keeps `_OBJC_PROTOCOL_$__TtP5Hello5Proto_`, `_TtPs5Error_` and `-[_TtC5Hello3Foo bar]`. - Base reproduction: with the two source files stashed, both selector cases fail. - Existing MCP fixtures (`_TtC7Fixture5Class`, `_TtP7Fixture8Protocol`, …) still pass. - Remaining proof gaps: the issues' Hopper MCP sessions were not rerun; the predicates are provider-neutral domain code over the same procedure names. - [x] Observed, derived, and inferred claims remain distinguishable. - [x] Artifact identity, source provenance, and failed attempts remain preserved. - [x] Unsupported, incomplete, unavailable, or uncertain outcomes remain visible. ## Validation performed - `npm run test:focused -- src/domain/symbolAnalysis.test.ts tests/boundary/mcp/enhancedTools.01-lists-the-complete-target-open.test.ts tests/boundary/mcp/enhancedTools.swiftTypes.test.ts`: 31 passed - `npm run test:local -- src/domain/symbolAnalysis.test.ts` with the source fix stashed: 2 failed, 17 passed - `npm run check:fast`: passed ## Compatibility, safety, and release - Breaking changes or migration steps: none. - Real Hopper/Ghidra, browser, or OS coverage: none; domain logic only. - Package or release metadata impact: none. - Security, privacy, process, or containment review: no new reads, processes or side effects. ## Author readiness Human owner: @kaoru0822-kitauji - [x] I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work. - [x] I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps. - [x] I declare this PR ready for initial maintainer review. ## Before merge - [ ] This PR addresses a concrete problem or an agreed enhancement. - [ ] Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff. - [ ] The PR has one focused outcome and the title follows `type(scope): outcome`. - [ ] Related issue is linked, or the reason for not linking one is stated above. - [ ] Tests cover changed observable behavior and meaningful failure paths. - [ ] Owning docs, contracts, and generated metadata are updated where needed. - [ ] User-visible CLI/MCP changes include representative output. - [ ] I checked the final diff for secrets, unrelated cleanup, and unsupported claims. 🤖 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-11-01 21:44:28 +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#6981
No description provided.