Skip to content

fix(native): preserve Objective-C records with unreadable protocol lists - #8958

Merged
gensokyo-dev merged 5 commits into
morluto:mainfrom
SahinurDEV:fix/objc-protocol-list-limit
Nov 6, 2026
Merged

gensokyo-dev merged 5 commits into
morluto:mainfrom
SahinurDEV:fix/objc-protocol-list-limit

Conversation

@SahinurDEV

@SahinurDEV SahinurDEV commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #8945. An unreadable adopted-protocol sublist no longer discards its independently readable owner. Classes/metaclasses, categories and adopting protocol declarations retain their own facts, any readable protocol-name prefix and explicit partial decode status (protocol_list_unreadable). Empty partial arrays do not establish absence.

The shared protocol reader owns the pointer field, count and entry decoding and returns a tagged Result, including known names and the failure reason. All three consumers use that result. The original class-only recovery wrapper and old list callback are removed. The existing 20,000-entry guard, record budget, malformed top-level refusals and source identity remain intact; no new cache, schema or ceiling is introduced. The source-owned reader profile advances to v3 so v2 snapshots cannot replay stale missing-owner results. Product documentation explains the partial-list semantics.

Validation

  • Current main 93ce13e76: the original count-limit case fails; expanded class/prefix/category/adopting-protocol cases give 4 failures / 110 passes. The original PR's class-only fix leaves 3 failures / 111 passes, establishing the related producer-boundary gap.
  • 232 tests pass across eight files, covering all 114 decoder cases, fixups, class coverage/imports, two new provider-delivery cases with source SHA256/admission verification, input bounds, malformed top-level sections and descriptor cleanup failures. The provider-delivery cases use the existing controlled NativeFixtureRunner; they do not qualify Apple's tools or a Darwin runtime.
  • Real public binary: arm64 libglfw.3.dylib (263,308 bytes) from the official glfw==2.11.0 macOS wheel on PyPI. Wheel SHA256 7405d3e3041add442e40a15ef5a880178ff90f486d576a82e112240c66f59555; dylib SHA256 409f1c5acc4f512c448f8297a5a7e8f8a1d41fcc90e065d1ba25b4a25508d19a. It is neither installed nor executed.
  • LLVM Objective-C metadata plus an independent Python struct Mach-O/segment/class/protocol walk establish five classes and five metaclasses. An owned copy changes only the 8-byte protocol-count field at offset 199,992 from 1 to 20,001. Before: eight rows, both GLFWApplicationDelegate rows lost. After: all ten rows retained, those two explicitly partial with the unread protocol lists, and all four independent properties retained. The original binary's entire byte-decoder result equals the baseline; both input hashes remain unchanged.
  • Two new Darwin public CLI/stdio MCP cases exercise both protocol count 1 and 20,001, assert retained facts, partial status, source hash/input admission, same-client open/read/close and unchanged target bytes. They reuse the existing byte fixture through one shared builder. The existing macOS Apple artifact CI job explicitly runs this file. Local Linux collection reports 9 provider tests passed / 12 Darwin CLI tests skipped (including these two). The final head then passed the real macOS CI lane: Apple CLI/MCP E2E records all 12 tests passing, explicitly including count 1n and 20001n over CLI and stdio MCP. These are authored byte fixtures executed on Darwin, distinct from the public GLFW byte-decoder control.
  • Compiled CLI attempts are recorded: explicit native-macos is not selectable on this Linux host; the ordinary automatic selection returns provider_unavailable. Those local attempts do not qualify Darwin; the macOS CI cases above do. No GUI or target execution is claimed. The real public-data positive controls exercise the production byte decoder.
  • The snapshot regression accepts an actual v2 binding before the profile bump (1 failure / 29 passes / 2 platform skips). With reader v3, that binding is rejected while same-version workflow replay remains covered.
  • check:fast, docs:check (9 consistency tests), formatting and git diff --check pass. No binary, wheel or generated artifact is committed.

