Skip to content

fix for tests unable to resolve @cardstack/catalog when skipping catalog#4207

Closed
habdelra wants to merge 4 commits intomainfrom
fix-missing-skill-failures
Closed

fix for tests unable to resolve @cardstack/catalog when skipping catalog#4207
habdelra wants to merge 4 commits intomainfrom
fix-missing-skill-failures

Conversation

@habdelra
Copy link
Contributor

Fix skill loading failures in host and matrix tests

Summary

  • Skills realm cards recently changed from a production URL adoption path to @cardstack/catalog/skill-set, @cardstack/catalog/skill-plus, but test environments
    that skip the catalog realm can't resolve these modules, causing skill instances to 404
  • When SKIP_CATALOG=true, start-development.sh now builds a minimal catalog (~15 files: skill modules, Theme instances, config) instead of skipping it entirely, so the skills realm can always index
    correctly
  • Added the same minimal catalog to the matrix isolated realm server and the host test trimmed catalog
  • Removed skip_catalog from the host CI build step so the browser registers the @cardstack/catalog/ import map needed to instantiate skill cards

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

${START_CATALOG:+--path='../catalog/contents'} \
${START_CATALOG:+--username='external_catalog_realm'} \
${START_CATALOG:+--fromUrl="${EXTERNAL_CATALOG_REALM_URL}"} \
${START_CATALOG:+--toUrl="${EXTERNAL_CATALOG_REALM_URL}"} \

P1 Badge Skip mounting external_catalog_realm when SKIP_CATALOG is set

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".

Comment on lines +65 to 68
SKIP_CATALOG="${SKIP_CATALOG:-}"
WAIT_ON_TIMEOUT=900000 \
SKIP_EXPERIMENTS=true \
SKIP_CATALOG="$SKIP_CATALOG" \

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. Fixed in 7dbb7b0start-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.

Comment on lines +309 to +314
let minimalCatalogDir = buildMinimalCatalog();
serverArgs = serverArgs.concat([
`--username='catalog_realm'`,
`--path='${minimalCatalogDir}'`,
`--fromUrl='@cardstack/catalog/'`,
`--toUrl='http://localhost:4205/catalog/'`,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
@habdelra habdelra requested a review from Copilot March 18, 2026 20:00
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 when SKIP_CATALOG is 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: true so 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.

Comment on lines +36 to 55
# 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)
Comment on lines +40 to 52
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
Comment on lines 64 to 71
${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/"
Comment on lines +27 to +44
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'));
}
@github-actions
Copy link

Host Test Results

0 files   -     1  0 suites   - 1   0s ⏱️ - 2h 16m 47s
0 tests  - 2 030  0 ✅  - 1 996  0 💤  - 15  0 ❌ ± 0 
0 runs   - 2 045  0 ✅  - 1 992  0 💤  - 15  0 ❌  - 19 

Results for commit 7dbb7b0. ± Comparison against base commit e172ea0.

@habdelra habdelra closed this Mar 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants