Skip to content

fix(native): honor cancellation during PE alias expansion - #9063

Merged
vincentkoc merged 7 commits into
morluto:mainfrom
Afloat16:fix/native-export-parse-cancellation
Nov 30, 2026
Merged

vincentkoc merged 7 commits into
morluto:mainfrom
Afloat16:fix/native-export-parse-cancellation

Conversation

@Afloat16

@Afloat16 Afloat16 commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Honor cancellation while expanding thousands of PE aliases for one address-table slot. The shared parsePeExportSteps generator now yields before the first alias and every 1,024 exported rows, so queued cancellation reaches the file-backed consumer promptly. Complete synchronous parsing retains the same output.

Main already contains the other cancellation checkpoints from #13951. This PR adds the remaining alias-loop checkpoint and keeps the shared parser/composition owners.

Validation

  • Current head: ac057b23796a496431c6df24e65100e14a5cde79, integrated with pinned main aeea7c25ede5c5e6b16198e60c0eb0475ff6f5d8.
  • Canonical P2 review found no actionable issues.
  • The regression drives real PE/ELF bytes through the filesystem service. It queues cancellation after parsing begins, preserves the exact abort reason, checks early interruption, awaits cleanup, and compares successful retries with the complete buffered result.
  • Earlier contributor verification reported one failing alias case with five passing controls before the fix and all six passing afterward; 100 focused tests passed on the earlier integrated tree. These results are historical, not a fresh local run.
  • Current diff checks and all exact-head hosted checks passed, including static checks and portable tests. The worktree has no qualified dependency installation. No native target code is executed by this parsing fix.

Author readiness

Human owner: @Afloat16

The author owns this contribution and requested its submission for maintainer review.

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

Advance export parsing at its cooperative checkpoints so queued cancellation is observed before publishing a complete inventory. Preserve the exact caller abort reason and the existing resource owner.

Add matching checkpoints to PE name, address and alias traversal, with real-byte regression coverage for ELF symbols, GNU version records and PE tables.
@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-06T03:01:59.285517Z
We couldn’t complete this review. Comment @codex review to try again.
4967d06 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 6, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5 · The PR appears safe to merge; no actionable issues were found.RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable issues were found.

Summary

Adds a cancellation checkpoint every 1,024 output rows while expanding PE aliases.

  • PE export aliases now give cancellation a turn every 1,024 rows.

Reviews (7) · Last reviewed commit: "Merge commit 'aeea7c25ede5c5e6b16198e60c..." · Reviewed by Greptile

Afloat16 commented Nov 7, 2026

Copy link
Copy Markdown
Contributor Author

I checked how this change (4967d068) interacts with #9083 (6fba4455), since both edit NativeExportParser.ts. Merging them into main at 99db80a1 in either order produced the same Git tree. All 76 tests in the four parser, ELF dynamic-table, and filesystem regression suites passed on the combined code (Node 24.22.1, Vitest 5.0.3).

I also exercised the overlap with a sectionless GNU-hash ELF containing 8,192 exports. An abort queued during the bucket scan returned AnalysisCancelledError with the original cause before the scan finished. Retrying on the same service returned all 8,192 exports.

@morluto, both PRs now pass PR readiness and their required CI checks. Could you review the two native-export changes? Either merge order works for the cases above.

@CassieFox23

CassieFox23 commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

TL;DR: I ran the PR's one changed test file on Node 22.23.4, 24.22.1 and 26.12.1. All 6 tests passed on each version. With the two source files put back to the merge base, all 6 failed on each version.

Edit (20 Nov): I ran the new head, c1df0d1, in a VM, and the results are here.

Check Node 22.23.4 Node 24.22.1 Node 26.12.1
Head 4967d06 pass: 1 file, 6 tests pass: 1 file, 6 tests pass: 1 file, 6 tests
Red run (source files from de8b2f3) fail: 1 file, 6 tests fail: 1 file, 6 tests fail: 1 file, 6 tests

