Skip to content

feat(dns): register friendly account-name alias FQDN (#121 consumer / spore-host#357) - #135

Merged
scttfrdmn merged 3 commits into
mainfrom
feat/357-account-name-dns-cname
Jun 13, 2026
Merged

scttfrdmn merged 3 commits into
mainfrom
feat/357-account-name-dns-cname

Conversation

@scttfrdmn

Copy link
Copy Markdown
Contributor

Completes the consumer side of #121 (the spawn-repo half of #357 — the dns-updater and spored both live here). spawn already tags spawn:account-name; now the friendly FQDN actually resolves.

What

The dns-updater registers a CNAME {name}.{account-name}.spore.host → the canonical base36 A-record. Per the design call: base36 stays authoritative (holds the IP, updated in one place); the account-name FQDN is a true alias.

Wiring (tag → record)

  1. spored reads the spawn:account-name tag into provider.Config.AccountName (pkg/provider/ec2.go).
  2. dns.Client.SetAccountName includes it in the DNS API request (account_name).
  3. The Lambda re-validates the slug as an RFC-1035 label (aliasDNSName — never trusts the caller's value blindly, even though it's signed-instance traffic) and upserts/deletes the CNAME alongside the A-record.

Degradation (all best-effort, non-fatal)

Empty name / no account:GetAccountInformation / invalid slug / a failed alias change → base36-only, exactly as before. The canonical A-record is never blocked by the alias.

Tests

aliasDNSName rejects spaces, underscores, leading/trailing hyphens, and dots (multi-label). make check + the dns-updater Lambda module both green.

Cross-repo note

The umbrella spore-bot display/match sites (executor.go) construct the FQDN from base36 for show/lookup — they still work (base36 is unchanged). Honoring the account-name form there too is a nice-to-have follow-up on #357, but not required for the FQDN to resolve. Closes the spawn side of #121 / #357.

Completes #121's consumer side: the dns-updater now registers a CNAME
{name}.{account-name}.spore.host -> the canonical base36 A-record, so the
legible FQDN resolves. base36 stays authoritative (holds the IP); the name is a
true alias, updated in one place.

Wiring: spored reads the spawn:account-name tag into provider.Config.AccountName
-> dns.Client.SetAccountName -> the DNS request's account_name -> the Lambda,
which re-validates the slug as an RFC-1035 label (never trust the caller blindly)
and upserts/deletes the CNAME alongside the A-record. All best-effort and
non-fatal: empty/invalid slug or a failed alias change leaves base36 working.

Tests: aliasDNSName validation (rejects spaces, underscores, leading/trailing
hyphen, dots). make check + lambda module green.
@codecov

codecov Bot commented Jun 13, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 8.33333% with 11 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
pkg/agent/agent.go 0.00% 5 Missing ⚠️
pkg/dns/client.go 20.00% 4 Missing ⚠️
pkg/provider/ec2.go 0.00% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

Add a Substrate-emulator test exercising upsertCNAMERecord/deleteCNAMERecord
through the real ChangeResourceRecordSets/ListResourceRecordSets path (create
zone, upsert alias CNAME, assert present, delete, assert gone, delete-missing
no-op). Closes the patch-coverage gap on the new Route53 helpers with a real
behavior test rather than a mock.
@scttfrdmn
scttfrdmn merged commit b5576d6 into main Jun 13, 2026
2 of 3 checks passed
@scttfrdmn
scttfrdmn deleted the feat/357-account-name-dns-cname branch June 13, 2026 01:43
scttfrdmn added a commit that referenced this pull request Jun 13, 2026
* ci: build/vet/test the lambda/* modules (#136)

The 11 lambda/* dirs are each their own Go module, so the root `go test ./...`
never descended into them — their tests never ran in CI and their code was
invisible to codecov. Notably the cost-critical ttl-reaper and the dns-updater
Substrate Route53 test (from #135) were unguarded. Add a CI step that loops over
lambda/*/go.mod and runs build + vet + test -short in each. Verified all 11
currently pass locally. Closes #136.

* fix(lambda): go mod tidy stale modules surfaced by CI (#136)

Enabling lambda-module tests in CI immediately caught 4 modules with stale
go.mod/go.sum that fail `go build` without -mod=mod: sweep-orchestrator,
ttl-reaper, alert-handler, autoscale-orchestrator. Tidy them so the new CI step
is green. Exactly the rot the missing CI coverage was hiding.
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