From 951bb6b2f46ed00440e84c8689c17d2fc217824d Mon Sep 17 00:00:00 2001 From: Richard Tan Date: Mon, 13 Jul 2026 18:46:02 +0800 Subject: [PATCH 1/3] Fix remixed cards keeping their module reference pointed at the catalog realm buildInstanceOperation computed the correct target module reference for a copied instance but never wrote it onto the copied card's adoptsFrom, so remixing a listing left the installed card's module pointing back at the catalog realm instead of the destination realm. Also unskips the listing install live test and adds an assertion that catches this specifically, and fixes a stray relationships.categories.0 placement bug in the skill listing test fixture uncovered along the way. Co-Authored-By: Claude Sonnet 5 --- commands/listing-install.ts | 1 + tests/helpers/test-fixtures.ts | 8 +++--- .../live/catalog-app/listing-install.test.gts | 28 +++++++++++++++++-- 3 files changed, 31 insertions(+), 6 deletions(-) diff --git a/commands/listing-install.ts b/commands/listing-install.ts index 1deea2d8..bdbf5bee 100644 --- a/commands/listing-install.ts +++ b/commands/listing-install.ts @@ -67,6 +67,7 @@ export function buildInstanceOperation( delete (doc as any).data.id; delete (doc as any).included; let cardResource = (doc as any).data as LooseCardResource; + cardResource.meta.adoptsFrom = copyInstanceMeta.targetCodeRef; let href = join(realmIdentifier, copyInstanceMeta.lid) + '.json'; return { op: 'add', href, data: cardResource }; } diff --git a/tests/helpers/test-fixtures.ts b/tests/helpers/test-fixtures.ts index 54fcd17b..3fb86dcb 100644 --- a/tests/helpers/test-fixtures.ts +++ b/tests/helpers/test-fixtures.ts @@ -543,10 +543,10 @@ export function makeMockCatalogContents( self: pirateSkillId, }, }, - }, - 'categories.0': { - links: { - self: writingCategoryId, + 'categories.0': { + links: { + self: writingCategoryId, + }, }, }, meta: { diff --git a/tests/live/catalog-app/listing-install.test.gts b/tests/live/catalog-app/listing-install.test.gts index 89f82a82..7add9fc8 100644 --- a/tests/live/catalog-app/listing-install.test.gts +++ b/tests/live/catalog-app/listing-install.test.gts @@ -1,6 +1,8 @@ import { getService } from '@universal-ember/test-support'; import { module, test } from 'qunit'; +import { identifyCard, isResolvedCodeRef } from '@cardstack/runtime-common'; + import ListingInstallCommand from '../../../commands/listing-install'; import type { CardDef } from 'https://cardstack.com/base/card-api'; @@ -38,7 +40,7 @@ const authorListingId = `${mockCatalogURL}Listing/author`; const blogPostListingId = `${mockCatalogURL}Listing/blog-post`; export function runTests() { - module.skip( + module( 'Acceptance | Catalog | catalog app - listing install', function (hooks) { setupApplicationTest(hooks); @@ -107,7 +109,7 @@ export function runTests() { test('card listing', async function (assert) { const listingName = 'author'; - await executeCommand( + let result = await executeCommand( ListingInstallCommand, authorListingId, testDestinationRealmURL, @@ -128,6 +130,28 @@ export function runTests() { let examplePath = `${outerFolder}${listingName}/Author/example.json`; await openDir(assert, examplePath); await verifyFileInFileTree(assert, examplePath); + + // Author/example.json's own adoptsFrom is an absolute URL into + // the catalog realm (see makeMockCatalogContents), so this + // catches the install pipeline leaving the copied instance + // pointed at the source realm instead of rewriting it into the + // newly installed module. + let store = getService('store'); + let installedCard = (await store.get( + result.exampleCardId as string, + )) as CardDef; + let installedRef = identifyCard(installedCard.constructor); + if (!installedRef || !isResolvedCodeRef(installedRef)) { + throw new Error('expected a resolved code ref'); + } + assert.ok( + installedRef.module.startsWith(testDestinationRealmURL), + `installed card module "${installedRef.module}" resolves into the destination realm`, + ); + assert.false( + installedRef.module.startsWith(mockCatalogURL), + `installed card module "${installedRef.module}" should not still point at the catalog realm`, + ); }); test('listing installs relationships of examples and its modules', async function (assert) { From 251ab3370dbe25433edf4611a1b46df1b2d0c2ce Mon Sep 17 00:00:00 2001 From: Richard Tan Date: Mon, 13 Jul 2026 19:35:44 +0800 Subject: [PATCH 2/3] =?UTF-8?q?TEMP:=20pin=20CI=20to=20companion=20fix=20b?= =?UTF-8?q?ranch=20for=20verification=20=E2=80=94=20revert=20before=20merg?= =?UTF-8?q?e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Points the boxel monorepo checkout at fix/catalog-remix-adopts-from-base-realm so this PR's own Live Tests job can prove the fix works end to end before boxel#5478 merges. Must be reverted to the default branch before this PR is merged. Co-Authored-By: Claude Sonnet 5 --- .github/workflows/ci-test.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci-test.yaml b/.github/workflows/ci-test.yaml index 8517987c..a10fd5e8 100644 --- a/.github/workflows/ci-test.yaml +++ b/.github/workflows/ci-test.yaml @@ -25,10 +25,13 @@ jobs: # so it doesn't move HEAD off the PR commit during service startup. SKIP_CATALOG_UPDATE: '1' steps: - # Checkout the boxel monorepo + # TEMP: pin to the companion fix branch to verify it against this PR + # before boxel#5478 merges. Revert before merging this PR. + # Checkout the boxel monorepo - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # 4.2.2 with: repository: cardstack/boxel + ref: fix/catalog-remix-adopts-from-base-realm # Checkout this catalog repo directly into the monorepo's catalog location - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # 4.2.2 From 1189de6415647c63b188c3c6ae88ab0697cc16c8 Mon Sep 17 00:00:00 2001 From: Richard Tan Date: Mon, 13 Jul 2026 20:24:00 +0800 Subject: [PATCH 3/3] =?UTF-8?q?Revert=20"TEMP:=20pin=20CI=20to=20companion?= =?UTF-8?q?=20fix=20branch=20for=20verification=20=E2=80=94=20revert=20bef?= =?UTF-8?q?ore=20merge"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 251ab3370dbe25433edf4611a1b46df1b2d0c2ce. --- .github/workflows/ci-test.yaml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/ci-test.yaml b/.github/workflows/ci-test.yaml index a10fd5e8..8517987c 100644 --- a/.github/workflows/ci-test.yaml +++ b/.github/workflows/ci-test.yaml @@ -25,13 +25,10 @@ jobs: # so it doesn't move HEAD off the PR commit during service startup. SKIP_CATALOG_UPDATE: '1' steps: - # TEMP: pin to the companion fix branch to verify it against this PR - # before boxel#5478 merges. Revert before merging this PR. - # Checkout the boxel monorepo + # Checkout the boxel monorepo - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # 4.2.2 with: repository: cardstack/boxel - ref: fix/catalog-remix-adopts-from-base-realm # Checkout this catalog repo directly into the monorepo's catalog location - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # 4.2.2