Skip to content

fix(native): keep property flags unknown for unfinished quoted types - #3825

Merged
kaoru0822-kitauji merged 1 commit into
mainfrom
fix/objc-property-unfinished-quote
Oct 15, 2026
Merged

kaoru0822-kitauji merged 1 commit into
mainfrom
fix/objc-property-unfinished-quote

Conversation

@kaoru0822-kitauji

Copy link
Copy Markdown
Collaborator

Summary

Fixes #3345. inspect-native-dispatch-metadata (MCP inspect_native_dispatch_metadata) reported atomicity: "atomic" and is_readonly: false for an Objective-C property whose type attribute has an unfinished quoted class name (T@"NSString). objc_properties_categories coverage stayed complete. The documented semantics (docs/native-investigation.md) say incomplete attribute metadata leaves atomicity and any unestablished read-only value null.

Now such a property reports atomicity: null and is_readonly: null, unless an explicit R token establishes read-only. The raw type and attribute pairs are kept, and the facet becomes partial with a property_attributes_incomplete reason.

Problem and expected behavior

splitAttributes toggles a quote state while splitting on commas but never reported an unbalanced quote. parsePropertyAttributes then treated any nonempty T token as a complete type and inferred the atomic/read-write defaults from the absence of N/R. With an unfinished quote, any later N or R would sit inside the unfinished type (T@"NSString,N,R yields one token), so their absence establishes nothing.

Change and scope

  • The attribute owner, src/native/AppleObjcProperties.ts, changes as follows. splitAttributes returns { tokens, complete }, and decodePropertyAttributes establishes the defaults only for a complete typed string. Explicit N/R tokens remain established, as do G/S accessors and the raw type_encoding.
  • readObjcPropertyList returns the names of incomplete properties. readObjcPropertiesOf records one property_attributes_incomplete issue per property through the existing class and category issue paths, which already mark objc_properties_categories partial with the reason.
  • parsePropertyAttributes keeps its signature.
  • Docs name the new coverage reason.
  • Not included: other malformed type encodings, such as unbalanced braces in struct types. The issue concerns the quoted class-name splitter that already tracks quote state.

Contract and boundary impact

  • Semantic owner and earliest changed stage: Objective-C property attribute 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. Nullable fields that were wrongly established are now null, and there is a new coverage reason code.
  • Provider, bridge, target-format, or platform compatibility: Apple Mach-O dispatch metadata.
  • Evidence, artifact, provenance, or reconstruction contract: unknowns are no longer reported as established facts; the raw attribute is preserved.
  • 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) for four cases. The complete Tq,N control and the complete default T@"NSString",C keep their flags. An unfinished T@"NSString gives null flags, and R,T@"NSString keeps is_readonly: true. The facet is partial with the reason only for the unfinished cases.
    • src/native/AppleMachoFixups.test.ts checks that N,R swallowed by an unfinished quote are not flags, while N/R before the type still are.
  • Base reproduction: against the unfixed AppleObjcProperties.ts, all three unfinished-quote cases fail (Tests 3 failed | 39 passed).
  • User-visible output for the issue's incomplete-attributes.bin, after:
    Fixture.first: type="@\"NSString" atomicity=null readonly=null
    facet=partial reason=property_attributes_incomplete at 0x100000500: Fixture.first: the type attribute has an unterminated quoted class name, so atomicity and unestablished read-only state are unknown; ...
    
    Before: atomicity=atomic readonly=false, facet=complete reason=null.
  • 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 -- src/native/AppleMachoFixups.test.ts tests/boundary/cli/nativeDispatchPropertyAttributes.test.ts tests/boundary/providers/native/nativeProvider.test.ts: 88 passed
  • npm run check:fast, npm run knip, npm run docs:check: passed
  • Issue reproduction on macOS (Darwin 25.6, arm64) with the issue's fixture generator: valid.bin stays nonatomic and read-write with the facet complete; incomplete-attributes.bin matches the expected behavior above.
  • No false positives on real apps. inspect-native-dispatch-metadata on Transmission, KeepingYouAwake, BetterDisplay, Raycast and XLD decoded 768 real properties: 0 got null atomicity and 0 property_attributes_incomplete issues. Where a facet was partial, it was already partial for other reasons. Run times were 0.5–0.7 s per app; the fix only keeps a boolean the splitter already computed.

Compatibility, safety, and release

  • Breaking changes or migration steps: none. Callers already handle nullable atomicity/is_readonly.
  • 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

An Objective-C property attribute string whose quoted class name never
closes, such as T@"NSString, was treated as complete. The missing N and
R were then read as the Objective-C defaults, so the property was reported
atomic and read-write, and objc_properties_categories coverage stayed
complete. The documented semantics require null flags for incomplete
attribute metadata.

The attribute splitter now reports whether every quote closed. An
incomplete string leaves atomicity and any unestablished read-only value
null, while explicit N or R tokens remain established and the raw type is
preserved. Each affected property adds a property_attributes_incomplete
issue, which marks the facet partial.

Fixes #3345

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:28:47.979473Z d0a14c9 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; no actionable defects were found.

Summary

The PR keeps property flags unknown when a quoted Objective-C type never closes.

  • Unfinished quoted property types leave unproven flags unknown.

No actionable defects or security issues were found. Tests were inspected but not run. Whether another PR supersedes this one could not be checked because GitHub authentication was unavailable.

Reviews (1) · Last reviewed commit: "fix(native): keep property flags unknown..." · Reviewed by Greptile

@kaoru0822-kitauji
kaoru0822-kitauji merged commit b7dcf78 into main Oct 15, 2026
33 checks passed
@kaoru0822-kitauji
kaoru0822-kitauji deleted the fix/objc-property-unfinished-quote branch October 15, 2026 03:42
@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] Incomplete Objective-C property attributes produce established atomic and read-write flags

2 participants