Skip to content

feat(artifacts): select extraction entries and output destination - #4031

Merged
gensokyo-dev merged 11 commits into
morluto:mainfrom
jsk1004ha:feat/artifact-selection-3490
Nov 5, 2026
Merged

gensokyo-dev merged 11 commits into
morluto:mainfrom
jsk1004ha:feat/artifact-selection-3490

Conversation

@jsk1004ha

@jsk1004ha jsk1004ha commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #3490. extract_artifact can extract exact inventory occurrences into a caller-selected, absent absolute destination. CLI adds --output-root and repeatable --occurrence-id; MCP uses output_root and occurrence_ids. Omitting both keeps all-file extraction into a fresh temporary directory. Published files persist after session close.

Selection uses occurrence identity, including independently selectable identical-content entries. The active reader's complete inventory remains separate from the requested output: unknown/duplicate/empty IDs, nested-reader members, links, unsafe paths and selected destination collisions are refused before publication. Full source-integrity checks, hashes, exclusive output ownership and rollback remain in force. Output inside a source directory, including symlink aliases, is refused.

Implementation and integration

ArtifactExtractionSelection owns reader membership and selection; ArtifactExtraction verifies and materializes it; SafeOutputTree owns destination admission and cleanup. CLI/MCP share these owners and named contracts. output_root uses the shared absolute-local-path schema, including after SDK conversion. No provider, dependency, target execution, instrumentation or protection-recovery expansion; writes are ordinary extraction output within existing authority.

Head 9ccb372a5 includes main 808491685. The previous CI shard 8 found one PR-owned defect: adapting output_root with unwrap().optional() discarded the owning contract's description. The CLI adapter now preserves that metadata; the existing whole-CLI help regression failed before and passes after. No duplicate description, test waiver or unrelated repair was added. Automatic review also confirmed that the runtime-only uniqueness refinement was absent from the advertised input schema. The canonical array now carries uniqueItems: true, following the managed selection contract. A full-profile public SDK schema regression failed before this correction and passes after: one/two distinct IDs are valid, repeated IDs fail the uniqueItems keyword, and runtime duplicate-ID calls leave no output directory. The sibling occurrence option already had its repeatable-flag description. Obsolete failed-head CI was cancelled after its failure log was retained.

Executed validation

Linux x64, Node 24.22.1 / npm 11.16.0:

  • Initial integration: 91 tests / 12 files passed, covering extraction selection/destination, public CLI/MCP, advertised absolute paths, UnityFS refusal, inventory completeness, source identity/admission, cancellation and output ownership.
  • After both fixes: 38 tests / 4 files passed (whole-CLI help/aliases, public selection/advertised-schema parity, provider selection and full SDK absolute paths). The final public acceptance file passed again after adding runtime duplicate-ID/no-output checks. Existing help and provider assertions were retained; the public acceptance test was extended with the new schema regression.
  • Full source typecheck passed with one checker / 1536M soft memory target; focused syntax lint and formatting passed. Runtime build and git diff --check passed.
  • npm run docs:check passed after the fix and latest-main sync, including 9 README tests. The last sync added only main's evaluation docs/scripts; extraction runtime source did not change after these checks.
  • Real installed Apache Commons CLI 1.5.0 JAR /usr/share/java/commons-cli.jar (SHA-256 f990941be47ddb0895a3e4b0532bca9e1338db28a075119485efb15b6b59b973): inspect summary → exact-path/field-projected occurrence → selected extraction. The 7,026-byte CommandLine.class matched Python's independent ZIP reader (982cb7617cfc22a99c97b18db981de2bc522a8c2234ead14239f4f19281e12dd). CLI/MCP artifact lists and selection manifests matched, the file survived close_binary, and the input digest remained unchanged. Neither Java classes nor target applications were executed. This real workflow was repeated after the help fix.

