Skip to content

feat(api): include poster URLs in personal smart previews - #1892

Merged
Quick104 merged 5 commits into
feat/collections-revampfrom
feat/api-personal-preview-posters
Oct 4, 2026
Merged

Quick104 merged 5 commits into
feat/collections-revampfrom
feat/api-personal-preview-posters

Conversation

@Quick104

@Quick104 Quick104 commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Related issue: #192
Validation tasks: changes #193 S3

S3 changes because the v2 preview now returns poster URLs, a new kind of output on an access-checked response. Posters are signed only for the titles the access-filtered preview already returns, so a restricted title still can't be reached through the preview. S3 should be re-checked after merge to confirm no poster URL appears for a title the profile can't see. S4 is not affected: this changes only the unsaved POST /api/v2/collections/preview response, not saved smart collection members or empty results.

Stacked on #1888 (feat/api-personal-create-description).

A personal smart collection preview returns no posters. POST /api/v2/collections/preview gives each matching title only its id, title and type, so a client can't show what the rules pick without fetching every title. The redesigned smart collection page shows a live poster strip that updates as the rules change. The admin preview, previewAdminCollection, already returns a poster_url for each item.

This adds the same optional poster_url to personal preview items.

Approach

  • PersonalCollectionPreviewItem gets an optional poster_url, a card-size poster URL. It is left out when the title has no poster, the same as on AdminCollectionPreviewItem.
  • Posters are signed in one batch, and only for the items the access-filtered preview query returned. A title the profile can't see is never looked up. Signing goes through the catalog detail service, which signs item posters on other routes. The collection handler's artwork resolver handles only stored collection artwork, so it can't sign item posters.
  • The handler's preview request and item structs are shared with the frozen /api/v1/collections/preview. Both new fields (the item's poster and a request flag that asks for posters) are tagged json:"-", and only the v2 adapter sets the flag. The v1 response bytes are unchanged, and a v1 request does no poster signing.
  • getCollectionCapabilities gains preview_posters. A missing poster_url looks the same on a server that doesn't return posters and on one whose titles have no artwork, so a client checks the flag before drawing a poster strip. Clients that don't know either field ignore it.
  • docs/catalog-api.md documents the field and the flag next to the other personal collection notes.
  • The OpenAPI document, fixtures, system-info digest and web types are regenerated. The new preview_collection_ok fixture is added at the end of the fixture list, so no existing request id changes.

No web code reads the field yet; the smart collection page uses it in a later PR. jellycompat needs no change, since BoxSets read stored collections. The user manual doesn't describe API fields, and silo-apple and silo-android need no follow-up.

Validation

  • Go: build, gofmt, vet and make lint-changed against feat/api-personal-create-description are clean. make test-go passes.
  • DB-backed tests pass on a migrated database: the collection and preview tests in handlers, the full apiv2 package, and usercollections. They cover these cases:
    • A PG profile's preview leaves out a title above its rating ceiling and a title from a library it can't see, and sends neither poster for signing (Collections — Server #193 S3).
    • A title without a poster has no poster_url.
    • Without a configured signer, items have no poster_url.
    • The v1 preview body matches a byte-for-byte golden and signs nothing.
    • The v2 route returns poster_url.
    • getCollectionCapabilities reports preview_posters: true.
  • Contract: verify-apiv2-openapi, verify-apiv2-contract (additive changes only: an optional preview property and the new capability flag), verify-apiv2-fixtures, verify-apiv2-web-types, verify-route-inventory, verify-migration-ledger and TestCommittedArtifactMatchesRouter pass. So do verify-settings-bindings-all, verify-playback-fixtures, verify-scenario-catalogs and verify-offline-routes.
  • Web: lint, format:check, build, budget:check, tsc -b and make test-web pass.
  • make verify-local-paths passes.
  • Run against a database, internal/catalog fails TestOrphanCleanupAfterPlexTableDropPostgres, because its fixture inserts a user without a role. This branch doesn't change that package or any migration.

Risks

  • Additive only. /api/v1 requests and responses are unchanged.
  • Each v2 preview now makes one presign batch call for at most limit posters (100 at most). With a plugin image resolver, that can be one extra round trip per preview.
  • Poster URLs can be signed and expire, so a client should read a fresh preview instead of storing them. The docs say so.

Checklist

  • I read and can explain the complete diff.
  • This pull request addresses one concern.

AI Disclosure

  • Harness: Claude Code (in T3 Code)
  • Tool(s): Claude Code subagents (implementer, independent reviewer)
  • Model(s): claude-opus-5-5[1m]
  • Involvement: Fully AI-generated, human review pending
  • Adversarial review: An independent reviewer subagent read the full diff, checked every caller of the preview service and the router wiring, and reran the new tests on a freshly migrated database. It made three changes on its own to confirm a test fails for each: giving the v1 poster field a JSON name, dropping the poster copy in the v2 adapter, and passing an empty access filter. It found one problem: the frozen v1 preview signed posters and then dropped them. That was fixed with the request flag described above. Tests now confirm that v1 signs nothing and that v2 sets the flag, and a test fails if either is undone.

🤖 Generated with Claude Code

Note

Add optional poster_url to personal smart preview items in the v2 API

  • Adds an optional poster_url field to PersonalCollectionPreviewItem and a required preview_posters boolean to CollectionCapabilities in the v2 contract (openapi.json).
  • CollectionHandler.PreviewPersonalCollection accepts an internal WithPosters flag, batch-signs poster paths via a new ItemPosters dependency (poster/small size), and copies URLs into the preview view. The router wires the catalog detail service as the signer.
  • Items without a poster path or without a configured signer omit poster_url; the v1 preview response is unchanged.
  • Risk: the v2 contract digest changed, so clients validating against the old OpenAPI schema will reject the updated responses — check get_system_info_ok.json and index.json ETags.

Macroscope summarized c22af4f.

Quick104 and others added 2 commits October 4, 2026 03:40
The Smart collection editor shows a live poster strip as the rules
change, but /api/v2 previewCollection returned only ids, titles and
types, so a client had to fetch each title again for its artwork.
previewAdminCollection already carries poster_url.

Each preview item now carries an optional poster_url, signed in one
batch through the catalog detail service (the collection artwork
resolver signs only stored collection artwork). Only titles the
profile can see are signed. The shared handler view holds the URL as
json:"-", so the frozen /api/v1 preview body is unchanged.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The shared preview service signed every item's poster, but /api/v1
drops the URL from its body, so each v1 preview paid for a presign
batch (possibly a plugin round trip) for no output. The request now
carries WithPosters, which only the /api/v2 adapter sets and which a
v1 body cannot set.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@coderabbitai

coderabbitai Bot commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 2392f347-8003-4848-a5cf-6db920ff736b

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-04T17:40:52.873929Z c22af4f New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

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: 6863fbeb0f

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

ContentID ID `json:"content_id"`
Title string `json:"title"`
Type string `json:"type"`
PosterURL string `json:"poster_url,omitempty" doc:"Card-size poster URL; omitted when the item has none"`

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Advertise preview posters in collection capabilities

When a client connects to an older server, an unsupported preview and a supported preview whose items lack artwork both omit poster_url, so the client cannot determine whether poster previews are available without inspecting the server version or contract digest. Add a preview_posters flag (or equivalent) to getCollectionCapabilities and document it for clients before exposing this field.

AGENTS.md reference: AGENTS.md:L149-L150

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 4db0cdf: getCollectionCapabilities now reports preview_posters: true (false when the collection service is not configured), and docs/catalog-api.md tells clients to check it rather than infer support from a missing poster_url. TestGetCollectionCapabilities covers the flag; the OpenAPI document, fixtures and web types are regenerated.

@macroscopeapp

macroscopeapp Bot commented Oct 4, 2026

Copy link
Copy Markdown

Major change — #193 S3 (Server/API, build 927 · 66f6a52a). The v2 personal-preview response now includes signed poster URLs for its access-filtered results. This adds access-sensitive output not covered by the recorded S3 evidence. The PR must explain why validated behavior changes, and S3 needs re-validation after merge to confirm inaccessible titles cannot be exposed through poster URLs. The saved-member and stream-check paths themselves are unchanged.

The recorded S4 coverage concerns saved smart-collection membership and empty results (GET /api/v2/collections/{id}/items); this diff changes only the unsaved POST /api/v2/collections/preview response. It neither changes those results nor unblocks S4's unrun library-content-change subcase, so S4 should not be listed as affected.

Suggested fix: replace the PR body line with Validation tasks: changes #193 S3

Automated check: Macroscope check run agent (gpt-6-luna). No validation was performed.

Posted via Macroscope — v1 validation impact

A preview item without poster_url looks the same on a server that does
not return posters and on one whose titles lack artwork. The
preview_posters flag lets a client decide whether to draw a poster strip
without sniffing the server version.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@Quick104

Quick104 commented Oct 4, 2026

Copy link
Copy Markdown
Contributor Author

Updated the PR body: the validation line is now Validation tasks: changes #193 S3, with a note on why S3 changes and that S4 is not affected.

…view-posters

Brings in login-wide personal collection sharing (#1875), the scrobble lock
fix (#1887), and the earlier phase-1 merges from feat/collections-revamp.
Capabilities now advertise both login_sharing and preview_posters, the fixture
deps carry the shared collection alongside the preview view, and the preview
fixture case stays appended after the create-description cases. Generated
contract artifacts were regenerated.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Base automatically changed from feat/api-personal-create-description to feat/collections-revamp October 4, 2026 17:24
@Quick104
Quick104 merged commit 5782ce2 into feat/collections-revamp Oct 4, 2026
14 checks passed
@Quick104
Quick104 deleted the feat/api-personal-preview-posters branch October 4, 2026 17:50
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