feat(projects): add persistent card actions - #551
Open
huyanxius wants to merge 5 commits into
Open
Conversation
Project cards need a persistent way to change names. Add ownership checks, duplicate handling, and service-level persistence. Project renames now return the updated resource through PATCH.
The rename endpoint must preserve ownership and naming constraints. Cover successful persistence, duplicate rejection, and cross-user access. These cases protect the public project rename contract.
The generated schema must reflect the new project capability. Add the rename request model and PATCH operation to OpenAPI. API consumers can now discover the project rename endpoint.
Project cards hide their only action until hover and only expose deletion. Replace it with a persistent warm-canvas menu and add the rename dialog. Users can discover, rename, or delete projects without changing card navigation.
The project card menu changes both rename and delete entry points. Cover API mapping, disclosure behavior, rename persistence, and delete regressions. The fixture now models project PATCH requests and duplicate names.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
✅ 此 PR 已关联 issue,之前的提醒已自动标记为已解决。 |
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
| class ProjectRename(BaseModel): | ||
| """重命名项目请求。""" | ||
|
|
||
| project_name: str = Field(min_length=1, max_length=20) |
Contributor
There was a problem hiding this comment.
[P2] Reject whitespace-only project names
min_length=1 只检查字符串长度,因此 PATCH 请求可以提交全是空格的 project_name,并将这个不可见名称持久化到数据库;这绕过了项目名称应为 1–20 个有效字符的验收约束。前端弹窗会先 trim(),但直接 API 调用和其他客户端仍可触发该路径。请在后端对名称做 trim 后的非空校验(并保持保存值与前端行为一致),或使用等效的约束。
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.
项目卡片现在常驻显示右上角操作入口,并在同一菜单中提供重命名与删除;同时补齐后端重命名接口、唯一性与权限保护。
Why
原入口只在悬停时出现,用户难以发现,而且只能删除项目,无法修正项目名称。
Changes
PATCH /projects/{project_id},保留用户归属和名称唯一性约束。Implementation
Verification
uv run ruff check .:通过uv run lint-imports:2 个契约通过uv run pytest -q --cov=packages --cov-report=term-missing --cov-report=xml:coverage.xml:1332 passed,14 skippednpm run format:check、npm run lint、npm run typecheck:通过npm test -- src/pages/projects/index.test.tsx:10 passednpm run test:coverage:本机全量运行出现大范围无关页面超时,已停止;以 GitHub CI runner 结果为准Scope
Related Issues
Closes #549