Skip to content

build: add opt-in Node SDK next prereleases - #802

Open
roncohen wants to merge 2 commits into
mainfrom
build/node-sdk-next-prerelease
Open

roncohen wants to merge 2 commits into
mainfrom
build/node-sdk-next-prerelease

Conversation

@roncohen

@roncohen roncohen commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Set up an explicit Node-only 2.0.0-next.0 prerelease under npm's next tag, without merging Node SDK v2 or changing the stable Changesets/docs publisher. This is an automation-only PR based on current main; the candidate remains Node #790, currently 0809be2b95f43fa1785c6b7b188c03ac8fd40965.

A separate workflow is intentional: GitHub must have the manual workflow on the default branch before dispatch, so this can land independently of the SDK migration and avoid prematurely putting v2 into the normal stable release flow.

Behavior and safeguards

  • New Node SDK next prerelease manual workflow (node-sdk-prerelease.yml). No push, tag or PR publication triggers. Defaults to artifact-only (publish=false). Only a dispatch from main can publish.
  • Requires an exact commit SHA and 2.0.0-next.N matching the candidate's existing manifest; no source version rewriting or Changesets prerelease mode.
  • Requires successful GitHub Actions Build & Test, actual CodeQL and Oneleet checks on that exact commit, with no pending/failed reported CI/security checks. Copilot reviewer-agent execution is not a validation check or approval. Rejects dirty or moving source checkouts.
  • Builds clean evaluator/Node outputs, runs the Node test/type contracts, uses Yarn to pack only @reflag/node-sdk, and verifies that workspace:* resolved to published evaluator 2.0.0. Validates tarball contents/entry points, compiled SDK version metadata and SHA-256/SHA-512 integrity.
  • Installs the tarball in an owned, clean consumer with scripts disabled. Runs strict augmented/unaugmented TypeScript contracts and real loopback-HTTP runtime checks against the installed package and its published evaluator dependency—not workspace source shortcuts.
  • Uploads the verified tarball and metadata. Publication is a separate OIDC-enabled job, behind npm-node-prerelease; candidate code/dependency/lifecycle scripts never run in that job. Preparation has no OIDC permission. Both prerelease jobs explicitly disable dependency caching, preventing candidate checkout from poisoning the default-branch cache scope.
  • publish=true first verifies that the GitHub environment already has required reviewers. It fails closed if the environment is absent or unprotected.
  • Rechecks the downloaded artifact digest, registry version absence and stable-tag baseline immediately before npm publish <one-tarball> --tag next --access public --provenance --ignore-scripts. No evaluator, OpenFeature, Browser/framework or CLI publication, no Git tags/releases, no docs push, and no general Changesets publish command.
  • Checks next, registry tarball integrity and unchanged latest afterward, with bounded reads for registry visibility. Does not repair/retag/unpublish anything automatically.
  • Wires 11 safeguard tests into normal Package CI. Adds root test:release and prerelease:node commands.

Validation

  • All 11 safeguard tests, actionlint 1.7.7, zero-warning changed-source lint, repository formatting, immutable install and whitespace checks pass.
  • Full local dry run against the clean, CI-green 0809be2 candidate: 271 Node tests, both existing SDK type programs, clean package builds, two strict installed-package consumers and real installed-package HTTP/runtime checks pass.
  • The final tarball's evaluator dependency is 2.0.0, SDK version/header is 2.0.0-next.0, and preparation/verification both retain registry latest: 1.8.3. SHA-256: 4e9fc2a58ca995d7aa23717909076422af01e5913739e52edd3c84a4e13a6424.
  • Initial and final clean-output preparations produced the same tarball hash. Candidate checkout remained clean. All 11 pre-existing JavaScript worktrees, including concurrent release/docs safety work, retained their HEADs/indexes/status/dirty-file hashes.
  • Existing stable .github/workflows/publish.yml and every package source/manifest remain unchanged. Full lint has zero errors and one inherited warning in generated Next.js environment declarations. Normal hooks passed; committed tree matches the verified prepared tree.
  • Final remote CI is green on pushed head b6f02cc5da8e8435d06ac4d06e952d2a85d901bd: both complete Build & Test runs (43641143957, 43641140252), CodeQL/Analyze and Oneleet pass; PR is MERGEABLE/CLEAN. Initial CodeQL caught a genuine cache-poisoning hazard; the follow-up disables all prerelease-job caching and adds a regression guard, without suppressing the alert. An earlier push run's report-action HTTP 404 is historical and superseded by both passing final runs. No full-repository local rebuild/E2E was claimed; the full rebuild/test jobs ran remotely.

Activation still required — nothing published

  1. Review and merge this automation-only PR so GitHub registers the manual workflow. This is not permission to merge feat(node-sdk): adopt collection values and Boolean-first reads #790 or publish a package.
  2. Configure GitHub environment npm-node-prerelease with required reviewers. It did not exist at setup inspection; the workflow refuses publication without protection.
  3. Add a separate npm trusted publisher for @reflag/node-sdk: organization reflagcom, repository javascript, workflow filename node-sdk-prerelease.yml, environment npm-node-prerelease, with Allow npm publish. Keep the stable publisher intact; no token fallback is added. Configure this close to first use because new npm trusted-publisher entries require their first successful publish within two days.
  4. Run artifact-only first; inspect its summary and choose the exact reviewed source commit. The preserved matchedRuleId patch remains outside feat(node-sdk): adopt collection values and Boolean-first reads #790 and is not silently included. Server/snapshot/canary readiness and v1 bootstrap incompatibility still apply.
  5. Publishing requires a separate deliberate dispatch with publish=true plus the environment approval. latest must stay on v1; the first prerelease version must not already exist. Automatic npm provenance identifies the trusted main workflow/build run; the separately selected SDK source SHA is recorded in dispatch inputs, the job summary and candidate.json. Do not treat the main workflow revision as the SDK candidate commit.

After activation, an artifact-only run would be:

gh workflow run node-sdk-prerelease.yml --repo reflagcom/javascript --ref main \
  -f source_sha=0809be2b95f43fa1785c6b7b188c03ac8fd40965 \
  -f version=2.0.0-next.0 -f publish=false

No prerelease workflow was dispatched, no npm trusted publisher/environment was created, no package/tag was published or changed, and no main merge, deployment, snapshot rebuild, persistent-service restart or model study occurred during setup. npm/OIDC publication itself remains untested until the explicitly approved first publish.

Copilot AI balanced review requested due to automatic review settings November 14, 2026 20:53

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.

Copilot AI balanced review requested due to automatic review settings November 14, 2026 21:07

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.

@roncohen
roncohen added this pull request to the merge queue Nov 18, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 18, 2026
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.

3 participants