Skip to content

A work project's slug can be renamed too (#1038) - #1040

Merged
mkreyman merged 2 commits into
masterfrom
fix/work-project-slug-rename
Nov 11, 2026
Merged

mkreyman merged 2 commits into
masterfrom
fix/work-project-slug-rename

Conversation

@mkreyman

Copy link
Copy Markdown
Owner

Summary

Follow-up to #1039 (#1038). #1039 let only a kind: kb scope's slug change and refused a
work project's with 422. Four of the ten repo channels Mark asked to rename to their repo
basename are work projects, so they could not be renamed. This lets any project's slug change.

  • Project.update_changeset/2: the work-project refusal (validate_slug_change) is gone. The
    unique index on (tenant_id, slug) still refuses a slug another project holds, archived
    included.
  • On a slug-only rename (no name in the request) a kb scope's name always follows the slug,
    as before, including a legacy kb row whose name drifted from its slug. A work project's name
    follows only when it equalled the old slug; a display name ("Fleet Dashboard") is kept.
  • Docs, OpenAPI operation text, CHANGELOG.md, the epic 5 story (AC-5.1.6), and the MCP
    update_project / delete_project descriptions say any project's slug can change. MCP
    bumped to 3.13.1.

Testing

  • mix test test/loopctl_web/controllers/project_controller_test.exs test/loopctl/projects/projects_test.exs: 183 tests, 0 failures.
  • New controller tests: a legacy kb scope whose name drifted is realigned by a slug-only
    rename; a work project's slug change with a name keeps that name; a work
    project named as its slug follows a slug-only rename; a work project with a display name
    keeps it on a slug-only rename; a taken slug is 422 and the stored slug is unchanged.
  • npm --prefix mcp-server test: 916 pass, 0 fail.
  • mix credo --strict on the changed files: no issues.

Risk

A slug is how sessions reach a channel. Renaming a work project's slug changes the string
other sessions resolve, but #1039's folded lookup keeps the hyphenated form resolving
(cron-books reaches cron_books) as long as exactly one active project folds to it. A
rename to an unrelated string is not covered by the fold and would strand callers that still
use the old slug; the rename is audited with old and new slug, so it can be found and reversed.
Orchestrator role on a human-anchored tenant is still required. No custody gate changes.

How to revert

Revert this commit. Work-project slug changes go back to 422. Slugs already renamed stay
renamed and cannot be PATCHed back after the revert, so rename them back first if needed
(the audit log holds each old slug).

Review findings

  1. fixed medium lib/loopctl/projects/project.ex:133 — name_follows_slug now fires only when the stored name equals the stored slug, so a legacy kb scope whose name drifted from its slug no longer has its name follow a slug-only rename; validate_kb_name_equals_slug then refuses it with 422, unlike before this change.
  2. fixed low mcp-server/CHANGELOG.md:12 — The PR body says the MCP handoff description was updated, but the diff does not touch the handoff tool's description; only update_project and delete_project changed.
  3. fixed low docs/user_stories/epic_5_projects/us_5.1.json:44 — The acceptance criterion still says 'slug cannot be changed after creation', which now contradicts PATCH accepting a slug for every project.

#1039 let only a kind: kb scope's slug change and refused a work project's
with 422, so the four of the ten repo channels that are work projects could
not be aligned to their repo basename. Any project's slug can now change; the unique index still
refuses a taken one.

The name follows the slug only when the request carries no name and the
stored name equalled the stored slug, so a work project with a display name
keeps it. MCP 3.13.1 updates the update_project and handoff descriptions.
The name-follows clause matched only name == slug, which dropped the
unconditional follow a kb scope had, so a legacy kb row whose name drifted
from its slug got 422 on a slug-only rename. A kb scope's name follows again;
a work project's follows only when it was the slug. Also corrects the MCP
changelog (update_project and delete_project descriptions, not handoff) and
AC-5.1.6, which still said a slug cannot change.
@mkreyman
mkreyman enabled auto-merge (squash) November 11, 2026 21:44
@mkreyman
mkreyman merged commit f4efa19 into master Nov 11, 2026
17 checks passed
@mkreyman
mkreyman deleted the fix/work-project-slug-rename branch November 11, 2026 21:54
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