Skip to content

duckling: stop deriving the CR name — stored duckling_name is authoritative#891

Merged
benben merged 1 commit into
mainfrom
ben/duckling-name-authoritative
Jul 3, 2026
Merged

duckling: stop deriving the CR name — stored duckling_name is authoritative#891
benben merged 1 commit into
mainfrom
ben/duckling-name-authoritative

Conversation

@benben

@benben benben commented Jul 3, 2026

Copy link
Copy Markdown
Member

Removes all duckling-name derivation/resolution logic. The config-store duckling_name column (NOT NULL since migration 000012, editable + audited via the admin UI) is now the single source of truth for a warehouse's Duckling CR name.

Backend

  • DucklingClient takes the explicit CR name in every method (Create/Get/Delete/CRStatus/pgbouncer/bucket accessors) and uses it verbatim. ducklingName(), legacyDucklingName(), and the hyphen-stripped legacy fallback in getCR are deleted — the CP never re-derives or guesses a name again.
  • Callers pass the stored name: the provisioner controller (via a small ducklingCRName(w) helper), both resolveDucklingStatus closures (worker activation + query-log writer — these keep their (ctx, orgID) signature and resolve the name from the warehouse row internally, via a new ConfigStore.GetManagedWarehouse), and the drift scanner (orphan set no longer includes legacy hyphen-stripped variants).
  • Create default: duckling_name = org_id verbatim (org IDs are validated lowercase DNS-1123 labels at the provision endpoint, so no transform). Public provisioning API shape unchanged; the Duckling CR is created under exactly the stored name.

Frontend

  • Deleted the client-side ducklingName() derive helper; ducklingEntryFor matches exactly (stored name / org), no canonical+stripped variant list. All views render the stored field only.

Safety

  • Immediately before this change, every prod warehouse's duckling_name was verified byte-identical to its live Duckling CR (and no orphan CRs), so removing the legacy fallback strands nothing. New tests: Create uses the given name verbatim; reconcile creates/deletes under a stored name that differs from the org ID.

Build / test

  • go build -tags kubernetes ./..., go vet, gofmt — clean.
  • go test — controlplane + provisioner + provisioning ok; admin skips are the pre-existing Postgres-container tests (run in CI).
  • npm run build + lint + vitest — clean.

🤖 Generated with Claude Code

…tative

The Duckling CR name was derived from the org ID at every use site
(lowercase transform + a hyphen-stripped legacy fallback on NotFound),
with the stored duckling_name only consulted sometimes. Now the config
store column (NOT NULL since 000012) is the single source of truth:

- DucklingClient methods take the explicit CR name and use it verbatim;
  ducklingName()/legacyDucklingName() and the legacy getCR fallback are
  deleted. Create names the CR exactly what it is given.
- The provisioner controller, both resolveDucklingStatus closures
  (worker activation + query-log writer), and the drift scanner pass the
  warehouse row's duckling_name (org-ID fallback only for zero-value
  fixtures; the column is NOT NULL in the DB).
- Warehouse create stamps duckling_name = org_id verbatim (org IDs are
  validated lowercase DNS-1123 labels; no ToLower). Public provisioning
  API unchanged.
- Admin UI drops the client-side ducklingName() derive helper and the
  hyphen-stripped matching in ducklingEntryFor; views render the stored
  field only.

Verified beforehand that every prod warehouse's duckling_name exactly
matches its live CR, so removing the legacy fallback strands nothing.
@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown

Test Impact Plan

Deterministic summary of how this PR changes tests, CI runners, and coverage-risk signals.

Summary

Area Added Changed Deleted
Test files 0 3 0
E2E/journey files 0 0 0
Workflow files 0 0 0

Signals

  • Test cases: +2 / -2
  • Assertions: +13 / -11
  • Skips or known failures added: 0
  • Workflow continue-on-error added: 0
  • Workflow path filters added: 0
  • Test commands removed from justfile: 0
  • E2E/journey retry lines added: 0

Coverage risk: neutral or increased

No coverage-reduction warnings detected.

@benben benben merged commit 7495ab7 into main Jul 3, 2026
28 checks passed
@benben benben deleted the ben/duckling-name-authoritative branch July 3, 2026 13:55
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