Render orphan Drive-ID cards from text/XML import - #393
Merged
Conversation
…lience Phase 1) Fixes text-import [mpc:<id>] tokens and unindexed XML slots (incl. the b:null back-face case) getting silently cleared or landing in Invalid Cards, by synthesizing a client-side orphan CardDocument and skipping the invalidation listener for identifiers that look like real Drive file IDs. Orphan images load direct from Google, never our CDN. Closes #324 (Phase 1 only - Phase 2 source-suggestion deferred).
…splay Common Cardback panel showed "Card not found" for an orphan XML cardback (ImportXML.tsx now seeds state.project.cardback when unset; listenerMiddleware.ts's cardback listener gets the same orphan carve-out the per-slot listener already had). OrphanRendering.spec.ts now verifies rendering on the unified /display page per owner ruling, not the legacy /editor route. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
[mpc:<id>]text-import token syntax (owner's exact reported repro:1x Kharn [mpc:1FItgPw7VK_Tbv6dMiqdy5zd-jAoEC9mn]) alongside the pre-existingquery@idsyntax.<id>/<query>text verbatim (incl. the reportedBack | b:null | <id>case, which isparseXmlImport's pre-existing "no matching<backs>entry -> fall back to the order's own<cardback>" path) - the actual root cause waslistenerMiddleware.ts's invalid-identifier listener unconditionally clearing any selectedImage absent from the catalog's own search results, regardless of whether it was garbage or a genuinely-unindexed-but-real Drive file ID.lh4.googleusercontent.com), never through our own image-CDN Worker/R2 bucket; two size tiers mirror the Worker's own small/large convention exactly, full-resolution only on an actual PDF export action.<id>and the real (sanitized) query text, not a fabricated placeholder.Deviations from the ratified spec (see
docs/features/foreign-order-resilience.mdfor full detail)=w<px>; implemented using the image-CDN Worker's own already-tested=h<px>convention/host instead, for exact parity rather than a second unverified shape.[mpc:<id>]syntax isn't in the ratified issue body - designed fresh to match the owner's own exact repro line, additive to the pre-existingquery@idsyntax.Test plan
orphanCard.test.ts- Drive-ID regex, URL builder (small/large/full tiers), name sanitizer, synthesisprocessing.test.ts-[mpc:<id>]bracket-token parsing incl. the owner's exact repro linelistenerMiddleware.test.ts- orphan-candidate skip + explicit regression guard (a known-but-filtered catalog card still gets invalidated)ImportXML.test.ts- front + the b:null back-face casedownloadXML.test.ts- orphan round-trip exportCard.test.tsx- badge, no click-to-detail, error-degrade (not a stuck spinner)tests/OrphanRendering.spec.ts- both reported symptoms end-to-end with real Google image fetches; caught and fixed a real CSS bug (Bootstrap's.ratio > *stretching the badge) that Jest/jsdom couldn't seemarkedpackage)tsc --noEmitclean (same pre-existing unrelatedmarkederror)prettier@2.7.1 --checkcleanScreenshots (desktop, from the Playwright run): text-import orphan tile shows the real fetched "Kharn the Betrayer" art + "Your file" badge; the b:null XML back-face orphan shows a real fetched card-back image + "Unindexed card" fallback name + "Your file" badge.