Skip to content

fix(release): guard publish dist-tags and matrices - #666

Merged
IvGolovach merged 1 commit into
junhoyeo:mainfrom
IvGolovach:codex/release-publish-safety-20260601
Jun 5, 2026
Merged

fix(release): guard publish dist-tags and matrices#666
IvGolovach merged 1 commit into
junhoyeo:mainfrom
IvGolovach:codex/release-publish-safety-20260601

Conversation

@IvGolovach

@IvGolovach IvGolovach commented Jun 1, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Add a release workflow safety checker that keeps the native-build and publish matrices aligned before build or publish jobs run.
  • Guard npm publishing so prerelease versions derive a prerelease dist-tag and cannot accidentally publish to latest.
  • Extend release-state and launcher smoke coverage to catch package metadata, installed wrapper, platform binary, and stale PATH fallback regressions.
  • Align publish workflow environment settings with the native build workflow and remove unsupported ARM Linux strip commands from the publish matrix.

Why

Tokscale publishes platform packages and wrapper packages directly to npm from a manual release workflow. Small drift between the test-only native build matrix, the publish build matrix, and the platform publish matrix can produce release-only failures that are hard to see in normal PR checks. The same is true for npm dist-tags: a prerelease should not be able to land on latest by accident. This PR adds deterministic local and CI checks for those release invariants before a release publish can proceed.

Diff scope

  • .github/workflows/publish-cli.yml: adds top-level release build environment parity, runs the release safety checker, and avoids unsupported ARM Linux strip commands in the publish matrix.
  • .github/workflows/build-native.yml: runs the same release safety checker during native-build PR validation.
  • scripts/check-release-workflow-safety.py: validates workflow env parity, build matrix parity, package directory mapping, artifact names, binary names, and platform package manifest names.
  • scripts/publish-npm-package.sh: derives npm dist-tags from semver prerelease identifiers and refuses prerelease publishes with latest.
  • scripts/test-release-workflow-safety.sh: covers accepted and rejected workflow drift cases.
  • scripts/test-npm-release-state.sh: covers stable and prerelease npm dist-tag behavior.
  • scripts/test-package-launchers.sh: supports debug smoke builds, verifies installed wrapper/package paths, and checks stale PATH fallback failure behavior.

Branch integrity

  • Base branch: main
  • Validated base SHA: a86e688d620939d2c973c6d5625baa815ea223d7
  • Ahead/behind against fetched origin/main: 0 behind / 1 ahead
  • Merge base: a86e688d620939d2c973c6d5625baa815ea223d7
  • Diff proof was computed against the fetched base.

Commit integrity

  • Introduced commit: 5600a47776f7184d4c0db51ba59e2b716cb70928 fix(release): guard publish dist-tags and matrices
  • Final PR diff contains only the intended release workflow, publish script, and release verification test changes.
  • Ledger: not applicable - not required for selected validation mode/change family.
  • Version: not applicable - not required for selected validation mode/change family.

Diff hygiene

  • git diff --name-status origin/main...HEAD: M .github/workflows/build-native.yml, M .github/workflows/publish-cli.yml, A scripts/check-release-workflow-safety.py, M scripts/publish-npm-package.sh, M scripts/test-npm-release-state.sh, M scripts/test-package-launchers.sh, A scripts/test-release-workflow-safety.sh
  • git diff --check origin/main...HEAD: PASS, no output

Validation mode and proof

  • Validation mode: Mode 4 - CI/release workflow and release verification tooling changed.
  • python3 scripts/check-release-workflow-safety.py: PASS
  • bash scripts/test-release-workflow-safety.sh: PASS
  • bash scripts/test-npm-release-state.sh: PASS
  • TOKSCALE_SMOKE_BUILD_PROFILE=debug bash scripts/test-package-launchers.sh: PASS
  • bash -n scripts/*.sh: PASS
  • python3 -m py_compile scripts/check-release-workflow-safety.py: PASS
  • ruby -e 'require "yaml"; YAML.load_file(".github/workflows/publish-cli.yml"); YAML.load_file(".github/workflows/build-native.yml"); puts "YAML parse OK"': PASS
  • git diff --check origin/main...HEAD: PASS, no output
  • actionlint: not run - not installed in this local environment.

CI context confirmation

  • Pending - required GitHub Actions checks will run after the PR is created.
  • CI workflow context names unchanged; this PR adds checks inside existing workflows rather than renaming contexts.

Runtime safety

Not applicable - no CLI runtime session parsing, frontend runtime, database, auth, or server API path changed.

Release safety

  • The publish and native build matrices are now checked for target, host, build command, strip command, binary name, artifact name, package directory, and platform package manifest drift.
  • The publish script now uses latest only for stable versions and derives prerelease dist-tags such as beta for versions like 3.1.0-beta.1.
  • The publish script refuses prerelease packages when the effective npm dist-tag is latest.
  • Launcher smoke coverage validates the installed wrapper and platform package layout and confirms missing platform binaries do not silently fall back to a stale tokscale on PATH.

Migration notes

Not applicable - no DB migration changed.

Documentation integrity

Not applicable - no docs or runbooks changed. This PR enforces existing release expectations through scripts and workflow checks.

Rollback plan

Rollback: revert this PR.
DB downgrade: not applicable.
Data repair: not applicable.
Operational caveats: reverting removes the new release safety checks and restores the previous npm publish dist-tag behavior.

Known residual risks

  • Remote CI has not run yet because the PR has not been opened.
  • Local actionlint proof is unavailable because actionlint is not installed in this environment; workflow YAML was parsed locally and the release safety checker exercises the changed matrix invariants.

Summary by cubic

Adds a release safety checker to keep native-build and publish matrices/env in sync, and prevents prerelease versions from publishing with the latest npm tag. Expands tests, aligns publish env with native build, and removes unsupported ARM Linux strip commands.

  • New Features

    • Adds scripts/check-release-workflow-safety.py and runs it in build-native and publish workflows to enforce env/matrix/artifact/binary/package parity.
    • Updates scripts/publish-npm-package.sh to derive npm dist-tags from semver (stable -> latest, prerelease -> first identifier like beta) and reject prerelease publishes with latest.
    • Extends tests: workflow drift checks; npm dist-tag cases (prerelease, build metadata, explicit NPM_DIST_TAG); launcher smokes add debug/release profiles, verify installed wrapper/CLI/platform paths, and assert PATH fallback failures.
  • Bug Fixes

    • Aligns publish workflow top-level env with native build.
    • Removes unsupported ARM Linux strip commands from the publish matrix.

Written for commit b030c90. Summary will update on new commits.

Review in cubic

@vercel

vercel Bot commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
tokscale Ignored Ignored Preview Jun 5, 2026 3:44am

Request Review

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3 issues found across 7 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread scripts/check-release-workflow-safety.py
Comment thread scripts/test-npm-release-state.sh
Comment thread scripts/publish-npm-package.sh Outdated
@IvGolovach
IvGolovach force-pushed the codex/release-publish-safety-20260601 branch from 5600a47 to 82e6941 Compare June 1, 2026 22:58
Validation
* Validation tier: Tier 4 - CI/release tooling; touched publish workflow, native-build workflow, npm publish helper, launcher smoke helper, and release workflow safety checks.
* git diff --check origin/main...HEAD: PASS.
* git diff --check: PASS.
* git diff --cached --check: PASS.
* bash scripts/test-calculate-release-version.sh && bash scripts/test-check-version-coherence.sh && bash scripts/test-npm-release-state.sh && bash scripts/test-prepare-release-provenance.sh && bash scripts/test-release-workflow-safety.sh: PASS.
* bash scripts/test-package-launchers.sh: PASS.
* python3 scripts/check-release-workflow-safety.py: PASS.
* python3 -m py_compile scripts/check-release-workflow-safety.py: PASS.
* bash -n scripts/check-version-coherence.sh scripts/test-check-version-coherence.sh scripts/check-npm-release-state.sh scripts/test-npm-release-state.sh scripts/publish-npm-package.sh scripts/test-package-launchers.sh scripts/test-release-workflow-safety.sh scripts/calculate-release-version.sh scripts/test-calculate-release-version.sh scripts/prepare-release-provenance.sh scripts/test-prepare-release-provenance.sh: PASS.
* ruby -e 'require "yaml"; ARGV.each { |path| YAML.load_file(path); puts "#{path}: OK" }' .github/workflows/publish-cli.yml .github/workflows/build-native.yml: PASS.
* Version: PASS, bash scripts/check-version-coherence.sh.
* Ledger: not applicable - not required for selected validation tier/change family.
* Not run: full workspace cargo test - not required for selected validation tier because runtime Rust code was not changed and targeted release/workflow validation covers the touched tooling.

Rollback
* git revert HEAD
@IvGolovach
IvGolovach force-pushed the codex/release-publish-safety-20260601 branch from 82e6941 to b030c90 Compare June 5, 2026 03:44
@IvGolovach
IvGolovach merged commit e6290a3 into junhoyeo:main Jun 5, 2026
7 checks passed
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.

2 participants