fix for tests unable to resolve @cardstack/catalog when skipping catalog#4207
fix for tests unable to resolve @cardstack/catalog when skipping catalog#4207
Conversation
There was a problem hiding this comment.
💡 Codex Review
boxel/packages/realm-server/scripts/start-development.sh
Lines 137 to 140 in 544f58e
When SKIP_CATALOG=true, this script now still mounts external_catalog_realm from ../catalog/contents even though the setup step above skips pnpm --dir=../catalog catalog:setup. On a clean checkout/CI runner, packages/catalog/contents does not exist until that setup runs (packages/catalog/package.json), so server.start() hits a missing realm directory during initial indexing and the start:development stack aborts. This affects the existing start:services-for-host-tests and start:skip-optional-realms flows that still export SKIP_CATALOG=true.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| SKIP_CATALOG="${SKIP_CATALOG:-}" | ||
| WAIT_ON_TIMEOUT=900000 \ | ||
| SKIP_EXPERIMENTS=true \ | ||
| SKIP_CATALOG="$SKIP_CATALOG" \ |
There was a problem hiding this comment.
Stop forwarding SKIP_CATALOG into host-test worker startup
This still propagates SKIP_CATALOG=true into start:worker-development. That worker script only registers the @cardstack/catalog/ -> .../catalog/ import-map prefix when SKIP_CATALOG is unset, so the worker queue keeps indexing /skills/ without any way to resolve @cardstack/catalog/skill-set or skill-plus. On a fresh host-test database, the initial skills_realm index still fails even though start-development.sh now serves a trimmed catalog realm.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Good catch. Fixed in 7dbb7b0 — start-worker-development.sh now always registers the @cardstack/catalog/ → catalog URL mapping via a new START_CATALOG_MAPPING=true variable, independent of SKIP_CATALOG. This ensures the worker's VirtualNetwork can resolve @cardstack/catalog/skill-set and skill-plus during skills realm indexing.
| let minimalCatalogDir = buildMinimalCatalog(); | ||
| serverArgs = serverArgs.concat([ | ||
| `--username='catalog_realm'`, | ||
| `--path='${minimalCatalogDir}'`, | ||
| `--fromUrl='@cardstack/catalog/'`, | ||
| `--toUrl='http://localhost:4205/catalog/'`, |
There was a problem hiding this comment.
Pass the catalog prefix to matrix workers too
This adds catalog_realm to the matrix realm server, but the worker-manager in the same helper is still started with only /test/ and /base/ mappings. Workers build their own VirtualNetwork from those --fromUrl/--toUrl pairs, so startup indexing of skills_realm on a fresh matrix database still cannot resolve @cardstack/catalog/skill-set or skill-plus. In other words, the new minimal catalog fixes direct server fetches, but not the queued indexing path matrix tests exercise.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Good catch. Fixed in 7dbb7b0 — added @cardstack/catalog/ and http://localhost:4205/skills/ URL mappings to the matrix worker-manager args so the worker's VirtualNetwork can resolve the catalog module references when indexing the skills realm.
The worker-manager processes build their own VirtualNetwork from --fromUrl/--toUrl pairs. When SKIP_CATALOG=true, the catalog mapping was omitted, so workers couldn't resolve @cardstack/catalog/skill-set during skills realm indexing. - start-worker-development.sh: always register the @cardstack/catalog/ mapping regardless of SKIP_CATALOG (the realm server always serves at least a minimal catalog now) - isolated-realm-server.ts: add catalog and skills URL mappings to the matrix test worker-manager args Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR addresses test-time skill loading failures caused by environments that skip the catalog realm being unable to resolve @cardstack/catalog/* modules that skills now adopt from. It does so by ensuring a minimal catalog is still available (or at least the @cardstack/catalog/ mapping is registered) in dev/test flows, and by adjusting CI so host test assets include the catalog import-map entries.
Changes:
- Ensure the worker always registers the
@cardstack/catalog/URL mapping so skills can be indexed even whenSKIP_CATALOGis set. - Build/serve a minimal catalog realm (skill modules + Theme + config) for SKIP_CATALOG test/development scenarios, including matrix isolated realm server and host test trimmed catalog.
- Update host CI to stop building test web assets with
skip_catalog: trueso the browser has the@cardstack/catalog/import map.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/realm-server/scripts/start-worker-development.sh | Always registers @cardstack/catalog/ mapping for worker indexing flows. |
| packages/realm-server/scripts/start-services-for-host-tests.sh | Extends trimmed catalog fixture to include skill modules and Theme/ needed by skills. |
| packages/realm-server/scripts/start-development.sh | Builds a minimal catalog realm when SKIP_CATALOG=true so skills can still index. |
| packages/matrix/helpers/isolated-realm-server.ts | Adds minimal catalog realm mounting + worker URL mapping in matrix isolated realm server. |
| .github/workflows/ci-host.yaml | Removes skip-catalog build flags so host dist contains catalog import map entries. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # Always start the catalog realm. The skills realm depends on | ||
| # @cardstack/catalog/skill-set and @cardstack/catalog/skill-plus modules. | ||
| # When SKIP_CATALOG is set, build a minimal catalog with only the files needed | ||
| # by the skills realm so it indexes quickly. | ||
| if [ "${SKIP_CATALOG:-}" = "true" ] && [ "${CATALOG_REALM_PATH:-}" = "" ]; then | ||
| CATALOG_REALM_PATH="$(mktemp -d "${TMPDIR:-/tmp}/catalog-realm.minimal.XXXXXX")" | ||
| CATALOG_SRC="../catalog-realm" | ||
| for f in .realm.json package.json tsconfig.json; do | ||
| [ -e "$CATALOG_SRC/$f" ] && cp -a "$CATALOG_SRC/$f" "$CATALOG_REALM_PATH/" | ||
| done | ||
| for f in skill-set.gts skill-plus.gts skill-reference.gts; do | ||
| [ -f "$CATALOG_SRC/$f" ] && cp -a "$CATALOG_SRC/$f" "$CATALOG_REALM_PATH/" | ||
| done | ||
| if [ -d "$CATALOG_SRC/Theme" ]; then | ||
| cp -a "$CATALOG_SRC/Theme" "$CATALOG_REALM_PATH/" | ||
| fi | ||
| fi | ||
| START_CATALOG=true | ||
| START_BOXEL_HOMEPAGE=$(if [ -z "$SKIP_BOXEL_HOMEPAGE" ]; then echo "true"; else echo ""; fi) | ||
| START_SUBMISSION=$(if [ -z "$SKIP_SUBMISSION" ]; then echo "true"; else echo ""; fi) |
| if [ "${SKIP_CATALOG:-}" = "true" ] && [ "${CATALOG_REALM_PATH:-}" = "" ]; then | ||
| CATALOG_REALM_PATH="$(mktemp -d "${TMPDIR:-/tmp}/catalog-realm.minimal.XXXXXX")" | ||
| CATALOG_SRC="../catalog-realm" | ||
| for f in .realm.json package.json tsconfig.json; do | ||
| [ -e "$CATALOG_SRC/$f" ] && cp -a "$CATALOG_SRC/$f" "$CATALOG_REALM_PATH/" | ||
| done | ||
| for f in skill-set.gts skill-plus.gts skill-reference.gts; do | ||
| [ -f "$CATALOG_SRC/$f" ] && cp -a "$CATALOG_SRC/$f" "$CATALOG_REALM_PATH/" | ||
| done | ||
| if [ -d "$CATALOG_SRC/Theme" ]; then | ||
| cp -a "$CATALOG_SRC/Theme" "$CATALOG_REALM_PATH/" | ||
| fi | ||
| fi |
| ${START_EXPERIMENTS:+--fromUrl="${REALM_BASE_URL}/experiments/"} \ | ||
| ${START_EXPERIMENTS:+--toUrl="${REALM_BASE_URL}/experiments/"} \ | ||
| \ | ||
| ${START_CATALOG:+--fromUrl='@cardstack/catalog/'} \ | ||
| ${START_CATALOG:+--toUrl="${CATALOG_REALM_URL}"} \ | ||
| ${START_CATALOG_MAPPING:+--fromUrl='@cardstack/catalog/'} \ | ||
| ${START_CATALOG_MAPPING:+--toUrl="${CATALOG_REALM_URL}"} \ | ||
| \ | ||
| --fromUrl="${REALM_BASE_URL}/skills/" \ | ||
| --toUrl="${REALM_BASE_URL}/skills/" \ |
| KEEP_SKILL_FOLDERS="Theme" | ||
| for item in $KEEP_SKILL_FOLDERS; do | ||
| if [ -d "$CATALOG_SRC_PATH/$item" ]; then | ||
| cp -a "$CATALOG_SRC_PATH/$item" "$CATALOG_TEMP_PATH/" |
| let configFiles = ['.realm.json', 'package.json', 'tsconfig.json']; | ||
| for (let f of configFiles) { | ||
| let src = join(catalogRealmSrc, f); | ||
| if (existsSync(src)) { | ||
| copySync(src, join(tmpDir, f)); | ||
| } | ||
| } | ||
| let skillFiles = ['skill-set.gts', 'skill-plus.gts', 'skill-reference.gts']; | ||
| for (let f of skillFiles) { | ||
| let src = join(catalogRealmSrc, f); | ||
| if (existsSync(src)) { | ||
| copySync(src, join(tmpDir, f)); | ||
| } | ||
| } | ||
| let themeDir = join(catalogRealmSrc, 'Theme'); | ||
| if (existsSync(themeDir)) { | ||
| copySync(themeDir, join(tmpDir, 'Theme')); | ||
| } |
Fix skill loading failures in host and matrix tests
Summary
that skip the catalog realm can't resolve these modules, causing skill instances to 404
correctly