Skip to content

feat: rename project name and slug (#480) - #481

Merged
unjica merged 10 commits into
developfrom
feature/rename-project
Jul 17, 2026
Merged

unjica merged 10 commits into
developfrom
feature/rename-project

Conversation

@unjica

@unjica unjica commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator

Summary

Implements #480.

  • API: PATCH /api/meta/projects/:projectId (OWNER) updates name and/or slug; unique slug per org excluding self; audit project.update
  • Dashboard: Settings → Organization Projects section with edit forms; project switcher “Rename this project” links to #rename-project-{id} for all projects (not only the legacy seed)
  • Docs: RBAC matrix + CHANGELOG

Test plan

  • As OWNER: rename name/slug on Settings → Organization → Projects → Save
  • Switcher shows new name after refresh
  • “Rename this project” scrolls to the correct project form
  • As EDITOR/VIEWER: forms read-only / API 403
  • Slug conflict with another project gets a unique suffix (or clear error path)

Made with Cursor

unjica and others added 2 commits July 17, 2026 00:55
Add PATCH /api/meta/projects/:projectId, Settings → Organization edit
forms, and wire the project switcher rename link to the real UI.

Co-authored-by: Cursor <[email protected]>
Return 409 instead of silently appending a numeric suffix when an
owner sets an explicit slug that another project already uses.

Co-authored-by: Cursor <[email protected]>
@unjica

unjica commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator Author

Addressed Bugbot: PATCH rename now returns 409 if the requested slug is already taken (no silent acme-1 rewrite). Create still auto-allocates unique slugs.

Slug helpers moved to project-slug, but invite token generation still needs crypto.randomBytes.

Co-authored-by: Cursor <[email protected]>
@unjica

unjica commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator Author

bugbot run

bugbot-review was failing when api.github.com returned HTML 503 pages
instead of JSON. Enable github-script retries and poll through transient errors.

Co-authored-by: Cursor <[email protected]>
@unjica

unjica commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator Author

Pushed CI resilience for bugbot-review (retry HTML/5xx from GitHub API). Re-run the failed Bugbot review job once this commit is on the branch.

Add integration tests for OWNER rename success, EDITOR/VIEWER 403,
empty/invalid name/slug, missing/deleted project 404, and slug conflicts.

Co-authored-by: Cursor <[email protected]>
@unjica

unjica commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator Author

Added integration coverage for `PATCH /api/meta/projects/:projectId` in `project-rename.integration.test.ts` (same shape as workspace rename #483):

  • OWNER rename success (returns updated name + slug)
  • EDITOR / VIEWER → 403
  • missing / empty name or slug → 400
  • invalid / soft-deleted / missing project → 400 / 404
  • slug already taken → 409

unjica and others added 2 commits July 17, 2026 02:18
Keep both project and workspace rename changelog/audit entries and
Settings organization page sections after merging develop.

Co-authored-by: Cursor <[email protected]>
Require the parent org to be active (deleted_at null), matching create
and workspace rename. Cover with an integration test.

Co-authored-by: Cursor <[email protected]>
@unjica

unjica commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator Author

Fixed Bugbot finding: PATCH /meta/projects/:projectId now requires the parent organization to be non-archived (organization.deleted_at: null) and returns 404 otherwise.

Keep rename inputs controlled so slugified values match after save, and
return 409 when a concurrent unique slug update hits P2002.

Co-authored-by: Cursor <[email protected]>
@unjica

unjica commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator Author

Addressed the two Bugbot findings on `74aee32`:

  1. Rename form stale after save — project name/slug fields are now controlled and synced from props / the PATCH response (same pattern as workspace rename).
  2. Concurrent slug rename 500 — `PATCH /meta/projects/:projectId` catches Prisma `P2002` and returns 409 with the existing conflict message.

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

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 43b8013. Configure here.

ScrollToHash now listens for hashchange, and org/project switcher rename
links scroll immediately when already on Organization settings.

Co-authored-by: Cursor <[email protected]>
@unjica

unjica commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator Author

Fixed Bugbot Rename hash link skips scroll:

  • `ScrollToHash` also runs on `hashchange` (not only pathname changes).
  • Project (and workspace) switcher “Rename …” links call `scrollToSectionId` when already on Organization settings, where App Router same-path navigation would not remount/re-run the effect.

@unjica
unjica merged commit 56f44a8 into develop Jul 17, 2026
5 of 6 checks passed
@unjica
unjica deleted the feature/rename-project branch July 17, 2026 00:34
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