chore: prepare public foundry-ai identity - #41
Merged
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
anandpant
force-pushed
the
chore/shipit-foundry-ai-identity
branch
from
July 11, 2026 20:01
737e1d0 to
c9009c3
Compare
anandpant
force-pushed
the
chore/shipit-foundry-ai-identity
branch
from
July 11, 2026 20:20
c9009c3 to
d8749c4
Compare
4 tasks
Contributor
Author
This was referenced Jul 12, 2026
Contributor
Author
anandpant
added a commit
that referenced
this pull request
Jul 12, 2026
Fixes four defects found in adversarial review of the PR #41 one-time npm bootstrap publish flow: 1. The npm token revocation step could exit green on a single transient `npm whoami` failure without ever attempting revocation. It now probes liveness 3x with backoff before and after revocation, and hard-fails on any mixed or inconclusive result instead of guessing. 2. `npm token revoke` historically wasn't guaranteed to manage granular access tokens. As of npm's December 2025 platform changes, npm CLI 11.16+ revokes granular tokens uniformly with classic tokens; the step keeps that as primary, adds a registry DELETE API fallback for defense-in-depth, and hard-fails with explicit manual-revocation instructions if both paths fail. 3. check-release-policy.mjs didn't assert the actual publish gates: bootstrap requiring both workflow_dispatch and the main ref, publish-prerelease/publish-stable requiring NPM_PUBLISH_ENABLED and a merged PR, and the release/non-release branch split between them. 4. A published package whose attestation URL hadn't propagated yet threw a non-retryable BootstrapMismatchError instead of the retryable BootstrapUnavailableError, causing reconciliation to fail immediately on ordinary propagation lag. A present-but-malformed URL still correctly stays a hard mismatch. Added tests for lag-then- success, permanent-absence exhaustion, and malformed-URL mismatch. Verification: pnpm run format, the reconciliation test file, and nx run-many -t identity-check release-policy-check lint test typecheck build skills-validate package-audit --projects=foundry-ai all pass. Manually confirmed release-policy-check fails when the NPM_PUBLISH_ENABLED gate is removed, then passes again once restored.
anandpant
added a commit
that referenced
this pull request
Jul 12, 2026
## Summary Stacks on #41. Fixes four defects an adversarial review found in the one-time npm "bootstrap publish" flow (`.github/workflows/release.yml` job `bootstrap-package`, `scripts/reconcile-bootstrap-release.mjs`, `scripts/check-release-policy.mjs`, `docs/RELEASING.md`): 1. **Revoke step could go green with a live token.** A single transient `npm whoami` failure took the "already non-authenticating" branch and exited 0 without revoking. The step now probes liveness 3x with backoff both before and after revocation, and hard-fails on any mixed/inconclusive result — it only exits 0 when no publish was attempted and no token was supplied, or the token is verified non-authenticating. 2. **`npm token revoke` and granular access tokens.** Research confirmed npm's December 2025 platform changes made npm CLI 11.16+ revoke granular tokens the same as classic tokens (the current `npm-token` CLI docs make no distinction). Kept CLI revoke as primary, added a registry `DELETE /-/npm/v1/tokens/token/{token}` API fallback for defense-in-depth, and made the step hard-fail with an explicit "manually revoke on npmjs.com now" message if both paths fail. Updated `docs/RELEASING.md` step 10 accordingly. 3. **Missing publish gate assertions.** `check-release-policy.mjs` now asserts the `bootstrap-package` job's `if:` requires both `workflow_dispatch` and the main ref, that `publish-prerelease`/`publish-stable` each require `NPM_PUBLISH_ENABLED == 'true'` and a merged PR, and that the release/non-release branch conditions are correctly split between the two jobs. 4. **Attestation propagation lag hard-failed instead of retrying.** A present package with an unpopulated `dist.attestations.url` now throws the retryable `BootstrapUnavailableError` instead of the non-retryable `BootstrapMismatchError`. A present-but-malformed URL still correctly stays a hard mismatch. Added unit tests for lag-then-success, permanent-absence exhaustion, and malformed-URL mismatch. No identity/version values changed, and no existing check was weakened — only added to. ## Test plan - [x] `pnpm run format` — passes (biome), only a pre-existing informational schema-version notice unrelated to this change - [x] `pnpm exec vitest run scripts/reconcile-bootstrap-release.test.mjs` — 6/6 passed - [x] `pnpm exec nx run-many -t identity-check release-policy-check lint test typecheck build skills-validate package-audit --projects=foundry-ai --outputStyle=static --skip-nx-cache` — all 8 targets pass - [x] Sanity check: temporarily removed the `NPM_PUBLISH_ENABLED` clause from `publish-prerelease`'s `if:` — `release-policy-check` failed with `publish-prerelease must require NPM_PUBLISH_ENABLED=true.`; restored and reconfirmed it passes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
shpitdev/foundry-aiand@shpit/foundry-aidestinations0.0.5as the first public package version while preserving all root exports, provider subpaths, configuration, and model behavior used by foundry-clawNPM_PUBLISH_ENABLEDand bootstrap only from GitHub Actions at an explicitly selected cleanmainSHAid-token: write, and--provenance --access public, then revoke the tokengit+httpsmanifest repository URL and post-transfer GitHub description, homepage, and topic allowlistNo repository transfer, npm publish, tag, or merge is included in this PR.
Verification
pnpm install --frozen-lockfile --config.strict-dep-builds=falsepnpm run formatpnpm exec nx run-many -t identity-check release-policy-check lint test typecheck build skills-validate package-audit --projects=foundry-ai --outputStyle=static --skip-nx-cache@shpit/foundry-ai@0.0.5with 56 files0.0.6and0.0.6-rc.0npm pack --dry-run --jsonandnpm publish --access public --dry-run --jsongit diff --check; amended tree clean atd8749c4bea2923b24b3657feaf170aea8863675aCutover Gate
For a package-absent bootstrap, an npm maintainer creates a one-day
@shpittoken, stores it only asNPM_BOOTSTRAP_TOKEN, and dispatchesrelease.ymlfrommainwith the exact current fullmainSHA. The GitHub-hosted job publishes with provenance, then itsalways()reconciliation polls npm and tags only after the npm-hosted attestation binds the exact package artifact, destination repository, workflow, and selected commit.If npm accepted the package but the publish command returned nonzero, rerun the same selected SHA. The package-present path skips publishing, requires that SHA to remain in
mainhistory, verifies the same attestation claims, and creates or verifies only the matching annotated tag. Mismatched or unverifiable state never tags. A rerun after token revocation needs no replacement token. After a green bootstrap, delete the invalidated GitHub secret, configure the exact trusted publisher, and only then enableNPM_PUBLISH_ENABLED=true.