Repository navigation
fix(artifacts): preserve iNES shutdown ownership and I/O failures - #10152
ShuaixinHuang wants to merge 4 commits into
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ea9aa396a7
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: dd72640758
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
[Medium impact] The PR appears safe to merge; no blocking issue was found. SummaryThe PR keeps iNES reads and final source checks owned until shutdown finishes. It also preserves physical read errors when cancellation arrives before the stream forwards them.
DiagramsequenceDiagram
participant Caller
participant Reader as InesArtifactReader
participant Scope as ArtifactResourceScope
participant Stream
participant File as Owned descriptor
Caller->>Reader: open(entry)
Reader->>Scope: Admit read and stream ownership
Reader->>Stream: Start bounded pipeline
Caller->>Reader: close()
Reader->>Stream: Abort lifecycle
Reader->>Scope: Stop admission and join work
Stream-->>Scope: Producer and readable retire
Scope-->>Reader: Work settled
Reader->>File: Close owned descriptor
Reader-->>Caller: Shutdown complete
Reviews (2) · Last reviewed commit: "chore: merge main while preserving iNES ..." · Reviewed by Greptile |
Superseded by #10554 at the author’s explicit request. The replacement carries the same focused lifecycle/I/O fix on main
8578daf8b; this PR remains closed to preserve its review and CI history.Latest main integration — 2026-11-14
Merged main
5815178a8d581fa81a9422cdfb9f86dd5cb913d7at36ddb7432be8f72feed3f70360f426d18e25365b. Kept this PR's scope-admitted header/inventory work, joining of pending I/O/readable retirement, post-await state checks and primary read-failure ownership. Main's independent paused-inventory controls are retained. The moved#assertOpenhas one definition at main's location; relative to the previously published reader, the integrated production-file difference is only that method's placement. The shared physical-read failure state machine is byte-identical to the published PR.Fresh qualification: 353 passed / 15 focused files, including real compiled CLI/stdio MCP, iNES cancellation/closure/identity, descriptor failure and retry, and shared ASAR/FIT/Bun/Deno/process consumers.
check:ci:fast3 tasks passed; all four changed TS files type-aware lint 0 errors / 5 advisory warnings; discovery and docs passed (9 README tests). Normal commit/pre-push hooks, final diff review and all five PR-file hashes passed. No regression, retry, timeout or skip was removed/relaxed to resolve the conflict.Hosted CI for the new merge head is pending. Earlier baseline and CI evidence below qualifies only its named older heads, not this merge commit. No fresh monolithic full check, native Windows/macOS, real Bun target or emulator qualification is claimed; initial human declarations remain recorded.
Closing an iNES reader could release its extraction-owned descriptor while a region read or final source check was pending. Its stream could deliver bytes after
close()resolved, and a paused inventory could continue yielding entries. Shutdown also exposed a shared read-error forwarding gap: cancellation could replace an already rejected physical read withunavailable/cancelled, losing its I/O classification and exact cause.The reader now uses
ArtifactResourceScopefor admission, stops region producers, and joins producer completion plus readable retirement before releasing its owned descriptor. Async final identity validation is admitted independently, so consumer destruction cannot release its descriptor early. Borrowed inventory descriptors stay open; failed owned closes retain the same retry owner. The unowned nested generator is replaced with a bounded pipeline; identity, length and byte-exact reconstruction checks remain.Two automated-review findings were reproduced and repaired at their owners:
PositionalArtifactReader.open()already performs this check.Readable.fromforwards its rejection; lifecycle/caller cancellation cannot overwrite that physical failure. Successful, unread and buffered cancellation retain their existing behavior.This is an existing offline-reader lifecycle/provenance repair. No new provider, execution authority, public schema, dependency, budget, installation behavior or generated metadata. Maintainer scope decision: not applicable. Source inspection and targeted searches found no matching fix: open #8689 only adjusts a different timestamp fixture; merged #9649/#9641/#10081 address earlier failure-provenance boundaries. No separate issue was opened.
Executed evidence
Head
e49bb2f25, latest fetched main/basea01674377; Linux x64, Node 24.22.1 / npm 11.9.0, source-authored cartridge bytes:node scripts/run-exact-tests.mjs run tests/boundary/filesystem/inesCancellation.test.ts tests/boundary/filesystem/inesArtifact.test.ts tests/boundary/filesystem/fileHandleChunks.test.ts.ea9aa396a, post-validation closure/cancellation produced 2 failed / 44 passed and one uncaught closed-reader error. Ondd7264075, final error-forwarding regressions produced 4 failed / 53 passed. These controls use real identity checks and real native write-only descriptor failures, plus injected EIO at an actual iNES descriptor method; same/distinct cancellation reasons are covered.npm run test:focused -- <15 exact test files>passed 348 tests across iNES filesystem/domain/compiled CLI/real stdio MCP, resource ownership, Godot, shared descriptor reads, ASAR, FIT, Bun/Deno readers, process inspection and capture. Regression coverage includes pending and failed I/O, final validation, consumer destruction, unread/buffered streams, borrowed/owned descriptors, cleanup retry and paused iteration.npm run check:fast, normal commit/pre-push hooks, formatting andgit diff --check: passed. Typed lint vianode scripts/ci/static-check-report.mjs typed-linton all four changed TS files: zero errors, five pre-existing warnings. Final checked-file SHA-256 inputs were verified unchanged.npm run docs:check: passed, including nine README tests; docs have not changed since. Initial-headnpm run checkpassed its pre-typed stages but its monolithic typed-lint stage was SIGKILLed at the cloud 8 GiB ceiling, including a lower-GC retry. It is not reported as passing. The unchanged checker/config/rules subsequently passed all 7,207 default-inventory files in nine serial batches (0 errors, 4,986 advisory warnings), with exact scope/digest verification; follow-up changes were checked again above.Exact focused-test selection
Scheduling gates/microtasks establish ordering at production boundaries, not naturally occurring race frequency. Local native Windows/macOS, real Bun execution and emulator behavior were not exercised. No game ROM or target execution was used. Current-head CI passed, including
CI required, source/static/build/docs, all eight built-test shards, portable tests, Linux native packaging, Windows native-control cross-build, APK verification and the real macOS Apple lane. The macOS lane explicitly ran the iNES CLI/MCP/source-boundary suites. This reports the workflow's selected lanes; skipped deep/provider/platform lanes remain visible in the run. Automatic re-review ofe49bb2f25completed with no findings and no unresolved findings. Both earlier valid review threads were fixed and resolved.Previous-head lane successes are not counted as current-head passes. Initial CI's Apple lane exceeded its 15-minute job limit (confirmed by its check annotation); the current-head Apple lane and complete workflow passed.
Author readiness
Human owner: @ShuaixinHuang
The human owner explicitly confirmed review of the final head
e49bb2f2544b633c0aef1a38776925b5a31443c9and instructed that this PR be ready for maintainer review. All three declarations below are confirmed by that instruction.