Skip to content

fix(dns,cost): honour --profile when signing; dns help and dns delete tags (#967, #1159) - #1228

Merged
scttfrdmn merged 2 commits into
mainfrom
fix/1159-967-dns-cli
Oct 20, 2026
Merged

scttfrdmn merged 2 commits into
mainfrom
fix/1159-967-dns-cli

Conversation

@scttfrdmn

Copy link
Copy Markdown
Contributor

Fixes for spawn dns and spawn cost: they now honour --profile, the help text is fixed, and dns delete cleans up all its tags.

#967: --profile reaches the signature.

  • spawn dns register and spawn dns delete resolved the instance with a client that honours --profile, then signed the updater request through dns.NewClient, which loads the ambient chain.
  • They now build the DNS client with the new dns.NewClientWithConfig(awsClient.Config(), …). dns.NewClient stays as-is for spored and delegates to it.
  • cost.NewClient now takes the command's aws.Config and builds both the sweep-table client and the on-demand pricer from it. Before, the pricer lazily loaded the ambient chain (with its own --account / SPORE_ACCOUNT is accepted but never checked (only spawn doctor reads it) #1118 check). The cfg comes from loadAWSConfig, so the shared loader's account guard applies.
  • cost.NewClient's signature changed. pkg/cost isn't in the API snapshot, and nothing outside spawn calls it (checked across ~/src/spore-host).

#1159: help text, dns delete tags, and the docs claim.

  • updateCommandDescriptions now applies spawn.dns.{list,register,delete}.short. They existed in libs but were never used.
  • The discovered gate also found spawn status with a blank Short. It has no i18n key, so the Short is set in code.
  • spawn dns's long text is now spawn's own (dnsLongHelp). libs' spawn.dns.long is wrong in en/es/ja/pt: it says names register "with --dns flag" and gives dns delete a DNS name. Filed as i18n: spawn.dns.long says names register 'with --dns flag' and dns delete takes a name (en/es/ja/pt); no spawn.status keys libs#60, so spawn can go back to the i18n key once it's fixed.
  • spawn dns delete now removes every spawn:dns-* tag on the instance with the new aws.Client.DeleteInstanceTags: name, domain, endpoint, and spored's status/error. Before, it set spawn:dns-name="" (still a tag) and left the rest.
  • docs/custom-dns.md no longer claims spawn status shows spawn:dns-status: registered. It says what status prints and how to read the tag. The page's account IDs are spore.host's own infra account (the deploy script's real default) and AWS-doc placeholders, so I left them.

Gates (each watched failing against a compiling revert)

  • TestDNSDeleteSignsWithTheProfileAndRemovesTheDNSTags runs the real root command spawn dns delete <id> --yes --profile other against Substrate, through a recording proxy. --profile other has its own keys in a temp AWS config; the environment holds different ones. The updater is served locally by swapping only the transport of the command's own DNS client.
    • Revert: sign with LoadDefaultConfig → FAIL ("signed by TESTAMBIENT…").
    • Revert: the old blank-the-name tag update → FAIL. It lists all four leftover tags, and the DescribeInstances check confirms they're still on the instance.
  • TestCostPricesWithTheProfile runs spawn cost sw-967 --profile other with a seeded sweep. The GetItem and the Price List GetProducts call must both be signed by the profile. Revert: the pricer loads the ambient config → FAIL.
  • TestEveryCommandHasAShortDescription walks the whole cobra tree after i18n init. It fails if discovery finds nothing, and also checks that the dns long help mentions --name.
    • Revert: drop the subcommand loop → FAIL on the three dns subcommands.
    • Revert: blank status → FAIL.
    • Revert: back to i18n.T("spawn.dns.long") → FAIL.
  • TestCommandsCallNoAmbientPkgLoader extends Make spawn burst and every other command honour --region and --profile (#939) #966's gate one level into pkg/, as the issue suggested. It discovers every exported top-level pkg/ function that calls LoadDefaultConfig without explicit credentials, excluding the three shared loaders (a 3-entry list, because they apply the profile through an options slice the AST can't see). Package cmd may reference none of them. Revert: a compiling var _ = dns.NewClient in cmd → FAIL. Limitation, stated in the test: one level only. It would not have found pkg/cost's unexported pricer, which the behaviour test covers.

Checks

make check passes every step except check-build-tags, which fails identically on unmodified origin/main on this machine. make check-docs and semgrep scan --config=auto --error . are clean. make api-snapshot is regenerated (additions only in pkg/aws). The cmd SDK-import allowlist dropped cost.go: dynamodb, which its own gate required.

Not verified

Nothing was run on AWS.

Merge note: this touches the same docs/custom-dns.md section and ## [Unreleased] as #1218, so whichever merges second needs a mechanical rebase (make changelog-fix for the CHANGELOG).

Fixes #1159
Fixes #967

@scttfrdmn scttfrdmn added this to the v0.137.0 milestone Oct 20, 2026
@codecov

codecov Bot commented Oct 20, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 52.77778% with 17 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
pkg/aws/client.go 0.00% 12 Missing ⚠️
cmd/dns.go 75.00% 2 Missing and 1 partial ⚠️
pkg/cost/cost.go 66.66% 1 Missing ⚠️
pkg/dns/client.go 75.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

…ete removes its tags

spawn dns register/delete signed the updater request through dns.NewClient,
which loads the ambient chain, and spawn cost's pricer did the same, so
--profile/SPORE_PROFILE reached neither (#967). Both now use the config the
command loaded through the shared loader (dns.NewClientWithConfig,
cost.NewClient(cfg)). A discovered gate keeps cmd off every exported pkg/
function that loads the ambient config.

spawn dns --help listed its subcommands (and spawn --help listed status)
with blank descriptions; the dns long text claimed names register only with
--dns. spawn dns delete now removes every spawn:dns-* tag instead of blanking
spawn:dns-name, and docs/custom-dns.md no longer claims spawn status prints
the registered status (#1159).

Fixes #1159
Fixes #967
…rofile

Combined #1121 + #967 gate: an AccessDenied on the account's SSM DNS
setting, read with --profile's credentials, refuses spawn dns delete,
naming the parameter and --domain; no updater request, no tag change.

Refs #1121
Refs #967
@scttfrdmn
scttfrdmn force-pushed the fix/1159-967-dns-cli branch from acfec46 to 87a1afe Compare October 20, 2026 08:31
@scttfrdmn
scttfrdmn merged commit 07dc31b into main Oct 20, 2026
9 checks passed
@scttfrdmn
scttfrdmn deleted the fix/1159-967-dns-cli branch October 20, 2026 08:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant