// approved_region_ha_copy_test.go package main import ( "os" "regexp" "strconv" "testing" ) // The copy gate of region HA plan 2a (Task 1). 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: // // - TestRegionHACopyRecordIsComplete: the record names exactly RHA-C1 to // RHA-C25; // - TestRegionHACopyHasNoEmDash; // - TestRegionHABuiltCopyIsApproved: an id in regionHACopyBuilt is an // approved row. No pending string reaches code, CLI help or docs; // - TestRegionHABuiltCopyIsApplied: a built row's text is in the file it // names. const regionHACopyRecordPath = "docs/superpowers/plans/2026-10-16-region-ha-2a-copy.md" var regionHACopyIDPattern = regexp.MustCompile(`^RHA-C[0-9]+$`) // regionHACopyIDs is the record's inventory: RHA-C1 to RHA-C25, pinned // (RHA-C17 to RHA-C19 are Task 11's; RHA-C20 to RHA-C25 are Task 10's // further rows). var regionHACopyIDs = func() []string { ids := make([]string, 0, 25) for i := 1; i <= 25; i++ { ids = append(ids, "RHA-C"+strconv.Itoa(i)) } return ids }() // regionHACopyBuilt is every id whose text the code or docs carry. The // task that writes a row's text adds its id here in the same commit, once // Paul has approved the row. var regionHACopyBuilt = []string{"RHA-C1", "RHA-C2", "RHA-C3", "RHA-C4", "RHA-C5", "RHA-C6", "RHA-C7", "RHA-C8", "RHA-C9", "RHA-C10", "RHA-C11", "RHA-C12", "RHA-C13", "RHA-C14", "RHA-C15", "RHA-C16", "RHA-C17", "RHA-C18", "RHA-C19", "RHA-C20", "RHA-C21", "RHA-C22", "RHA-C23", "RHA-C24", "RHA-C25"} func mustParseRegionHARecord(t *testing.T) []copyRow { t.Helper() raw, err := os.ReadFile(regionHACopyRecordPath) if err != nil { t.Fatal(err) } rows, err := parseCopyTable(string(raw), regionHACopyRecordPath, regionHACopyIDPattern, "an RHA-C") if err != nil { t.Fatal(err) } return rows } func TestRegionHACopyRecordIsComplete(t *testing.T) { reportAll(t, checkMovesInventory(mustParseRegionHARecord(t), regionHACopyIDs)) } func TestRegionHACopyHasNoEmDash(t *testing.T) { reportAll(t, checkMovesNoEmDash(mustParseRegionHARecord(t))) } func TestRegionHABuiltCopyIsApproved(t *testing.T) { reportAll(t, checkRunBuilt(mustParseRegionHARecord(t), regionHACopyBuilt)) } func TestRegionHABuiltCopyIsApplied(t *testing.T) { reportAll(t, checkRunApplied(builtRows(mustParseRegionHARecord(t), regionHACopyBuilt), ".")) }