Skip to content

feat(artifacts): inspect and extract Godot PCK with retained facts - #3634

Merged
gensokyo-dev merged 6 commits into
morluto:mainfrom
0xthearchitect:feat/godot-pck-reader
Oct 20, 2026
Merged

gensokyo-dev merged 6 commits into
morluto:mainfrom
0xthearchitect:feat/godot-pck-reader

Conversation

@0xthearchitect

@0xthearchitect 0xthearchitect commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Complete the original author's static Godot PCK reader with shared CLI/MCP inventory and extraction. Ordinary formats 2, 3 and 4 now retain engine/header/directory facts, verify declared MD5 through the shared integrity policy, and expose stable occurrence/content identities through selected inventory views. Refs #3633 and #3631; the broader resource/GDScript/signal work in #3631 remains open.

Use inspect_artifact({"detail":"summary"}) for a standalone active pack, then inspect_analysis_view with exact paths or occurrence IDs, batch content IDs and selected fields. Complete Evidence remains retained; unknown encrypted coverage never becomes a claim of absence. CLI supports inspect-artifact PATH --detail summary --evidence_output BUNDLE --json; export never overwrites. Existing complete delivery and native target defaults remain compatible. CLI artifact inspection/extraction also locate exact embedded EOF trailers.

Approach and boundaries

  • The PCK reader owns header/directory parsing, positional reads and descriptor/stream cleanup. Every readable logical occurrence, including repeated ranges and zero-MD5 claims, consumes the shared ZIP/PCK expansion budget: max(256 MiB, 500 × encoded PCK span), with exact-number accounting. Carrier bytes do not grant budget. The entire PCK directory passes this check before any member is yielded or hashed; extraction uses the same owner. Bounded aliases remain valid and encrypted content is not read. Directory metadata has a 64 MiB encoded retention budget with expansion checked before allocation; parsing uses a 64 KiB read window. Unfinished reads drain before owned descriptors close. Borrowed descriptors remain caller-owned.
  • Atomic-root inventories retain their existing limitation and Evidence semantics; Godot-specific unknown coverage stays in the PCK producer.
  • One canonical integrity claim represents SHA-256 or MD5; shared streaming verification implements strict versus record-and-continue. Observed SHA-256 remains content identity. Legacy SHA contradiction identities/fields remain compatible. Extraction verifies the complete carrier before creating output, including header-only replacements with identical member bytes.
  • Shared inventory views validate authenticated facts once, borrow sealed snapshots and lazily index IDs/paths. Cache lifetime follows the immutable result; every projection retains current parent identity and subject checks. Filters intersect, pagination follows selected canonical order, and identity links survive field selection. Producer coverage is separate from retained graph/page completeness.
  • No target execution, decryption, key recovery, resource decoding or GDScript decompilation. Extraction writes only a fresh REA-owned output tree; optional CLI export writes the caller-selected bundle. No dependencies, installers, package metadata or deep-provider changes. Maintainer scope covers the ordinary archive slice.

