// approved_region_ha_2b_copy_test.go package main import ( "os" "regexp" "strconv" "strings" "testing" ) // The copy gate of region HA plan 2b (Task 1), plan 2a's gate over plan // 2b's record. The record is a markdown table in the moves record's // format, read with the moves gate's parser and checked with the run // gate's helpers, so "approved" and "applied" mean what they mean there: // // - TestRegionHA2bCopyRecordIsComplete: the record names exactly // regionHA2bCopyIDs; // - TestRegionHA2bCopyHasNoEmDash; // - TestRegionHA2bBuiltCopyIsApproved: an id in regionHA2bCopyBuilt is an // approved row. No pending string reaches code, CLI help or docs; // - TestRegionHA2bBuiltCopyIsApplied: a built row's text is in the file // it names. const regionHA2bCopyRecordPath = "docs/superpowers/plans/2026-10-17-region-ha-2b-copy.md" var regionHA2bCopyIDPattern = regexp.MustCompile(`^RHB-C[0-9]+$`) // regionHA2bCopyIDs is the record's inventory, pinned: RHB-C1 to RHB-C64, // RHB-C67 to RHB-C71. RHB-C65 and RHB-C66 were withdrawn in review and // are not reused. var regionHA2bCopyIDs = func() []string { ids := make([]string, 0, 69) for i := 1; i <= 64; i++ { ids = append(ids, "RHB-C"+strconv.Itoa(i)) } return append(ids, "RHB-C67", "RHB-C68", "RHB-C69", "RHB-C70", "RHB-C71") }() // regionHA2bCopyBuilt is every id whose text the code or docs carry. The // task that writes a row's text adds its ids here in the same commit, once // Paul has approved the rows. var 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"} func mustParseRegionHA2bRecord(t *testing.T) []copyRow { t.Helper() raw, err := os.ReadFile(regionHA2bCopyRecordPath) if err != nil { t.Fatal(err) } rows, err := parseCopyTable(string(raw), regionHA2bCopyRecordPath, regionHA2bCopyIDPattern, "an RHB-C") if err != nil { t.Fatal(err) } return rows } func TestRegionHA2bCopyRecordIsComplete(t *testing.T) { reportAll(t, checkMovesInventory(mustParseRegionHA2bRecord(t), regionHA2bCopyIDs)) } func TestRegionHA2bCopyHasNoEmDash(t *testing.T) { reportAll(t, checkMovesNoEmDash(mustParseRegionHA2bRecord(t))) } func TestRegionHA2bBuiltCopyIsApproved(t *testing.T) { reportAll(t, checkRunBuilt(mustParseRegionHA2bRecord(t), regionHA2bCopyBuilt)) } func TestRegionHA2bBuiltCopyIsApplied(t *testing.T) { rows := builtRows(mustParseRegionHA2bRecord(t), regionHA2bCopyBuilt) // A table cell holds one line, so in this record a row's text writes a // newline as \n: RHB-C19, the install-channel usage Paul re-approved on // 2026-10-18 (claim-prev-rehearsal, then claim-untagged-pointer), is two // lines and a blank one. for i := range rows { rows[i].Text = strings.ReplaceAll(rows[i].Text, `\n`, "\n") } reportAll(t, checkRunApplied(rows, ".")) }