Skip to content

feat(artifacts): inspect classic iNES container regions - #2087

Closed
Zhong-fan wants to merge 41 commits into
morluto:mainfrom
Zhong-fan:feat/2072-ines-container
Closed

Zhong-fan wants to merge 41 commits into
morluto:mainfrom
Zhong-fan:feat/2072-ines-container

Conversation

@Zhong-fan

@Zhong-fan Zhong-fan commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Add the container-only first milestone of #2072: classic iNES routing, file-region inventory and byte-exact reconstruction through existing artifact tools. The broader 6502/emulator work remains in #2072 and #1641.

Problem and expected behavior

Valid cartridge bytes named cartridge.data were rejected as an unsupported native binary. They should open as an archive and return original header facts, region offsets, sizes and SHA-256 identities.

Change and scope

  • One domain parser owns the header/layout. Preserve header, trainer, PRG/CHR units and trailing bytes; verify their actual concatenation against the source digest using the same bytes read for region hashes.
  • Reuse retained descriptors and safe extraction. Handle short reads, source changes and cancellation consistently; choose the format from current bytes before inventory and choose extraction readers from that fresh manifest.
  • Express optional container facts at the output-schema owner, removing duplicate graph parsing and downstream field repairs.
  • Complete the CI follow-up: browser startup waits for a responsive fixture page within its existing budget; cleanup covers content drain plus shutdown, retries survive request cancellation, and macOS explicitly runs iNES and Mach-O summary/page checks.

Supported scope is classic iNES roots with clean reserved bytes. NES 2.0, UNIF, dirty headers and truncation are refused. CPU mapping, native 6502 analysis, emulation and nested cartridge traversal remain outside this increment.

Contract and boundary impact

  • Semantic owner/earliest stage: domain/inesContainer.ts; signature routing before native detection.
  • Scope/maintainer decision: offline artifact support and ordinary fixes within existing authority; new execution-provider approval is not applicable.
  • CLI/MCP: existing open_binary, inspect_artifact, extract_artifact; additive ines format, metadata and observations.
  • Provider/platform: portable Node reads; existing artifact provider and CLI/MCP workflows.
  • Evidence/reconstruction: exact source bytes, offsets, hashes and physical region order; header declarations remain distinct from runtime behavior.
  • Selection/cleanup: explicit database choice remains authoritative; failed closes retain their cause and owner. Existing browser launch/connect authority is preserved.
  • Metadata: authored guide/skill updated; CI regenerates ignored catalogs and skills.

Expected effects:

  • Read existing files.
  • Launch/attach to a process — existing browser cleanup follow-up.
  • Change files — extracted regions and private browser-profile cleanup.

Evidence and regression coverage

Representative executed output (excerpt):

{"header":{"format":"ines","mapper":19,"trainer_present":true},"reconstruction":{"bytes":41492,"verified":true}}

Tests independently check region offsets/hashes, the source digest and extracted concatenation. Added regressions reproduce stale plist/PE routing, an extra full payload read, and changed-file admission incorrectly reported as I/O. The Windows race changes the real file between descriptor stat and admission lstat; it now reports integrity failure.

  • Observed, derived and inferred claims remain distinguishable.
  • Identity, provenance and failed attempts remain preserved.
  • Unsupported or incomplete outcomes remain visible.

Validation performed

Current head 480a467, integrated with main cae7620:

  • npm run check:ci, npm run docs:check, commit/push checks and post-commit npm run format:check — passed without relaxing checks. The commit tree matches the tested tree.
  • npm run test:focused -- <14 files> on Windows (Node 24.18.0, npm 11.16.0): 218 passed, 9 platform skips. Covers Evidence/snapshot/raw-6502 boundaries, iNES inventory/extraction, compiled CLI and SDK stdio MCP, replacement formats, cancellation, browser fixture readiness/cleanup and Windows launcher isolation.
  • Linux Vitest on an isolated snapshot of the same tree: 68 passed across Evidence, snapshot, raw-binary and snapshot persistence tests, including the actual POSIX private-file mode assertion.
  • npm run verify:browser:runtime with real Windows Chrome 155 — passed the public CLI/MCP runtime workflow. Earlier Windows/Linux real-browser and source-map checks at 00f3169 also passed; the startup helper is unchanged in this merge.
  • Upstream CI for this head is pending; it has not passed yet.