The test file is tests/boundary/filesystem/nativeExportsCancellation.test.ts. The red run swapped back src/native/exports/NativeExportParser.ts and src/native/exports/NativeExportsProvider.ts. On Node 24.22.1 the failing tests were three in ELF export parsing cancellation. Three more were in PE export parsing cancellation. The other two Node versions failed the same tests.

The PR changes 3 files against the merge base. They are the 2 source files above and the test file. The head is 178 commits behind main c78c8ae.

CI on the head, read live. GitHub shows mergeable true and state clean.

  • CI is completed/success, and CodeQL production is completed/skipped.
  • PR readiness has 3 runs completed/failure, 2 completed/cancelled and 1 completed/success. The PR readiness commit status is success.
  • PR title has 4 runs completed/success and 2 completed/cancelled.
  • Validate author declaration shows 3 failures, 2 cancelled and 1 success.
  • Check runs Source tests, Static checks, Portable tests and CI required are success. 25 check runs were skipped.

Not run

  • A run of tests/boundary/filesystem/nativeExportsCancellation.test.ts on 4967d06 after removing one PE yield at a time (NativeExportParser.ts:184, :217 or :246). The run would check that each removal fails only its own stage.
  • A merge with current main, c78c8ae.
Test setup
  • Box: Fedora 44 VM (4 vCPUs, 8 GB) on my Nobara 44 PC, Linux 7.2.11
  • Node: 22.23.4, 24.22.1, 26.12.1
  • Head / base: 4967d06 / de8b2f3 (merge base with main)
  • Red run: 4967d06 with the changed source files from de8b2f3
  • Install: npm ci --offline and npm run test:prepare on Node 24.22.1
Commands
npm ci --offline
npm run test:prepare
xvfb-run -a npm run test:focused -- tests/boundary/filesystem/nativeExportsCancellation.test.ts

🤖 Written and tested with Claude Code (Sonnet 5.5, verified by Opus 5.5), posted with my OK 🦊

Merge current main, retain typed parser failures, and adapt cancellation regressions to reserved-symbol validation.

Copy link
Copy Markdown
Contributor Author

Merged main at 093e41a5 in d46d283; the branch is conflict-free again. The provider retains upstream's typed-failure projection and uses the relocated native-domain parser. The version-traversal tests now account for the reserved null-symbol check before cancellation, while still proving no exported symbol was read.

All 89 related tests, scoped TypeScript checking, changed-file lint/format, discovery and diff checks passed. I also combined this head with #9083 at 5b4f674: both merge orders yield the same tree, and 116 tests passed across the five combined suites. The two PRs remain independently based on main.

The author declaration now matches the repository's required wording. The description separates the current source-based checks from older validation; complete locked-install/build/workspace coverage is tracked in new-head CI.

Use the supported compact profile in the Windows environment-spelling regression. Keep the exact environment assertion so a duplicate uppercase key still fails, and retain separate coverage rejecting the removed full profile.

Copy link
Copy Markdown
Contributor Author

The inherited Windows Kimi fixture blocker is fixed in b4dda3f, and required CI for this head has now passed. This includes the selected tests, Windows capability/package checks, all three native package baselines and the final CI required gate.

Only the fixture's supported profile value and title changed in this follow-up. The cancellation implementation and its six real-byte regressions are unchanged, and the scoped Windows control still rejects a duplicate uppercase environment key. The PR description now records the completed current-head CI result.

Ready for final maintainer review and merge if the change looks good.

Afloat16 commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor Author

Integrated main 56d31bc7a in 06cccc88e1, resolving the conflicts while preserving cancellation checkpoints and current parser-limit recovery. The standard runtime/skill build, all 105 focused tests, check:fast, changed-file formatting, and git diff --check passed with Node 24.22.1 / npm 11.16.0.

The PR is mergeable again. Current-head CI is running; the body records the validation scope and remaining gaps.

Current-head CI passed.

Keep current main's cooperative ELF directory and provider resource owner. Consume PE name, address, and alias checkpoints through the same cooperative parser, while retaining the synchronous wrapper and all six cancellation regressions.
@CassieFox23