Executed validation

  • npm run check, npm run docs:check, npm run verify:test-discovery — passed on the final source tree, including generated error-schema consistency and authored skill/docs.
  • Source regressions: 111 tests across 10 files passed, including reader bounds/cancellation, ownership, inventory identity, cached context binding and Evidence authentication/comparison.
  • Final focused CLI/MCP/filesystem/provider suite: 61 tests passed. Actual compiled CLI covers formats 2/3/4, embedded carriers, integrity policies, encrypted unknowns, no-overwrite export and historical reads. The SDK validates named advertised JSON Schemas and exact batch/field responses. ASAR/ZIP integrity, extraction identity and cleanup regressions remain covered.
  • Atomic-root compatibility and Godot public workflows: 15 tests across 4 files passed, including the exact CLI/MCP comparison regression caught by CI. Tests retain their original assertions. Full check, docs and discovery checks passed again after the producing-boundary correction.
  • Aggregate expansion regression: four new metadata-admission controls fail on f1535a575 (formats 2/3/4 and embedded-carrier budget), using a roughly 0.32 MiB fixture declaring 275 MiB across 1,100 aliases; no amplified payload hashing/writes were run on the affected revision. After correction, all 35 reader/budget tests and 35 public CLI/MCP/ZIP/coverage tests passed. Both integrity policies reject the over-budget pack with typed truncation before extraction output exists. All 13 real corpus packs were verified again against the independent oracle.
  • Shared CLI delivery regression: all 5 Unity CLI/MCP acceptance cases passed, including export and caller-selected symlink-parent paths.
  • Real compiled CLI: 13 packs checked against an independent Python struct/hashlib oracle, including official Godot 4.4.1 (PCK 2), 4.6.1 (PCK 3), 4.7.1 (PCK 4) SDK outputs and Dodge the Creeps. All 15,063 plaintext member hashes/bytes agreed; plain small packs and the public game's 48 members extracted byte-for-byte. Encrypted samples retain metadata only. The public pack SHA-256 is 989666e8c4619bc4022903cfb58fd29d88b881a136452952a3df06b8cf99ad70.
  • Two constructed official-editor ELF carriers containing official PCK 3/4 packs verified whole-carrier SHA, native content classification, exact bounds and member hashes. These are constructed carriers, not shipped embedded games; no target was executed by REA.

Measured completed task

The actual stdio SDK finds three exact paths in an official 5,000-unique-member PCK 3, joins their observed SHA-256/size, unlinks the owned input copy and retrieves their stable identities again. Both implementations use summary delivery and the best available batch path query; the original reader integrated with current main must read all 5,001 content nodes for the join. The follow-up selects three nodes. Both complete in 6 calls including open/close, with independent oracle, schema and provenance assertions and zero retries.

Two alternating pairs on pinned revisions, in baseline/follow-up/follow-up/baseline order:

Cost Baseline 00bedf665 Follow-up 047fe3a84
Tool calls 6 6
Selected input declarations + all calls/replies, tokenx estimate 832,709 23,492
All input declarations + calls/replies, tokenx estimate 1,050,177 240,960
Entire recorded protocol including output schemas, tokenx estimate 1,811,194 1,006,151
Whole task elapsed, seconds 28.60–31.94 28.30–29.95
Whole process-family CPU, seconds 31.63–36.90 29.01–33.81
Sampled peak process-family RSS, MiB 1042–1110 1005–1019

Includes staging/input hashing, discovery, advertised-schema validation, protocol envelopes, calls and teardown; build/install excluded. Actual model/host-rendered tokens are unmeasured. Fresh processes and analysis caches, two CPUs, bounded heaps, disabled Node compile caches, 20 ms process-family memory sampling; OS cache and host load uncontrolled. Runtime and RSS varied between earlier probes, so no general speed or memory improvement is claimed. Cold analysis, first retained view and warm retained queries are recorded separately; warm reads after source removal are historical facts, not current filesystem claims.

The final resource-bound tree passed the complete SDK task again: 23,492 / 240,960 / 1,006,151 tokenx estimates respectively, 18.07 s elapsed, 19.74 s CPU and 1081 MiB sampled peak RSS. The paired table pins its earlier revisions; this final probe covers the atomic-root compatibility and aggregate expansion corrections.

Remaining verification limits

Real corpus/SDK verification ran on Linux. PCK 1, signed/section-only embedded discovery, patch/removal entries and encrypted contents are unsupported. Sparse-bundle unknown coverage has synthetic tests; real sparse producers and shipped PE/Mach-O embedded games were not verified. Complete Evidence preserves the observed header/directory facts and limitations; it is not a retained copy of every source payload.

Author readiness

Human owner: @gensokyo-dev

The repository operator explicitly delegated these declarations and authorized ready review, CI follow-up and normal merge in this session. Codex reviewed the final diff and executed evidence; independent human review was not observed. Original author commits remain in this PR's history.

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

Add a Godot Engine PCK artifact reader for standalone packs and packs
embedded behind an executable trailer (formats 2 and 3). Members are
uncompressed byte ranges verified against their declared MD5 on read.

