feat(vale): fetch, verify, and publish the Vale platform packages - #86
Conversation
There was a problem hiding this comment.
Pull request overview
Adds the automated “detect upstream → review manifest diff → publish verified binaries” pipeline for the six @taskless/vale-<platform> packages, including the zero-dependency release logic + tests, and a new GitHub Actions workflow that implements the two-phase trust boundary described in the PR.
Changes:
- Adds
.github/workflows/vale-binaries.ymlwith separatedetect, credential-freeprepare, and credentialedpublishjobs. - Introduces pure release logic (
vale-release.cjs) plus unit tests, and I/O entrypoints (vale-detect.cjs,vale-prepare.cjs) to fetch/verify/stamp/pack. - Updates
.gitignoreto exclude local pack output in.vale-dist/.
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| openspec/changes/add-vale-binary-packages/tasks.md | Marks tasks for fetch/verify/stamp/workflow and quality gates as completed. |
| .gitignore | Ignores .vale-dist/ output from local npm pack runs. |
| .github/workflows/vale-binaries.yml | New two-phase workflow: detect upstream release → prepare verified tarballs → publish via OIDC trusted publishing. |
| .github/scripts/vale-release.test.cjs | Unit tests covering stamping/versioning, manifest rewrite planning, checksum parsing, and digest assertion logic. |
| .github/scripts/vale-release.cjs | Pure, dependency-free release logic (version parsing/stamping, manifest validation, digest comparison, detect planning). |
| .github/scripts/vale-prepare.cjs | Fetch/verify/unpack/stamp/pack script used by the credential-free prepare job (and for manual bootstrap). |
| .github/scripts/vale-detect.cjs | Detect script that reads upstream latest release + checksums and rewrites the pinned manifest for review. |
|
@claude /review |
|
Claude finished @thecodedrift's task in 19m 8s —— View job Claude finished reviewing @thecodedrift's PRTasks
Overall assessmentThe two-phase trust-boundary design (credential-free However, there is one bug that breaks the feature's core purpose, found while tracing
Two lower-severity, non-blocking observations posted inline:
Nothing else stood out on security, performance, or clarity — the shell/Action-expression injection surface is well-handled (all interpolated values are validated by pure functions before hitting |
All three findings are addressed in
— AI Coding Agent |
c5fc35a to
7d735af
Compare
Unit 2 of a forward-merging stack. Unit 1 added six empty packages; this adds the pipeline that fills and publishes them, plus the scripts it runs and their tests. Nothing is consumed yet: the CLI pin is unit 3. Two phases, because the trust boundary is code review. `detect` runs on a weekly schedule with no npm credential and no OIDC identity, compares upstream Vale against the pinned version, and opens a pull request carrying the new version and all six digests taken from upstream's own checksums file. `publish` runs on the push to main that merges it. Splitting them is what makes the automation worth trusting: a single job that discovered a digest and then verified downloads against the digest it had just discovered would verify nothing. What bounds a run is the upstream comparison alone. The "is this version already on npm?" check release.yml uses cannot work here, since every publish stamps <valeVersion>-<yyyymmddhhmmss>, a version npm has never seen, so that check would answer "not published" every time and could never suppress anything. The publish phase is split again into prepare and publish. `prepare` downloads third-party bytes off the internet, so it holds contents: read, no environment, and no id-token, and cannot publish or mint a token no matter what it downloads. It verifies every archive against the committed digest and aborts before anything is unpacked on a mismatch. The credentialed `publish` job only ever sees bytes that already matched a reviewed digest, and it does not even check out the repository. Packing happens before the artifact upload because actions/upload-artifact does not preserve file modes and the Vale executable has to reach npm executable. `npm pack` records modes inside the .tgz, so shipping the tarball through the artifact keeps 0755 intact end to end. Merging this publishes nothing. The publish trigger is a path filter on the manifest, which this branch does not touch, and unit 1 added the manifest without a workflow to fire. The first publish is always deliberate. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Three review findings from the platform-package release scripts: - rangeMatches treated every `^0.0.x` as in-range for any `0.0.y`. Semver desugars `^0.0.1` to `>=0.0.1 <0.0.2`, so the patch is pinned too. - vale-prepare defaulted a missing `--out` / `--only` value to the empty string, which resolved `--out` to the current working directory instead of failing on the typo. - unpackMember copied whatever landed at the member path. It now requires the resolved path to stay inside the temp directory and to be a regular file, so a symlink or traversal entry in third-party archive bytes cannot reach the published tarball. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The detect job routed its cheap "is upstream ahead?" check through
planManifestUpdate with an empty checksums payload. That function only
ignores checksumsText on the NOT-ahead path, so the placeholder made it
throw ("parsed to no entries") on exactly the runs with a release to
propose: every real upstream bump failed before the checksums URL was
ever resolved, and only the no-op path passed.
Call isUpstreamAhead/parseReleaseTag directly for the cheap check and
call planManifestUpdate once, with the real checksums. Every function
involved was already green in isolation, so the bug lived purely in
main()'s composition — vale-detect.test.cjs now covers that by running
main() with both fetches stubbed.
Also from review:
- The publish loop no longer aborts at the first failure. Six sequential
publishes are six chances at a transient registry error, and stopping
midway leaves the set partially released, which is the one state the
CLI's exact cross-package pins cannot tolerate. It now attempts all
six, skips any already published at this stamped version (making a
re-run idempotent rather than fatal), and fails at the end naming the
stragglers.
- assertManifest requires archiveMember to be a flat filename.
unpackMember's containment checks run after extraction and cover the
leaf entry only, so a nested member could have a symlinked intermediate
directory followed by tar before there is a path to inspect. Removing
the intermediate component is the guarantee; GNU tar's own refusal is
not ours to rely on.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Jwc9FFroR3mTZ4hLiSkkX3
7d735af to
c439227
Compare
Stack (root → tip):
Unit 2 of the
add-vale-binary-packagesstack. Unit 1 (#72) added six empty packages and the pinned manifest; this adds the pipeline that fills and publishes them, along with the scripts it runs and their tests. Unit 3, the CLI'soptionalDependenciespin, is not here and cannot be written until these names exist on npm.Two phases, because the trust boundary is code review
detectruns on a weekly schedule with no npm credential and no OIDC identity. It compares the latest upstream Vale release against the version pinned in.github/scripts/vale-manifest.json, and when upstream is ahead it opens a pull request updating that version and all six SHA256 digests, taken from upstream's ownvale_<version>_checksums.txt. It publishes nothing.publishruns on the push tomainthat merges that pull request, once a human has read the digests.The split is what makes the automation trustworthy. A single job that discovered a digest and then verified its downloads against the digest it had just discovered would verify nothing at all: whatever it downloaded would match, because the digest came from the same fetch. Separating discovery from verification puts a review in between, so nothing publishes on bytes nobody signed off on, and nobody has to notice a Vale release for the process to run.
What bounds a run
The upstream-version comparison, and only that. The "is this version already on npm?" check
release.ymluses cannot work here. Every publish stamps<valeVersion>-<yyyymmddhhmmss>, a version npm has never seen, so such a check would answer "not published" on every single run and could never suppress anything. The comparison against upstream is the only thing that can say "nothing to do."Why
prepareandpublishare separate jobspreparedownloads third-party bytes off the internet. It holdscontents: read, no environment, and noid-token, so it cannot publish or mint a token regardless of what it downloads. It verifies every archive against the committed digest and aborts the run on a mismatch before anything is unpacked, then hands overnpm packtarballs.The credentialed
publishjob therefore only ever handles bytes that already matched a reviewed digest and are already sealed into a tarball. It does not even check out the repository.Why packing comes before the artifact upload
actions/upload-artifactdoes not preserve file modes, and the Vale executable has to reach npm with its executable bit set.npm packrecords modes inside the.tgz, so packing first and shipping the tarball through the artifact keeps0755intact end to end.Before this can merge
package.jsoncarries the placeholder version0.0.0and no binary, so a barenpm publishfrom a package directory would burn the name on an empty0.0.0.npm-productionenvironment. There is no fallback token path in this workflow on purpose.phase: publishto exercise the OIDC path end to end.Merging neither PR in this stack publishes anything
The publish phase triggers on a push to
mainthat touches.github/scripts/vale-manifest.json. Unit 1 adds that manifest but no workflow to fire on it, and this PR adds the workflow but does not touch the manifest. The path filter never matches on either merge. The first publish is always deliberate, whether that is the manual bootstrap or aworkflow_dispatch.Known inherited limitation: the detect PR needs a manual check re-run
The detect phase opens its pull request with
GITHUB_TOKEN, and GitHub does not fire workflows on events raised by that token. SoValidatewill not start on a detect PR, and a maintainer has to re-run checks by hand before merging.This is the same step the changesets "Version Packages" PR already needs. Verified:
Validateon #65 ran withrun_attempt: 2, re-run manually before it merged. It is a limitation inherited from how GitHub scopesGITHUB_TOKEN, not a defect in this workflow.Stack
Forward-merging, per the proposal's delivery table. Unit 1 is repository-only and publishes nothing. Unit 2 publishes packages no consumer references yet. Unit 3 pins packages that by then exist.
This PR is a draft because it is the tip of the stack until unit 3 exists, and the OpenSpec archive gate would otherwise ask it to archive a change that is not finished. It also must not merge before the npm bootstrap above.
skip-changesetis correct here for the same reason it is on #72: the six packages are in the changesetsignorelist, andpackages/cliis untouched. Unit 3 is where a changeset belongs, since that is where a published CLI actually changes.Refs OSS-22
Built on top of #72
Publishes the Vale binary as per-platform npm packages from this repo, so a first-class engine isn't a host prerequisite.
This PR now carries unit 1 of a forward-merging stack: the six
packages/vale-<platform>/workspace packages, the committed checksum manifest that pins what goes into them, and the changesetsignoreentries that keeprelease.ymlout of their versions. It publishes nothing and no consumer references it. Unit 2 (#86) adds the fetch, verify, stamp, and two-phase release workflow. Unit 3, the CLI'soptionalDependenciespin, cannot be written until these names exist on npm.Why binary-in-tarball
The only existing npm distribution,
@vvago/vale, is third-party and downloads at postinstall. That script runs during a consumer's install under a policy we don't set — pnpm 10 blocks dependency build scripts by default — producing no binary and no error. The objection is mechanism, not provenance: it would stand if the Vale project published it. Binary-in-tarball is integrity-hashed, lockfile-pinned, resolves offline, and needs no lifecycle script. Sopackages/vale-<platform>/carries the binary withos/cpudeclared and nobin, no code, no scripts — ast-grep's packaging without ast-grep's installation, whose hardlink step already fails here underpnpm dlx.Versioning
An all-prerelease timestamp,
<valeVersion>-<yyyymmddhhmmss>, with a plain<valeVersion>never published. That keeps the Vale version legible, means a packaging fix is a new timestamp on the same base rather than a spent version, and — because a prerelease only satisfies a range naming the samemajor.minor.patch— makes^3.17.1provably unable to resolve. Exact pinning stops being a convention someone can drift from.Binaries are not committed
Six platforms at 10–20 MB each would live in git history permanently, so a published tarball is not reproducible from a plain clone. SHA256 checksums are committed and reviewed, and the pipeline refuses a mismatch, keeping "what can merge to main" as the trust boundary. The workflow that consumes them (#86) runs in two phases — detect upstream on a schedule and open a PR with the new version and checksums, then publish on merge — so nobody has to notice a Vale release and nothing publishes on bytes nobody signed off on. Safe to automate because publishing is inert: the CLI pins a literal exact version, so a new package reaches nobody until that pin is deliberately bumped.
Resolved open questions
The proposal left three open. All three are answered, and the reasoning is written up in
design.mdunder Resolved Questions.The matrix is six packages, not ast-grep's seven. Vale 3.17.1 publishes exactly six binary assets, and the packages are those six:
darwin-arm64,darwin-x64,linux-arm64,linux-x64,win32-arm64,win32-x64. ast-grep's seventh iswin32-ia32, and Vale ships no 32-bit Windows asset, so there is nothing to package.No libc or toolchain suffix in the names —
vale-linux-x64, notvale-linux-x64-gnu;vale-win32-x64, not-msvc. ast-grep carries those suffixes because Rust target triples disambiguate several builds per platform. Vale publishes exactly one build peros/cpupair, so a suffix would disambiguate nothing while asserting a toolchain nobody verified.musl stays on the
PATHfallback. Upstream publishes no musl asset, so there is nothing to package for Alpine. That is not only a packaging gap: Vale's Linux build is dynamically linked against glibc (verified asdynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0), so it is not a static Go binary and would not run on musl even if it were installed there. The linux packages' READMEs say so plainly rather than leaving a user to discover it as a loader error. This matches the existing gap rather than widening it:findSgBinary()maps every Linux to-gnutoday, so Alpine already falls through for ast-grep.Vale 3.17.1 is the pinned version, recorded in
.github/scripts/vale-manifest.jsonbeside the scripts that consume it. The manifest holds the version once, and per platform the asset-name template, the archive member to unpack, and the SHA256 of the release archive — upstream'svale_<version>_checksums.txtcovers the archives rather than the executables inside them, so a committed digest is independently checkable against upstream and the archive is verified before anything is unpacked from it. Tracking is the detect phase in #86: a weekly schedule opens a PR whenever upstream is ahead, and a security release takes a manualdetectdispatch rather than waiting for the cadence.Which Vale version the CLI pins is a separate decision, made when the CLI's
optionalDependenciesland in unit 3.Also carries two
CLAUDE.mdfixesUnrelated to Vale but too small to spend PRs on:
TSKL-, reading as though it's the only bare identifier the Linear integration resolves. It isn't —OSS-23linked and moved to In Review on PR creation for ref(cli): resolve ast-grep without an install-time step #69.git clone --depth=Nimplies--single-branch, which breaks--force-with-leaseon every branch (it failsstale info, so people fall back to a bare--force) and, more quietly, makesgit rebase maincorrect only while the merge base sits inside the shallow window.Where this sits
This change is the one exception to "one change, one PR": it is stacked, merging forward, with the archive landing on the last unit. The archive gate skips a PR that is not the tip, so
stack: openspec-archivedis not expected on this PR at all — #86 is the tip, and the change is archived on unit 3.ignoreoptionalDependenciespinpartition-rules-by-enginehas landed and is archived, so #71's only remaining prerequisite is a published binary from this stack.#70 and #71 are coupled by exactly one line: whichever lands second adds the engine-selection topic to
TOPICS. Ordering between them doesn't matter.Downstream, the generator's decision router (TSKL-279) needs a published release containing #70 and #71. It consumes a normal release — no prerelease, no path dependency — so it waits without blocking anything here.
skip-changesetstays on this PR. The six packages are in the changesetsignorelist andpackages/cliis untouched, so there is nothing here for changesets to version or release. Unit 3 is where a changeset belongs, since that is where a published CLI actually changes.Fixes OSS-22