Repository navigation
test(spaces): close the one-sided tests and checks - #260
Merged
Merged
Conversation
It takes ~10s alone but ~25s after the rest of the suite in the shared isolate, and CI is slower again: it passed in 58.7s against the 60s limit on #257 and timed out on the release PR. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LZ7qcQNQoiA6a23woGC7tB
Every call through exports.default.fetch left the next one slower: 1000 requests took a trivial 404 from ~1ms to ~190ms, and the slowdown carried across test files. Calling the Hono app directly shows no growth. The suite was quadratic in requests made: the conformance run (~1000 requests) took ~3s alone, ~25s after the other files, and ~60s on CI, where it timed out on the release PR. The helper now calls app.fetch with a fresh ExecutionContext per request, leaving waitUntil work running as in production. All 355 tests pass, and the run's test time drops from ~60s to ~15s locally. The conformance timeout goes back to 60s. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LZ7qcQNQoiA6a23woGC7tB
workerd refuses redirect: "error", so on a Worker every client metadata and JWKS fetch threw, every attestation failed and a memberspace with allowedApps refused every app. The unit tests' stub fetch ignored the option, and the conformance checks only cover refusals. Use "manual": a 3xx fails the existing ok check, so redirects are still refused. The stub now rejects "error" as workerd does, and a test pins that behaviour (via the Request constructor, which applies the same check without a rejected promise for the pool to report twice). Calling the PDS directly in tests (previous commit) surfaced this as an unhandled rejection that failed the run. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LZ7qcQNQoiA6a23woGC7tB
…e like workerd The PDS's spaces adapter had no tests of its own: the engine's route tests use doubles for it, and the PDS conformance run has no foreign identities. Breaking its signature check, OAuth scope check, deactivation gate or foreign DID resolution left all 355 tests passing. New spaces-adapter tests serve foreign DID documents and a managing app from a stubbed fetch and cover each: signed and forged notifyRepoUpdate, key rotation through forceRefresh, a foreign delegation token, a managing app's did#service endpoint and service auth, OAuth space: scopes by type and collection, and RepoDeactivated. Each of those breaks now fails a test. The route tests' fake fetch builds a Request (so unsupported init options throw, as on workerd) and follows 3xx unless redirect is manual. checkAccess and the outbound notifyRepoUpdate now use redirect: manual, and each outbound call has a test where following the redirect would have succeeded. The space DO tests restore the global fetch they stub, and gain a successful syncer delivery test. notifyRepoUpdate refusals assert which guard refused. The engine looks up the global fetch per call, so host tests can stub it after the routes are built. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LZ7qcQNQoiA6a23woGC7tB
…rogress) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LZ7qcQNQoiA6a23woGC7tB
The syncer inbox also serves client metadata and mints attestations, so the attestation checks verify that a valid attestation issues before treating a refusal as a pass. New checks: valid-attestation-issues, valid-attestation-unlisted-refused, personalspace-owner-admitted. Registration, managing-app and update checks get controls; status-only refusals require a 4xx or the named error. With the redirect bug put back, five attestation checks now fail against Cirrus (none did). Matrix: 109 checks, 107 pass, 1 pinned divergence, 1 slow skip. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LZ7qcQNQoiA6a23woGC7tB
commit: |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
pdscheck | fd2d978 | Nov 21 2026, 11:54 AM |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
cirrusdocs | fd2d978 | Commit Preview URL Branch Preview URL |
Nov 21 2026, 11:55 AM |
Open
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.
This closes the tests and checks that would pass against a broken implementation. The motivating case is the attestation bug fixed in #258: verification always failed on workerd, yet every test and conformance check passed. The unit test's fake fetch ignored
redirect, and no check ever sent a valid attestation.Builds on #258. This branch contains #258's commits (the direct-call test helper and the attestation
redirectfix). Merge #258 first and this diff shrinks to its own changes.PDS host adapter (
packages/pds/test/spaces-adapter.test.ts, new)The PDS's spaces adapter had no tests of its own: the engine's route tests use test doubles, and the PDS conformance run has no foreign identities. Breaking any of these left all 355 PDS tests passing:
verifyForeignServiceJwtaccepting any signaturespace:scope check allowing everythingThe new tests serve foreign DID documents and a managing app from a stubbed fetch:
notifyRepoUpdategets 200, while a forged one and a wronglxmget 401;forceRefresh;InvalidDelegationToken;did#serviceendpoint is resolved and called with service auth (audis the managing app);space:grant allows its type and collection, and refuses another type or collection;RepoDeactivated.Each of the four breaks above now fails a test, and so does swapping
&&for||in the signature check.Fakes that behave like workerd (
packages/spaces)Request, so unsupported init options throw as they do on workerd, and it follows 3xx unlessredirectis"manual".checkAccessand the outboundnotifyRepoUpdatenow useredirect: "manual", asconfirmRegistrationand attestation already did (changeset). Each of the four outbound calls has a test whose redirect target would succeed if it were followed. Switching any one of them to"follow"fails its test.isolate: falsethe old fakes leaked into later files. There's a new test for a successful syncer delivery: no service auth,redirect: "manual", token in the body, queue emptied.notifyRepoUpdaterefusals assert which guard refused, not just a 403.fetchper call, so host tests can stub it after the routes are built. No change in production.Conformance suite (
packages/space-conformance)client-metadata.jsonwith an ES256 JWKS, andinbox.attest()mints attestations.credential.valid-attestation-issuesandcredential.valid-attestation-unlisted-refused.allowed-apps-gatefirst require a valid attestation to issue whenever an inbox is available, through a new optionalusescapability. Without an inbox, their detail says the success path wasn't checked.notify.renewal-not-reconfirmednow requires the first registration to have been confirmed.request.invalid-space-uri-rejectedis sent authenticated and requires a 400 with an error name.revocation.non-authority-refusedrequires 401/403.bare-did-rejectedrequiresInvalidRequest, after a control that a well-formeddid#serviceis accepted.cross-space-refused,published-collections-refusedandowner-state-not-by-credentialrequire a 4xx.applywrites-update-missingfirst updates an existing record,space-blob-not-publicchecks that a public blob is served, and there's a new checkpolicy.personalspace-owner-admitted.Results
writes.delete-in-missing-space, unchanged) and 1 slow skip.pnpm build,pnpm checkandpnpm knipare clean. knip prints one configuration hint, which comes from main.One small divergence noted, not changed: Cirrus answers a malformed
spacewith400 InvalidSpaceUri, which no lexicon declares. The reference answers XRPC's genericInvalidRequest.Generated by Claude Code