carlos / platform Public

Clone
git clone https://amadan.net/carlos/platform

Plain git — no account needed to clone.

Download

Download this file

1// approved_region_ha_2b_copy_test.go
2package main
3
4import (
5 "os"
6 "regexp"
7 "strconv"
8 "strings"
9 "testing"
10)
11
12// The copy gate of region HA plan 2b (Task 1), plan 2a's gate over plan
13// 2b's record. The record is a markdown table in the moves record's
14// format, read with the moves gate's parser and checked with the run
15// gate's helpers, so "approved" and "applied" mean what they mean there:
16//
17// - TestRegionHA2bCopyRecordIsComplete: the record names exactly
18// regionHA2bCopyIDs;
19// - TestRegionHA2bCopyHasNoEmDash;
20// - TestRegionHA2bBuiltCopyIsApproved: an id in regionHA2bCopyBuilt is an
21// approved row. No pending string reaches code, CLI help or docs;
22// - TestRegionHA2bBuiltCopyIsApplied: a built row's text is in the file
23// it names.
24const regionHA2bCopyRecordPath = "docs/superpowers/plans/2026-10-17-region-ha-2b-copy.md"
25
26var regionHA2bCopyIDPattern = regexp.MustCompile(`^RHB-C[0-9]+$`)
27
28// regionHA2bCopyIDs is the record's inventory, pinned: RHB-C1 to RHB-C64,
29// RHB-C67 to RHB-C71. RHB-C65 and RHB-C66 were withdrawn in review and
30// are not reused.
31var regionHA2bCopyIDs = func() []string {
32 ids := make([]string, 0, 69)
33 for i := 1; i <= 64; i++ {
34 ids = append(ids, "RHB-C"+strconv.Itoa(i))
35 }
36 return append(ids, "RHB-C67", "RHB-C68", "RHB-C69", "RHB-C70", "RHB-C71")
37}()
38
39// regionHA2bCopyBuilt is every id whose text the code or docs carry. The
40// task that writes a row's text adds its ids here in the same commit, once
41// Paul has approved the rows.
42var regionHA2bCopyBuilt = []string{"RHB-C1", "RHB-C2", "RHB-C3", "RHB-C4", "RHB-C5", "RHB-C6", "RHB-C7", "RHB-C8", "RHB-C9", "RHB-C10", "RHB-C11", "RHB-C12", "RHB-C13", "RHB-C14", "RHB-C15", "RHB-C16", "RHB-C17", "RHB-C18", "RHB-C64", "RHB-C67", "RHB-C68", "RHB-C19", "RHB-C20", "RHB-C21", "RHB-C22", "RHB-C23", "RHB-C24", "RHB-C25", "RHB-C26", "RHB-C27", "RHB-C28", "RHB-C29", "RHB-C30", "RHB-C31", "RHB-C32", "RHB-C33", "RHB-C34", "RHB-C35", "RHB-C36", "RHB-C37", "RHB-C38", "RHB-C39", "RHB-C40", "RHB-C41", "RHB-C42", "RHB-C43", "RHB-C44", "RHB-C45", "RHB-C46", "RHB-C47", "RHB-C48", "RHB-C49", "RHB-C62", "RHB-C63", "RHB-C50", "RHB-C51", "RHB-C52", "RHB-C53", "RHB-C54", "RHB-C55", "RHB-C56", "RHB-C57", "RHB-C58", "RHB-C59", "RHB-C60", "RHB-C61", "RHB-C69", "RHB-C70", "RHB-C71"}
43
44func mustParseRegionHA2bRecord(t *testing.T) []copyRow {
45 t.Helper()
46 raw, err := os.ReadFile(regionHA2bCopyRecordPath)
47 if err != nil {
48 t.Fatal(err)
49 }
50 rows, err := parseCopyTable(string(raw), regionHA2bCopyRecordPath, regionHA2bCopyIDPattern, "an RHB-C<n>")
51 if err != nil {
52 t.Fatal(err)
53 }
54 return rows
55}
56
57func TestRegionHA2bCopyRecordIsComplete(t *testing.T) {
58 reportAll(t, checkMovesInventory(mustParseRegionHA2bRecord(t), regionHA2bCopyIDs))
59}
60
61func TestRegionHA2bCopyHasNoEmDash(t *testing.T) {
62 reportAll(t, checkMovesNoEmDash(mustParseRegionHA2bRecord(t)))
63}
64
65func TestRegionHA2bBuiltCopyIsApproved(t *testing.T) {
66 reportAll(t, checkRunBuilt(mustParseRegionHA2bRecord(t), regionHA2bCopyBuilt))
67}
68
69func TestRegionHA2bBuiltCopyIsApplied(t *testing.T) {
70 rows := builtRows(mustParseRegionHA2bRecord(t), regionHA2bCopyBuilt)
71 // A table cell holds one line, so in this record a row's text writes a
72 // newline as \n: RHB-C19, the install-channel usage Paul re-approved on
73 // 2026-10-18 (claim-prev-rehearsal, then claim-untagged-pointer), is two
74 // lines and a blank one.
75 for i := range rows {
76 rows[i].Text = strings.ReplaceAll(rows[i].Text, `\n`, "\n")
77 }
78 reportAll(t, checkRunApplied(rows, "."))
79}
80