Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .github/workflows/ci-host.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ jobs:
test-web-assets:
name: Build test web assets
uses: ./.github/workflows/test-web-assets.yaml
with:
skip_catalog: true
concurrency:
group: ci-host-test-web-assets-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
Expand Down Expand Up @@ -107,7 +105,6 @@ jobs:
fi
exit $exit_code
env:
SKIP_CATALOG: true
PERCY_GZIP: true
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN_HOST }}
PERCY_PARALLEL_NONCE: ${{ github.run_id }}-${{ github.run_attempt }}
Expand Down
44 changes: 43 additions & 1 deletion packages/matrix/helpers/isolated-realm-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { spawn, type ChildProcess } from 'child_process';
import { resolve, join } from 'path';
// @ts-expect-error no types
import { dirSync, setGracefulCleanup } from 'tmp';
import { ensureDirSync, copySync, readFileSync } from 'fs-extra';
import { ensureDirSync, copySync, readFileSync, existsSync } from 'fs-extra';
import { Pool } from 'pg';
import { createServer as createNetServer, type AddressInfo } from 'net';
import type { SynapseInstance } from '../docker/synapse';
Expand All @@ -17,6 +17,33 @@ const skillsRealmDir = resolve(
join(__dirname, '..', '..', 'skills-realm', 'contents'),
);
const baseRealmDir = resolve(join(__dirname, '..', '..', 'base'));
const catalogRealmSrc = resolve(join(__dirname, '..', '..', 'catalog-realm'));

// Build a minimal catalog realm with only the files needed by the skills realm.
// Skills adopt from @cardstack/catalog/skill-set and @cardstack/catalog/skill-plus,
// and link to @cardstack/catalog/Theme/cardstack.
function buildMinimalCatalog(): string {
let tmpDir = dirSync({ unsafeCleanup: true }).name;
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'));
}
Comment on lines +27 to +44
return tmpDir;
}
const matrixDir = resolve(join(__dirname, '..'));
export const appURL = 'http://localhost:4205/test';

Expand Down Expand Up @@ -244,6 +271,14 @@ export async function startServer({
`--fromUrl='http://localhost:4205/test/'`,
`--toUrl='http://localhost:4205/test/'`,
];
workerArgs = workerArgs.concat([
`--fromUrl='@cardstack/catalog/'`,
`--toUrl='http://localhost:4205/catalog/'`,
]);
workerArgs = workerArgs.concat([
`--fromUrl='http://localhost:4205/skills/'`,
`--toUrl='http://localhost:4205/skills/'`,
]);
workerArgs = workerArgs.concat([
`--fromUrl='https://cardstack.com/base/'`,
`--toUrl='http://localhost:4205/base/'`,
Expand Down Expand Up @@ -279,6 +314,13 @@ export async function startServer({
`--fromUrl='http://localhost:4205/test/'`,
`--toUrl='http://localhost:4205/test/'`,
];
let minimalCatalogDir = buildMinimalCatalog();
serverArgs = serverArgs.concat([
`--username='catalog_realm'`,
`--path='${minimalCatalogDir}'`,
`--fromUrl='@cardstack/catalog/'`,
`--toUrl='http://localhost:4205/catalog/'`,
Comment on lines +317 to +322

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.

]);
serverArgs = serverArgs.concat([
`--username='skills_realm'`,
`--path='${skillsRealmDir}'`,
Expand Down
20 changes: 17 additions & 3 deletions packages/realm-server/scripts/start-development.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,24 @@ if [ -z "$MATRIX_REGISTRATION_SHARED_SECRET" ]; then
fi

START_EXPERIMENTS=$(if [ -z "$SKIP_EXPERIMENTS" ]; then echo "true"; else echo ""; fi)
START_CATALOG=true
if [ "${SKIP_CATALOG:-}" = "true" ]; then
START_CATALOG=""
# 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
Comment on lines +40 to 52
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 +36 to 55

Expand Down
14 changes: 12 additions & 2 deletions packages/realm-server/scripts/start-services-for-host-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,17 @@ for item in $KEEP_FOLDERS; do
fi
done
# Explicitly keep some files needed for the tests
KEEP_FILES="cloudflare-image.gts index.json Spec/f869024a-cdec-4a73-afca-d8d32f258ead.json"
# skill-set.gts, skill-plus.gts, skill-reference.gts are needed because the
# skills realm's skill instances adopt from @cardstack/catalog/skill-set and
# @cardstack/catalog/skill-plus which are defined in these files.
# The Theme directory is needed because skills link to @cardstack/catalog/Theme/cardstack.
KEEP_FILES="cloudflare-image.gts index.json Spec/f869024a-cdec-4a73-afca-d8d32f258ead.json skill-set.gts skill-plus.gts skill-reference.gts"
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/"
fi
done
for item in $KEEP_FILES; do
if [ -f "$CATALOG_SRC_PATH/$item" ]; then
cp -a "$CATALOG_SRC_PATH/$item" "$CATALOG_TEMP_PATH/$item"
Expand All @@ -48,11 +58,11 @@ export CATALOG_REALM_PATH="$CATALOG_TEMP_PATH"

# Make host-test startup logs focus on indexing progress rather than per-request noise.
HOST_TEST_LOG_LEVELS="${HOST_TEST_LOG_LEVELS:-*=info,realm:requests=warn,realm-index-updater=debug,index-runner=debug,index-perf=debug,index-writer=debug,worker=debug,worker-manager=debug}"
SKIP_CATALOG="${SKIP_CATALOG:-}"
# There is a race condition starting up the servers that setting up the
# submission realm triggers which triggers the start-development.sh script to
# SIGTERM. currently we don't need the submission realm for host tests to
# skipping that. but this issue needs to be fixed.
SKIP_CATALOG="${SKIP_CATALOG:-}"
WAIT_ON_TIMEOUT=900000 \
SKIP_EXPERIMENTS=true \
SKIP_CATALOG="$SKIP_CATALOG" \
Comment on lines +65 to 68

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.

Expand Down
9 changes: 7 additions & 2 deletions packages/realm-server/scripts/start-worker-development.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ DEFAULT_SOFTWARE_FACTORY_REALM_URL="${REALM_BASE_URL}/software-factory/"
SOFTWARE_FACTORY_REALM_URL="${RESOLVED_SOFTWARE_FACTORY_REALM_URL:-$DEFAULT_SOFTWARE_FACTORY_REALM_URL}"

START_EXPERIMENTS=$(if [ -z "${SKIP_EXPERIMENTS:-}" ]; then echo "true"; else echo ""; fi)
# Always register the catalog URL mapping. The skills realm depends on
# @cardstack/catalog/skill-set and @cardstack/catalog/skill-plus modules,
# so the worker needs this mapping to index skills even when SKIP_CATALOG is set
# (start-development.sh always serves at least a minimal catalog).
START_CATALOG_MAPPING=true
START_CATALOG=$(if [ -z "${SKIP_CATALOG:-}" ]; then echo "true"; else echo ""; fi)

NODE_ENV=development \
Expand All @@ -59,8 +64,8 @@ NODE_ENV=development \
${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/" \
Comment on lines 64 to 71
Expand Down
Loading