Skip to content

fix(native): retain valid Objective-C properties beside a malformed record - #3833

Merged
kaoru0822-kitauji merged 2 commits into
mainfrom
fix/objc-property-record-isolation
Oct 15, 2026
Merged

kaoru0822-kitauji merged 2 commits into
mainfrom
fix/objc-property-record-isolation

Conversation

@kaoru0822-kitauji

Copy link
Copy Markdown
Collaborator

Summary

Fixes #3336. inspect-native-dispatch-metadata (MCP inspect_native_dispatch_metadata) lost valid Objective-C metadata when a single property record was malformed:

  • An unmapped name pointer in the second property removed the already decoded first property (Fixture.properties: []).
  • An empty name in the first property failed the whole inspection: exit 1, execution_failure with a schema violation at ["objc_classes",0,"properties",0,"name"], and no Sibling class or valid second property.

Now each property record is decoded on its own. The failing record becomes a property_decode_failed diagnostic at its entry address, the facet is marked partial, and every valid sibling property and class is retained.

Problem and expected behavior

readObjcPropertyList accumulated a whole property_list_t in one operation, and readObjcPropertiesOf returned [] from its list-level catch. A failure on entry n therefore discarded entries 0..n-1. An empty name raised nothing during decoding, so it reached appleDispatchMetadataSchema validation of the whole result. That rejected every class, matching the class-level case #2611 already fixed for empty class names.

Change and scope

  • The property list owner, src/native/AppleObjcProperties.ts, decodes each property_t entry inside its own try. An empty name is rejected there. The function returns { properties, issues }, where each issue has a code, message and entry address.
  • readObjcPropertiesOf forwards those issues through the existing class and category issue paths. objc_properties_categories is therefore partial with property_decode_failed at <entry>: <owner>: property <index> could not be decoded: <cause>.
  • The property_attributes_incomplete issue from fix(native): keep property flags unknown for unfinished quoted types #3825 now uses the same path and reports the entry address instead of the list address.
  • List-header failures (an unreadable count or an unsupported entry size) still fail only that list, as before.
  • Docs describe the per-record diagnostic.
  • Not included: other metadata tables such as methods and ivars. They have their own decoders, and the issue concerns property records.

Contract and boundary impact

  • Semantic owner and earliest changed stage: Objective-C property list decoding (AppleObjcProperties.ts).
  • Contribution scope fit and linked maintainer decision: correctness fix to an existing read-only decoder; not applicable.
  • CLI and MCP/tool-catalog contract: schemas unchanged. Inputs that failed now return partial results with diagnostics.
  • Provider, bridge, target-format, or platform compatibility: Apple Mach-O dispatch metadata.
  • Evidence, artifact, provenance, or reconstruction contract: partial facts are retained with explicit partial coverage, per AGENTS.md and docs/tool-design.md.
  • Target selection, authority, upstream behavior, and cleanup details: unchanged.
  • Generated metadata, package, or installation impact: none.

Expected effects:

  • Read existing files or captured data.

Evidence and regression coverage

  • Tests added: tests/boundary/cli/nativeDispatchPropertyAttributes.test.ts runs the built CLI on the issue's synthetic arm64 Mach-O (darwin).
    • An unmapped second name pointer keeps first, with property_decode_failed at 0x100000518.
    • An empty first name keeps second, with the diagnostic at 0x100000508.
  • Existing attribute cases in the same file still pass.
  • Base reproduction: against the unfixed module, both new cases fail (Tests 2 failed | 4 passed).
  • User-visible output on the issue's fixtures, after:
    valid.bin     exit=0 classes=Fixture[first,second] Sibling[]  facet=complete
    unmapped.bin  exit=0 classes=Fixture[first] Sibling[]         facet=partial reason=property_decode_failed at 0x100000518: Fixture: property 1 could not be decoded: Unmapped or ambiguous metadata pointer 0x100002000
    empty.bin     exit=0 classes=Fixture[second] Sibling[]        facet=partial reason=property_decode_failed at 0x100000508: Fixture: property 0 could not be decoded: the property name is empty
    
    Before: unmapped.bin returned Fixture[], and empty.bin exited 1 with no metadata.
  • Remaining proof gaps: none for this issue.

For evidence-bearing changes:

  • 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 -- tests/boundary/cli/nativeDispatchPropertyAttributes.test.ts src/native/AppleMachoFixups.test.ts src/native/AppleDispatchMetadata.test.ts tests/boundary/providers/native/nativeProvider.test.ts: 126 passed
  • npm run check:fast, npm run knip, npm run docs:check: passed
  • Real apps on macOS (Darwin 25.6, arm64). Transmission, KeepingYouAwake, BetterDisplay, Raycast and XLD produced the same 768 properties with no new diagnostics, at 0.49–0.63 s per app against 0.50–0.66 s before. The change only adds one try per property entry.

Compatibility, safety, and release

  • Breaking changes or migration steps: none. A failing whole-inspection case now succeeds with partial coverage.
  • Real Hopper/Ghidra, browser, or OS coverage: macOS only; the metadata reader runs in-process.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: none.

Author readiness

Human owner:

  • 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

…ecord

readObjcPropertyList decoded a whole property_list_t in one operation.
When a later entry's name pointer was unmapped, the list-level catch
discarded the properties already decoded. An empty property name passed
decoding and then failed schema validation of the whole result, so
inspect-native-dispatch-metadata exited 1 with no metadata.

Each property_t entry is now decoded on its own. A failing entry, or an
empty name, becomes a property_decode_failed issue at the entry address,
and sibling properties are retained. Incomplete-attribute issues also
report their entry address. List-header failures still fail only that
list.

Fixes #3336

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kaoru0822-kitauji kaoru0822-kitauji added the track:bugs Small-bug loop track PRs label Oct 15, 2026
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-15T03:47:24.527773Z 3ccf11a PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@greptile-apps

greptile-apps Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge, with the previous coverage gap addressed and no new actionable issues found.

Summary

The PR keeps valid Objective-C properties when another record cannot be decoded.

  • Objective-C property lists keep valid properties beside malformed records.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Read property list header] --> B[Check record budget]
  B --> C[Decode one property]
  C --> D{Record valid?}
  D -->|Yes| E[Retain property]
  D -->|No| F[Record issue at entry address]
  E --> B
  F --> B
  B -->|Finished or budget exhausted| G[Return retained properties and issues]
Loading

Reviews (2) · Last reviewed commit: "test(native): cover property record isol..." · Reviewed by Greptile

Move the synthetic Objective-C property Mach-O into a shared fixture and
decode it through decodeAppleDispatchMetadata in a portable test, so
Linux and Windows runs also catch a regression that drops valid sibling
properties. The macOS CLI cases keep exercising the built command.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kaoru0822-kitauji
kaoru0822-kitauji merged commit f09f454 into main Oct 15, 2026
32 checks passed
@kaoru0822-kitauji
kaoru0822-kitauji deleted the fix/objc-property-record-isolation branch October 15, 2026 04:22
@morluto morluto added area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior bug Something isn't working labels Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior bug Something isn't working track:bugs Small-bug loop track PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Malformed Objective-C property records discard valid sibling metadata

2 participants