[PR #4126] [CLOSED] fix(artifacts): interpret ZIP current-directory prefixes #6074

Closed
opened 2026-10-31 01:11:39 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/4126
Author: @Adkid-Zephyr
Created: 10/15/2026
Status: ❌ Closed

Base: main ← Head: fix/zip-current-directory-prefix


📝 Commits (1)

  • bf1dfa9 fix(artifacts): interpret ZIP current-directory prefixes

📊 Changes

2 files changed (+138 additions, -3 deletions)

View changed files

📝 src/artifacts/ZipArtifactReader.ts (+24 -3)
➕ tests/boundary/filesystem/artifactZipRelativePaths.test.ts (+114 -0)

📄 Description

Summary

Fixes #4124.

ZIPs created by bsdtar --format=zip -cf sample.zip . contain a ./ root entry. REA rejected that spelling, so both inspect-artifact and extract-artifact failed before returning results. The ZIP adapter now interprets leading current-directory prefixes and omits the redundant root-directory entry. The inventory already represents the archive root.

Change and scope

ZipArtifactReader.projectZipEntry owns the interpretation for both inventory and extraction. It strips only leading ./ components, retains the original member spelling in occurrence limitations, and keeps central-directory indexes as member identities—even when two source names map to the same logical path. Shared path validation is unchanged. Ordinary reliability fix; no new provider or execution capability, so a maintainer scope decision is not applicable.

Contract and boundary impact

  • CLI/MCP: existing operations accept these ordinary ZIPs; no tool/schema changes.
  • Evidence/provenance: source archive identity and distinct member identities remain intact; interpreted source spellings remain visible. Root-only ZIPs produce an empty member inventory/extraction.
  • Compatibility: tested on macOS arm64 with Node 24.18.0 and real bsdtar 3.5.3/libarchive 3.7.4. Other OS/tool producers were not exercised.
  • Package, generated metadata, migration and breaking changes: none.
  • Target selection/authority: unchanged. Tests use small owned archives and temporary output directories; no archived target is executed.

Evidence and regression coverage

On unmodified base fe7bcc3fbeafe73fed97f1d6d75f6ee3a0821d4a, the unprefixed production-boundary control passed and ./ / ././ cases failed with Artifact path is not normalized. The actual bsdtar fixture also made both CLI commands exit 1 with artifact_operation_failed and reason: path.

After the fix, both CLI commands exit 0. Inventory contains ., sub, and sub/data.txt; extraction reproduces the exact UTF-8 text bytes, and the source ZIP hash is unchanged. Added five cases cover plain/prefixed names, repeated prefixes, root-only archives, and independent member bodies/identities across repeated enumeration.

Validation performed

  • node node_modules/vitest/vitest.mjs run tests/boundary/filesystem/artifactZipRelativePaths.test.ts tests/boundary/filesystem/artifactInventoryEntryOrder.test.ts tests/boundary/filesystem/artifactZipIntegrity.test.ts src/artifacts/ZipArtifactReader.test.ts — 46/46 passed.
  • npm run check — passed, including typecheck, lint, format, knip, metadata and architecture guards.
  • npm run verify:test-discovery — passed; all 1,348 test files discovered exactly once.
  • npm run build:cached — passed.
  • Actual inspect-artifact and extract-artifact on the bsdtar fixture, with an isolated profile — passed; exact extracted bytes and unchanged source hash checked.
  • git diff --check — passed.

These are local results; CI and human review are separate. No packaging/provider changes; no real external analysis engine was used.

Author readiness

Human owner: @Adkid-Zephyr

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

AI-assisted preparation. Kept in draft for the human owner to complete initial readiness.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/4126 **Author:** [@Adkid-Zephyr](https://github.com/Adkid-Zephyr) **Created:** 10/15/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/zip-current-directory-prefix` --- ### 📝 Commits (1) - [`bf1dfa9`](https://github.com/morluto/rea/commit/bf1dfa9e7daeefd24a578eb3c4301173fa97f0b2) fix(artifacts): interpret ZIP current-directory prefixes ### 📊 Changes **2 files changed** (+138 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `src/artifacts/ZipArtifactReader.ts` (+24 -3) ➕ `tests/boundary/filesystem/artifactZipRelativePaths.test.ts` (+114 -0) </details> ### 📄 Description ## Summary Fixes #4124. ZIPs created by `bsdtar --format=zip -cf sample.zip .` contain a `./` root entry. REA rejected that spelling, so both `inspect-artifact` and `extract-artifact` failed before returning results. The ZIP adapter now interprets leading current-directory prefixes and omits the redundant root-directory entry. The inventory already represents the archive root. ## Change and scope `ZipArtifactReader.projectZipEntry` owns the interpretation for both inventory and extraction. It strips only leading `./` components, retains the original member spelling in occurrence limitations, and keeps central-directory indexes as member identities—even when two source names map to the same logical path. Shared path validation is unchanged. Ordinary reliability fix; no new provider or execution capability, so a maintainer scope decision is not applicable. ## Contract and boundary impact - CLI/MCP: existing operations accept these ordinary ZIPs; no tool/schema changes. - Evidence/provenance: source archive identity and distinct member identities remain intact; interpreted source spellings remain visible. Root-only ZIPs produce an empty member inventory/extraction. - Compatibility: tested on macOS arm64 with Node 24.18.0 and real bsdtar 3.5.3/libarchive 3.7.4. Other OS/tool producers were not exercised. - Package, generated metadata, migration and breaking changes: none. - Target selection/authority: unchanged. Tests use small owned archives and temporary output directories; no archived target is executed. ## Evidence and regression coverage On unmodified base `fe7bcc3fbeafe73fed97f1d6d75f6ee3a0821d4a`, the unprefixed production-boundary control passed and `./` / `././` cases failed with `Artifact path is not normalized`. The actual bsdtar fixture also made **both CLI commands exit 1** with `artifact_operation_failed` and `reason: path`. After the fix, both CLI commands exit 0. Inventory contains `.`, `sub`, and `sub/data.txt`; extraction reproduces the exact UTF-8 text bytes, and the source ZIP hash is unchanged. Added five cases cover plain/prefixed names, repeated prefixes, root-only archives, and independent member bodies/identities across repeated enumeration. ## Validation performed - `node node_modules/vitest/vitest.mjs run tests/boundary/filesystem/artifactZipRelativePaths.test.ts tests/boundary/filesystem/artifactInventoryEntryOrder.test.ts tests/boundary/filesystem/artifactZipIntegrity.test.ts src/artifacts/ZipArtifactReader.test.ts` — **46/46 passed**. - `npm run check` — passed, including typecheck, lint, format, knip, metadata and architecture guards. - `npm run verify:test-discovery` — passed; all 1,348 test files discovered exactly once. - `npm run build:cached` — passed. - Actual `inspect-artifact` and `extract-artifact` on the bsdtar fixture, with an isolated profile — passed; exact extracted bytes and unchanged source hash checked. - `git diff --check` — passed. These are local results; CI and human review are separate. No packaging/provider changes; no real external analysis engine was used. ## Author readiness Human owner: @Adkid-Zephyr - [ ] 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. AI-assisted preparation. Kept in draft for the human owner to complete initial readiness. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-31 01:11:39 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#6074
No description provided.