Add slug rename support to note update API #23

Closed
opened 2026-02-25 23:17:17 +00:00 by forgejo_admin · 0 comments

Plan

plan-2026-02-25-agent-profiles — Phase 3.5

This is a prerequisite for renaming SOP slugs to use a consistent sop- prefix convention (e.g., worktree-workflowsop-worktree-workflow).

User Story

As a platform operator
I need to rename note slugs via the update API
So that I can enforce consistent slug naming conventions (e.g., sop- prefix) without deleting and recreating notes, which would lose revision history and break link references

Acceptance Criteria

When I PUT /notes/{slug} with a slug field in the body (e.g., {"slug": "sop-worktree-workflow"})
Then the note's slug is updated and the note is accessible at the new slug

When I PUT /notes/{slug} with a slug that already belongs to a different note
Then I get a 409 Conflict response

When I PUT /notes/{slug} with the same slug as the current note (no-op rename)
Then the update succeeds without error

When I call mcp__pal-e-docs__update_note(slug="old-slug", new_slug="new-slug")
Then the MCP tool sends the slug rename to the API and returns the updated note at the new slug

Additional Information

pal-e-docs API repo (forgejo_admin/pal-e-docs):

  • NoteUpdate in src/pal_e_docs/schemas.py (line 81-86) — add slug: str | None = None
  • update_note in src/pal_e_docs/routes/notes.py (line 96-134) — add slug update logic with uniqueness check (409 if conflict)
  • Note.slug is unique=True, index=True — DB enforces uniqueness but route should return clean 409
  • note_links uses note.id FKs — slug renames are safe for the relational graph
  • Tests in tests/test_crud.py

pal-e-docs MCP repo (forgejo_admin/pal-e-docs-mcp):

  • update_note tool in src/pal_e_docs_mcp/tools/notes.py (line 79-110) — add new_slug parameter mapping to slug in API body

Gotcha: Notes referencing other notes by slug in html_content won't auto-update. That's a separate search-and-replace pass, out of scope here.

Checklist

  • Add slug: str | None = None to NoteUpdate in schemas.py
  • Add slug update logic in routes/notes.py — check uniqueness, return 409 on conflict
  • Add test: rename slug succeeds
  • Add test: rename to existing slug returns 409
  • Add test: rename to same slug (no-op) succeeds
  • Add new_slug parameter to MCP update_note tool in pal-e-docs-mcp repo
  • PRs opened with related notes
  • project-pal-e-docs — the project this affects
  • plan-2026-02-25-agent-profiles — Phase 3.5 prerequisite
  • sop-index — will use this feature to rename all SOP slugs
### Plan `plan-2026-02-25-agent-profiles` — Phase 3.5 This is a prerequisite for renaming SOP slugs to use a consistent `sop-` prefix convention (e.g., `worktree-workflow` → `sop-worktree-workflow`). ### User Story As a platform operator I need to rename note slugs via the update API So that I can enforce consistent slug naming conventions (e.g., `sop-` prefix) without deleting and recreating notes, which would lose revision history and break link references ### Acceptance Criteria When I PUT `/notes/{slug}` with a `slug` field in the body (e.g., `{"slug": "sop-worktree-workflow"}`) Then the note's slug is updated and the note is accessible at the new slug When I PUT `/notes/{slug}` with a `slug` that already belongs to a different note Then I get a 409 Conflict response When I PUT `/notes/{slug}` with the same slug as the current note (no-op rename) Then the update succeeds without error When I call `mcp__pal-e-docs__update_note(slug="old-slug", new_slug="new-slug")` Then the MCP tool sends the slug rename to the API and returns the updated note at the new slug ### Additional Information **pal-e-docs API repo (`forgejo_admin/pal-e-docs`):** - `NoteUpdate` in `src/pal_e_docs/schemas.py` (line 81-86) — add `slug: str | None = None` - `update_note` in `src/pal_e_docs/routes/notes.py` (line 96-134) — add slug update logic with uniqueness check (409 if conflict) - `Note.slug` is `unique=True, index=True` — DB enforces uniqueness but route should return clean 409 - `note_links` uses `note.id` FKs — slug renames are safe for the relational graph - Tests in `tests/test_crud.py` **pal-e-docs MCP repo (`forgejo_admin/pal-e-docs-mcp`):** - `update_note` tool in `src/pal_e_docs_mcp/tools/notes.py` (line 79-110) — add `new_slug` parameter mapping to `slug` in API body **Gotcha:** Notes referencing other notes by slug in `html_content` won't auto-update. That's a separate search-and-replace pass, out of scope here. ### Checklist - [ ] Add `slug: str | None = None` to `NoteUpdate` in `schemas.py` - [ ] Add slug update logic in `routes/notes.py` — check uniqueness, return 409 on conflict - [ ] Add test: rename slug succeeds - [ ] Add test: rename to existing slug returns 409 - [ ] Add test: rename to same slug (no-op) succeeds - [ ] Add `new_slug` parameter to MCP `update_note` tool in pal-e-docs-mcp repo - [ ] PRs opened with related notes ### Related - `project-pal-e-docs` — the project this affects - `plan-2026-02-25-agent-profiles` — Phase 3.5 prerequisite - `sop-index` — will use this feature to rename all SOP slugs
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
forgejo_admin/pal-e-api#23
No description provided.