Copy link
Copy Markdown
Contributor

TL;DR: I ran the PR's test file on head c1df0d1. All 6 tests passed on Node 22.23.4, 24.22.1 and 26.12.1. With the parser swapped back to the merge base, 3 of 6 failed on each version.

Findings

Check Node 22.23.4 Node 24.22.1 Node 26.12.1
Head c1df0d1 pass: 1 file, 6 tests pass: 1 file, 6 tests pass: 1 file, 6 tests
Red run (parser from c0ee832) fail: 1 file; 3 failed, 3 passed fail: 1 file; 3 failed, 3 passed fail: 1 file; 3 failed, 3 passed
  • The red run puts src/domain/native/nativeExportParser.ts back to the merge base c0ee832. The test file stays the same.
  • On Node 24.22.1, these three tests failed in tests/boundary/filesystem/nativeExportsCancellation.test.ts:
    • PE export parsing cancellation > observes cancellation during PE addresses and preserves successful output on retry
    • PE export parsing cancellation > observes cancellation during PE aliases and preserves successful output on retry
    • PE export parsing cancellation > observes cancellation during PE names and preserves successful output on retry
  • The Node 24.22.1 log shows one failure in detail, at tests/boundary/filesystem/nativeExportsCancellation.test.ts:219. The test expected AnalysisCancelledError but got ok: true.
  • Node 22.23.4 and 26.12.1 failed the same three tests.
  • The PR changes 2 files against the merge base: src/domain/native/nativeExportParser.ts and tests/boundary/filesystem/nativeExportsCancellation.test.ts.
  • GitHub shows the head as mergeable, state clean, not a draft. The head is 32 commits behind main 3e3faf2.
  • Workflow runs: CI is completed/success, PR title is completed/success, and CodeQL production is completed/skipped.
  • 15 check runs finished success: Build bundled Windows x64 native controls, Build package, CI required, Classify changes, Conventional PR title, Documentation, Greptile Review, Native package baseline (darwin arm64), Native package baseline (linux arm64), Native package baseline (linux x64), Portable tests, Static checks, Test shard (1/1), Windows capability and package lane (capabilities) and Windows capability and package lane (package).
  • 27 check runs were skipped. They include Source tests, Deep static checks and Python producer tests.

Not run

  • A run of tests/boundary/filesystem/nativeExportsCancellation.test.ts with one PE yield removed at a time, to see which test catches each one.
  • A merge with current main, 3e3faf2.
Test setup
  • Box: Fedora 44 VM (4 vCPUs, 8 GB, Linux 7.2.11) on my Nobara 44 PC
  • Node: 22.23.4, 24.22.1, 26.12.1
  • Head / base: c1df0d1 / c0ee832 (merge base with main)
  • Red run: c1df0d1 with the changed source file from c0ee832
  • Install: npm ci --offline and npm run test:prepare on Node 24.22.1
Commands
npm ci --offline
npm run test:prepare
xvfb-run -a npm run test:focused -- tests/boundary/filesystem/nativeExportsCancellation.test.ts

🤖 Written and tested with Claude Code (Sonnet 5.5, verified by Opus 5.5), posted with my OK 🦊

@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
Integrate main ca26f2a and preserve its positional PE/ELF parser. Add the remaining cooperative checkpoint to PE alias expansion and adapt the real-byte service regressions to current composition and ELF traversal boundaries.
@Afloat16 Afloat16 changed the title fix(native): honor cancellation while parsing exports fix(native): honor cancellation during PE alias expansion Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

Integrated current main ca26f2ac in bf1efa8, resolving the parser conflict. Main's #13951 already handles the PE name/address traversals, so the remaining production diff is one checkpoint in the shared PE alias-expansion loop. The positional parser and its ownership remain intact.