Resources and remaining scope

Two CPUs and time/RSS guards throughout; no guard stop or OOM. The two-file production-decoder control used 0.79 s wall / 0.88 CPU s / 158.4 MiB sampled family RSS before, and 1.19 s / 1.17 CPU s / 164.7 MiB after. Fresh Node processes with uncontrolled warm OS caches; the modified input retains more correct facts after the fix, so these single observations establish no speedup/regression claim and do not measure a full Darwin investigation. RSS sampling sums descendants at 100 ms, can double-count shared pages and miss short peaks; model tokens are unmeasured.

The three adopted-list consumers and their superseded wrapper are covered in this change. Darwin CI qualifies the two new authored CLI/MCP cases; the public GLFW comparison remains a production byte-decoder control, without a public-application GUI or live-target claim. Full technical CI passes on the final head, including all eight shards, real Apple CLI/MCP, platform package baselines and required aggregates. The original unchecked Author readiness declarations remain subject to the explicitly authorized maintainer exception; they do not attest to human review.

Author readiness

Human owner: @SahinurDEV

  • 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.

@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-11-05T04:10:00.924505Z
We couldn’t complete this review. Comment @codex review to try again.
1e602c8 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 Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no blocking issue remains.

Summary

The PR preserves independently readable Objective-C records when their adopted-protocol lists cannot be read.

  • Unreadable protocol lists no longer hide their Objective-C owners.
  • Saved native metadata snapshots now distinguish reader v3 results.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Class, category or protocol] --> B[Shared protocol-list reader]
  B --> C{List readable?}
  C -->|Yes| D[Return protocol names]
  C -->|No| E[Return known names and failure reason]
  D --> F[Retain owner facts]
  E --> G[Retain owner facts with partial status]
  F --> H[Publish under reader v3]
  G --> H
Loading

Reviews (6) · Last reviewed commit: "fix(native): invalidate snapshots from t..." · Reviewed by Greptile

Comment thread src/native/AppleObjcDispatchFacets.ts Resolved
readAdoptedProtocols now returns Result<string[], ProtocolListUnreadable>
and readClass records the failure reason and marks the class row partial.
Own adopted protocol-list recovery at the shared reader and retain readable
prefixes and independent class, category and protocol facts. Remove the
class-only wrapper and cover source-preserving provider delivery.

Fixes morluto#8945

Assisted-by: Reimu (gensokyo-skills:reimu-incident-triage)
@gensokyo-dev gensokyo-dev changed the title fix(native): retain Objective-C classes whose adopted-protocol list exceeds its count limit fix(native): preserve Objective-C records with unreadable protocol lists Nov 6, 2026
Exercise the count guard through the real Darwin entrypoints selected by
the Apple artifact CI lane, retaining target identity and partial facts.
Share the existing controlled byte fixture with provider-boundary tests.

Assisted-by: Reimu (gensokyo-skills:reimu-incident-triage)
Advance the source-owned reader commitment for recovered protocol-list
results. Replace the fictional old-version control with the actual v2
binding so the regression catches unintended reuse of pre-fix snapshots.

Assisted-by: Reimu (gensokyo-skills:reimu-incident-triage)
@gensokyo-dev
gensokyo-dev merged commit 81ada02 into morluto:main Nov 6, 2026
45 of 48 checks passed
@morluto

morluto commented Nov 11, 2026

Copy link
Copy Markdown
Owner

Welcome to REA, @SahinurDEV, and thanks for improving Objective-C metadata recovery. Keeping readable class and protocol facts when an adopted-protocol list cannot be decoded gives analysts useful evidence without hiding the partial result.

@morluto morluto added area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior bug Something isn't working labels Nov 22, 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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] inspect-native-dispatch-metadata drops class and metaclass rows when an adopted-protocol list exceeds its count limit

3 participants