[GH-ISSUE #4542] [Bug] Empty symbol addresses in Swift symbol inventory cause inspectNativeDispatchMetadata to crash with ZodError #2367

Closed
opened 2026-10-17 21:03:47 +00:00 by bsakaguchi · 3 comments
Owner

Originally created by @kevinjosh10 on GitHub (Oct 16, 2026).
Original GitHub issue: https://github.com/morluto/rea/issues/4542

Before submitting

  • I searched the open and closed issues for a related report.
  • I removed credentials, tokens, private paths, and sensitive target data.

Area

Native analysis or decompilation

Observed behavior

Calling inspectNativeDispatchMetadata with a symbol name inventory containing a Swift mangled symbol whose address is an empty string ("") throws an unhandled ZodError (too_small: expected string to have >=1 characters at swift_symbols[0].address).

This crashes the inspect-native-dispatch-metadata CLI command and the corresponding MCP/application tool, preventing the caller from receiving any extracted Objective-C classes, dispatch implementations, or partial coverage facts.

Reproduction

  1. Reproduction script (repro_swift_sym.mts):
import { inspectNativeDispatchMetadata } from "./src/domain/native/objcSwiftMetadata.js";

try {
  const result = inspectNativeDispatchMetadata([
    { name: "$s4Test7MyClassC", address: "" },
  ]);
  console.log("Success:", result);
} catch (e: any) {
  console.log("Error caught:", e.name, e.message);
}
  1. Run with Node / tsx:
npx tsx repro_swift_sym.mts
  1. Observe ZodError thrown during top-level schema parsing:
[
  {
    "origin": "string",
    "code": "too_small",
    "minimum": 1,
    "inclusive": true,
    "path": [
      "swift_symbols",
      0,
      "address"
    ],
    "message": "Too small: expected string to have >=1 characters"
  }
]

Expected behavior

If a provider or external symbol table produces an unlocated or empty address for a Swift symbol, inspectNativeDispatchMetadata should either filter out the empty-address symbol or record it with an address conforming to the schema (or the schema/projection should accept or normalize empty addresses), rather than failing with an unhandled ZodError.

Impact and scope

Providers or tools that output unallocated, external, or stripped symbols with empty string addresses cause inspect-native-dispatch-metadata to abort completely, discarding all other recognized classes and methods.

REA version

8194695144045e0a950f2989190e7337890342f7 (6.5.0)

Runtime and platform

Node v24.13.0; Windows x64

Target and artifact context

Symbol name inventory passed to inspectNativeDispatchMetadata

Interface

CLI

Earliest failure stage

Native analysis or reconstruction

Relevant output or evidence

In src/domain/native/objcSwiftMetadata.ts:372-379:

if (isSwiftMangledSymbolName(entry.name) || entry.name.startsWith("_Tt"))
  swiftSymbols.push({
    mangled_name: entry.name,
    address: entry.address,
    decode: { status: "partial", reason: "mangled_symbol_not_demangled" },
    evidence: symbolEvidence(entry.name, entry.address),
  });

swiftSymbolSchema in src/domain/native/objcSwiftMetadata.ts:225-230:

export const swiftSymbolSchema = z.strictObject({
  mangled_name: z.string().min(1),
  address: z.string().min(1),
  decode: nativeMetadataDecodeSchema,
  evidence: z.array(nativeMetadataEvidenceSchema).min(1),
});

Because swiftSymbolSchema requires address: z.string().min(1), an empty address string produces a schema validation error during objcSwiftMetadataSchema.parse.

Typed outcome or recovery expected

The operation should succeed and return a typed ObjcSwiftMetadata containing all other decoded classes, methods, and coverage.

Analysis or suspected cause

inspectNativeDispatchMetadata lacks a check to ensure entry.address.length > 0 before adding to swiftSymbols.

Originally created by @kevinjosh10 on GitHub (Oct 16, 2026). Original GitHub issue: https://github.com/morluto/rea/issues/4542 ### Before submitting - [x] I searched the open and closed issues for a related report. - [x] I removed credentials, tokens, private paths, and sensitive target data. ### Area Native analysis or decompilation ### Observed behavior Calling `inspectNativeDispatchMetadata` with a symbol name inventory containing a Swift mangled symbol whose address is an empty string (`""`) throws an unhandled `ZodError` (`too_small: expected string to have >=1 characters at swift_symbols[0].address`). This crashes the `inspect-native-dispatch-metadata` CLI command and the corresponding MCP/application tool, preventing the caller from receiving any extracted Objective-C classes, dispatch implementations, or partial coverage facts. ### Reproduction 1. Reproduction script (`repro_swift_sym.mts`): ```ts import { inspectNativeDispatchMetadata } from "./src/domain/native/objcSwiftMetadata.js"; try { const result = inspectNativeDispatchMetadata([ { name: "$s4Test7MyClassC", address: "" }, ]); console.log("Success:", result); } catch (e: any) { console.log("Error caught:", e.name, e.message); } ``` 2. Run with Node / `tsx`: ```sh npx tsx repro_swift_sym.mts ``` 3. Observe `ZodError` thrown during top-level schema parsing: ```json [ { "origin": "string", "code": "too_small", "minimum": 1, "inclusive": true, "path": [ "swift_symbols", 0, "address" ], "message": "Too small: expected string to have >=1 characters" } ] ``` ### Expected behavior If a provider or external symbol table produces an unlocated or empty address for a Swift symbol, `inspectNativeDispatchMetadata` should either filter out the empty-address symbol or record it with an address conforming to the schema (or the schema/projection should accept or normalize empty addresses), rather than failing with an unhandled `ZodError`. ### Impact and scope Providers or tools that output unallocated, external, or stripped symbols with empty string addresses cause `inspect-native-dispatch-metadata` to abort completely, discarding all other recognized classes and methods. ### REA version `8194695144045e0a950f2989190e7337890342f7` (6.5.0) ### Runtime and platform Node v24.13.0; Windows x64 ### Target and artifact context Symbol name inventory passed to `inspectNativeDispatchMetadata` ### Interface CLI ### Earliest failure stage Native analysis or reconstruction ### Relevant output or evidence In `src/domain/native/objcSwiftMetadata.ts:372-379`: ```ts if (isSwiftMangledSymbolName(entry.name) || entry.name.startsWith("_Tt")) swiftSymbols.push({ mangled_name: entry.name, address: entry.address, decode: { status: "partial", reason: "mangled_symbol_not_demangled" }, evidence: symbolEvidence(entry.name, entry.address), }); ``` `swiftSymbolSchema` in `src/domain/native/objcSwiftMetadata.ts:225-230`: ```ts export const swiftSymbolSchema = z.strictObject({ mangled_name: z.string().min(1), address: z.string().min(1), decode: nativeMetadataDecodeSchema, evidence: z.array(nativeMetadataEvidenceSchema).min(1), }); ``` Because `swiftSymbolSchema` requires `address: z.string().min(1)`, an empty address string produces a schema validation error during `objcSwiftMetadataSchema.parse`. ### Typed outcome or recovery expected The operation should succeed and return a typed `ObjcSwiftMetadata` containing all other decoded classes, methods, and coverage. ### Analysis or suspected cause `inspectNativeDispatchMetadata` lacks a check to ensure `entry.address.length > 0` before adding to `swiftSymbols`.
Author
Owner

@jayinvers commented on GitHub (Oct 16, 2026):

Source-derived confirmation: 8116dc06 (fix(native)!: preserve unknown provider symbol addresses) resolves the reported crash path for this issue — empty provider addresses are normalized once at the symbol-inventory boundary to null swift_symbols[].address, the original value is retained in the new optional evidence.reported_address, and the metadata result keeps partial coverage instead of throwing the ZodError. The commit message records its own before/after regression validation. Sharing this triage note since the issue is still open.

<!-- gh-comment-id:6224207888 --> @jayinvers commented on GitHub (Oct 16, 2026): Source-derived confirmation: 8116dc06 (fix(native)!: preserve unknown provider symbol addresses) resolves the reported crash path for this issue — empty provider addresses are normalized once at the symbol-inventory boundary to null `swift_symbols[].address`, the original value is retained in the new optional `evidence.reported_address`, and the metadata result keeps partial coverage instead of throwing the ZodError. The commit message records its own before/after regression validation. Sharing this triage note since the issue is still open.
Author
Owner

@CassieFox23 commented on GitHub (Oct 18, 2026):

Checked on Linux: this is fixed on main by 8116dc065. The commit's message says "Refs #4542", which is why GitHub left this issue open.

  • src/domain/native/objcSwiftMetadata.test.ts passes on main 36d156ff0 on Node 22.23.1, 24.18.0 and 26.11.1 (3 tests).
  • With the fix reverted on main, 1 test fails, ZodError.

Thanks, kevinjosh10, for the clear report.

If nothing else is open here, this can be closed.

🤖 Generated with Claude Code (Sonnet 5.5, verified by Opus 5.5) 🦊

<!-- gh-comment-id:6254873992 --> @CassieFox23 commented on GitHub (Oct 18, 2026): Checked on Linux: this is fixed on main by 8116dc065. The commit's message says "Refs #4542", which is why GitHub left this issue open. - `src/domain/native/objcSwiftMetadata.test.ts` passes on main 36d156ff0 on Node 22.23.1, 24.18.0 and 26.11.1 (3 tests). - With the fix reverted on main, 1 test fails, `ZodError`. Thanks, kevinjosh10, for the clear report. If nothing else is open here, this can be closed. 🤖 Generated with Claude Code (Sonnet 5.5, verified by Opus 5.5) 🦊
Author
Owner

@morluto commented on GitHub (Oct 18, 2026):

Closing as fixed on main after reconciling this report with the landed owner/consumer changes.

  • 8116dc065: fix(native)!: preserve unknown provider symbol addresses. Validation: domain and production-registration MCP regressions failed before the fix. Ten focused files passed 181 tests with 2 skipped, including SDK converted JSON Schema/catalog validation and graph consumers. npm run check and docs:check passed (5 documentation tests). Fixture provider only; no native-provider malformed-symbol or Windows runtime reproduction claimed.

Evidence scope: this closure uses the landed source, regression coverage and validation already recorded in the linked commits/thread. No new local tests or native-provider reproduction were run during this backlog pass; previously documented platform and real-provider gaps still apply.

<!-- gh-comment-id:6256004654 --> @morluto commented on GitHub (Oct 18, 2026): <!-- rea-backlog-reconciliation-2026-10-19-4542 --> Closing as fixed on `main` after reconciling this report with the landed owner/consumer changes. - [8116dc065](https://github.com/morluto/rea/commit/8116dc06512b4609d8db63cebc9f2ff8cb964151): fix(native)!: preserve unknown provider symbol addresses. Validation: domain and production-registration MCP regressions failed before the fix. Ten focused files passed 181 tests with 2 skipped, including SDK converted JSON Schema/catalog validation and graph consumers. npm run check and docs:check passed (5 documentation tests). Fixture provider only; no native-provider malformed-symbol or Windows runtime reproduction claimed. Evidence scope: this closure uses the landed source, regression coverage and validation already recorded in the linked commits/thread. No new local tests or native-provider reproduction were run during this backlog pass; previously documented platform and real-provider gaps still apply.
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#2367
No description provided.