With the main parser unchanged, the updated six-case real-byte service regression had 1 failure / 5 passing controls: the alias path visited all 4,096 aliases before observing cancellation. The candidate passes all six, and 100 tests across the complete parser and filesystem suites passed. The normal runtime/skill build, check:fast, changed-file formatting and diff checks also passed. The PR body distinguishes this current evidence from the older three-failure baseline and records the full-gate limits and existing main deep-check failures.

GitHub now reports the branch conflict-free. New-head CI is running.

…063-native-alias-cancellation

* commit 'aeea7c25ede5c5e6b16198e60c0eb0475ff6f5d8': (881 commits)
  fix(hopper): clarify publisher verification failures
  fix(analysis-view): keep PTX text pages on Unicode boundaries (morluto#15222)
  feat(mcp): advertise each tool's family in tools/list _meta (morluto#7154)
  perf(evidence): inspect retained records without building a bundle (morluto#15219)
  fix(process): report denied inspection as typed cleanup failures (morluto#9261)
  perf(mcp): complete retained Evidence without rebuilding bundles (morluto#15210)
  fix(agentenv): stop dry-run tarball reads on cancellation (morluto#15205)
  perf(png): reuse scanline storage in screenshot comparisons (morluto#15215)
  fix(javascript): respect Node HTTP path validation (morluto#9684)
  fix(windows): reject native addons with unusable delay-import tables (morluto#15216)
  feat(artifacts): inventory Android super image metadata (morluto#14928)
  fix(paths): reject dotted console device names for portability (morluto#15220)
  fix(analysis-view): return continuation for GPU pages at the byte limit (morluto#15206)
  fix(screenshots): report the PNG comparison memory allowance (morluto#15217)
  fix(process): compare Windows server paths by native realpath (morluto#15044)
  fix(firmware): recheck decoded member source on completion (morluto#15211)
  fix(artifacts): check signed BC4 and BC5 DDS payload extents (morluto#15208)
  fix(artifacts): bound embedded GLB images by the declared buffer length (morluto#15207)
  perf(ci): confirm test-only macOS selection on Linux (morluto#15203)
  fix(paths): reject Windows console device names (morluto#14972)
  ...
@vincentkoc
vincentkoc merged commit 7dc0356 into morluto:main Nov 30, 2026
44 checks passed
@vincentkoc

Copy link
Copy Markdown
Collaborator

Thanks for the careful cancellation regression! Merged after the exact-head checks and canonical review passed.

vincentkoc added a commit to agnaylor/rea that referenced this pull request Nov 30, 2026
…410-windows-transport

* commit '28772e67d245661b4a66ef5a09353eafda483367': (674 commits)
  docs: note symlink EPERM in Windows source test failures (morluto#7211)
  fix(javascript): scope candidate this event receivers (morluto#4656)
  fix(config): validate target and loader options before printing MCP registrations (morluto#9279)
  fix(native): honor cancellation during PE alias expansion (morluto#9063)
  fix(audit): preserve env shebang argument ownership (morluto#14075)
  feat(evtx): inventory Windows event log records offline
  docs(skill): replace the staged workflow with the rules it encodes (morluto#10374)
  fix(hopper): clarify publisher verification failures
  fix(analysis-view): keep PTX text pages on Unicode boundaries (morluto#15222)
  feat(mcp): advertise each tool's family in tools/list _meta (morluto#7154)
  perf(evidence): inspect retained records without building a bundle (morluto#15219)
  fix(process): report denied inspection as typed cleanup failures (morluto#9261)
  perf(mcp): complete retained Evidence without rebuilding bundles (morluto#15210)
  fix(agentenv): stop dry-run tarball reads on cancellation (morluto#15205)
  perf(png): reuse scanline storage in screenshot comparisons (morluto#15215)
  fix(javascript): respect Node HTTP path validation (morluto#9684)
  fix(windows): reject native addons with unusable delay-import tables (morluto#15216)
  feat(artifacts): inventory Android super image metadata (morluto#14928)
  fix(paths): reject dotted console device names for portability (morluto#15220)
  fix(analysis-view): return continuation for GPU pages at the byte limit (morluto#15206)
  ...
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.

4 participants