Skip to content

fix(artifacts): collect named tests through npm workspaces - #896

Merged
SUaDtL merged 2 commits into
mainfrom
codex/fix-artifact-npm-workspace-results
Oct 3, 2026
Merged

SUaDtL merged 2 commits into
mainfrom
codex/fix-artifact-npm-workspace-results

Conversation

@SUaDtL

@SUaDtL SUaDtL commented Oct 3, 2026 •

Copy link
Copy Markdown
Collaborator

What & why

A root command such as npm run test:client could not supply named verification when its script delegated to an npm workspace. Empty test names failed native readiness; named tests failed the Python collector's nested-npm check.

Resolve one explicit workspace delegation while executing the original root argv. Bind the root and all inspected workspace manifests (maximum 32), reject ambiguous selectors and shell-sensitive syntax, and qualify Windows nested npm with a pinned prefix helper. npm run test:client -- -- --reporter=verbose retains both npm argument boundaries and the complete suite.

Type of change

  • fix: bug fix

Checklist

  • Branched from main; Conventional Commit
  • Regression-first Python and Go contract tests, manifest-drift and mutation sensitivity checks
  • Impact-bounded local verification passed; exact-head hosted CI remains required before merge
  • Shipped payload versions and changelogs advanced together: ca 2.23.2, ca-codex 0.14.9, ca-pi 0.15.9
  • Generated adapters, documentation, package metadata, and staged secret scan verified

No hook event or storage contract changes, new dependency, or architectural decision.

Validation and review notes

  • Authority adapter: 176 tests, one platform skip; includes a real npm workspace running unittest through the Go receipt validator.
  • Authoring adapter: 48 tests passed. Native unit/CLI tests, go vet, and Python compilation passed.
  • Independent security/test review passed after fixing Windows quoting and adding prefix-helper mutation coverage.
  • CodeRabbit reviewed head 6035aa018b1e with no actionable defects. Its fault-injection suggestions are nonblocking: manifest mutation is covered, and the additional publication/save crash-window test concerns unchanged recovery code. The docstring percentage warning is advisory; repository Python standards require module-header API documentation, not a per-function percentage.
  • All six native platform jobs and all 18 installed-host cold-package checks passed on head 6035aa018b1e. The complete native Go statement union passed at 80.87% (4,481/5,541 statements), with required integration evidence from all six platforms. Local Windows/amd64 alone measured 62.18%; all added Go statements were covered locally.
  • Payload version guards and automatic-release candidate preflight, including pre-tag checks, passed.
  • Original root commands are preserved; no transitive dependency closure is claimed for excluded inputs. Globs, multiple selectors, recursion, custom Windows script shells/options, alternate nested npm installations, and non-dot prefix delegation remain unsupported.

The workspace fixture compares resolved paths so the same manifest binding assertion works across macOS /var and /private/var aliases.

Hosted CI blockers

At head 6035aa018b1eefddf2ec54d6e667f4b434bab170, existing dependency audits block delivery:

  • Pi adapter and coverage jobs fail while auditing the pinned Pi 0.84.1 dependency fixture, before adapter execution. The downstream Pi coverage union consequently lacks required evidence. Pi pins vulnerable Undici 8.9.0; this requires reviewed host promotion and qualification.
  • Site generator and artifact browser qualification fail the same production dependency audit, before browser execution. Astro depends on http-cache-semantics 4.2.0, and GHSA-ch52-4w7c-c8xp currently has no patched release.

Dependency inputs and audit gates are unchanged by this PR. CI is complete: 66 successful checks, 5 skipped checks, and 10 failures from these audits, their missing downstream evidence, and the merge-readiness aggregate. No merge or publication has occurred.

ADR ancestry verifier selected squash for base 158daa0016eb7f7127221fac6deefb59991804ad and head 6035aa018b1eefddf2ec54d6e667f4b434bab170. Revalidate against the current base/head before merge.

Root npm scripts delegating to a workspace could not satisfy both native
readiness and named-result collection. Resolve one bounded workspace
delegation while retaining the original root command, inspected manifests,
and qualified nested npm runtime identities.

CHANGELOG: Root npm workspace scripts can now provide named verification.
@coderabbitai

coderabbitai Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository YAML (base), Central YAML (inherited)
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 3185e5e1-0840-45ed-af25-558e9e39a7a1
📥 Commits

Reviewing files that changed from the base of the PR and between 158daa0 and 6035aa0.

⛔ Files ignored due to path filters (12)
  • plugins/ca-codex/hooks/_artifactauthoritylib.py is excluded by !plugins/ca-codex/hooks/*.py
  • plugins/ca-codex/hooks/_host.py is excluded by !plugins/ca-codex/hooks/*.py
  • plugins/ca-codex/hooks/hostapi.py is excluded by !plugins/ca-codex/hooks/*.py
  • plugins/ca-codex/includes/artifacts.md is excluded by !plugins/ca-codex/includes/**
  • plugins/ca-pi/hooks/_artifactauthoritylib.py is excluded by !plugins/ca-pi/hooks/*.py
  • plugins/ca-pi/hooks/_host.py is excluded by !plugins/ca-pi/hooks/*.py
  • plugins/ca-pi/hooks/hostapi.py is excluded by !plugins/ca-pi/hooks/*.py
  • plugins/ca-pi/includes/artifacts.md is excluded by !plugins/ca-pi/includes/**
  • plugins/ca/hooks/_artifactauthoritylib.py is excluded by !plugins/ca/hooks/*.py
  • plugins/ca/hooks/_host.py is excluded by !plugins/ca/hooks/*.py
  • plugins/ca/hooks/hostapi.py is excluded by !plugins/ca/hooks/*.py
  • plugins/ca/includes/artifacts.md is excluded by !plugins/ca/includes/**
📒 Files selected for processing (20)
  • .codearbiter/.provenance/code-map.json
  • .codearbiter/.provenance/release-targets.json
  • .codearbiter/code-map.md
  • .github/scripts/test_artifact_authority_adapter.py
  • .github/scripts/test_artifact_npm_nested_launch.py
  • CHANGELOG.md
  • README.md
  • core/artifacts/internal/observation/contract.go
  • core/artifacts/internal/observation/runner_contract.go
  • core/artifacts/internal/observation/runner_contract_test.go
  • core/pysrc/_artifactauthoritylib.py
  • core/pysrc/hostapi.py
  • core/surface/includes/artifacts.md
  • package.json
  • plugins/ca-codex/.codex-plugin/plugin.json
  • plugins/ca-codex/CHANGELOG.md
  • plugins/ca-codex/package.json
  • plugins/ca-pi/CHANGELOG.md
  • plugins/ca-pi/package.json
  • plugins/ca/.claude-plugin/plugin.json

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.


📝 Walkthrough

Walkthrough

Named npm verification now supports a root script that delegates once to a uniquely selected workspace runner. The flow preserves the declared root command, binds inspected manifests and required npm launch files, and rejects unsupported delegation before execution.

Changes

npm workspace verification

Layer / File(s) Summary
Resolve and qualify the workspace runner
core/pysrc/_artifactauthoritylib.py, .github/scripts/test_artifact_npm_nested_launch.py, .github/scripts/test_artifact_authority_adapter.py
The npm runner accepts one explicit delegation to a uniquely selected workspace. It checks script and workspace constraints, qualifies nested npm launch resolution, and rejects unsupported commands or configuration.
Bind and validate launch provenance
core/pysrc/_artifactauthoritylib.py, core/artifacts/internal/observation/*, .github/scripts/test_artifact_authority_adapter.py
The binding records root and workspace manifests. The contract validates manifest paths and count, collector type, and native npm prefix provenance. Tests cover valid bindings, invalid closures, and manifest drift.
Verify end-to-end behavior and record releases
.github/scripts/test_artifact_authority_adapter.py, core/surface/includes/artifacts.md, CHANGELOG.md, plugins/*/CHANGELOG.md, README.md, package.json, plugins/*/package.json, plugins/*/.*/plugin.json, core/pysrc/hostapi.py, .codearbiter/*
End-to-end coverage checks named results, preserved launch arguments, provenance, and receipt publication. Documentation and release metadata describe the delegation support and updated versions; provenance records contain updated hashes.

Priority: ➖ Normal

Estimated code review effort: 4 (Complex) | ~45 minutes

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant NamedVerification
  participant _npm_runner
  participant RootPackageManifest
  participant WorkspacePackageManifest
  participant _bind_commands
  participant Observation
  NamedVerification->>_npm_runner: Resolve the declared root npm script
  _npm_runner->>RootPackageManifest: Read script and workspace declarations
  _npm_runner->>WorkspacePackageManifest: Resolve and inspect selected workspace
  _npm_runner-->>NamedVerification: Return runner tokens and inspected manifests
  NamedVerification->>_bind_commands: Bind root and workspace manifests
  _bind_commands->>Observation: Record qualified launch provenance
Loading

Merge Risk: ⚪ Minimal · up to 6035a

No actionable defect was identified in the workspace-verification change. It is mergeable after the normal exact-head checks.

Security Architecture Review

Security architecture risk: 🔵 Low · up to 6035a

Workspace verification support is narrowly bounded and retains command, authorization, and manifest-integrity checks. No introduced security defect was demonstrated, but cross-platform and interruption evidence remains incomplete.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The affected security decision is acceptance of named verification evidence for an authorized repository/worktree. The 32-workspace bound limits inspected manifest scope, not child-process privileges or transitive dependency access. Process supervision remains distinct from the host sandbox and does not establish tenant isolation.

Trust Boundaries and Controls

  • observed — Repository-controlled delegation is checked against nested executable shadowing. Windows qualification also checks default script-shell and node-options settings, rejects redirection to another existing CLI, and binds npm-prefix.js with a post-probe identity check. Execution requires correlated wrapper authorization; Claude hooks explicitly reject background or unsandboxed invocation.
  • observed — Every recorded launch file is identity-checked before and after execution, including inspected workspace manifests and the Windows prefix helper. Native validation checks role/path constraints and observation linkage; it does not independently reread launch files, so filesystem provenance remains the authorized producer's responsibility.

Resilience and Maintainability Implications

  • observed — Failed execution or integrity drift occurs before successful observation publication. Publication subsequently requires corroborated completion, while immutable observation content and stale-state checks constrain recovery and concurrent updates. The inspected source supports these guards, but targeted interruption and concurrent-mutation fault injection was not established by the scoped evidence.

Hardening Proposals

  • proposed — Add targeted fault injection for manifest/helper mutation during execution and interruption between immutable observation publication and the final state save. Assert that recovery cannot yield an uncorroborated accepted receipt or permit rerun under the original request.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 9.62% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 52 functions across 7 files. (13 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the npm workspace test-collection fix, which is the primary change.
Full details: Docstring Coverage

Explanation

Docstring coverage is 9.62% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 52 functions across 7 files. (13 skipped: 13 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 2
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🛠️ Fix failing CI checks 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@SUaDtL
SUaDtL marked this pull request as ready for review October 3, 2026 07:17
Compare bound physical manifest paths against the resolved temporary root. macOS aliases /var through /private/var, so the unnormalized test expectation rejected a correct binding.
@SUaDtL
SUaDtL merged commit 9ed2bf2 into main Oct 3, 2026
@SUaDtL
SUaDtL deleted the codex/fix-artifact-npm-workspace-results branch October 3, 2026 07:53
SUaDtL added a commit that referenced this pull request Oct 3, 2026
#896 merged while this promotion was in flight and spent ca-pi 0.15.9.
Move this branch's entry to the next free patch, re-baseline the
release-target and code-map provenance it watches, and keep the root
package metadata in step with the plugin manifest.
SUaDtL added a commit that referenced this pull request Oct 4, 2026
#896 and #898 spent ca 2.23.2, ca-codex 0.14.9 and ca-pi 0.15.9/0.15.10
while this fix was in review. Keep main's entries and move this branch's
to the next free versions: ca 2.23.3, ca-codex 0.14.10, ca-pi 0.15.11.
Both new end-to-end authority tests are kept; provenance is re-baselined.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant