Skip to content

Hide Create Listing for index cards in inspector and playground menu#4386

Open
lucaslyl wants to merge 3 commits intomainfrom
CS-10584/shouldnt-create-listing-from-indexjson-when-inside-code-mode
Open

Hide Create Listing for index cards in inspector and playground menu#4386
lucaslyl wants to merge 3 commits intomainfrom
CS-10584/shouldnt-create-listing-from-indexjson-when-inside-code-mode

Conversation

@lucaslyl
Copy link
Copy Markdown
Contributor

@lucaslyl lucaslyl commented Apr 13, 2026

linear: https://linear.app/cardstack/issue/CS-10584/shouldnt-create-listing-from-indexjson-when-inside-code-mode

  1. Replaces filename-based guard in operator-mode detail panel with card-identity check (card.id === ${realmURL}index).

  2. Introduces shared helpers in runtime-common:

  • isRealmIndexCardId(cardId, realm)
  • isRealmIndexCard(card)
  1. Refactors duplicate index-card logic to use shared helper across:
  • base menu items
  • operator-mode detail panel
  • operator-mode stack item
  • operator-mode state service
  1. Removes local ad-hoc isIndexCard implementations and keeps behavior consistent across code paths.
  • Keeps intended behavior intact: only the actual realm root index card is excluded from Create Listing; non-root cards in index.json paths remain eligible.

Before:
image

After:
image

@lucaslyl lucaslyl requested a review from a team April 13, 2026 03:22
@lucaslyl lucaslyl self-assigned this Apr 13, 2026
@lucaslyl lucaslyl requested review from a team and cardstack-deploy-user April 13, 2026 03:23
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 13, 2026

Host Test Results

2 196 tests  +2   2 181 ✅ +2   2h 20m 53s ⏱️ - 1m 10s
    1 suites ±0      15 💤 ±0 
    1 files   ±0       0 ❌ ±0 

Results for commit 5929ec5. ± Comparison against base commit b5cd4a5.

♻️ This comment has been updated with latest results.

Copy link
Copy Markdown

@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

Here are some automated review suggestions for this pull request.

Reviewed commit: 52994efb28

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

}

private get isIndexJsonInstanceFile() {
return this.args.readyFile.url.endsWith('/index.json');
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Restrict index-card guard to actual realm index cards

The new guard uses readyFile.url.endsWith('/index.json'), which suppresses Create Listing for any folder-style instance file named index.json (for example .../ViewCardDemo/index.json), not just a realm’s index card. In code-mode inspector this removes a valid action for non-index cards that happen to use index.json filenames; the check should key off card identity (e.g. ${realmURL}index) rather than filename suffix.

Useful? React with 👍 / 👎.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 13, 2026

Realm Server Test Results

1 files  ±  0  0 suites   - 1   0s ⏱️ - 13m 30s
0 tests  - 844  0 ✅  - 844  0 💤 ±0  0 ❌ ±0 
0 runs   - 915  0 ✅  - 915  0 💤 ±0  0 ❌ ±0 

Results for commit 5929ec5. ± Comparison against base commit b5cd4a5.

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Copy Markdown

Preview deployments

Copy link
Copy Markdown
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 updates Host/operator-mode UI logic to hide the Create Listing action specifically for the realm root index card (card id ${realmURL}index), avoiding the previous overly-broad filename-based checks (e.g. index.json anywhere).

Changes:

  • Added shared runtime-common helpers isRealmIndexCardId() and isRealmIndexCard() and refactored call sites to use them.
  • Updated operator-mode detail panel, stack item, and operator-mode state logic to use the shared index-card identity checks.
  • Added unit + acceptance coverage to ensure Create Listing is omitted for the realm index card in code-mode contexts.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/runtime-common/code-ref.ts Introduces shared isRealmIndexCardId / isRealmIndexCard helpers.
packages/base/menu-items.ts Uses shared helper to omit “Create Listing” in code-mode playground menu for realm index card.
packages/host/app/components/operator-mode/detail-panel.gts Hides Create Listing action button in inspector for realm index card instances.
packages/host/app/components/operator-mode/stack-item.gts Refactors index-card detection to use shared helper.
packages/host/app/services/operator-mode-state-service.ts Refactors index-card detection to use shared helper when trimming stacks.
packages/host/tests/unit/card-def-menu-items-test.ts Adds unit test asserting Create Listing is omitted for index card in code-mode playground menu.
packages/host/tests/acceptance/code-submode/inspector-test.ts Adds acceptance test asserting Create Listing action is not shown for index.json card instance.

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

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
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