Repository navigation
Tighten release workflow validation - #14
Conversation
|
OpenRouter review posted ( |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
OpenRouter pull-request review
Verdict: partial
Scope: full-pr (full-pr)
Mode: initial
Commit: a84395d9e348331730fb4942893f73fe2194a6f8
Judge: openai/gpt-5.6-luna (repaired(canonical+1): source coverage preserved before publication cap)
Cost: $0.2133 (lanes $0.2059 + judge $0.0074) + at least $0.0415 (incomplete)
Lanes
meta/muse-spark-1.2: ok (6 finding(s), 73.2s, 171855+8365 tokens (40418 cached), 4 tool round(s), via Meta, $0.21)z-ai/glm-5.3-flash: ok (9 finding(s), 966.5s, 1203704+72018 tokens (1049935 cached), 16 tool round(s), 1 retried request(s), salvaged finish, via OpenInference, at least $0.0415 (incomplete))
Warning
The PR head advanced after this review's diff was collected. This review is pinned to commit a84395d and does not cover the newest push.
Findings
🔴 Issue 1 — Release-tag regex allows leading-zero components that stable semver forbids
scripts/release-packages.mjs:33 · bug · identified by meta/muse-spark-1.2
Concrete failure: v1.01.0 or v0.1.01 passes both the bash and JS RELEASE_TAG checks and can be used to create a GitHub release, but STABLE_SEMVER and npm both forbid leading zeros. The prepared manifest would then record a non-canonical version, npm pack/npm view would normalize or reject it, and the vX.Y.Z invariant in docs/RELEASING.md becomes unenforceable.
Evidence: scripts/release-packages.mjs:33 defines RELEASE_TAG = /^v(0\.[1-9]\d*|[1-9]\d*\.\d+)\.\d+$/u where the patch \d+ and the minor in the second branch \d+ allow 01, while STABLE_SEMVER = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/u forbids it. isSupportedReleaseTag() delegates only to RELEASE_TAG (:360), and validateRepository() now uses isSupportedReleaseTag for manifest.version (:454), so a version like 1.01.0 passes. The same permissive pattern is duplicated in .github/workflows/publish.yml:36 and :204 (^v(0\.[1-9][0-9]*|[1-9][0-9]*\.[0-9]+)\.[0-9]+$).
Checked: packages/sessions/package.json currently 0.2.0 canonical; test/release-packages.test.ts only exercises v0.1.1, v0.12.0, v1.0.0 and explicitly rejects v01.2.3 but never tests v1.01.0/v0.1.01. No counterevidence that npm normalizes this — npm pack will emit the literal version from package.json.
🟠 Issue 2 — Bare [[ … ]] and verify-tag assertions under set -e fail without diagnostic
.github/workflows/publish.yml:69 · risk · identified by meta/muse-spark-1.2
Concrete failure: if the fetched tag is not an annotated tag, if git verify-tag fails, if the tag commit != RELEASE_COMMIT, or if merge-base --is-ancestor fails, the bare [[ "$(git cat-file -t ...)" == "tag" ]] / git verify-tag / [[ "${tag_commit}" == "${RELEASE_COMMIT}" ]] lines exit the step via set -e with status 1 and no ::error:: annotation, leaving the Actions log with only Process completed with exit code 1.
Evidence: .github/workflows/publish.yml:69-74 and :236-242 use standalone [[ … ]] and git -C … verify-tag without if ! …; then echo "::error::"; exit 1; fi. With set -euo pipefail a false [[ test is a failing command and terminates the shell before the intended error message. The same applies to tag_commit equality and merge-base --is-ancestor.
Checked: sibling Verify the release source blocks already emit ::error:: for the four explicit checks above; the git checks are the only ones without messages. No wrapper || exit or if was found. set -e semantics confirmed for bash (exits on failed [[ outside if/while).
🟠 Issue 3 — prepareRelease / workflow clean-build leaves TypeScript build-info outside package
scripts/release-packages.mjs:613 · risk · identified by meta/muse-spark-1.2
Concrete failure: scripts/release-packages.mjs: buildFromCleanOutputs deletes only packages/sessions/tsconfig.tsbuildinfo and packages/sessions/dist, while .github/workflows/publish.yml: Remove generated package outputs deletes packages/sessions/dist plus find packages/sessions -type f -name '*.tsbuildinfo' -delete. If the root tsconfig.base.json build info or a tsconfig.tsbuildinfo at the repository root is used by tsc -b, tsc -b --clean may not remove it when the isolated tsc is invoked via node <tsc> -b, leaving stale incremental state that makes the "clean build" non-hermetic and can cause the prepared tarball to differ from a truly clean checkout.
Evidence: scripts/release-packages.mjs:613-618 vs publish.yml:122-127. The run helper invokes process.execPath with the tsc JS file directly, not tsc --build via npx, so project-reference discovery depends on cwd: root.
Checked: tsconfig.json at repo root not read; packages/sessions/tsconfig.json extent unknown; pnpm-lock.yaml shows TypeScript installed at root, so path root/node_modules/typescript/bin/tsc exists, but tsc -b --clean behavior with allowBuildInfo not verified. No test asserts the working tree is clean after buildFromCleanOutputs except the stale.js/buildInfo file in packages/sessions (test/release-packages.test.ts:395).
🟠 Issue 4 — npm self-install in release jobs fetched without integrity pin
.github/workflows/publish.yml:143 · risk · identified by meta/muse-spark-1.2
Concrete failure: both jobs run npm install --global npm@11.18.0 --ignore-scripts (publish.yml:108/251 via Node script) fetching the npm tarball from https://registry.npmjs.org with only a version pin. If the registry is compromised or a network attacker serves a different 11.18.0 tarball (same version, different bytes), the "reviewed npm release" guarantee is lost and all subsequent npm pack/npm publish --provenance steps run under attacker-controlled code.
Evidence: publish.yml lines 108/143/251, scripts/release-packages.mjs: requireTrustedPublishingNpm only checks npm --version after install, not a hash. docs/securityscan.md:151 already notes this as the one unpinned supply-chain fetch. The new isolated runtime and --ignore-scripts mitigate lifecycle attacks but not tarball substitution.
Checked: no npm_config_cache or integrity pin, no actions/setup-node npm pin, no hash check after install. Counterevidence: npm client verifies the packument's dist.integrity when fetching, but that is still registry-trusted, not repository-pinned.
🟠 Issue 5 — Publish workflow duplicates validation logic from release-packages.mjs and the copies have already diverged
.github/workflows/publish.yml:257 · risk · identified by z-ai/glm-5.3-flash
On a future release, a schema or policy change made only in scripts/release-packages.mjs (new manifest key, new allowed package file path, extended npm env allowlist) will not reach the publish job's inline copy, so the publisher enforces stale rules while the reviewed script accepts the change — or a fix applied only to the workflow leaves the script's local verification weaker than the publisher's, and neither is flagged.
The publish job reimplements inline in .github/workflows/publish.yml (step Publish the prepared tarball and the prepare-job inventory step):
- the two-file inventory check that now exists as
validateReleaseInventory; - the manifest schema checks (
hasExactKeys, digest format regexes, requiredpackage.json/README.md/LICENSE/dist/*path filter); - the tarball-name derivation (
"pegma-sessions-${version}.tgz"hard-coded, while the script derives it from@pegma/sessions); - the npm environment allowlist, which already diverges: the inline copy omits
COMSPEC,HOMEDRIVE,HOMEPATH,LOCALAPPDATA,PATHEXT,USERPROFILE,WINDIRthat the script'sNPM_ENVIRONMENT_NAMESincludes, so on a windows-latest publish runnerUSERPROFILEwould be stripped even though the script version preserves it.
The new test pins the duplication rather than preventing it: expect(publish).toContain('const expectedNames = ["package-manifest.json", expectedTarball]') and expect(workflow.match(/git init --quiet --bare/gu)).toHaveLength(2) assert the copies exist and stay duplicated, instead of asserting the workflow delegates to the newly exported helpers (validateReleaseInventory, isolatedNpmEnvironment, createIsolatedNpmRuntime). Any future edit to one copy must be manually mirrored in the other, and the string-pinning test only catches edits that change those exact literals.
🟠 Issue 6 — ci.yml never installs npm 11.18.0, but the new test requires exactly npm 11.18.0
.github/workflows/ci.yml · risk · identified by z-ai/glm-5.3-flash
pnpm test in the ci.yml validate job fails on every matrix entry if the Node-bundled npm is not exactly 11.18.0, because the new test asserts expect(runNpm(["--version"], { capture: true }).stdout.trim()).toMatch(/^11\.18\.0$/u). The publish workflow installs npm@11.18.0 --global before pnpm test; ci.yml has no equivalent step — its sequence is checkout, pnpm setup, pnpm install --frozen-lockfile, then release:check, format/check, and pnpm test.
Node releases bundle whatever npm version shipped with them, and it is not guaranteed that Node 24.18.0 bundles exactly npm 11.18.0 (e.g., Node 24.11.0 bundles npm 11.6.x). If the bundled version differs, every CI matrix run fails on this assertion with a version mismatch unrelated to the code under test.
Proof gap: I could not verify the npm version bundled with Node 24.18.0 nor run the CI job; if the bundled npm is exactly 11.18.0 this passes today, but the test then silently breaks whenever the setup-node version is ever bumped. Adding an npm install --global npm@11.18.0 step to ci.yml (mirroring publish.yml) would remove both hazards.
🟠 Issue 7 — Publish job drops the post-publish registry integrity confirmation
.github/workflows/publish.yml:257 · risk · identified by z-ai/glm-5.3-flash
If the registry-side upload diverges from the verified tarball (partial PUT, CDN anomaly, content rewritten in transit), the release is marked successful and the discrepancy is only discovered later when a consumer's lockfile integrity check fails — and a rerun then fails decidePublication with "registry version exists with different tarball integrity" instead of confirming the release.
The replaced script path, publishPreparedRelease in scripts/release-packages.mjs, ends with confirmRegistryIntegrity(record), re-fetching the published dist.integrity after the PUT. The new inline publish script in .github/workflows/publish.yml performs the pre-publish digest checks and npm publish, then simply exits in the finally block — no post-publish registry confirmation. The hardening work removed a belt that the script path still carries; the publisher (the path that actually ships) is now the weaker of the two.
🟠 Issue 8 — Version-floor gate in validateRepository may reject the current package version
scripts/release-packages.mjs:457 · risk · identified by z-ai/glm-5.3-flash
If packages/sessions/package.json still declares version 0.1.0 (or any 0.0.x), every release:pack invocation, the new release:check step added to both workflows, and the new end-to-end test in test/release-packages.test.ts fail immediately, because validateRepository now gates the manifest version with isSupportedReleaseTag(\v${manifest.version}`), which explicitly excludes v0.1.0 and prerelease/0.0.xversions that the previousSTABLE_SEMVER` check accepted.
Proof gap: I was unable to read packages/sessions/package.json to confirm the current version clears the new floor. The workflow's explicit "v0.1.0" exclusion and the tests' use of v0.1.1 suggest the version was already bumped past it, but this must be confirmed before merge — it is the difference between the whole gate working and every release command failing on the first run.
🔵 Issue 9 — Workflow inline allowlist diverges from library IsolatedNpmRuntime
.github/workflows/publish.yml:321 · nit · identified by meta/muse-spark-1.2
Concrete failure: the publish job inline Node script allowlists ACTIONS_ID_TOKEN_REQUEST_*, CI, HOME, PATH, SystemRoot/SYSTEMROOT, TEMP/TMP/TMPDIR and GITHUB_*, while scripts/release-packages.mjs: NPM_ENVIRONMENT_NAMES also allowlists COMSPEC, HOMEDRIVE, HOMEPATH, LOCALAPPDATA, PATHEXT, USERPROFILE, WINDIR, and Path (capital P). On a Windows self-hosted runner or future windows-latest matrix entry, spawnSync of npm-cli.js would receive a different environment depending on whether the workflow inline or the runNpm() library path is used, breaking the "reviewed npm with isolated configuration" claim and making local repro vs CI diverge.
Evidence: .github/workflows/publish.yml:321-346 defines allowedNames vs scripts/release-packages.mjs:49-66. Tests in test/release-packages.test.ts pin the library allowlist but never compare it to the workflow inline set.
Checked: publish job currently runs-on: ubuntu-latest, so divergence is not triggered today; proof gap is future runner change or local runNpm usage on Windows. No single source of truth is imported by the workflow — it inlines the logic.
🔵 Issue 10 — Type-only import placed after value exports in declaration file
scripts/release-packages.d.mts:135 · nit · identified by meta/muse-spark-1.2
Concrete failure: scripts/release-packages.d.mts:135 places import type { SpawnSyncReturns } from "node:child_process"; after all export declarations. While TypeScript accepts late type-only imports, some declaration bundlers and tsc --isolatedDeclarations heuristics treat file as having two modules, and editors may not provide SpawnSyncReturns in language service, causing downstream tsc -b errors for consumers importing the declaration.
Evidence: scripts/release-packages.d.mts:1-132 exports, line 135 import at EOF. Conventional placement is top-of-file before exports; docs/code-map.md not checked but test/release-packages.test.ts imports SpawnSyncReturns indirectly via runNpm return type.
Checked: grep for SpawnSyncReturns shows only this file and the test; no existing tsc error observed, but declaration file lint (prettier --check) would not catch ordering.
🔵 Issue 11 — Trailing type import at the end of release-packages.d.mts
scripts/release-packages.d.mts:135 · nit · identified by z-ai/glm-5.3-flash
import type { SpawnSyncReturns } from "node:child_process"; is placed as the very last line of scripts/release-packages.d.mts, after all the interface and function declarations it annotates. TypeScript hoists imports so this compiles, but if the repo's pnpm run check enables an eslint rule such as import/first, CI fails; even without lint, a bottom-of-file import is easy to miss when auditing the file's dependencies. It should sit with the other imports at the top of the file.
🔵 Issue 12 — workflowRunScripts helper mis-parses folded scalars, silently skipping the no-${{ assertion for those steps
test/release-packages.test.ts:50 · nit · identified by z-ai/glm-5.3-flash
A future workflow step written as a folded scalar (run: > or run: >- with content on following lines) is collected by workflowRunScripts as the literal string ">" (or ">-") instead of the folded block content, so the subsequent expect(script).not.toContain("${{") assertion passes trivially and any ${{ ... }} interpolation inside that step's script is never checked. The helper only handles plain run: <inline> and run: | block scalars.
The helper's purpose is to enforce the security convention that workflow scripts reference values via environment variables rather than direct template interpolation; the folded-scalar blind spot means the convention can be violated in a later edit without the test noticing. I checked the current publish.yml and ci.yml: both use only | blocks and inline values today, so the helper works for the present files — the gap only opens on future edits using >.
🔵 Issue 13 — prepareRelease writes the manifest before validating the output inventory, leaving partial output on failure
scripts/release-packages.mjs:742 · nit · identified by z-ai/glm-5.3-flash
If validateReleaseInventory(output, ...) fails inside prepareRelease (for example, an unexpected extra file was written into the output directory), the partially populated output directory — including the just-written package-manifest.json and tarball — is left on disk. A developer rerunning release:pack into the same --output path then hits the earlier "release output directory must be empty" failure with a confusing message pointing at the wrong problem, and must manually clean the directory.
The failure occurs after the tarball and manifest are written (the writeFile(manifestPath, ...) call precedes the inventory validation) and nothing cleans up the output directory on that path. CI is unaffected because each runner starts fresh; this only bites local reruns.
🔵 Issue 14 — buildFromCleanOutputs bypasses the package build script in favor of raw tsc
scripts/release-packages.mjs:630 · nit · identified by z-ai/glm-5.3-flash
If the package's build npm script ever gains non-tsc steps (copying static assets into dist, generating documentation, post-processing emitted files), release:pack silently packs a dist that is missing those outputs while a regular pnpm run build produces them, and the divergence only surfaces if a later manifest/file check happens to fail — or not at all, shipping a tarball with incomplete dist contents.
buildFromCleanOutputs in scripts/release-packages.mjs runs node node_modules/typescript/bin/tsc -b --clean followed by tsc -b directly, replacing the previous runNpm(["run", "build"], { cwd: root }). The new end-to-end test passes today, which suggests tsc alone is currently sufficient for the package's build script, but the bypass is a maintenance trap: the release path and the documented build path (pnpm run build) are no longer the same operation.
🔵 Issue 15 — Prepare-release test leaves rebuilt dist and tsbuildinfo in the shared working tree
test/release-packages.test.ts:408 · nit · identified by z-ai/glm-5.3-flash
The new test "removes generated outputs before building and records both digests" seeds stale artifacts into the real checkout (packages/sessions/dist/stale.js, packages/sessions/tsconfig.tsbuildinfo) and then runs a full tsc -b rebuild through prepareRelease. Its finally block only removes the temporary output root; the freshly rebuilt dist/ and tsconfig.tsbuildinfo remain in the developer's working tree after the test completes.
Consequences: a later test in the same file that inspects packages/sessions sees post-build state rather than the seeded stale state (test-order dependence), and a developer running the suite locally is left with regenerated build outputs they may not expect. Harmless if both paths are gitignored, but it makes the suite stateful in a way the finally block does not undo.
There was a problem hiding this comment.
OpenRouter pull-request review
Verdict: issues
Scope: full-pr (full-pr)
Mode: initial
Commit: 10ba59283a49a8dcb12f1149ecbce3c3cfc9d7b7
Judge: openai/gpt-5.6-luna
Cost: $0.2525 (lanes $0.2465 + judge $0.0060)
Lanes
meta/muse-spark-1.2: ok (4 finding(s), 51.4s, 145505+8008 tokens (43588 cached), 3 tool round(s), via Meta, $0.17)z-ai/glm-5.3-flash: ok (9 finding(s), 456.0s, 1282843+77894 tokens (1042752 cached), 15 tool round(s), via CoreWeave, $0.0786)
Findings
🔵 Issue 1 — RELEASE_TAG regex permits leading zeros for major >=1
scripts/release-packages.mjs:33 · nit · identified by meta/muse-spark-1.2
Concrete failure: a tag like v1.01.0 passes the workflow bash regex ^v(0\.[1-9][0-9]*|[1-9][0-9]*\.[0-9]+)\.[0-9]+$ (second alternative \d+ allows 01) and the RELEASE_TAG constant in scripts/release-packages.mjs, while STABLE_SEMVER correctly rejects "1.01.0" and the npm version can never be 1.01.0.
The tag then verifies in the bare-repo step but validateRepository later fails with release tag must be v1.1.0 or isSupportedReleaseTag mismatch, giving a confusing late failure after the expensive tag-signature fetch. Conversely the floor ^v(0\.[1-9]... intentionally blocks v0.0.x but the mismatch between the two regexes leaves a gap for v1.0.01 etc.
Evidence: scripts/release-packages.mjs:33 RELEASE_TAG, .github/workflows/publish.yml:19,68 bash regex, vs STABLE_SEMVER 0|[1-9]\d* pattern on line 32.
Checked current callers, tests for isSupportedReleaseTag cover v01.2.3 but not v1.01.0; no guard in workflow maps to STABLE_SEMVER. Gap is material for operability, not security, so severity is nit.
🔵 Issue 2 — Bare [[ ]] assertions in Verify the release source fail without diagnostic
.github/workflows/publish.yml:56 · nit · identified by meta/muse-spark-1.2
Concrete failure: if the signed-tag type, tag-commit equality, or merge-base --is-ancestor checks fail, the set -euo pipefail script exits with status 1 from the failing [[ ... ]] or git verify-tag/merge-base without an ::error:: annotation.
Operators rerunning a failed hardened release then see an opaque Process completed with exit code 1 instead of Release tag must be... / tag is not an annotated tag etc., while earlier explicit checks (RELEASE_PRERELEASE, RELEASE_TAG regex, RELEASE_COMMIT format) do emit ::error::. The same three silent assertions are duplicated in both prepare and publish jobs.
Evidence: .github/workflows/publish.yml:56-73 and 204-221 — [[ "$(git ... cat-file -t ...)" == "tag" ]], git verify-tag, [[ "${tag_commit}" == "${RELEASE_COMMIT}" ]], git merge-base --is-ancestor are bare statements; trap cleanup already exists.
Checked sibling workflow: no other branch prints tag-commit mismatch; grep for "tag" shows no alternative error path.
🔵 Issue 3 — docs/securityscan.md line-number pins are stale after workflow expansion
docs/securityscan.md:125 · nit · identified by meta/muse-spark-1.2
Concrete failure: docs/securityscan.md Finding 3 asserts action pins at specific lines (publish.yml lines 28, 50, 76, 101, 108, 114; ci.yml lines 29, 32) and references publish.yml lines 57 and 86 for the global-npm fetch and artifact-digest summary.
The PR expands publish.yml from ~50 to ~360 lines (bare-repo verification, inventory checks, inline publish) and adds CI env and release:check to ci.yml. The hard-coded line numbers now point to unrelated YAML, so a future auditor following the doc lands on the wrong lines and may conclude the pins are missing.
Evidence: docs/securityscan.md:125-126,143,151 still lists the pre-PR line numbers; list_dir shows only ci.yml/publish.yml and the new publish.yml is 2x longer; no update to securityscan.md in diff.
Checked README and RELEASING: RELEASING.md was updated, but securityscan.md was not; tests do not cover this doc.
🟠 Issue 4 — Duplicated bare-repo verification script creates drift risk
.github/workflows/publish.yml:22 · risk · identified by meta/muse-spark-1.2
Concrete failure: the full 40-line Verify the release source bash block is duplicated verbatim between prepare and publish jobs. A later fix to the regex floor, allowed-signers handling, or merge-base check in one job that forgets the other creates a split verification path where prepare builds an artifact for a tag that publish later rejects (or vice-versa), wasting a release run or, worse, letting a tag that should be rejected through the weaker copy if drift is toward leniency.
Evidence: .github/workflows/publish.yml:22-62 and 186-223 are identical blocks; the test at test/release-packages.test.ts:593-613 asserts counts ==2 for each env var but does not diff the script bodies for equivalence.
Consider extracting to a composite action or workflow_call template. Checked sibling .github/workflows contains only two files, so no existing shared action to reuse.
🔴 Issue 5 — upload-artifact with include-hidden-files: false and paths under the hidden .release directory will find no files and fail every release
.github/workflows/publish.yml:171 · bug · identified by z-ai/glm-5.3-flash
Failure scenario: the prepare job reaches "Upload the prepared release", upload-artifact finds zero files because both explicitly listed paths (.release/package-manifest.json, .release/pegma-sessions-<version>.tgz) live under the dot-directory .release, and if-no-files-found: error fails the step. Since publish: needs: prepare, no release can ever publish — every future release is blocked at the same step.
Mechanism and evidence: upload-artifact since v4.4.0 excludes hidden files by default, and its documented breakage reports (action issue #299, plus widely reported failures uploading contents of dot-directories such as Nuxt's .output/) show the exclusion applies to files under hidden directories and is not bypassed by listing the path explicitly in path:. The immediately preceding version of this same step used path: .release/ with include-hidden-files: true for exactly this directory, which is only explainable if the flag was required for it. The new test pins the suspect value (expect(prepare).toContain("include-hidden-files: false"), test/release-packages.test.ts:563), so a fix must change both the workflow and the assertion.
What I checked and the proof gap: I confirmed the step in the current file (lines 162-173), that both paths are under .release, and that no other workflow in the repo uses upload-artifact. I could not read the pinned v5.0.0 action source offline; if v5.0.0 filters only dot-file basenames (not dot-directory segments), the explicit paths would upload fine and this would be a no-op cleanup instead of a bug — that is the one counterevidence I could not rule out, and it is cheap to falsify by reading the pinned action or running the upload step once.
🟠 Issue 6 — Unpinned npm install --global npm@11.18.0 is newly added to the OIDC-enabled publish job
.github/workflows/publish.yml:249 · risk · identified by z-ai/glm-5.3-flash
Failure scenario: the registry fetch of npm@11.18.0 now executes inside the publish job — the only job with id-token: write and the one that actually publishes. A compromised or substituted npm CLI obtained through that unpinned install would run with publication authority and could publish arbitrary content with valid provenance.
Evidence: the diff adds "Use the reviewed npm release" to the publish job (line 249); the previous publish job used Node's bundled npm via node scripts/release-packages.mjs publish, which only required npm >= 11.5.1 (requireTrustedPublishingNpm). The repository's own security record, docs/securityscan.md finding 3, explicitly valued that this unpinned fetch "runs in the prepare job (not the OIDC-enabled publish job)". The new test even asserts expect(publish).toContain("npm install --global npm@11.18.0"), cementing it.
A cheaper fix keeps the unpinned fetch out of the OIDC job: verify the bundled npm's version (>= 11.5.1) in the publish job instead of installing npm from the registry there.
🟠 Issue 7 — Workflow publish path no longer confirms the registry serves the prepared integrity after publishing
.github/workflows/publish.yml:438 · risk · identified by z-ai/glm-5.3-flash
Failure scenario: npm publish exits 0 but the version does not end up queryable/served as prepared; the workflow goes green and nobody notices, while docs/RELEASING.md:176's recovery table ("absent version: publish the prepared tarball") assumes a human notices. The repo's own history records this exact shape: run 30319397574 "passed the gate" but npm returned E404 and the maintainer had to publish manually.
Evidence: the old path (release-packages.mjs publish) ended with confirmRegistryIntegrity(record) (script line 969, polling up to 6 times); the inline replacement at publish.yml ~line 438 publishes and exits, and the only registry interaction is the pre-publish E404 lookup. release:publish still exists but the test asserts the workflow must not call it, so the confirmation is now unreachable from the release path.
Proof gap: none on the behavior (visible in the diff); the residual question is only how likely a successful-but-ineffective publish is.
🔵 Issue 8 — Publish-job inline validation is an untested duplicate of the script logic and has already drifted
.github/workflows/publish.yml:341 · nit · identified by z-ai/glm-5.3-flash
The publish job's inline script re-implements verifyPreparedManifest/verifyPackedFiles/isolatedNpmEnvironment and is pinned only by string-containment assertions (test/release-packages.test.ts:522-618), so behavioral regressions in it cannot fail a test. Two concrete drifts already exist:
- it omits the
exports-target presence check thatverifyPackedFilesperforms (publish.yml:341 region), so a manifest whosefilesdropdist/index.d.tswould pass the publish job's independent re-validation (the whole point of duplicating it) as long aspackage.json/README/LICENSE and somedist/files are present; - its environment allowlist (~lines 370-381) omits the Windows names (
USERPROFILE,HOMEDRIVE,HOMEPATH,LOCALAPPDATA,PATHEXT,WINDIR,COMSPEC,Path) that the testedisolatedNpmEnvironmentkeeps, so the two copies disagree the day the job's runner changes.
Fix: extract the validation into a reviewed module both paths share, or replicate the missing checks.
🔵 Issue 9 — Isolated npm environment drops proxy and custom-CA variables, breaking documented local release packs on proxied networks
scripts/release-packages.mjs:120 · nit · identified by z-ai/glm-5.3-flash
Failure scenario: a maintainer following docs/RELEASING.md's local pnpm run release:pack on a corporate proxy or TLS-intercepting network gets connection or certificate errors from the smoke-test npm install, npm view, and npm publish, because isolatedNpmEnvironment forwards only a fixed name set and drops HTTP_PROXY/HTTPS_PROXY/NO_PROXY, NODE_EXTRA_CA_CERTS, and SSL_CERT_FILE/SSL_CERT_DIR. The previous runNpm inherited the full environment and worked there.
Evidence: scripts/release-packages.mjs:99-145 (NPM_ENVIRONMENT_NAMES plus isolatedNpmEnvironment); the new test asserts HTTPS_PROXY is stripped, so the behavior is deliberate. The CI jobs run on ubuntu-latest with direct egress, so only local/documented use breaks — but docs/RELEASING.md's local-procedure section does not mention the new direct-route requirement.
🔵 Issue 10 — New prepareRelease test makes the unit suite depend on live registry.npmjs.org access and a full rebuild
test/release-packages.test.ts:418 · nit · identified by z-ai/glm-5.3-flash
Failure scenario: pnpm test now fails for an offline contributor or a mirror-only/proxied CI, because the test at test/release-packages.test.ts:418 calls prepareRelease, which smoke-tests the tarball with a real npm install that must fetch the runtime dependencies @pegma/spine@0.1.1 and @pegma/storage-core@0.4.0 from registry.npmjs.org. The isolated npm env also strips proxy variables (see the proxy finding), so even a configured proxy no longer helps.
Cost beyond correctness: the test runs tsc -b --clean + tsc -b plus npm pack and npm install inside vitest run, on both CI matrix nodes (Node 22 and 24), adding roughly a minute of network-sensitive runtime per job. Previously the full pack path was only run manually per the docs; the PR moved it into the suite without documenting or stubbing the network dependency.
🔵 Issue 11 — RELEASING.md release-procedure example still walks through v0.1.1 while the package is at 0.2.0
docs/RELEASING.md:137 · nit · identified by z-ai/glm-5.3-flash
Failure scenario: a release engineer follows docs/RELEASING.md:135-142 ("For example, for the next patch release" -> git tag --sign v0.1.1 ... -> gh release create v0.1.1). The GitHub release fires the publish workflow, whose prepare job fails at "Check release metadata" with "release tag must be v0.2.0" — a wasted release attempt after tags were already pushed.
Evidence: the package version is 0.2.0 (packages/sessions/package.json), and the PR's own logic requires RELEASE_TAG === v${manifest.version} in validateRepository. The PR edits this file but leaves the pre-0.2.0 example stale.
🔵 Issue 12 — docs/securityscan.md line-number evidence for the release path no longer matches the changed files
docs/securityscan.md:125 · nit · identified by z-ai/glm-5.3-flash
Failure scenario: an auditor following the repo's recorded security review lands on the wrong code. docs/securityscan.md finding 3 cites exact line numbers (publish.yml lines 28/50/76/101/108/114 for six action pins; release-packages.mjs lines 109-117, 126-141, 186-201, 287-307, 469-475, 494-506, 530-532). This PR removes the publish-job checkout (five pins remain, at different lines), shifts line positions throughout, adds sha256 to the manifest checks, adds the NPM_TOKEN refusal beside the NODE_AUTH_TOKEN one, and replaces the node scripts/release-packages.mjs publish call with inline publish code.
The record also still states the unpinned npm fetch runs only in the prepare job, which this PR invalidates (see the publish-job npm install finding). The PR changes exactly the files this record describes without updating it.
🔵 Issue 13 — import type { SpawnSyncReturns } sits at the bottom of the declaration file instead of the top
scripts/release-packages.d.mts:135 · nit · identified by z-ai/glm-5.3-flash
scripts/release-packages.d.mts:135 places import type { SpawnSyncReturns } from "node:child_process"; after all declarations instead of at the top with the other imports. It is valid TypeScript (imports are hoisted) and prettier will not reorder it, but it reads as an afterthought and is the kind of placement a future lint pass or reader will flag.
| "WINDIR", | ||
| ]); | ||
|
|
||
| export function isolatedNpmEnvironment(source, userConfig, globalConfig) { |
There was a problem hiding this comment.
🔵 Isolated npm environment drops proxy and custom-CA variables, breaking documented local release packs on proxied networks (nit)
Failure scenario: a maintainer following docs/RELEASING.md's local pnpm run release:pack on a corporate proxy or TLS-intercepting network gets connection or certificate errors from the smoke-test npm install, npm view, and npm publish, because isolatedNpmEnvironment forwards only a fixed name set and drops HTTP_PROXY/HTTPS_PROXY/NO_PROXY, NODE_EXTRA_CA_CERTS, and SSL_CERT_FILE/SSL_CERT_DIR. The previous runNpm inherited the full environment and worked there.
Evidence: scripts/release-packages.mjs:99-145 (NPM_ENVIRONMENT_NAMES plus isolatedNpmEnvironment); the new test asserts HTTPS_PROXY is stripped, so the behavior is deliberate. The CI jobs run on ubuntu-latest with direct egress, so only local/documented use breaks — but docs/RELEASING.md's local-procedure section does not mention the new direct-route requirement.
There was a problem hiding this comment.
Not changed: the task requires proxy overrides and NODE_EXTRA_CA_CERTS to be removed from npm invocations. The direct registry endpoint and empty configuration files are deliberate. This thread remains open for maintainer visibility.
|
Addressed in
#6 was fixed in No change for #5: publication validation must remain workflow-owned inline code because the OIDC job may not execute repository or artifact scripts. The parity checks now cover the duplicated environment contract. No change for #8: both package manifests on the PR base and current head are already version |
|
Follow-up for the OpenRouter review pinned to Fixed in
#1, #2, #6, #7, and #13 were fixed in |
There was a problem hiding this comment.
OpenRouter pull-request review
Verdict: partial
Scope: latest-commit (commit-range)
Mode: verify
Commit: 5880eb621017b697db280d951d5cbdfe6decea3b
Judge: openai/gpt-5.6-luna (repaired(canonical+1): source coverage preserved before publication cap)
Cost: $0.2175 (lanes $0.2169 + judge $0.0007)
Lanes
meta/muse-spark-1.2: ok (0 finding(s), 28.6s, 117718+4345 tokens (10210 cached), 3 tool round(s), via Meta, $0.15)z-ai/glm-5.3-flash: ok (1 finding(s), 539.4s, 849160+74847 tokens (719872 cached), 12 tool round(s), via DigitalOcean, $0.0625)
Round 2 resolution
- ❌
r1-5not fixed — upload-artifact withinclude-hidden-files: falseand paths under the hidden.releasedirectory will find no files and fail every release: Not fixed:.github/workflows/publish.yml:220still hasinclude-hidden-files: falsewithif-no-files-found: errorwhile both listed paths (.release/package-manifest.jsonandsteps.inventory.outputs.tarballwhich is.release/pegma-sessions-<version>.tgz) live under hidden directory.release.upload-artifactv4.4+ excludes hidden files by default and issue #299 documents that explicit… - 🤝
r1-4disputed — Duplicated bare-repo verification script creates drift risk: Intentional tradeoff with mitigation:publish.ymlstill duplicates the fullVerify the release sourcebash block inprepare(~23-89) andpublish(~240-306). Fixing agent rebuttal that publication validation must remain workflow-owned inline code (OIDC job must not execute repository/artifact scripts) is a reasoned security isolation justification. Drift risk is now mitigated by parity test… - ✅
r1-6fixed correctly — Unpinnednpm install --global npm@11.18.0is newly added to the OIDC-enabled publish job: Fixed inpublish.ymlprepare and publish jobs: addedREVIEWED_NPM_TARBALL/REVIEWED_NPM_INTEGRITYenv, replacednpm install --global npm@11.18.0withcurl --proto '=https' --tlsv1.2to temp dir +node --input-type=moduleSHA-512 check viacreateHash('sha512')+timingSafeEqualagainstsha512-T67M4L5wNm0cZ7EBLErcEkY1SmzEW/WJ+SADBzsFUY1UdAPfFHXFQtZ6SEXiK0+vzXysCvAsepbMaBTwnrAD+w==+… - ✅
r1-7fixed correctly — Workflow publish path no longer confirms the registry serves the prepared integrity after publishing: Fixed:publish.ymlpublish job now restores post-publish confirmation. AddedqueryRegistryIntegrityhelper +waitviaAtomics.wait, then afternpm publish ... --provenance --ignore-scriptsloops 6 attempts with exponential backoff2**attempt*1000mspollingnpm view <spec> dist.integrity --jsonandtimingSafeEqualagainstrecord.integrity; throws `did not expose the prepared packa… - 9 nit finding(s) from earlier rounds retired (severity floor for follow-up rounds is
risk). - Open findings after this round: 2 (1 bug-severity).
Warning
The PR head advanced after this review's diff was collected. This review is pinned to commit 5880eb6 and does not cover the newest push.
Findings
🔵 Issue 1 — Prune guard in tsbuildinfo cleanup is a no-op next to -delete
.github/workflows/publish.yml:172 · nit · identified by z-ai/glm-5.3-flash
The newly rewritten cleanup step uses find . -path './node_modules' -prune -o -type f -name '*.tsbuildinfo' -delete, but GNU/BSD find makes -delete imply -depth, and -prune has no effect once -depth is in effect. The step therefore still descends into ./node_modules (including the pnpm virtual store) and would delete any *.tsbuildinfo file found there — the prune guard does not provide the exclusion it appears to promise.
Impact today is cosmetic: no *.tsbuildinfo is expected under node_modules, deleting one would only drop a build cache, and the actual targets are still covered — the root tsconfig.tsbuildinfo matches the find and is deleted, and buildFromCleanOutputs (scripts/release-packages.mjs:635-643) also removes it plus the package build info before the clean build. .gitignore covers *.tsbuildinfo, dist/, and .release/, so --require-clean is unaffected.
Checked: the previous command (find packages/sessions -type f -name '*.tsbuildinfo' -delete) had no prune, no test pins the pruning behavior, and no tracked file matches *.tsbuildinfo. If the node_modules exclusion is intended, use -not -path './node_modules/*' or two separate find invocations.
|
Fixed in |
|
Verify-round follow-up:
Both workflows pass actionlint, and the complete local gate remains green. |
There was a problem hiding this comment.
OpenRouter pull-request review
Verdict: partial
Scope: latest-commit (commit-range)
Mode: verify
Commit: 072b018fda74d348608b2ed70801790c0b17d1ad
Judge: openai/gpt-5.6-luna
Cost: $0.2186 (lanes $0.2174 + judge $0.0013)
Lanes
meta/muse-spark-1.2: ok (0 finding(s), 31.6s, 101576+3530 tokens (4292 cached), 3 tool round(s), via Meta, $0.14)z-ai/glm-5.3-flash: ok (2 finding(s), 360.1s, 717899+59918 tokens (479488 cached), 11 tool round(s), via Crusoe, $0.0801)
Round 2 resolution
- ✅
r1-5fixed correctly — upload-artifact withinclude-hidden-files: falseand paths under the hidden.releasedirectory will find no files and fail every release: Staging fix confirmed:preparenow copiespackage-manifest.jsonandpegma-sessions-<version>.tgzfrom hidden.releaseto non-hiddenrelease-upload/viacopyFileSync/mkdirSyncand uploadsrelease-upload/package-manifest.json+steps.inventory.outputs.tarball(release-upload/pegma-sessions-${version}.tgz).include-hidden-files: falseremains but no longer filters the artifact p… - ✅
r1-4fixed correctly — Duplicated bare-repo verification script creates drift risk: Drift risk mitigated by invariant test:workflowRunScriptsnow handles both|and>-folded blocks, extracts the tworelease-verify.XXXXXXscripts and asserts length 2 and byte-equality. Both jobs still contain identicalVerify the release sourcebash blocks with explicit::error::diagnostics for tag type, signature, commit resolution, andmerge-base --is-ancestor, so a one-sided ed… - ✅
r1-6fixed correctly — Unpinnednpm install --global npm@11.18.0is newly added to the OIDC-enabled publish job: Both jobs now setREVIEWED_NPM_TARBALL/REVIEWED_NPM_INTEGRITYand theUse the reviewed npm releasestep fetches viacurl --proto '=https' --tlsv1.2, computessha512-withcreateHash('sha512')and verifies with length check +timingSafeEqualbeforenpm install --global "${npm_tarball}" --ignore-scriptsand verifiesnpm --versionis11.18.0. Inline publish job no longer does unpi… - ✅
r1-7fixed correctly — Workflow publish path no longer confirms the registry serves the prepared integrity after publishing: Publish job now confirms registry state afternpm publish: addedqueryRegistryIntegrity(handles E404 vs error) and 6-attempt exponential poll (wait(2**attempt*1000)viaAtomics.wait) requiringequal(record.integrity, currentIntegrity)before success, throwingdid not expose the prepared package integrityotherwise. Test asserts containment offor (let attempt = 0; attempt < 6and th… - 9 nit finding(s) from earlier rounds retired (severity floor for follow-up rounds is
risk). - Open findings after this round: 2 (0 bug-severity).
Warning
The PR head advanced after this review's diff was collected. This review is pinned to commit 072b018 and does not cover the newest push.
Findings
🟠 Issue 1 — Duplicated "Use the reviewed npm release" block has no drift-parity invariant, unlike the verification blocks it was modeled on
.github/workflows/publish.yml:121 · risk · identified by z-ai/glm-5.3-flash
The latest commit grew the npm self-install from a one-liner into a ~28-line workflow-owned supply-chain block (curl the fixed tarball URL, compute SHA-512, timing-safe-compare against REVIEWED_NPM_INTEGRITY, npm install --global "${npm_tarball}" --ignore-scripts, assert npm --version), and that block is now duplicated verbatim in both jobs.
The drift-parity invariant added in this same commit covers only the verification scripts: test/release-packages.test.ts filters workflowRunScripts(workflow) for release-verify.XXXXXX and asserts verificationScripts[1] === verificationScripts[0]. The reviewed-npm.XXXXXX blocks are not covered, so a future edit that changes the curl flags, the hash computation, or the version/integrity check in one job and not the other will pass CI. The dangerous direction is drift in the publish (OIDC) copy toward leniency, which would quietly undo the r1-6 pinning while the prepare copy still looks pinned.
Partial guards already exist and limit this: the test asserts 'npm install --global "${npm_tarball}"' in both jobs and that the exact integrity constant appears exactly twice, so wholesale deletion of the check from one job fails the test. What is unguarded is logic drift within the blocks. The same repair as r1-4 applies: extract both reviewed-npm.XXXXXX scripts and require exact equality. Both copies are currently byte-identical, so this is purely a preventive invariant, not an active defect.
🔵 Issue 2 — find prune of ./node_modules is ineffective because -delete implies -depth in GNU find
.github/workflows/publish.yml:172 · nit · identified by z-ai/glm-5.3-flash
The Remove generated package outputs step changed to:
find . -path './node_modules' -prune -o -type f -name '*.tsbuildinfo' -delete
On the ubuntu-latest runner this uses GNU find, whose documented behavior is that -delete automatically turns on -depth and that -prune has no effect when -depth is in effect (find also emits the warning "-delete automatically turned on -depth, but -prune does nothing when -depth is in effect"). So the prune guard does nothing: find descends into ./node_modules anyway and would delete any *.tsbuildinfo files inside the pnpm virtual store, in addition to traversing the whole store.
Practical impact today is benign — no step after this one re-runs an install that would notice store changes, and no dependency consumes a shipped .tsbuildinfo at runtime — so the release path still works; the primary goal (deleting the repo's own build-info files) is achieved. But the guard is provably inert and the deletion scope is broader than intended. If the store exclusion matters, use a form compatible with -delete, e.g. -not -path './node_modules/*', or keep the earlier per-package find packages/sessions ... scope plus a root-level rm -f tsconfig.tsbuildinfo.
|
Verify-round follow-up for
Both workflows pass actionlint, and the full local gate is green. |
There was a problem hiding this comment.
OpenRouter pull-request review
Verdict: partial
Scope: latest-commit (commit-range)
Mode: verify
Commit: 3751790667bb81cf5b91002f8142137627277bf9
Judge: openai/gpt-5.6-luna
Cost: $0.1420 (lanes $0.1417 + judge $0.0003)
Lanes
meta/muse-spark-1.2: ok (0 finding(s), 22.7s, 78358+2798 tokens (14419 cached), 2 tool round(s), via Meta, $0.0940)z-ai/glm-5.3-flash: ok (1 finding(s), 322.7s, 678404+38589 tokens (522560 cached), 14 tool round(s), via Makora, $0.0478)
Round 2 resolution
- ✅
r1-5fixed correctly — upload-artifact withinclude-hidden-files: falseand paths under the hidden.releasedirectory will find no files and fail every release: Prepare now copies the exact verified pair from hidden.releaseto non-hiddenrelease-upload/and uploadsrelease-upload/package-manifest.json+release-upload/pegma-sessions-<version>.tgzwithinclude-hidden-files: falseunchanged, verified in current.github/workflows/publish.yml:207-235inventory step and uploadpath. - ✅
r1-4fixed correctly — Duplicated bare-repo verification script creates drift risk: Risk mitigated by invariant test:test/release-packages.test.tsextracts both workflow-owned verification blocks viaworkflowRunScriptsfiltering onrelease-verify.XXXXXXand asserts byte-for-byte equality, failing CI on drift; current workflow also has identical explicit error messages for each git check. - ✅
r1-6fixed correctly — Unpinnednpm install --global npm@11.18.0is newly added to the OIDC-enabled publish job: Bothprepareandpublishjobs now downloadREVIEWED_NPM_TARBALLviacurl --proto '=https' --tlsv1.2, verifysha512-T67M...withcrypto.createHash('sha512')+timingSafeEquallength check, thennpm install --global "${npm_tarball}" --ignore-scriptsand assertnpm --version == 11.18.0in.github/workflows/publish.yml:118-148and334-364. - ✅
r1-7fixed correctly — Workflow publish path no longer confirms the registry serves the prepared integrity after publishing: Publish job now definesqueryRegistryIntegrityand polls up to 6 times with exponentialAtomics.waitbackoff, requiringrecord.integrityto be served afternpm publish; throwsdid not expose the prepared package integrityif not confirmed, matching priorconfirmRegistryIntegritybehavior in.github/workflows/publish.yml:548-622. - 9 nit finding(s) from earlier rounds retired (severity floor for follow-up rounds is
risk). - Open findings after this round: 1 (1 bug-severity).
Warning
The PR head advanced after this review's diff was collected. This review is pinned to commit 3751790 and does not cover the newest push.
Findings
🔴 Issue 1 — Upload-artifact no longer finds the hidden .release paths
.github/workflows/publish.yml:238 · bug · identified by z-ai/glm-5.3-flash
The prepare job stages the exact verified pair into a non-hidden release-upload/ directory, so include-hidden-files: false no longer excludes the manifest and tarball and if-no-files-found: error finds both files. Fixed.
There was a problem hiding this comment.
OpenRouter pull-request review
Verdict: clean
Scope: latest-commit (commit-range)
Mode: verify
Commit: 153c7c2c7744afc5af906a6d24c0599f6838a1f7
Judge: openai/gpt-5.6-luna
Cost: $0.1192 (lanes $0.1191 + judge $0.0001)
Lanes
meta/muse-spark-1.2: ok (0 finding(s), 25.4s, 68501+3700 tokens (2274 cached), 2 tool round(s), via Meta, $0.0988)z-ai/glm-5.3-flash: ok (0 finding(s), 298.9s, 591948+27874 tokens (509098 cached), 14 tool round(s), via OpenInference, $0.0203)
Round 2 resolution
- ✅
r1-5fixed correctly — upload-artifact withinclude-hidden-files: falseand paths under the hidden.releasedirectory will find no files and fail every release: Prepare now stages the exact verified pair into non-hiddenrelease-upload/viacopyFileSync+mkdirSyncand verification, andupload-artifactnow listsrelease-upload/package-manifest.jsonandrelease-upload/pegma-sessions-${version}.tgzwithinclude-hidden-files: false. The hidden.releasedirectory is no longer uploaded, soif-no-files-found: errorno longer fails. Verified in `.… - ✅
r1-4fixed correctly — Duplicated bare-repo verification script creates drift risk: Both jobs now contain the same expanded bare-repo verification with explicit::errordiagnostics, andtest/release-packages.test.tsextractsworkflowRunScriptscontainingrelease-verify.XXXXXXand requires 2 scripts with byte-for-byte equality, plus identicalreviewed-npm.XXXXXXblocks. Drift would fail CI, mitigating the duplicated-block risk. - ✅
r1-6fixed correctly — Unpinnednpm install --global npm@11.18.0is newly added to the OIDC-enabled publish job: Both prepare and publish jobs now setREVIEWED_NPM_TARBALL/REVIEWED_NPM_INTEGRITYenv,curl --proto '=https' --tlsv1.2the fixednpm-11.18.0.tgz, verify SHA-512 withcreateHash+timingSafeEqualagainstsha512-T67M4L5wNm0cZ7EBLErcEkY1SmzEW/WJ+SADBzsFUY1UdAPfFHXFQtZ6SEXiK0+vzXysCvAsepbMaBTwnrAD+w==, thennpm install --global "${npm_tarball}" --ignore-scriptsand assert11.18.0. No u… - ✅
r1-7fixed correctly — Workflow publish path no longer confirms the registry serves the prepared integrity after publishing: Publish inline publisher now extractsqueryRegistryIntegrityand afternpm publishloops 6 attempts withAtomics.waitexponential backoff, requiringrecord.integrityto be served vianpm view ... dist.integrity. Failure throwsdid not expose the prepared package integrity. Verified in.github/workflows/publish.ymlpublish script and test assertsfor (let attempt = 0; attempt < 6an… - 9 nit finding(s) from earlier rounds retired (severity floor for follow-up rounds is
risk). - Open findings after this round: 0 (0 bug-severity).
No structured findings from the successful lane(s).
Summary
Validation