Encrypted directories, sparse bundles, patch removal entries, unknown
flags and format 1 fail closed as unavailable; encrypted members are
reported without being read. inspect-artifact and extract-artifact
recognize standalone packs by their GDPC magic.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@0xthearchitect
0xthearchitect marked this pull request as ready for review October 14, 2026 19:41
@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 14, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

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

Summary

Adds static Godot PCK inventory and extraction with retained header facts, MD5 checks and selected inventory views.

  • Godot PCK packs now appear as static inventories of their files and format facts.
  • Archive inspection and extraction now check declared digests and total readable size.
  • Inventory views can select exact records and fields while keeping their identity links.
  • CLI artifact inspection can return a summary and save complete Evidence for later queries.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Open carrier] --> B[Read PCK header and directory]
  B --> C{Readable bytes fit budget?}
  C -->|No| D[Reject before yielding members]
  C -->|Yes| E[Build retained inventory]
  E --> F[Query selected historical facts]
  E --> G[Verify carrier before extraction]
  G --> H[Write fresh output tree]
Loading

Reviews (6) · Last reviewed commit: "fix(artifacts): bound aggregate PCK memb..." · Reviewed by Greptile

Comment thread src/artifacts/GodotPckArtifactReader.ts Resolved
Comment thread src/artifacts/GodotPckArtifactReader.ts Resolved
Comment thread src/artifacts/inventory/reader.ts Resolved
Cap member paths at 4096 bytes and the retained directory at 64 MiB
before allocation. Read members with positional chunk reads through
pipeline so cancellation is typed, abandoned consumers release their
source, and the shared descriptor stays reader-owned. Retain the root
descriptor for godot-pck inventory, as for ZIP and universal Mach-O.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@0xthearchitect
0xthearchitect marked this pull request as draft October 14, 2026 20:05
@kaoru0822-kitauji
kaoru0822-kitauji marked this pull request as ready for review October 15, 2026 06:16
@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-15T06:16:26.763530Z d8d5e86 Draft marked ready
ℹ️ 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.

@CassieFox23

Copy link
Copy Markdown
Contributor

TL;DR: All 18 new Godot PCK tests pass with this PR's change added to current main. So do 113 older tests nearby. On main without the change, the new test file cannot even load, because the reader does not exist yet.

Thanks, 0xthearchitect, for the care in this PR.

Results

Run Result
Main c7f6b8b plus only the new test file (before) 0 tests run. The file fails to load: Cannot find module './GodotPckArtifactReader.js'. Exit 1
PR head d8d5e86 as it stands, the new test file 18 of 18 pass, exit 0
Main c7f6b8b plus the whole PR diff (after), 14 test files 131 of 131 pass, exit 0
Same tree, typecheck with tsc -p tsconfig.json --noEmit No errors, exit 0

The 14 files are GodotPckArtifactReader.test.ts (18 tests) and 13 nearby files. I chose the nearby files because the PR touches them: 8 other files in src/artifacts/, 2 in src/artifacts/inventory/, and analysisSnapshot, artifactGraph and evidence in src/domain/. I searched all 14 for "doctor" first. None mention it.

The count of 18 matches the PR body. This is a feature, so there is no bug to show before and after.

The PR diff applied to main with small line offsets (1 to 4 lines) in three files. So the neighbour tests and the typecheck ran on the merged result. Only the new test file also ran on the bare head.

No test makes a real network call. The reader tests build small Godot packs in memory and in temp files. Godot Engine (MIT) is named only as the format's source. I ran no Godot software.

Real CI has not run on this PR. The only check on the PR page is a code-review bot named Greptile Review, and it passed. That is not CI.

One note on process. The PR body calls this a draft prototype that informs the scope decision in #3633. GitHub shows the PR as ready for review. I made no judgement on the scope decision.

Not run

  • The CLI path: inspect-artifact and extract-artifact on a real pack. The author reports doing this with packs made by a third-party tool. I did not repeat it.
  • The 1.6 GB Godot export and the out-of-memory claim. The author says the sample is a commercial game and is not shared, so I could not repeat it.
  • A pack from the official Godot editor, and real encrypted packs. The PR body lists both as untested.
  • The tests in tests/boundary/ and tests/conformance/. The PR body says the author ran them. I did not.
  • The whole test suite and any doctor command.
Test setup
  • Box: Nobara 44 (Fedora 44 base), Linux 7.2.9
  • CPU: AMD Ryzen 9 5900X, 12 cores / 24 threads
  • RAM: 32 GB DDR4-3600
  • Node: 24.18.0
  • Head / base: d8d5e86 over c7f6b8b
  • Other: other test agents shared the box. Tests ran under an 8 GB memory cap. These are source tests, so I did not build the project for this PR.
Commands
export PATH=~/.local/opt/node24/bin:$PATH npm_config_cache=/tmp/t26-1015/npm-cache TURBO_TELEMETRY_DISABLED=1
# main c7f6b8bad extracted to /tmp/t26-1015/main, dependencies installed with npm ci
# before: add only the new test file
patch -p1 -d /tmp/t26-1015/main -i /tmp/t26-1015/3634-tests.diff
npm run test:focused --prefix /tmp/t26-1015/main -- src/artifacts/GodotPckArtifactReader.test.ts
# head run: extract d8d5e86b0 to /tmp/t26-1015/p3634, npm ci, then the same one-file command
# after: add the rest of the PR diff, then run the test file and its neighbours
patch -p1 -d /tmp/t26-1015/main -i /tmp/t26-1015/3634-src.diff
npm run test:focused --prefix /tmp/t26-1015/main -- \
  src/artifacts/GodotPckArtifactReader.test.ts \
  src/artifacts/ArtifactPaths.test.ts \
  src/artifacts/ArtifactResourceScope.test.ts \
  src/artifacts/hostExecutableMarking.test.ts \
  src/artifacts/MachOSliceArtifactReader.test.ts \
  src/artifacts/OrderedReads.test.ts \
  src/artifacts/OwnedFileHandle.test.ts \
  src/artifacts/RegularFileAdmission.test.ts \
  src/artifacts/ZipArtifactReader.test.ts \
  src/artifacts/inventory/ArtifactGraphConstruction.test.ts \
  src/artifacts/inventory/ArtifactOccurrenceIdentity.test.ts \
  src/domain/analysisSnapshot.test.ts \
  src/domain/artifactGraph.test.ts \
  src/domain/evidence.test.ts
npm exec --prefix /tmp/t26-1015/main -- tsc -p /tmp/t26-1015/main/tsconfig.json --noEmit

🤖 Generated with Claude Code (Sonnet 5.5, verified by Opus 5.5) 🦊

@gensokyo-dev gensokyo-dev changed the title feat(artifacts): read Godot PCK packs feat(artifacts): inspect and extract Godot PCK with retained facts Oct 20, 2026
Comment thread src/artifacts/GodotPckArtifactReader.ts Resolved
@greptile-apps

greptile-apps Bot commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

Comments Outside Diff

These findings could not be posted inline.

  • P2 Unread children called absent src/artifacts/inventory/reader.ts:99 ▶

    This fallback now says the artifact has no child entries, but unsupported archives also reach it. A TAR file, for example, is classified as file without anyone reading its directory. Inspection repeats this claim in its limitations, so users can mistake “not examined” for “absent.” Keep the root-only caveat without claiming that children do not exist.

@gensokyo-dev
gensokyo-dev merged commit 5fa4def into morluto:main Oct 20, 2026
44 of 45 checks passed
@github-actions github-actions Bot mentioned this pull request Oct 19, 2026
3 tasks done
kangyishuai pushed a commit to kangyishuai/rea that referenced this pull request Oct 20, 2026
…ansition-view

Resolve the inspect_analysis_view description conflict with main's Godot
PCK inventory change (morluto#3634). Keep main's rewritten inventory text and add
this branch's capture_browser_scenario parent and view sentences.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kaoru0822-kitauji added a commit to earakely-scale/rea that referenced this pull request Oct 20, 2026
Resolve the inspect_analysis_view description conflict with morluto#3634 by
keeping main's inventory wording and adding the environment-state
sentence.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@morluto morluto added area: evidence Evidence, artifacts, and reconstruction enhancement New feature or request labels 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 enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants