CS-10009 PR 3: migrate server-endpoints/ tests to explicit fixture#4798
CS-10009 PR 3: migrate server-endpoints/ tests to explicit fixture#4798lukemelia wants to merge 3 commits into
Conversation
Third slice of the CS-10009 plan. Stacked on PR 2 (realm-endpoints).
The bulk of these go through the shared `setupServerEndpointsTest`
helper. Extended it to accept an optional `fixture` parameter and
defaulted to `'blank'` — server-level endpoint tests (bot-commands,
webhooks, realm lifecycle, stripe sessions, etc.) almost universally
manage server state without inspecting the testRealm's card content,
so blank is the right default and individual consumers override only
when they truly need more.
Two consumers need realistic:
- screenshot-card-endpoint-test references `Person/fadhlan` from
tests/cards/ — set `{ fixture: 'realistic' }` via the helper.
- index-responses-test's published-realm module asserts on a
`data-test-home-card` substring, which only exists in
tests/cards/home.gts — `fixture: 'realistic'` on its direct
setupPermissionedRealmCached call.
Direct setupPermissionedRealmCached calls migrated:
- authentication-test: `fileSystem: {}` → `fixture: 'blank'`
- stripe-session-test: `fileSystem: {}` → `fixture: 'blank'`
- stripe-webhook-test: implicit default → `fixture: 'blank'`
- realm-lifecycle-test ("realm mounted at server origin" module):
implicit default → `fixture: 'blank'`
Skipped (callers passing inline `fileSystem` per the plan):
federated-types-test, info-test, search-prerendered-test, search-test,
index-responses-test's first module, queue-status-test (already
migrated in PR 1).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Host Test Results 1 files 1 suites 1h 48m 47s ⏱️ Results for commit 97310d1. For more details on these errors, see this check. Realm Server Test Results 1 files ± 0 1 suites +1 11m 20s ⏱️ + 11m 20s Results for commit 64c4fe2. ± Comparison against earlier commit c29baeb. |
CI surfaced this: `_catalog-realms` returns the realm's `name` in the response, and the test asserts it equals "Test Realm". That value comes from tests/cards/realm.json's RealmConfig instance (`cardInfo.name`), so the test needs `realistic`. Same gotcha PR 2 hit with info-test. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
That change sneaked into the prior commit from a local benchmarking session. Pinning to 4G is a regression on CI runners where the default `--tmpfs` allocation is much larger; revert to the original behavior. The MATRIX_REGISTRATION_SHARED_SECRET env-override in measure-test-file.sh stays — that one is purely additive (default unchanged at "fake") and lets local benchmarking against a real synapse pass through the right secret. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Per-file benchmarksSingle run each via The two local env limits called out in the PR description are dealt with:
Totals across the 15 files that produced a usable BEFORE: 7061.10 → 6405.67 = -655.4s (-9.3%). Notes on the anomalies† ‡ § ‖ Wins worth highlighting
🤖 Generated with Claude Code |
Third slice of CS-10009. Stacked on #4790 — review/merge that one first; this PR's base will retarget to
mainonce it lands.Approach
Most callers in
tests/server-endpoints/go through the localsetupServerEndpointsTesthelper. Rather than touching ~15 individual setup sites, this PR extends that helper to accept an optionalfixtureparameter (default'blank') and threads it down tosetupPermissionedRealmCached. Server-level endpoint tests (bot-commands, webhooks, realm lifecycle, stripe sessions, etc.) almost universally manage server state without inspecting the testRealm's card content, soblankis the right default and each consumer overrides only when it truly needs more.Per-file decisions
authentication-test.tsfileSystem: {}blankbot-commands-test.tsblankbot-registration-test.tsblankdelete-realm-test.tsblankdownload-realm-test.tsblankfederated-types-test.tsincoming-webhook-test.tsblankindex-responses-test.ts(published-realm module)realistic(asserts ondata-test-home-cardfromtests/cards/home.gts)index-responses-test.ts(first module)info-test.tsmaintenance-endpoints-test.tsblankqueue-status-test.tsblankrealm-lifecycle-test.ts(server-endpoints module)blankrealm-lifecycle-test.ts("realm mounted at server origin" module)blankrun-command-endpoint-test.tsblankscreenshot-card-endpoint-test.tsrealistic(referencesPerson/fadhlanfromtests/cards/)search-prerendered-test.tssearch-test.tsstripe-session-test.tsfileSystem: {}blankstripe-webhook-test.tsblankuser-and-catalog-test.tsblankwebhook-commands-test.tsblankwebhook-receiver-test.tsblankLocal test plan
Tried locally; ran into two unrelated environment limits I want CI to validate past:
boxel-realm-test-pg's 1 GB tmpfs PGDATA fills up under the maintenance/realm-lifecycle workloads (hundreds ofNo space left on deviceerrors). Documented in CS-10009 follow-ups area; CI has more headroom.MATRIX_REGISTRATION_SHARED_SECRET=dummydoesn't match the local synapse HMAC, so any test that registers a new matrix user (the/_publish-realmpath indelete-realm-test) 500s before assertions run. CI uses the real secret.Test plan
screenshot-card-endpoint,index-responsespublished-realm module) againstrealisticand they pass.🤖 Generated with Claude Code