mirror of
https://github.com/webstudio-is/webstudio.git
synced 2026-12-01 21:05:42 +09:00
Marketplace items fail to load in Builder because the thumbnail lookup times out. It filters by asset ID alone, and project copies reuse those IDs. In production, 39 thumbnail IDs match about 113,000 asset rows across projects. Database logs identify this exact PostgREST query as the canceled statement. ## Change - Fetch thumbnail names by exact asset and marketplace project pairs. This lets PostgreSQL use the existing composite asset index for each thumbnail. - Fetch only the fields needed for thumbnail names, and match each result to its own project. - Keep the marketplace view and database schema unchanged. ## Checklist - [x] Add a regression test that fails for the old lookup and copied asset IDs. - [x] Fetch thumbnails by exact project and asset pairs. - [x] Run targeted tests, Builder typecheck, lint, and formatting checks. - [x] Review Builder docs. No update is needed because behavior and instructions are unchanged. - [x] Review CI results for the final commit. - [ ] Required CI green. Visual regression is blocked by a repeatable, unrelated color picker screenshot difference. ## Verification - The new regression test failed against the old lookup and passes with the paired filter. All six marketplace tests pass. - A read-only production query using the current 39 thumbnail IDs and 40 project IDs took about 14 ms for the broad asset lookup and 1.7 ms for exact pairs in a warm-cache comparison. The broad query returned 1,000 rows at its PostgREST limit; exact pairs returned 39. Query times vary with load. - The production Postgres log records 63 statement timeouts for the old Asset query in the last 24 hours. The earliest visible event is November 12 at 12:33 UTC; this is only the available log window, not the first-ever failure. - All 39 thumbnails exist in their own marketplace projects. The marketplace view still loads the 40 item records; this fix removes only the broad asset lookup. The paired filter URL grows with the number of marketplace items. - Builder typecheck, targeted oxlint, oxfmt, and git diff checks pass. No fixture inputs or outputs are affected. Agent evaluations were not run because this does not change agent-facing behavior. - [Main CI workflow](https://github.com/webstudio-is/webstudio/actions/runs/43421159979) passed all 23 jobs. [Visual regression](https://github.com/webstudio-is/webstudio/actions/runs/43421159955) failed on a 0.043% difference in the Design System color picker story and failed identically on retry. This PR changes only the marketplace server query and its test.