Skip to content

Fix opening FileDef cards from prerendered search results in the stack in interact mode#4072

Open
jurgenwerk wants to merge 3 commits intomainfrom
cs-10251-fix-opening-file-defs-from-prerendered-search
Open

Fix opening FileDef cards from prerendered search results in the stack in interact mode#4072
jurgenwerk wants to merge 3 commits intomainfrom
cs-10251-fix-opening-file-defs-from-prerendered-search

Conversation

@jurgenwerk
Copy link
Contributor

@jurgenwerk jurgenwerk commented Feb 26, 2026

Summary

  • Fixes "Card Error: Unsupported Media Type" when clicking on a prerendered FileDef card (e.g. embedded/fitted/atom format) to open it as a stack item
  • The root cause: detectStackItemTypeForTarget() defaults to 'card' for prerendered FileDef URLs because the store has no cached file-meta data — the card was only fetched as pre-rendered HTML, never loaded into the store
  • The fix flows isFileMeta from the server's prerendered search response through to a data-card-type="file" attribute on the rendered DOM element, then uses it as a fallback in the overlay type detection

How it works

Server side: When searchPrerendered detects a file-meta query, it now includes isFileMeta: true in the response meta.

Client side: PrerenderedCard reads this flag and sets data-card-type="file" on the rendered HTML element. The overlay's getTypeForCardTarget() checks this attribute as a fallback when the store-based detection returns 'card'.

🤖 Generated with Claude Code

image

When clicking a prerendered FileDef card (e.g. embedded format), the
system defaulted to type 'card' because the store had no cached
file-meta data for prerendered results. This caused a 415 Unsupported
Media Type error when the stack item tried to load the URL as a card.

The fix flows isFileMeta from the server response through to a
data-card-type="file" attribute on the rendered element, then uses it
as a fallback in the overlay type detection when the store-based
detection fails.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jurgenwerk jurgenwerk marked this pull request as draft February 26, 2026 13:37
Copy link

@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: d79c35ba67

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

@github-actions
Copy link

Preview deployments

@github-actions
Copy link

github-actions bot commented Feb 26, 2026

Host Test Results

    1 files  ±0      1 suites  ±0   1h 56m 4s ⏱️ + 1m 5s
1 915 tests ±0  1 900 ✅ ±0  15 💤 ±0  0 ❌ ±0 
1 930 runs  ±0  1 915 ✅ ±0  15 💤 ±0  0 ❌ ±0 

Results for commit a3d1d85. ± Comparison against base commit 8819b98.

♻️ This comment has been updated with latest results.

Replace the data-card-type DOM attribute approach with a module-level
Set (knownFileMetaUrls) to avoid card HTML content spoofing the
attribute and causing misclassification.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jurgenwerk jurgenwerk changed the title Fix opening FileDef cards from prerendered search results Fix opening FileDef cards from prerendered search results in the stack in interact mode Feb 26, 2026
@jurgenwerk jurgenwerk changed the base branch from cs-10125-filedef-support-for-prerendered-search to main February 27, 2026 11:07
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jurgenwerk jurgenwerk marked this pull request as ready for review February 27, 2026 11:30
@jurgenwerk jurgenwerk requested a review from a team February 27, 2026 11:32
Copy link

@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: a3d1d854ad

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

Comment on lines +311 to +312
if (docs.some((doc) => doc.meta?.isFileMeta)) {
combined.meta.isFileMeta = true;

Choose a reason for hiding this comment

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

P2 Badge Preserve per-result file-meta type when merging realms

combinePrerenderedSearchResults promotes isFileMeta to a single response-level boolean when any realm marks it true, which loses typing information in federated responses. In _federated-search-prerendered this merged meta is consumed by the host (prerendered-search.ts) and applied to every returned card, so a mixed multi-realm query (one realm resolved as file-meta, another as card) will misclassify normal cards as files and break overlay actions/open behavior for those cards.

Useful? React with 👍 / 👎.

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.

1 participant