The final selected/all CLI controls returned 1/32 files, 3,521/13,441 JSON bytes, in 1.719/1.867s. Full input inventory/integrity is still checked. These warm-cache illustrative runs do not establish a speedup or model-token saving. The complete final SDK+MCP+CLI workflow took 10.842s, with 11.695/1.037s task-process user/system CPU delta and 1.28 GiB sampled family RSS (200ms samples, shared pages counted per process; short peaks can be missed). SDK first-view schema preparation remains part of that cost.

CPU accounting was corrected to subtract initial RUSAGE_CHILDREN counters: a shell can exec-replace its last command and pass earlier child CPU into the profiler process. A control with preceding CPU work and /bin/true reproduced the nonzero baseline and near-zero task delta. This final rerun started with 78.312/7.093s inherited CPU, which was subtracted. Earlier raw CPU totals in the review history are not attributable task deltas; their elapsed/RSS observations are unaffected. CPU here excludes profiler overhead.

Local checks used two-CPU affinity and a 4-GiB sampled family RSS guard; no extraction verification hit it. Build/public-boundary peak was 1.78 GiB. Full local lint was not completed: earlier full-repository attempts exceeded the guard; focused lint is not a full gate. Local hooks were disabled for the synchronized push after the explicit checks above. Final-head CI 42089893879 passed, including all 8 test shards, Static checks, Portable tests and CI required; normal squash merge completed at ad518cff65cc71564f678b26bcae4a3862689ad4 without bypass. Real Windows filesystem behavior, the original third-party APK and other providers were not newly verified. Earlier PR-history checks belong to their pinned revisions. Existing human declarations below are preserved.

Author readiness

Human owner: @jsk1004ha

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

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 15, 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-11-05T19:01:37.065586Z
We couldn’t complete this review. Comment @codex review to try again.
9ccb372 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.

@greptile-apps

greptile-apps Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5 Tier: apex

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

Summary

Adds exact occurrence selection and caller-chosen extraction destinations through CLI and MCP. The latest revision advertises the existing uniqueness rule and adds public-schema coverage.

  • Artifact extraction lets callers choose exact inventory entries.
  • Artifact extraction writes to a caller-chosen absolute directory.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  CLI[CLI options] --> Contract[Shared extraction contract]
  MCP[MCP inputs] --> Contract
  Contract --> Inventory[Full inventory and integrity checks]
  Inventory --> Selection[Select active-reader occurrences]
  Selection --> Verify[Match entries and verify selected bytes]
  Verify --> Output[SafeOutputTree]
  Output --> Success[Commit files and return manifest]
  Output --> Failure[Roll back owned output on failure]
Loading

Reviews (7) · Last reviewed commit: "fix(contracts): advertise unique extract..." · Reviewed by Greptile

@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: 3d2920e2e4

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

Integrate current main while preserving ordered ZIP occurrence selection, rejecting colliding selected destinations, and using SafeOutputTree canonical output-root semantics. Mark occurrence and destination fields optional in the CLI contract and update directory fixtures to the admitted-source contract. Cover CLI/MCP acceptance, duplicate paths, symlink parents, and rollback behavior.
@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.

Validate complete reader inventory independently from collisions among selected output entries. Use occurrence-parent ownership instead of filename prefixes so independently owned PyInstaller entries remain selectable while nested-reader members remain refused. Validate advertised MCP schemas through the shared acceptance helper and add real PyInstaller/ASAR and excluded-entry regressions.
@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.

Merge upstream main while preserving occurrence-based selection and caller-selected destinations. Keep UnityFS and wxapkg directory-status refusals before selection, and cover UnityFS refusal and absent output through both MCP schema profiles.
@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.

Comment thread src/contracts/artifactToolContracts.ts Resolved
Reuse the shared host-absolute local path schema instead of an opaque refinement so SDK-converted JSON Schema preserves the runtime constraint. Extend the advertised-path and MCP-handler regression matrix for extract_artifact.output_root.
@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.

