Skip to content

Listings: supportingCards install with examples but stay out of the detail view (CS-12116)#664

Merged
richardhjtan merged 3 commits into
mainfrom
cs-12116-support-secondary-examples-that-is-not-showing-in-listing
Jul 17, 2026
Merged

Listings: supportingCards install with examples but stay out of the detail view (CS-12116)#664
richardhjtan merged 3 commits into
mainfrom
cs-12116-support-secondary-examples-that-is-not-showing-in-listing

Conversation

@richardhjtan

Copy link
Copy Markdown
Collaborator

What

Adds a supportingCards linksToMany field to the Listing card. Supporting cards behave identically to examples in every command flow — create, install (and therefore remix), use, and submission collection — but the catalog listing detail page does not render them.

Why

Query-based examples find their data by query, not linksTo, so the relationship walk (expandInstances) in install/submission can never discover those cards automatically. Without them, an installed or remixed query-based example renders empty. Linking them as regular examples works but pollutes the Examples tab with data cards that aren't showcases. supportingCards declares them explicitly while keeping the detail view clean.

How

  • catalog-app/listing/listing.gts — new @field supportingCards = linksToMany(() => CardDef). The detail template only iterates @fields.examples, so no template change is needed.
  • commands/listing-install.ts — seeds expandInstances with examples first, then supporting cards, so the primary example remains the first planned instance. exampleCardId/selectedCodeRef are only derived when primary examples exist, so a supporting-cards-only listing can't redirect remix navigation. Remix inherits all of this since it delegates copying to install.
  • commands/listing-use.ts — copies supporting cards alongside examples into the same install folder.
  • commands/collect-submission-files.ts — includes supporting cards in the submission snapshot so they land in catalog PRs.
  • commands/listing-create.ts — open cards are now classified by type: instances of the listed codeRef (including subtypes) become examples; other open cards become supportingCards. Screenshot capture, AI example auto-fill, and the spec dependency walk stay primary-example-only. Cards that fail to load during classification fall back to examples.

Behavior change

Previously, every open card at creation time became a visible example. Now open cards that aren't instances of the listed type become invisible supporting cards. This is intentional — it stops supporting data cards from appearing in the Examples tab.

CS-12116

🤖 Generated with Claude Code

… detail view

Query-based examples find their data by query, not linksTo, so the
relationship walk in install/submission can never discover it. The new
supportingCards field declares those cards explicitly. They flow through
create, install (and therefore remix), use, and submission identically
to examples; the only difference is the catalog detail page doesn't
render them. Listing creation now classifies open cards by type:
instances of the listed codeRef become examples, everything else becomes
supportingCards.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 17, 2026 08:39
@github-actions

github-actions Bot commented Jul 17, 2026

Copy link
Copy Markdown

Staging Submissions Preview

This PR's content is pushed to the staging submissions realm: https://realms-staging.stack.cards/submissions/

Changed folders:

  • catalog-app/
  • commands/

Updated at 2026-07-17 10:39:32 UTC for commit bea1e78. Shared realm: only this PR's changed files are pushed; files touched by multiple PRs reflect whichever pushed last, and deleted files are not removed.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 introduces a new supportingCards relationship on catalog Listing cards to allow “data/dependency” cards to be installed/remixed/collected alongside examples without being rendered on the listing detail page.

Changes:

  • Add supportingCards (linksToMany(CardDef)) to Listing.
  • Include supportingCards in install/use flows and submission snapshot collection.
  • Update listing creation to classify open cards into examples vs supportingCards based on whether they are instances of the selected codeRef.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
catalog-app/listing/listing.gts Adds the supportingCards field to the Listing card schema.
commands/listing-install.ts Installs/expands supporting cards alongside examples while keeping primary-example redirect behavior example-only.
commands/listing-use.ts Copies supporting cards alongside examples into the install folder.
commands/collect-submission-files.ts Includes supporting cards in the expanded submission snapshot set.
commands/listing-create.ts Classifies open cards into visible examples vs invisible supporting cards using runtime type ancestry checks.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread commands/listing-use.ts
Comment on lines +81 to 91
const sourceCards = [
...((listing.examples ?? []) as CardAPI.CardDef[]),
...((listing.supportingCards ?? []) as CardAPI.CardDef[]),
];
for (const card of sourceCards) {
await new CopyCardToRealmCommand(this.commandContext).execute({
sourceCard: card,
targetRealm: realmUrl,
localDir,
});
}

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

[Claude Code 🤖] Fixed in bea1e78 — the copy loop now dedupes by card id across the two fields. Install and submission were already safe because expandInstances tracks visited ids.

Comment on lines +102 to +106
let hasPrimaryExamples = (listing.examples?.length ?? 0) > 0;
let examplesToInstall = [
...(listing.examples ?? []),
...(listing.supportingCards ?? []),
];

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

[Claude Code 🤖] Agreed on coverage, but the listing install/create/use acceptance modules are currently module.skip pending the skipped-catalog-tests re-enablement effort, so a new test here wouldn't execute. Supporting-card scenarios (copied on install, supporting-only listing leaves exampleCardId/selectedCodeRef unset) are on the list for when those modules are unskipped.

Comment on lines +225 to +229
// Open cards that are instances of the listed type become examples; other
// open cards (e.g. data a query-based example depends on) become
// supportingCards, which install but don't render in the listing detail.
private async classifyOpenCards(
openCardIds: string[] | undefined,

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

[Claude Code 🤖] Same constraint as the install-test note: the listing-create acceptance module is currently module.skip, so classification coverage (non-instance open card lands in supportingCards, load-failure falls back to examples) will be added when that suite is re-enabled. The host-side modal behavior is covered by tests in cardstack/boxel#5536.

Callers (e.g. the host create-listing modal) can now pass supporting
cards explicitly instead of relying on type classification. Explicit ids
are taken verbatim; a card also selected as an example stays an example.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
A card linked as both an example and a supporting card was copied twice
into the install folder.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@richardhjtan
richardhjtan merged commit 065e07f into main Jul 17, 2026
3 checks passed
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