carlos / platform Public

console: region page copy, as approved

C24 is DB-IP's required wording, with the link target exposed as a
constant so the page can render it as a link (Paul's ruling, 2026-10-03).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev 97a0a413adcb578b8c3e02f9d0ca0dfe3cec2aab parent 236bcfe
2 files changed, +129 −0
  • internal/console/regioncopy.go +36 −0
  • internal/console/regioncopy_test.go +93 −0
diff --git a/internal/console/regioncopy.go b/internal/console/regioncopy.go
new file mode 100644
index 000000000..942db6d2e
--- /dev/null
+++ b/internal/console/regioncopy.go
@@ -0,0 +1,36 @@
+package console
+
+// attributionURL is where C24's credit must link. DB-IP's licence requires
+// the credit to link there, so the console page renders Attribution as an
+// <a href> to this URL (Paul's ruling, 2026-10-03).
+const attributionURL = "https://db-ip.com"
+
+// regionCopy is every console-page string the nearest-region feature
+// shows (spec §19), as approved in the nearest-region copy record. Verbs
+// are %s in the order each comment names. Change none of them without a
+// new copy review.
+type regionCopyStrings struct {
+ PickerLabel string // C1
+ PickerHelp string // C2
+ AutoOption string // C3: place
+ Unavailable string // C5
+ StartsIn string // C7: place
+ CantStart string // C8: place
+ AuditCreated string // C21: app name, place
+ Attribution string // C24, rendered as a link to AttributionURL
+ AttributionURL string // C24's link target
+}
+
+var regionCopy = regionCopyStrings{
+ PickerLabel: "Region",
+ PickerHelp: "Where this app's instances run. We picked the region nearest to you. Choose another if most of your users are somewhere else.",
+ AutoOption: "%s (nearest to you)",
+ Unavailable: "That region can't take new apps right now. Choose another.",
+ StartsIn: "New instances start in %s, this app's region.",
+ CantStart: "New instances can't start in %s, this app's region, right now. Pass a region to place one elsewhere.",
+ AuditCreated: "created app %s in %s",
+ Attribution: "IP Geolocation by DB-IP",
+ AttributionURL: attributionURL,
+}
+
+func (p page) RegionCopy() regionCopyStrings { return regionCopy }
diff --git a/internal/console/regioncopy_test.go b/internal/console/regioncopy_test.go
new file mode 100644
index 000000000..f2db026b5
--- /dev/null
+++ b/internal/console/regioncopy_test.go
@@ -0,0 +1,93 @@
+package console
+
+import (
+ "encoding/json"
+ "fmt"
+ "os"
+ "reflect"
+ "strconv"
+ "strings"
+ "testing"
+)
+
+func TestRegionCopyHasNoEmDashesAndRendersItsVerbs(t *testing.T) {
+ v := reflect.ValueOf(regionCopy)
+ for i := 0; i < v.NumField(); i++ {
+ s := v.Field(i).String()
+ if s == "" || strings.Contains(s, "—") {
+ t.Errorf("%s = %q: empty or has an em dash", v.Type().Field(i).Name, s)
+ }
+ }
+ for _, s := range []string{
+ fmt.Sprintf(regionCopy.AutoOption, "P"),
+ fmt.Sprintf(regionCopy.StartsIn, "P"),
+ fmt.Sprintf(regionCopy.CantStart, "P"),
+ fmt.Sprintf(regionCopy.AuditCreated, "blog", "P"),
+ } {
+ if strings.Contains(s, "%!") {
+ t.Errorf("bad verb: %q", s)
+ }
+ }
+}
+
+// TestRegionCopyMatchesTheApprovedRecord holds every string to the copy
+// record byte for byte, and to the quoted literal in the source, so a short
+// text such as "Region" cannot pass by matching part of an identifier.
+func TestRegionCopyMatchesTheApprovedRecord(t *testing.T) {
+ raw, err := os.ReadFile("../../docs/superpowers/plans/2026-10-02-nearest-region-copy.json")
+ if err != nil {
+ t.Fatal(err)
+ }
+ var rec struct {
+ Entries []struct {
+ ID string `json:"id"`
+ Text string `json:"text"`
+ Link string `json:"link"`
+ } `json:"entries"`
+ }
+ if err := json.Unmarshal(raw, &rec); err != nil {
+ t.Fatal(err)
+ }
+ src, err := os.ReadFile("regioncopy.go")
+ if err != nil {
+ t.Fatal(err)
+ }
+ byID := map[string]string{}
+ links := map[string]string{}
+ for _, e := range rec.Entries {
+ byID[e.ID] = e.Text
+ links[e.ID] = e.Link
+ }
+ for id, got := range map[string]string{
+ "C1": regionCopy.PickerLabel,
+ "C2": regionCopy.PickerHelp,
+ "C3": regionCopy.AutoOption,
+ "C5": regionCopy.Unavailable,
+ "C7": regionCopy.StartsIn,
+ "C8": regionCopy.CantStart,
+ "C21": regionCopy.AuditCreated,
+ "C24": regionCopy.Attribution,
+ } {
+ want, ok := byID[id]
+ if !ok {
+ t.Errorf("%s: not in the record", id)
+ continue
+ }
+ if got != want {
+ t.Errorf("%s = %q, record has %q", id, got, want)
+ }
+ if !strings.Contains(string(src), strconv.Quote(want)) {
+ t.Errorf("%s: regioncopy.go has no literal %s", id, strconv.Quote(want))
+ }
+ }
+ // C24 is DB-IP's required credit; the licence wants it linked.
+ if links["C24"] == "" {
+ t.Fatal("C24: the record carries no link")
+ }
+ if regionCopy.AttributionURL != links["C24"] || attributionURL != links["C24"] {
+ t.Errorf("attribution URL = %q / %q, record has %q", regionCopy.AttributionURL, attributionURL, links["C24"])
+ }
+ if regionCopy.Attribution != "IP Geolocation by DB-IP" {
+ t.Errorf("Attribution = %q", regionCopy.Attribution)
+ }
+}