@gensokyo-dev gensokyo-dev left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Maintainer-side automated verification of head 204766d9d combined with main fb453f293 (including the newly merged pseudocode paging), on Linux x64 / Node 24.22.1 / npm 11.16.0. No additional implementation changes were needed.

  • 91 tests passed across 12 files: selection/destination contracts, public CLI/stdio MCP, absolute advertised path schemas, UnityFS refusals, completeness, source identity/admission, cancellation and output ownership. This includes the 17 source tests, 44 first public/provider boundary tests and 30 additional integrity/cancellation cases; no test allowance was weakened.
  • Full source typecheck passed (one checker, 1536M soft target). Focused syntax lint of all changed TS files passed; npm run docs:check passed, including 9 README consistency tests. Runtime compilation passed.
  • Real installed Apache Commons CLI 1.5.0 JAR /usr/share/java/commons-cli.jar, SHA-256 f990941be47ddb0895a3e4b0532bca9e1338db28a075119485efb15b6b59b973: requested an inventory summary, selected one exact path with field projection, then extracted only org/apache/commons/cli/CommandLine.class. Its 7,026 bytes matched Python's independent ZIP reader (SHA-256 982cb7617cfc22a99c97b18db981de2bc522a8c2234ead14239f4f19281e12dd). CLI/MCP artifact lists and selection manifests matched. Output remained readable after close; input digest remained unchanged. No target code was executed.
  • Selected CLI extraction returned 1 artifact / 3,521 JSON bytes in 2.065s; the all-files control returned 32 / 13,441 bytes in 2.266s. These are warm-cache illustrative runs, not a controlled speedup or model-token comparison. Both still validate the complete inventory. The whole verification (SDK discovery/validation, summary, projected occurrence, MCP extraction/close and both CLI controls) completed in 13.073s; wait-accounted user/system CPU 13.843/1.291s, sampled peak process-family RSS 1.28 GiB (200ms sampling, shared pages counted per process, short peaks may be missed). First view SDK preparation dominated about 4.24s.

Checks used two-CPU affinity and a 4 GiB family RSS guard; no guard stop occurred in this extraction verification. The build/public-boundary invocation peaked at 1.78 GiB. The earlier full-repository lint resource limit remains documented in the PR; focused lint is not a full local lint claim. Real Windows filesystem behavior and the original third-party APK were not rerun here. Existing review threads were already resolved. Full original-head CI is newly approved and still pending; original human author declarations are preserved, not re-attested by this automated review.

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

@gensokyo-dev gensokyo-dev left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Maintainer-side automated follow-up on 29bc1d4: fixed the confirmed PR-owned CLI help failure by retaining canonical output_root metadata when adapting its optional wrapper. The unchanged global CLI help test failed before and passes after; both new extraction flags have descriptions. Final help/SDK/selection regressions (7), real Commons CLI JAR byte comparison and CLI/MCP parity, typecheck, focused lint, formatting and docs checks passed. Original 91-case integrity/lifecycle integration coverage is recorded in the current body. Latest main808491685 was synchronized; that sync changes evaluation docs/scripts only, not extraction runtime. Old failed-head CI was cancelled and final-head CI is newly approved. Existing author declarations are preserved; this is automated verification, not a human-readiness attestation.

Comment thread src/contracts/artifactToolContracts.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.

@gensokyo-dev gensokyo-dev left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Maintainer-side automated verification of 9ccb372: both confirmed PR-owned defects are corrected at their owners. CLI optional adaptation preserves canonical metadata; the canonical occurrence array advertises uniqueItems while retaining runtime refinement. Before/after public full-profile SDK validation proves the uniqueItems fix, with positive distinct-ID controls and runtime duplicate rejection before output creation. The 38-case selection/help/schema group, final acceptance controls, typecheck, lint, docs and real installed-JAR CLI/MCP byte-parity verification passed. The current body records corrected baseline-subtracted CPU accounting and meaningful local/Windows limits. Final-head CI is newly approved and pending; this review is automated and preserves the original human author declarations.

@gensokyo-dev
gensokyo-dev merged commit ad518cf into morluto:main Nov 5, 2026
47 checks passed
@morluto morluto mentioned this pull request Nov 11, 2026
3 tasks done
@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.

[Feature] extract_artifact: choose the destination and extract a subset of entries

3 participants