Skip to content

feat(module): UUID-based Config.ID + table prefix#18

Merged
I-am-nothing merged 1 commit into
mainfrom
feat/uuid-module-id
May 5, 2026
Merged

feat(module): UUID-based Config.ID + table prefix#18
I-am-nothing merged 1 commit into
mainfrom
feat/uuid-module-id

Conversation

@I-am-nothing

Copy link
Copy Markdown
Contributor

Summary

  • `Config.ID` and the SQL table prefix now substitute from the platform-assigned UUID (`m` + 32 hex chars) instead of the URL slug
  • Sanitization: strip hyphens, prepend `m` (UUIDs may begin with a digit), normalize lowercase
  • Threads `module_id` through three branches in the init flow (pre-check + --used, create POST success, race re-fetch on slug_taken-after-POST)
  • Pin SDK `v0.1.1` in `go.mod.tmpl`

Why

Renaming a URL slug today would orphan every Postgres schema and table prefixed from it. UUID-derived IDs are immutable, so slug rename becomes a metadata-only change.

Blocked on

Test plan

  • `cargo test` clean (42 tests, 5 new for UUID sanitization)
  • `cargo clippy --all-targets -- -D warnings` clean
  • `cargo fmt --all -- --check` clean
  • After SDK v0.1.1 ships: scaffold to /tmp, run `go mod tidy && go build ./...`, confirm `Config.ID = "m<32 hex>"` and table is `m<32 hex>_items`

What stays slug-based

  • The scaffold target dir name (`.//`) — easy to rename
  • `go.mod` module path (`module `) — easy to find/replace
  • `routes.go` response body (`hello from `) — user-facing, slug is the right identifier

What's UUID-derived

  • `Config.ID` in main.go
  • Table prefix in sql/app/0001_init.up.sql

🤖 Generated with Claude Code

Decouples the developer's module identity from the URL slug. Config.ID
now substitutes from the platform-assigned UUID (m + 32 hex chars),
which is immutable across slug renames. Table prefix follows the same
ID, so renaming a slug becomes a metadata-only change with zero schema
migration.

Inputs gains a module_id field threaded from three branches in the init
flow:
- pre-check Ok(Some) + --used (existing.id)
- create POST Ok (m.id)
- create POST slug_taken + --used race → re-fetch via get_module

The race re-fetch is rare (slug was free at pre-check, taken by POST
time) but had no other ID source available.

go.mod.tmpl bumps to SDK v0.1.1 (the regex bump that admits UUID-shape
IDs). Blocked on app-module-sdk#94 merging + tagging.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@I-am-nothing I-am-nothing force-pushed the feat/uuid-module-id branch from 72e9134 to 48ee90c Compare May 5, 2026 17:04
@I-am-nothing I-am-nothing changed the base branch from feat/module-init-scaffold to main May 5, 2026 17:04
@I-am-nothing I-am-nothing marked this pull request as ready for review May 5, 2026 17:04
@I-am-nothing I-am-nothing merged commit 3744ab3 into main May 5, 2026
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