test(cloudflare): decouple native-binding coverage from token minting - #1376
Open
Mkassabov wants to merge 2 commits into
Open
test(cloudflare): decouple native-binding coverage from token minting#1376Mkassabov wants to merge 2 commits into
Mkassabov wants to merge 2 commits into
Conversation
Mkassabov
force-pushed
the
feat/email-dev-mode
branch
from
August 30, 2026 04:36
4d10667 to
2c4f3d5
Compare
Mkassabov
force-pushed
the
fix/queue-http-token-gate
branch
from
August 30, 2026 04:36
eb03e1b to
10dbc6c
Compare
Contributor
|
Install the packages built from this commit: Alchemyalchemy bun add https://pkg.ing/alchemy/a5646bb@alchemy.run/better-auth bun add https://pkg.ing/@alchemy.run/better-auth/a5646bb@alchemy.run/cloudflare-runtime bun add https://pkg.ing/@alchemy.run/cloudflare-runtime/a5646bb@alchemy.run/frontend-frameworks bun add https://pkg.ing/@alchemy.run/frontend-frameworks/a5646bb@alchemy.run/node-utils bun add https://pkg.ing/@alchemy.run/node-utils/a5646bb@alchemy.run/pr-package bun add https://pkg.ing/@alchemy.run/pr-package/a5646bb@alchemy.run/floci bun add https://pkg.ing/@alchemy.run/floci/a5646bbDistilled@distilled.cloud/core bun add https://pkg.ing/@distilled.cloud/core/809f3d8@distilled.cloud/aws bun add https://pkg.ing/@distilled.cloud/aws/809f3d8@distilled.cloud/axiom bun add https://pkg.ing/@distilled.cloud/axiom/809f3d8@distilled.cloud/cloudflare bun add https://pkg.ing/@distilled.cloud/cloudflare/809f3d8@distilled.cloud/hetzner bun add https://pkg.ing/@distilled.cloud/hetzner/809f3d8@distilled.cloud/neon bun add https://pkg.ing/@distilled.cloud/neon/809f3d8@distilled.cloud/planetscale bun add https://pkg.ing/@distilled.cloud/planetscale/809f3d8 |
…inting
`Binding.test.ts` deployed the native-binding producer and the HTTP-token
producer in one stack. The `WriteQueueHttp` layer mints a scoped
`AccountApiToken`, so a credential without token-creation permission failed
the whole test — losing the native-binding coverage, which needs no token:
Unauthorized: Unauthorized to access requested resource
at AccountApiToken.ts (provider.create)
Cloudflare OAuth credentials have no token-creation scope at all, so this is
not recoverable by re-authorizing.
Split into two tests with separate deploys. The native-binding case now runs
everywhere; the HTTP case is gated behind `CLOUDFLARE_TEST_API_TOKENS`,
matching the `CLOUDFLARE_TEST_USER_TOKENS` gate on the `UserApiToken`
lifecycle tests.
`pnpm test test/Cloudflare/Queue --profile alchemy-testing` goes from
24 passed / 1 failed to 25 passed / 1 gated.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…inting
Same defect as the Queue suite in the previous commit. `R2/Binding.test.ts`
deployed all six workers (binding + http) from one shared `beforeAll`, and
`KV/Binding.test.ts` deployed all six inline in a single test — so minting
the `AccountApiToken` the `*Http` layers need took down the native-binding
coverage too, which needs no token:
Unauthorized: Unauthorized to access requested resource
at AccountApiToken.ts (provider.create)
R2 splits `fixtures/stack.ts` into a binding stack and a new
`fixtures/stack-http.ts`, driven by two `describe`s. The gate sits on the
`describe` rather than the tests so the suite's `beforeAll` never runs at
all: `runSuite` skips a suite's hooks when every test below it is skipped
(`alchemy-test/src/Runner.ts`). Both stacks stay independently inspectable
via `alchemy tail`.
KV splits its single `test.provider` into a native-binding test and a gated
HTTP-token test with separate deploys, matching the Queue shape.
`pnpm test test/Cloudflare/R2/Binding.test.ts test/Cloudflare/KV/Binding.test.ts
--profile alchemy-testing` goes from 5 failed / 0 passed to 0 failed /
3 passed / 3 gated. Verified the gate is not inert: with
CLOUDFLARE_TEST_API_TOKENS=1 the http tests run and reach the recorded
token-creation error.
Claude-Session: https://claude.ai/code/session_01QShcJ78QmS5g3rTfj6qdA5
Mkassabov
force-pushed
the
fix/queue-http-token-gate
branch
from
August 30, 2026 06:18
10dbc6c to
a5646bb
Compare
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.
Three Cloudflare binding suites deployed their native-binding workers and their HTTP-token workers in a single stack. The
*Httplayers mint a scopedAccountApiToken, so a credential without token-creation permission failed the whole deploy — taking down the native-binding coverage, which needs no token:Cloudflare OAuth credentials have no token-creation scope at all, so this is not recoverable by re-authorizing. On
--profile alchemy-testingit meant zero coverage of the R2, KV, and Queue native bindings, presenting as a red suite rather than a gap.Each suite now deploys the two transports separately and gates only the HTTP half.
Queue and KV split their
test.providerin two:R2 uses a shared
beforeAll, so it splitsfixtures/stack.tsinto a binding stack plus a newfixtures/stack-http.tsand gates at thedescribe:The gate sits on the
describerather than the individual tests so the suite'sbeforeAllnever runs at all —runSuiteskips a suite's hooks when every test below it is skipped (alchemy-test/src/Runner.ts). Both stacks stay independently inspectable viaalchemy tail.The env var matches
CLOUDFLARE_TEST_USER_TOKENSon theUserApiTokenlifecycle tests, and each skip comment records the exact error per the entitlement-gating convention.Result
test/Cloudflare/QueueR2/Binding+KV/BindingThe native-binding cases are coverage that was previously lost entirely, not failures that were re-labelled. Confirmed the gates are not inert: with
CLOUDFLARE_TEST_API_TOKENS=1the HTTP tests run and reach the recorded token-creation error.