fix(sip): reject realm names with hyphens/uppercase; add DNS and cache waits to test workflow - #31
fix(sip): reject realm names with hyphens/uppercase; add DNS and cache waits to test workflow#31michaela-band wants to merge 2 commits into
Conversation
…e waits ValidateRealmName previously allowed uppercase letters and internal hyphens (DNS label rules), but the Bandwidth API rejects both with error 33013 — supported chars are [a-z0-9] only. The mismatch caused a confusing runtime failure after CLI validation passed. Updated the regex and error message to match the actual API constraint. The AGENTS.md ephemeral-realm SIP test workflow had two related gaps discovered during live testing: - New realm FQDNs can take 1–2 minutes to appear in public DNS after the realm reaches ACTIVE status. Added a dig poll loop after realm creation. - Bandwidth's SIP proxy caches credential hashes; a freshly created or rotated credential fails authentication for ~15 s. Added a sleep 15 after credential creation with an explanation. Also fixed the example realm name (sip-test → siptest) which would have failed the now-correct validation, and updated the baresip output table to distinguish a repeated-407 cache miss from a genuine 403 credential error. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
|
Went through this one carefully and also verified the central claim against the live API rather than taking it on faith. The regex change is correct — I'd land it after a few small fixes. Verified against prodBuilt a binary from The control create is the important one: it proves the 33013s are specific to the name and not a blanket create failure. Both halves of the claim hold, and the new error message matches the API's own wording. Also worth noting the change makes Suite is green locally too: Three things I'd fix1. Stale rationale + orphaned 2. The 3. Two things the live run turned upThe "1–2 minutes to propagate" premise didn't reproduce for me. The new realm's FQDN resolved at t+0, the instant The workflow silently requires a SIP-enabled account. Running step 2 on my default account fails with exit 4 and "this account isn't enabled for SIP credentials — contact Bandwidth support to enable SipCredentialSettings"; only one of the accounts on my token has SIP. The workflow never mentions this, so an agent following it on the wrong account dies at step 2 with an error that reads like a support ticket rather than "pass Not approving yet just so the fixes get a look, but the substance here is verified correct rather than merely plausible — good catch on the validation mismatch. |
Summary
ValidateRealmNameregex fix — the previous regex allowed hyphens and uppercase letters (DNS label rules), but the Bandwidth API rejects both with error 33013 ([a-z0-9]only). Validation now matches the API constraint, so invalid names fail fast with a clear message before any HTTP request is made.TestRealmCreate_IfNotExistsMatchesNameCaseInsensitively(the uppercase-input scenario it covered is no longer reachable) and replaced it withTestRealmCreate_IfNotExistsRejectsUppercaseName, which verifies validation fires before any API call.ACTIVEstatus. Added adigpoll loop after realm creation to block until the FQDN resolves.sleep 15after credential creation with an explanation.sip-test→siptest(the hyphen would have failed the corrected validation).Test plan
make testpasses (all packages green)go vet ./...clean (golangci-lintnot installed locally; CI will cover it)183 Session Progressafter the 15 s credential cache wait🤖 Generated with Claude Code