Skip to content

feat(projects): add persistent card actions - #551

Open
huyanxius wants to merge 5 commits into
1024XEngineer:mainfrom
huyanxius:feat/549-project-card-actions
Open

feat(projects): add persistent card actions#551
huyanxius wants to merge 5 commits into
1024XEngineer:mainfrom
huyanxius:feat/549-project-card-actions

Conversation

@huyanxius

@huyanxius huyanxius commented Aug 23, 2026

Copy link
Copy Markdown
Collaborator

项目卡片现在常驻显示右上角操作入口,并在同一菜单中提供重命名与删除;同时补齐后端重命名接口、唯一性与权限保护。

Why

原入口只在悬停时出现,用户难以发现,而且只能删除项目,无法修正项目名称。

Changes

  • 将项目卡片操作按钮常驻在右上角,并使用页面暖黄色画布色。
  • 在操作菜单中提供“重命名项目”和“删除项目”。
  • 新增项目重命名弹窗、重复名称反馈和成功后的列表更新。
  • 新增 PATCH /projects/{project_id},保留用户归属和名称唯一性约束。

Implementation

  • 后端在锁定项目后校验归属与重复名称,并以数据库唯一约束兜底并发冲突。
  • 前端通过 Project API 更新名称,同时保留已有卡片预览。
  • 操作入口采用普通披露控件语义,支持 Escape 关闭,不改变卡片跳转、分页和删除规则。

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 skipped
  • npm run format:checknpm run lintnpm run typecheck:通过
  • npm test -- src/pages/projects/index.test.tsx:10 passed
  • 真实本地后端验证重命名、刷新持久化并恢复原名
  • npm run test:coverage:本机全量运行出现大范围无关页面超时,已停止;以 GitHub CI runner 结果为准

Scope

  • 本 PR 不改变项目卡片跳转、分页、预览和删除业务规则。
  • 本 PR 不包含部署。

Related Issues

Closes #549

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.
@vercel

vercel Bot commented Aug 23, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
windup Ready Ready Preview Aug 23, 2026 1:01pm

@github-actions

github-actions Bot commented Aug 23, 2026

Copy link
Copy Markdown

✅ 此 PR 已关联 issue,之前的提醒已自动标记为已解决。

@codecov

codecov Bot commented Aug 23, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 80.76923% with 15 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
frontend/src/pages/projects/index.tsx 81.25% 5 Missing and 4 partials ⚠️
...end/packages/app/src/windup_app/web/api/project.py 77.77% 4 Missing ⚠️
frontend/src/entities/project/index.ts 66.66% 1 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@fennoai fennoai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

已检查项目重命名后端接口、前端 API 适配、卡片操作菜单、列表状态同步、删除回归、OpenAPI 变更及相关测试。前端定向测试(18 项)、TypeScript 类型检查、Oxlint 和 git diff --check 均通过;本地缺少 uv,未能执行后端 pytest。

请修正下方名称校验后再合并。

class ProjectRename(BaseModel):
"""重命名项目请求。"""

project_name: str = Field(min_length=1, max_length=20)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[P2] Reject whitespace-only project names

min_length=1 只检查字符串长度,因此 PATCH 请求可以提交全是空格的 project_name,并将这个不可见名称持久化到数据库;这绕过了项目名称应为 1–20 个有效字符的验收约束。前端弹窗会先 trim(),但直接 API 调用和其他客户端仍可触发该路径。请在后端对名称做 trim 后的非空校验(并保持保存值与前端行为一致),或使用等效的约束。

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.

[Feature]: 项目卡片操作入口常驻并支持重命名

1 participant