Skip to content

Identity consistency: slug webhooks, pipeline refs by slug, dead-code cleanup#151

Merged
martsokha merged 1 commit into
mainfrom
refactor/identity-consistency
Jul 18, 2026
Merged

Identity consistency: slug webhooks, pipeline refs by slug, dead-code cleanup#151
martsokha merged 1 commit into
mainfrom
refactor/identity-consistency

Conversation

@martsokha

Copy link
Copy Markdown
Member

Follow-up to the slug/number identity redesign. An audit of the handler layer found three remaining UUID inconsistencies; this closes them so every workspace-owned config resource is addressed the same way.

Webhooks by slug

Webhooks were the only workspace config resource still UUID-keyed. Now mirror connections/pipelines/policies/contexts:

  • Immutable per-workspace slug (migration + UNIQUE(workspace_id, slug) + format/length checks).
  • Route {webhookSlug}; CreateWebhook takes a required slug; duplicate → 409.
  • Response is slug-only (drops the webhook UUID). find_webhook resolves by slug.

Pipeline policy/context references by slug

A pipeline referenced its policies/contexts by UUID while those resources are slug-addressed everywhere else.

  • PipelineDefinition now exposes policySlugs / contextSlugs instead of policyIds / contextIds.
  • Write: slugs resolve to ids (scoped to the pipeline's workspace, 404 on any unknown reference) before the join tables are written; the join tables keep UUID foreign keys.
  • Read: the referenced slugs are listed back via a join.
  • The engine run path still resolves references by id internally (unchanged).

Dead-code cleanup

  • Remove unused create_connection_with_unique_slug (connections require an explicit slug; duplicate → 409).
  • Remove orphaned WorkspacePathParams / FilePathParams / VersionPathParams path structs (superseded by the slug extractor).

Also: dropped a few historic/changelog-style code comments in favor of current-state docs.

Verification

  • cargo check / clippy -D warnings / fmt / rustdoc -D warnings / full test suite — clean.
  • Live: webhook routes use {webhookSlug} (no {webhookId}); Webhook response has no webhookId; PipelineDefinition exposes policySlugs/contextSlugs (no policyIds).
  • E2E: webhook create-by-slug → 200, dup → 409; policy pii-mask + pipeline policySlugs:["pii-mask"] → 201, reads back ["pii-mask"]; unknown ref slug → 404.

🤖 Generated with Claude Code

… UUID code

Closes the remaining UUID inconsistencies an audit surfaced after the slug/number
redesign, so every workspace-owned config resource is addressed the same way.

Webhooks by slug
- Add an immutable per-workspace slug (migration + UNIQUE(workspace_id, slug) +
  format/length checks), mirroring connections/pipelines/policies/contexts.
- Route is {webhookSlug}; create takes a required slug; a duplicate is a 409.
  Response is slug-only (drops the webhook UUID). find_webhook resolves by slug.

Pipeline policy/context references by slug
- PipelineDefinition exposes policySlugs/contextSlugs instead of raw UUIDs.
- On write, the slugs are resolved to ids (scoped to the pipeline's workspace,
  404 on any unknown reference) before the join tables are written; the join
  tables keep UUID foreign keys. On read, the referenced slugs are listed back
  via a join. The engine run path still resolves by id internally.

Dead code
- Remove the unused create_connection_with_unique_slug (connections require an
  explicit slug; a duplicate is a 409) and the orphaned WorkspacePathParams /
  FilePathParams / VersionPathParams path structs.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@martsokha martsokha added refactor code restructuring without behavior change postgres ORM, models, queries, migrations server API handlers, middleware, auth labels Jul 16, 2026
@martsokha martsokha self-assigned this Jul 18, 2026
@martsokha
martsokha merged commit 5fae694 into main Jul 18, 2026
7 checks passed
@martsokha
martsokha deleted the refactor/identity-consistency branch July 18, 2026 11:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

postgres ORM, models, queries, migrations refactor code restructuring without behavior change server API handlers, middleware, auth

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant