perf(projects): eliminate preview request waterfall - #431
Conversation
Project cards currently trigger one character request per project. Add a bounded window query and expose the resolved preview on project lists. Project listing now resolves all card previews with one character query.
The project center maintains a client-side queue for missing card previews. Read the preview projection returned by the project list and remove the queue. Opening the project center no longer requests characters for each card.
Project preview priority and query count need an executable contract. Exercise every fallback and count real character SELECT statements. The tests prevent project count from reintroducing query fan-out.
Project cards must render previews without the character list adapter. Model list previews in the HTTP fixture and assert zero character requests. The page tests preserve pagination, empty states, and card previews.
The project collection now exposes a resolved preview URL. Regenerate the checked-in OpenAPI schema from the updated route model. API consumers can distinguish project list and detail representations.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Reviewed the fixed 9d855697b701a449b965d15953af1e1ed0687221...1f837ccd797020f66d8f5362ff8ee38591281a90 range across the project preview service, API projection, frontend adapter/page, fixtures, and OpenAPI schema. The batched preview query preserves the existing six-character ordering and fallback priority, the list/detail response split is coherent, and the client no longer issues per-project character requests.
python3 -m compileall and git diff --check pass. The repository test commands could not be run in this environment because uv is unavailable and frontend dependencies/Vitest are not installed.
xyh202131
left a comment
There was a problem hiding this comment.
批准:项目列表一次返回 preview_url,消除逐项目读取 Character 的请求瀑布;批量窗口查询保持既有回退顺序,并以查询计数测试锁定性能边界。
项目卡片预览的冲突不是文本冲突:main 这段时间把预览做成了装载/空/失败/就绪四态 加骨架屏、取消与逐页翻找,本分支的前提恰恰是把这套前端编排整体删掉,改由 /projects 一次返回 preview_url。 按后端聚合后的真实状态重解: - 前端请求队列、并发闸门、AbortController、逐页翻找随编排一起去掉;列表响应 到手时预览就已定,不再有"预览请求中"和"单个预览请求失败"这两态。 - 展示层保留 main 的成果:空态与图片错误走 ProjectPreviewMessage,预览图解码 完成前仍盖 PixelMatrix 骨架,aria-busy 与 role=status 标注照旧。 - 测试同口径:删掉针对请求编排的用例,保留图片解码骨架与图片加载失败两例。
|
@fennoai 解决一下代码冲突 |
已解决
验证
临时替代 PR 已关闭,保留原 PR #431 继续走检查与评审。 |
Replay the project preview aggregation changes on the latest main and retain the card-thumbnail fallback test.
Resolve the remaining project page test conflict by keeping the single-request project preview flow together with the card-thumbnail fallback coverage.
xyh202131
left a comment
There was a problem hiding this comment.
我复核了这版 project preview 聚合改动:后端把列表预览一次性投影出来,前端也同步删掉了逐项目的补请求编排,相关查询与回退测试都跟上了。当前 diff 本身我没看到新的正确性回归,这版代码我先批准;不过 PR 现在仍有冲突,合入前还需要先解冲突。
main 上项目卡片又加了视角/朝向/尺寸这类元信息,import 段与本分支删掉 characterApis 的改动撞在一起。 取两边并集减去预览编排残留:保留 main 新增的 CHARACTER_PERSPECTIVE 与 DIRECTIONAL_MOVEMENT,characterApis 和 Character 不再回来。测试同样合并—— 留下 main 新增的"画廊内不重复出现新建入口"断言,请求断言保持本分支的 "只打 /projects",放宽成白名单会让预览瀑布悄悄回来。
xyh202131
left a comment
There was a problem hiding this comment.
已复核当前提交:项目列表直接提供 preview_url,消除逐项目读取 Character 的请求瀑布;批量查询保持既有预览回退顺序,相关后端查询计数、前端适配与契约测试完整。当前检查无失败项。
项目列表直接交付每个项目的可用资产预览,并移除项目中心逐项目读取 Character 的请求队列,使一页项目只需一次业务 API 请求。
Why
项目中心原先先读取项目列表,再为每个缺少样例图的项目分别读取最多 6 个完整 Character。12 个项目最多产生 13 次 API 请求,并被并发限制排成多轮网络等待。
Changes
/projects列表响应增加解析后的preview_url。/characters?project_id=...。Implementation
Verification
UV_CACHE_DIR=/private/tmp/windup-uv-cache uv run pytest -q tests/test_project_api.py:13 项通过。npm test -- src/entities/project/index.test.ts src/pages/projects/index.test.tsx:12 项通过。npm run typecheck:通过。npm run build:通过;仅有既存 chunk size 警告。uv run ruff check ...:相关后端文件通过。Scope
Related Issues
Closes #425
Refs #426