From 4b29bc813a7dca422316287dca76e24d49dfa2ec Mon Sep 17 00:00:00 2001 From: Luke Melia Date: Wed, 22 Jul 2026 17:55:58 -0400 Subject: [PATCH 1/5] Default new realms to a Workspace index card create-realm seeds every new realm's index.json; point it at Workspace instead of CardsGrid so newly created realms open to the Workspace experience. The publish handler and prerender fast-path already recognize both cards (so a new realm still gets the prerendered default-index treatment on publish), and CardsGrid stays available for existing realms. Update the publish/unpublish tests: the default-index case now exercises Workspace, and the explicit case covers the legacy CardsGrid path so both recognized defaults stay tested. Fix software-factory comments that described the old CardsGrid default (the factory overwrites the index regardless). Co-Authored-By: Claude Opus 4.8 (1M context) --- .../realm-server/handlers/create-realm.ts | 4 +- .../tests/publish-unpublish-realm-test.ts | 37 ++++++++++--------- .../src/factory-entrypoint.ts | 6 +-- .../src/factory-realm-index.ts | 6 +-- 4 files changed, 27 insertions(+), 26 deletions(-) diff --git a/packages/realm-server/handlers/create-realm.ts b/packages/realm-server/handlers/create-realm.ts index 52ffffef77b..7e9ad6822f1 100644 --- a/packages/realm-server/handlers/create-realm.ts +++ b/packages/realm-server/handlers/create-realm.ts @@ -187,8 +187,8 @@ export async function createRealm( type: 'card', meta: { adoptsFrom: { - module: '@cardstack/base/cards-grid', - name: 'CardsGrid', + module: '@cardstack/base/workspace', + name: 'Workspace', }, }, }, diff --git a/packages/realm-server/tests/publish-unpublish-realm-test.ts b/packages/realm-server/tests/publish-unpublish-realm-test.ts index 99e5a1e6469..008a36f3266 100644 --- a/packages/realm-server/tests/publish-unpublish-realm-test.ts +++ b/packages/realm-server/tests/publish-unpublish-realm-test.ts @@ -530,7 +530,7 @@ module(basename(import.meta.filename), function () { ); }); - test('publishing a realm with the default CardsGrid index writes includePrerenderedDefaultRealmIndex into the published realm.json', async function (assert) { + test('publishing a realm with the default Workspace index writes includePrerenderedDefaultRealmIndex into the published realm.json', async function (assert) { let response = await request .post('/_publish-realm') .set('Accept', 'application/vnd.api+json') @@ -546,7 +546,7 @@ module(basename(import.meta.filename), function () { JSON.stringify({ sourceRealmURL: sourceRealmUrlString, publishedRealmURL: - 'http://testuser.localhost:4445/cards-grid-default/', + 'http://testuser.localhost:4445/workspace-default/', }), ); assert.strictEqual(response.status, 202, 'HTTP 202 status'); @@ -574,12 +574,12 @@ module(basename(import.meta.filename), function () { ); }); - test('publishing a realm whose index.json is not a CardsGrid leaves the published realm.json untouched', async function (assert) { + test('publishing a realm whose index.json is a bespoke card leaves the published realm.json untouched', async function (assert) { let sourceRealmPath = new URL(sourceRealmUrlString).pathname; - // Replace the source realm's default CardsGrid index with a - // bespoke CardDef-adopting index so the publish handler should - // NOT set the opt-in flag. + // Replace the source realm's default index with a bespoke + // CardDef-adopting index (neither CardsGrid nor Workspace) so the + // publish handler should NOT set the opt-in flag. let customIndexResponse = await request .post(`${sourceRealmPath}index.json`) .set('Accept', 'application/vnd.card+source') @@ -600,7 +600,7 @@ module(basename(import.meta.filename), function () { assert.strictEqual( customIndexResponse.status, 204, - 'custom non-CardsGrid index.json can be written', + 'bespoke non-default index.json can be written', ); let response = await request @@ -642,16 +642,17 @@ module(basename(import.meta.filename), function () { publishedRealmConfig?.data?.attributes ?.includePrerenderedDefaultRealmIndex, true, - 'published realm.json does NOT carry includePrerenderedDefaultRealmIndex when the source index is a non-CardsGrid card', + 'published realm.json does NOT carry includePrerenderedDefaultRealmIndex when the source index is a bespoke, non-default card', ); }); - test('publishing a realm whose index adopts the default Workspace card writes includePrerenderedDefaultRealmIndex into the published realm.json', async function (assert) { + test('publishing a realm whose index adopts the legacy CardsGrid card writes includePrerenderedDefaultRealmIndex into the published realm.json', async function (assert) { let sourceRealmPath = new URL(sourceRealmUrlString).pathname; - // Point the source realm's index at the base Workspace card — the - // other recognized default index besides CardsGrid. - let workspaceIndexResponse = await request + // Workspace is the default index now, so point this realm's index at + // the legacy CardsGrid card explicitly — it is still recognized as a + // default index alongside Workspace. + let cardsGridIndexResponse = await request .post(`${sourceRealmPath}index.json`) .set('Accept', 'application/vnd.card+source') .send( @@ -661,17 +662,17 @@ module(basename(import.meta.filename), function () { attributes: {}, meta: { adoptsFrom: { - module: '@cardstack/base/workspace', - name: 'Workspace', + module: '@cardstack/base/cards-grid', + name: 'CardsGrid', }, }, }, }), ); assert.strictEqual( - workspaceIndexResponse.status, + cardsGridIndexResponse.status, 204, - 'Workspace index.json can be written', + 'CardsGrid index.json can be written', ); let response = await request @@ -689,7 +690,7 @@ module(basename(import.meta.filename), function () { JSON.stringify({ sourceRealmURL: sourceRealmUrlString, publishedRealmURL: - 'http://testuser.localhost:4445/workspace-default/', + 'http://testuser.localhost:4445/cards-grid-legacy/', }), ); assert.strictEqual(response.status, 202, 'HTTP 202 status'); @@ -713,7 +714,7 @@ module(basename(import.meta.filename), function () { assert.true( publishedRealmConfig?.data?.attributes ?.includePrerenderedDefaultRealmIndex, - 'published realm.json carries includePrerenderedDefaultRealmIndex: true for a Workspace index', + 'published realm.json carries includePrerenderedDefaultRealmIndex: true for a CardsGrid index', ); }); diff --git a/packages/software-factory/src/factory-entrypoint.ts b/packages/software-factory/src/factory-entrypoint.ts index e93736d877b..3fc36e42a3a 100644 --- a/packages/software-factory/src/factory-entrypoint.ts +++ b/packages/software-factory/src/factory-entrypoint.ts @@ -377,9 +377,9 @@ export async function runFactoryEntrypoint( let pullTargetRealm = dependencies?.pullTargetRealm ?? defaultPullTargetRealm; await pullTargetRealm(client, targetRealm.url, workspaceDir); - // For a realm the factory just created, replace the default CardsGrid - // index page with a RealmDashboard instance so the realm opens to the - // factory dashboard. A pre-existing realm keeps its current index page. + // For a realm the factory just created, replace the default index page + // with a RealmDashboard instance so the realm opens to the factory + // dashboard. A pre-existing realm keeps its current index page. if (targetRealm.createdRealm) { let writeRealmIndex = dependencies?.writeRealmIndex ?? writeRealmDashboardCard; diff --git a/packages/software-factory/src/factory-realm-index.ts b/packages/software-factory/src/factory-realm-index.ts index 6e82bd5e2ca..6875259b63a 100644 --- a/packages/software-factory/src/factory-realm-index.ts +++ b/packages/software-factory/src/factory-realm-index.ts @@ -42,10 +42,10 @@ export function inferRealmDashboardModuleUrl(targetRealm: string): string { /** * Set the realm's index page to a `RealmDashboard` instance, overwriting - * the default `CardsGrid` index that `create-realm` seeded. + * the default index that `create-realm` seeded. * - * Writes two files: a sibling `cards-grid.json` holding the `CardsGrid` - * instance (the same empty grid `create-realm` would have made), and + * Writes two files: a sibling `cards-grid.json` holding a `CardsGrid` + * instance (an empty grid), and * `index.json` adopting `RealmDashboard` with its `cardsGrid` link * pointing at that instance — so the dashboard's catalog tab shows the * realm's cards. The `board` link is left for the bootstrap agent to wire From ed3f3c155e83cf4bab7b07f77a01cbff29e19d44 Mon Sep 17 00:00:00 2001 From: ylm Date: Thu, 23 Jul 2026 08:45:31 -0400 Subject: [PATCH 2/5] Migrate matrix tests for the Workspace default realm index MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit New realms default to a Workspace index card, so acceptance tests that assumed the CardsGrid index UI need updating: - Add data-test hooks to the Workspace card (index root + Home/Library/Activity tabs) so tests can assert against it — it had none. - showAllCards handles both index types: click CardsGrid's "All Cards" filter, or switch to the Workspace's Library tab (same live CardsGridLayout grid). - create-realm.spec asserts the created realm renders a Workspace index rather than CardsGrid's 3 filter buttons. - live-cards asserts the shared cards grid rather than the CardsGrid-only "All Cards" filter. Co-Authored-By: Claude Opus 4.8 (1M context) --- packages/base/workspace.gts | 4 ++++ packages/matrix/helpers/index.ts | 20 ++++++++++++++------ packages/matrix/tests/create-realm.spec.ts | 5 ++--- packages/matrix/tests/live-cards.spec.ts | 4 +--- 4 files changed, 21 insertions(+), 12 deletions(-) diff --git a/packages/base/workspace.gts b/packages/base/workspace.gts index 04726d6a761..ef946ed2051 100644 --- a/packages/base/workspace.gts +++ b/packages/base/workspace.gts @@ -249,6 +249,7 @@ class Isolated extends Component {