Migrate deployed docs on project rename (fixes #122) #123
No reviewers
Labels
No labels
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
qwc-open/asiakirjat!123
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/project-rename-unreachable-docs"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
Fixes #122. Deployed documentation and the search index are keyed on the project's mutable
slug. Renaming a project (changing its slug) only updated the DB row — the on-disk files stayed at the old-slug directory, so every doc URL 404'd, and search results kept pointing at the old slug.old→newprojects.slug){base}/old/…{base}/new/…versions.storage_pathproject_slug/URLs =oldnewChanges
docs.Storage.MoveProject(old, new)— relocates a project's directory on rename. No-op if nothing is deployed yet; refuses to overwrite an existing destination so it can never clobber another project's docs.projects.Service.Update(project, oldSlug)— persists the row, moves storage, and rewrites each version'sStoragePath. If the storage move fails it rolls the slug back in the DB so the project stays reachable at its old URL. Slug collisions map toErrSlugConflict→ HTTP 409 (was a generic 500).handleAdminUpdateProject— routes through the service and, on a slug change, asynchronously refreshes the search index for the renamed project's versions (delete + reindex; doc IDs are keyed on project/version ID, so stale entries are fully replaced).os.Renamecould move the directory out from under an in-flight extract, corrupting or stranding the deployment.Tests
docs:MoveProjecthappy path, no-source no-op, refuses existing destination.projects: rename migrates storage + rewrites version paths; rollback on storage-move failure keeps the project reachable; rename into a taken slug returnsErrSlugConflict.go test ./...).AI-assisted.
🤖 Generated with Claude Code