Skip to content

ci(publish): id-token for provenance + tolerate publish conflicts#47

Merged
ShawnChen-Sirius merged 2 commits into
chdb-io:mainfrom
ShawnChen-Sirius:fix/publish-provenance-permission
Jun 15, 2026
Merged

ci(publish): id-token for provenance + tolerate publish conflicts#47
ShawnChen-Sirius merged 2 commits into
chdb-io:mainfrom
ShawnChen-Sirius:fix/publish-provenance-permission

Conversation

@ShawnChen-Sirius

Copy link
Copy Markdown
Contributor

Completes the v3.0.0 publish. After #46 fixed the runner + made publishes idempotent, the re-run got all four subpackages built and the main job finally executed for the first time — and failed:

npm error code EUSAGE
npm error Provenance generation in GitHub Actions requires "write" access to the "id-token" permission

main publishes with npm --provenance, which needs id-token: write (OIDC). The workflow never granted it; the bug was latent because main had only ever been skipped/cancelled before.

Changes:

  1. Grant id-token: write (+ contents: read) on the main job so --provenance works.
  2. Both publish steps tolerate an already-published conflict — if the pre-publish registry read lags behind a version that is in fact already published, fall back to treating an npm cannot publish over / 403 error as success rather than failing. This de-risks the darwin-x64 subpackage, which is currently in a half-published state on the registry.

State on npm right now: @chdb/lib-{linux-x64,linux-arm64,darwin-arm64}@26.5.0 published; @chdb/lib-darwin-x64@26.5.0 not yet visible; chdb@3.0.0 not published. After this merges, re-pointing the v3.0.0 tag re-runs the publish: the three publish steps skip/no-op, darwin-x64 publishes (or tolerates conflict), and main publishes chdb@3.0.0 with provenance to latest.

ShawnChen-Sirius and others added 2 commits June 15, 2026 12:29
The main job published with npm --provenance but the workflow never granted the
id-token: write permission OIDC provenance requires, so it failed with EUSAGE
once it finally ran (it had only ever been skipped/cancelled before). Grant
id-token: write (+ contents: read) on the main job.

Also harden both publish steps: when the pre-publish registry read lags behind a
version that is actually already published, fall back to treating an npm
'cannot publish over / 403' conflict as success, instead of failing the job.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Root-fix for the intermittent stream.test.ts failure that only struck the
slowest runner (macos-15-intel). libchdb allows one active data directory per
process and the v3 suite runs all files serially in a single fork, so a test
that creates a Session and throws before its own close() leaks the connection
and blocks every later `new Session()` at a different temp path —
'only one active data directory per process' — cascading into unrelated files.
It was timing-sensitive (a borderline async race losing only on the slow Intel
runner), which is why faster platforms and most runs passed.

- index.js: export internal _closeAllSessions() that force-closes every open
  session (close() releases the native connection synchronously).
- test/v3/setup.ts + vitest setupFiles: a global afterEach calls it, so a leak
  is local to the test that caused it instead of poisoning the rest.
- add try/finally around the unguarded new Session() sites (async-stress race
  test, two lifecycle tests) so they release even when an assertion throws.

Verified: reproduced the exact CHDB_CONNECTION cascade, confirmed the global
teardown clears it; full v3 suite green (118 passed).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@ShawnChen-Sirius ShawnChen-Sirius merged commit 660dfe8 into chdb-io:main Jun 15, 2026
15 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.

1 participant