Skip to content

fix(ci): repair latest main runtime and Inari validation failures - #329

Merged
yohnark merged 1 commit into
mainfrom
fix/328-repair-latest-main-ci
Aug 16, 2026
Merged

yohnark merged 1 commit into
mainfrom
fix/328-repair-latest-main-ci

Conversation

@yohnark

@yohnark yohnark commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Summary

Restore a green current-main CI baseline for the local-runtime and governance regressions in Issue #328.

Linked issue

Closes #328

Scope

Issue #328 only: repair the missing local-runtime test type import, managed QEMU archive entry verification, and the architecture boundary drift exposed while restoring the Standards job.

Included

  • Add the canonical QemuArtifactIdentity type-only import to the reconciler regression test.
  • Read archive names and archive entry types separately so directory entries are ignored, regular files are compared exactly with the manifest, and links/special files are rejected before extraction.
  • Add valid-directory, symlink, and POSIX FIFO archive regression coverage.
  • Register the existing injected QEMU child-process environment boundary with architecture validation.

Excluded

  • No test deletion, skip of supported environments, assertion weakening, CI relaxation, Inari version pinning/downgrade, release artifact publication, or unrelated Runtime redesign.
  • No change to the Inari resolver or semantic templates because the current public command is green and no Mottainai/Inari drift is reproducible.

Implementation

The typecheck failure was an omitted type-only import. The archive verifier previously used tar -tf output and stripped a trailing slash before deciding whether an entry was a regular file, turning a directory into a manifest file. It now correlates tar -tf paths with same-order tar -tvf type entries, validates safe paths from the exact name listing, counts only regular-file entries, and rejects every non-directory/non-regular type before extraction. The existing QEMU environment option is an explicit process boundary and is added to the architecture allowlist with no runtime behavior change.

Behavioral changes

Valid managed QEMU release archives with ordinary directory entries are accepted. Symlink, hardlink, device, FIFO, socket, and other non-regular archive entries fail closed before extraction. The reconciler test compiles, and architecture validation recognizes the already-injected QEMU environment boundary.

Validation

  • Typecheck
  • Tests
  • Build
  • Package check

Test layers:

  • Fast / unit / contract: pnpm test
  • Integration / process: pnpm run test:integration
  • Package / E2E / smoke: pnpm run test:e2e, pnpm run test:package
  • Standards / static: pnpm run verify:standards
  • Coverage: pnpm run test:coverage
  • Test effectiveness (when critical logic changes): pnpm run test:effectiveness
  • Full verification: pnpm run verify

Test contract

  • change type: bug fix
  • required layers: unit/contract, process/integration, lint/architecture, coverage shard, package smoke, and security-negative archive rejection
  • not-applicable decisions: fault injection and release are not applicable because no persistence/process-fault or package/publish/release path changed.

Regression proof

  • status: automated
  • test path: src/local-runtime/artifacts.test.ts
  • test identifier: available release archives are extracted into the private state root before verification
  • pre-fix observed failure: main CI run 31927197576 rejected the valid tar archive with a managed QEMU archive contents / manifest mismatch; coverage shard 3 failed on the same regression class.
  • post-fix result: pnpm test passes with 486 passed, 1 skipped, 0 failed, and coverage shard 3 exits 0 with its artifact generated.
  • command id: fast
  • base result: main commit f2651c0 reproduced the archive failure in CI.
  • head result: the regression test and the complete fast suite pass on the fix branch.
  • isolation: dedicated managed Mottainai worktree; no credentials or external artifact publication used.

Validation evidence

  • class: unit/contract; status: pass; command: pnpm test; target: local-runtime artifact/reconciler tests and complete fast suite; result: 486 passed, 1 skipped, 0 failed; artifact: test suite timing fast 3180ms
  • class: process/integration; status: pass; command: pnpm run test:integration; target: complete integration/process suite; result: 887 passed, 0 failed; artifact: test suite timing integration 70130ms
  • class: package smoke; status: pass; command: pnpm run test:package; target: built dist and packed consumer; result: build and isolated package smoke passed, 7 tests passed; artifact: temporary packed Mottainai tarball consumed by the isolated suite
  • class: fault injection; status: not-applicable; reason: No persistence or process-fault boundary changed.
  • class: lint/architecture; status: pass; command: pnpm run lint && pnpm run format:check && pnpm run architecture:check; target: changed TypeScript and architecture allowlist; result: lint, format, and 229 production files pass; artifact: architecture pass output
  • class: release; status: not-applicable; reason: No package, publish, or release path changed.
  • class: security/negative; status: pass; command: pnpm exec tsx --test src/local-runtime/artifacts.test.ts; target: archive extraction boundary; result: valid directory archive passes and symlink/FIFO archives are rejected before extraction; scenario: archive entry type and path tampering; artifact: focused test result

Release impact

  • impact: none
  • reason: No package metadata, publish workflow, or release artifact is changed; package smoke was run only as compatibility evidence.

Risks

The tar verbose type format must remain compatible with supported GNU/BSD tar implementations; pairing it with the exact name listing avoids reparsing path text from human-readable metadata. Rejecting non-regular entries may expose malformed release archives earlier, which is intentional for the trust boundary. The architecture allowlist entry documents an existing injected environment boundary and does not alter runtime behavior.

Breaking changes

No. Existing valid managed QEMU archives and persisted Runtime contracts remain compatible; malformed archives now fail closed before extraction.

Migration / compatibility

No migration. No configuration, CLI, persisted-state, or public schema contract changes.

Security impact

Positive defense-in-depth: archive symlink and special-file entries are rejected before tar extraction, and unsafe names are validated from the exact archive name listing. No credential or GitHub permission scope changes.

Review focus

  • Confirm tar -tf and tar -tvf entry ordering is deterministic for supported release archives.
  • Confirm directories are ignored while only regular files enter manifest comparison.
  • Confirm all non-regular types fail before destination extraction.
  • Confirm Inari evidence remains current-public 0.6.1 with no pin or downgrade.
  • Confirm PR closes Issue fix(ci): repair latest main runtime and Inari validation failures #328 and retains all required CI enforcement.

@coderabbitai

coderabbitai Bot commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 5fc610c0-2606-44b8-957f-d2c0da5fec29

📥 Commits

Reviewing files that changed from the base of the PR and between f2651c0 and 7374bbd.

📒 Files selected for processing (4)
  • scripts/architecture-check.mjs
  • src/local-runtime/artifacts.test.ts
  • src/local-runtime/artifacts.ts
  • src/local-runtime/reconciler.test.ts

Included review availability: Your plan includes up to 3 reviews per rolling hour; 2 remain after this review.

📜 Recent review details
⏰ Context from checks skipped due to timeout. (13)
  • GitHub Check: pr-agent
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: coverage shard 6/7 (Node 22)
  • GitHub Check: coverage shard 3/7 (Node 22)
  • GitHub Check: coverage shard 2/7 (Node 22)
  • GitHub Check: coverage shard 7/7 (Node 22)
  • GitHub Check: integration / process (Node 22)
  • GitHub Check: coverage shard 1/7 (Node 22)
  • GitHub Check: coverage shard 5/7 (Node 22)
  • GitHub Check: build / built dist e2e / package (Node 22)
  • GitHub Check: Node compatibility smoke (Ubuntu, Node 24)
  • GitHub Check: coverage shard 4/7 (Node 22)
  • GitHub Check: Nix Runtime evaluation / image / VM test
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,js,sh}

📄 CodeRabbit inference engine (CLAUDE.md)

ソースコード本体は原始人モードの対象外。日本語コメントを大量追加する場合のみ口調を確認する

Files:

  • src/local-runtime/reconciler.test.ts
  • src/local-runtime/artifacts.test.ts
  • src/local-runtime/artifacts.ts
**/*

📄 CodeRabbit inference engine (AGENTS.md)

Keep implementation within the user request and accepted Issue scope; do not add adjacent features, cleanup, refactors, documentation, or follow-up work unless required.

Files:

  • src/local-runtime/reconciler.test.ts
  • src/local-runtime/artifacts.test.ts
  • scripts/architecture-check.mjs
  • src/local-runtime/artifacts.ts
🪛 ast-grep (0.45.1)
src/local-runtime/artifacts.test.ts

[warning] 323-323: Filesystem path is not a string literal; a request-/variable-derived path can enable path traversal. Validate and normalize the path before use.
Context: fs.writeFileSync(path.join(stage, "bin", "qemu-system-x86_64"), executable, { mode: 0o700 })
Note: [CWE-22] Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').

(detect-non-literal-fs-filename-typescript)


[warning] 324-324: Filesystem path is not a string literal; a request-/variable-derived path can enable path traversal. Validate and normalize the path before use.
Context: fs.writeFileSync(path.join(stage, "licenses", "COPYING"), "license")
Note: [CWE-22] Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').

(detect-non-literal-fs-filename-typescript)


[warning] 342-342: Filesystem path is not a string literal; a request-/variable-derived path can enable path traversal. Validate and normalize the path before use.
Context: fs.readFileSync(archive)
Note: [CWE-22] Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').

(detect-non-literal-fs-filename-typescript)

🔇 Additional comments (4)
scripts/architecture-check.mjs (1)

93-94: LGTM!

src/local-runtime/reconciler.test.ts (1)

9-9: LGTM!

src/local-runtime/artifacts.ts (1)

440-469: LGTM!

src/local-runtime/artifacts.test.ts (1)

311-355: LGTM!


📝 Walkthrough

Walkthrough

The change fixes local-runtime validation issues. It adds the QMP module to the architecture allowlist, imports QemuArtifactIdentity in a test, and rejects symbolic links and special files in release archives before extraction.

Changes

Local runtime validation

Layer / File(s) Summary
CI validation alignment
scripts/architecture-check.mjs, src/local-runtime/reconciler.test.ts
The architecture allowlist includes src/local-runtime/qmp.ts. The reconciler test imports QemuArtifactIdentity.
Archive entry validation
src/local-runtime/artifacts.ts, src/local-runtime/artifacts.test.ts
Archive inspection compares typed tar listings, preserves unsafe-path checks, accepts regular files and directories, and rejects symbolic links and special files before extraction. A FIFO regression test verifies the rejection and cleanup behavior.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 7374b

This change repairs localized CI and archive-validation behavior, with the reported test, integration, package, architecture, and security-negative checks passing; no actionable merge-blocking risk remains.

Possibly related PRs

Suggested labels: Review effort 2/5

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the CI repairs covered by the pull request, including runtime and Inari validation failures.
Description check ✅ Passed The description directly explains the Issue #328 fixes, scope, implementation, validation, and security impact.
Linked Issues check ✅ Passed The changes satisfy Issue #328 coding objectives for typing, archive verification, regression coverage, and architecture validation.
Out of Scope Changes check ✅ Passed All reported changes directly support Issue #328 and do not introduce unrelated runtime, release, CI, or dependency changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/328-repair-latest-main-ci

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(ci): repair latest main runtime and Inari validation failures

1 participant