CS-10009 PR 2: migrate realm-endpoints/ tests to explicit fixture#4790
Conversation
One PR per directory per the CS-10009 plan; this one covers
packages/realm-server/tests/realm-endpoints/.
Per-file migration:
- cancel-indexing-job-test: fixture: 'blank' (job-queue ops only).
- dependencies-test: fixture: 'blank' (writes its own file).
- directory-test: fixture: 'realistic' (asserts on tests/cards/dir/
contents); the redundant `dirSync + copySync(cards)` hook ahead of
setupPermissionedRealmCached was dead code (the local `dir` was
immediately overwritten by args.dir in onRealmSetup) — removed.
- info-test: fixture: 'blank' on all 4 modules; same dead-copySync
removal as directory-test.
- lint-test: fixture: 'blank' (POSTs source bodies, no realm reads).
- mtimes-test: fixture: 'blank' (compares mtimes(testRealmPath)
round-trip; works on any fixture).
- permissions-test: fixture: 'blank' (was already fileSystem: {});
same dead-copySync removal.
- search-test: fixture: 'simple' on all 4 implicit-default modules
(they all query Person/Mango which the simple fixture has). The
three modules that pass their own `fileSystem` inline are
untouched.
- user-test: fixture: 'blank' on both modules (GET and POST _user
endpoints don't read realm card content); same dead-copySync
removal.
Skipped (per Linear plan: callers that pass their own `fileSystem`
inline are left alone): invalidate-urls-test (already simple from
PR 1), markdown-test, publishability-test, reindex-test.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Host Test Results 1 files 1 suites 1h 47m 24s ⏱️ Results for commit 20868f4. Realm Server Test Results 1 files ± 0 1 suites ±0 10m 51s ⏱️ -10s Results for commit 20868f4. ± Comparison against earlier commit 925e68f. |
Per-file benchmarksSingle run each via
† All FAIL→FAIL cases are local-env-specific: realistic-fixture template builds occasionally exceed qunit's 60s Reliability gainsFour files flip from local-FAIL to local-OK: Expected non-movers
Caveats
🤖 Generated with Claude Code |
CI surfaced two miscategorizations from the initial survey: info-test depends on `testRealmInfo.name === 'Test Realm'`, which comes from the `realm.json` RealmConfig card instance in tests/cards/, NOT from `.realm.json`. Neither `blank` nor `simple` ships that instance, so the realm boots with the "Unnamed Workspace" fallback and every 200-with-permission assertion fails the deepEqual. All 4 info-test modules now use `realistic`. search-test's `QUERY request (public realm) > public readable realm` module exercises pagination (expects 3 Person results), file-meta filtering across multiple FileDefs, and sparse-fieldset backward-compat — all of which need the kitchen-sink content. Reverted just that one sub-module to `realistic`; the other three search-test modules only ever query for Mango and stay on `simple`. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Migrates the remaining packages/realm-server/tests/realm-endpoints/* tests to use the explicit named realm fixtures (blank / simple / realistic) via setupPermissionedRealmCached, removing previously dead temp-dir + copySync(cards) setup blocks.
Changes:
- Updated realm-endpoints tests to declare an explicit
fixturerather than relying on the implicit default or inlinefileSystem: {}. - Removed unused tmp-dir copying logic (
dirSync/copySync/joinanddirplumbing) where the copied directory wasn’t actually used. - Adjusted fixture selection per-module in
search-test(mix ofrealisticandsimple) to match test expectations.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| packages/realm-server/tests/realm-endpoints/cancel-indexing-job-test.ts | Switches realm setup to fixture: 'blank' for job-queue endpoint tests. |
| packages/realm-server/tests/realm-endpoints/dependencies-test.ts | Uses fixture: 'blank' and continues writing its own test card file. |
| packages/realm-server/tests/realm-endpoints/directory-test.ts | Makes kitchen-sink dependency explicit via fixture: 'realistic'; removes unused temp copying. |
| packages/realm-server/tests/realm-endpoints/info-test.ts | Adds explicit fixture selection (currently realistic) and removes unused temp copying. |
| packages/realm-server/tests/realm-endpoints/lint-test.ts | Uses fixture: 'blank' for POST-only lint endpoint tests. |
| packages/realm-server/tests/realm-endpoints/mtimes-test.ts | Uses fixture: 'blank' for mtimes endpoint tests. |
| packages/realm-server/tests/realm-endpoints/permissions-test.ts | Replaces fileSystem: {} with fixture: 'blank'; removes unused temp copying. |
| packages/realm-server/tests/realm-endpoints/search-test.ts | Splits fixtures: one module uses realistic, other modules use simple; documents rationale. |
| packages/realm-server/tests/realm-endpoints/user-test.ts | Uses fixture: 'blank'; removes unused temp copying and dir plumbing. |
Comments suppressed due to low confidence (2)
packages/realm-server/tests/realm-endpoints/info-test.ts:46
setupPermissionedRealmCachedis configured withfixture: 'realistic', but this test file only exercises the_infoendpoint and does not appear to depend on any realm card/file content. Using the kitchen-sink fixture adds unnecessary setup cost; consider switching this tofixture: 'blank'(or, ifrealisticis actually required, reconcile this with the PR description which statesinfo-testusesblank).
module('public readable realm', function (hooks) {
setupPermissionedRealmCached(hooks, {
fixture: 'realistic',
permissions: {
'*': ['read'],
},
realmURL,
onRealmSetup,
});
packages/realm-server/tests/realm-endpoints/search-test.ts:73
- This module is using
fixture: 'realistic', but the PR description's per-file decisions state thatsearch-testuses thesimplefixture for its modules. Please reconcile the PR description with the code (or adjust the fixture selection). Given the pagination/file-meta assertions in this module,realisticmay be intentional, in which case the PR description table should be updated.
module('public readable realm', function (hooks) {
// Uses `realistic` because tests in this module depend on
// multiple Person instances (pagination), FileDef instances
// beyond person.gts (file-meta queries), and the kitchen-sink
// content variety (sparse-fieldsets backward-compat). Sibling
// modules below only ever query for Mango and stay on `simple`.
setupPermissionedRealmCached(hooks, {
fixture: 'realistic',
permissions: {
'*': ['read'],
},
realmURL: testRealmURLFor('test/'),
onRealmSetup,
});
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Second slice of CS-10009. Stack: PR 1 (#4772) landed the fixture plumbing + 2 representative migrations; this PR migrates the remaining 9 callers under
packages/realm-server/tests/realm-endpoints/.Per-file decisions
cancel-indexing-job-test.tsblankdependencies-test.tsblankdependencies-card.gtsdirectory-test.tsrealisticdir/bar.txt,dir/foo.txt,dir/subdir/fromtests/cards/dir/info-test.ts(4 modules)blank_inforeturnstestRealmInfo-shape; doesn't read cardslint-test.tsblankmtimes-test.tsblankmtimes(testRealmPath)round-trip; works on any fixturepermissions-test.tsblank(wasfileSystem: {})_permissionsendpointssearch-test.ts(4 modules)simple_searchqueries forPerson/Mangouser-test.ts(2 modules)blank_userendpoints don't read card contentSkipped (per Linear plan: callers that pass their own
fileSysteminline are left alone):invalidate-urls-test.ts— already migrated tosimplein PR 1.markdown-test.ts,publishability-test.ts,reindex-test.ts— each test slot defines its content inline.Drive-by: dead
copySync(cards)blocksFour files (
directory-test,info-test,permissions-test,user-test) had ahooks.beforeEach(() => { dir = dirSync(); copySync(cards, dir.name); })block whose result was never read — the localdirwas immediately overwritten byargs.dirfromonRealmSetup, so the kitchen-sink copy was dropped on the floor. Removed in those four files (alongside the now-unuseddirSync/copySync/joinimports).For
directory-test, the realm's actual content STILL needs to be the kitchen sink — that's now made explicit viafixture: 'realistic'rather than relying on the implicit default.Test plan
🤖 Generated with Claude Code