Compatibility, safety, and release

  • Breaking changes/migrations: none; format and observations are additive.
  • OS/provider coverage: source-owned iNES workflows on Linux, macOS and Windows; real browser verification in CI. This lane requires no native analysis engine or emulator.
  • Package/release: no dependency, version or installer changes; no build outputs committed.
  • Containment: bounded header/count parsing, streamed payloads, stable source identity and owned output. Fixtures use source-owned bytes.

Before merge

  • Concrete problem and related issue.
  • Material scope and authority resolved.
  • One focused outcome and conventional title.
  • Tests cover changed behavior and meaningful failures.
  • Owning docs, contracts and generated metadata updated.
  • Representative CLI/MCP output included.
  • Final diff checked for secrets, unrelated cleanup and unsupported claims.

@Zhong-fan
Zhong-fan marked this pull request as ready for review October 12, 2026 07:32
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 12, 2026 •

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-13T13:59:45.429553Z 480a467 New commits
ℹ️ 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 chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 414307c9d5

ℹ️ 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".

Comment thread src/artifacts/InesArtifactReader.ts Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 574f6bb3bd

ℹ️ 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".

Comment thread src/artifacts/InesArtifactReader.ts Resolved
@Zhong-fan

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5ba8b2f6bf

ℹ️ 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".

Comment thread src/artifacts/inventory/classify.ts Resolved
Comment thread src/artifacts/ArtifactProvider.ts Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e6d4d7fb84

ℹ️ 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".

Comment thread src/artifacts/inventory/classify.ts Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9b8916152b

ℹ️ 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".

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 071f632e92

ℹ️ 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".

Comment thread src/artifacts/InesArtifactReader.ts Resolved
Comment thread src/artifacts/inventory/classify.ts Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a60d60dc6b

ℹ️ 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".

Comment thread src/application/BinaryTargetResolver.ts Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 681f34879e

ℹ️ 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".

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2b29105bf9

ℹ️ 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".

Comment thread src/artifacts/InesArtifactReader.ts Resolved
@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.

@Zhong-fan

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Hooray!

Reviewed commit: 75c2741912

ℹ️ 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".

@greptile-apps

greptile-apps Bot commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

This PR is set for a Plus review. TREX isn't supported with Plus or Apex reviews yet, so Greptile reviews this PR at Base while TREX is on.

@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 13, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5 Tier: apex

[Medium impact] The reviewed changes appear safe to merge; no new blocking issue was found.

Summary

Adds classic iNES inspection and extraction through the existing artifact tools.

  • Classic iNES files open as inspectable, extractable containers.
  • Browser scenarios wait for page discovery and finish cleanup reliably.
  • Existing provider tests now use fixtures and setup that fit their platform.

Review scope: the commits have different target merge bases, so the full PR diff was reviewed as changes since the last review. No tests were executed during this review. Live supersession status could not be confirmed because GitHub access was unavailable.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A["Current source bytes"] --> B{"NES-family signature?"}
  B -- No --> C["Existing format routing"]
  B -- Yes --> D{"Supported complete classic header?"}
  D -- No --> E["Refuse unsupported or incomplete input"]
  D -- Yes --> F["Read regions through retained source"]
  F --> G["Hash each region and ordered concatenation"]
  G --> H{"Order, size and source hash match?"}
  H -- No --> I["Report inconsistent or changed source"]
  H -- Yes --> J["Return inventory and reconstruction facts"]
  J --> K["Fresh extraction scan and source check"]
  K --> L["Check each output file before transfer"]
Loading

Reviews (11) · Last reviewed commit: "Merge main and preserve iNES evidence fo..." · Reviewed by Greptile

@morluto

morluto commented Oct 13, 2026

Copy link
Copy Markdown
Owner

@greptileai review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: faa6f89566

ℹ️ 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".

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 577d6c3e9b

ℹ️ 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".

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

@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 13, 2026

Copy link
Copy Markdown
Contributor

Want your agent to iterate on Greptile's feedback? Try greploops.

@morluto

morluto commented Oct 13, 2026

Copy link
Copy Markdown
Owner

Continued in #2816. The fork rejected the maintainer push; the follow-up preserves the original contribution, commit history, and attribution, with the review fixes on a writable branch. Latest tests and provider runs were skipped at the maintainer's request.

@morluto morluto closed this Oct 13, 2026
@morluto morluto added enhancement New feature or request area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior labels Oct 14, 2026
@morluto morluto added the area: evidence Evidence, artifacts, and reconstruction label Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: evidence Evidence, artifacts, and reconstruction area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants