Skip to content

chore: prepare public foundry-ai identity - #41

Merged
anandpant merged 1 commit into
mainfrom
chore/shipit-foundry-ai-identity
Jul 12, 2026
Merged

chore: prepare public foundry-ai identity#41
anandpant merged 1 commit into
mainfrom
chore/shipit-foundry-ai-identity

Conversation

@anandpant

@anandpant anandpant commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Summary

  • move all tracked repository and package identity to the approved neutral shpitdev/foundry-ai and @shpit/foundry-ai destinations
  • set 0.0.5 as the first public package version while preserving all root exports, provider subpaths, configuration, and model behavior used by foundry-claw
  • remove the previous logo and legal identity, set the license holder to SHPIT LLC, and add repository/package zero-reference guards
  • keep ordinary publishing disabled behind NPM_PUBLISH_ENABLED and bootstrap only from GitHub Actions at an explicitly selected clean main SHA
  • publish the bootstrap with npm 11.16.0, a temporary token, id-token: write, and --provenance --access public, then revoke the token
  • reconcile an accepted immutable publish after any publish-command outcome: verify exact version, tarball digest, npm attestation repository/workflow/ref/runner/commit, and matching annotated tag before finalizing
  • make package-present recovery idempotent while rejecting absent, mismatched, or unverifiable package/tag states without tagging
  • document and verify the exact git+https manifest repository URL and post-transfer GitHub description, homepage, and topic allowlist

No repository transfer, npm publish, tag, or merge is included in this PR.

Verification

  • pnpm install --frozen-lockfile --config.strict-dep-builds=false
  • pnpm run format
  • fresh 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
  • 7 Vitest files / 40 tests passed, including publish-response failure recovery, existing-package safe resume, and provenance SHA mismatch rejection
  • release policy parsed the workflow, validated bootstrap/reconciliation invariants and the exact docs/manifest repository URL, and syntax-checked every workflow shell block
  • public metadata verifier passed an exact metadata fixture and rejected wrong description/homepage/topics
  • package audit passed for @shpit/foundry-ai@0.0.5 with 56 files
  • stable and prerelease Nx release dry-runs resolved 0.0.6 and 0.0.6-rc.0
  • npm pack --dry-run --json and npm publish --access public --dry-run --json
  • extracted tarball manifest/zero-reference scan and clean-install ESM/CommonJS foundry-claw root-contract smokes passed
  • git diff --check; amended tree clean at d8749c4bea2923b24b3657feaf170aea8863675a

Cutover Gate

For a package-absent bootstrap, an npm maintainer creates a one-day @shpit token, stores it only as NPM_BOOTSTRAP_TOKEN, and dispatches release.yml from main with the exact current full main SHA. The GitHub-hosted job publishes with provenance, then its always() 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 main history, 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 enable NPM_PUBLISH_ENABLED=true.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@anandpant
anandpant force-pushed the chore/shipit-foundry-ai-identity branch from 737e1d0 to c9009c3 Compare July 11, 2026 20:01
@anandpant
anandpant force-pushed the chore/shipit-foundry-ai-identity branch from c9009c3 to d8749c4 Compare July 11, 2026 20:20

anandpant commented Jul 12, 2026

Copy link
Copy Markdown
Contributor Author

Merge activity

  • Jul 12, 10:18 PM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Jul 12, 10:18 PM UTC: @anand-testcompare merged this pull request with Graphite.

@anandpant
anandpant merged commit e0dddc8 into main Jul 12, 2026
5 checks passed
@anandpant
anandpant deleted the chore/shipit-foundry-ai-identity branch July 12, 2026 22:18
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
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.

1 participant