carlos / platform Public

console perf: share the built-entry resolution between the copy gates

entryBuiltRows (in the asset cache gate) takes the diagnostic list name;
both gates keep their named wrappers.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev 4ab578e0a2e63b9ea151ee29cb65a970c5547da5 parent aca0592
2 files changed, +16 −42
  • approved_asset_cache_copy_test.go +12 −6
  • approved_console_perf_copy_test.go +4 −36

CI passed — run details

diff --git a/approved_asset_cache_copy_test.go b/approved_asset_cache_copy_test.go
index bce964d9d..9a3ee2fdb 100644
--- a/approved_asset_cache_copy_test.go
+++ b/approved_asset_cache_copy_test.go
@@ -55,12 +55,18 @@ var assetCacheCopyBuilt = []string{
"EAC-25",
}
-// assetCacheBuiltRows turns built entries into the rows to check: one per
-// entry, its file replaced by the entry's "@path" if it has one, and the
-// record's \n and \t (a cell holds one line) turned into the real characters.
-// It also reports an entry named twice, and (checkRunBuilt) an id with no row
-// or a row that is not approved.
+// assetCacheBuiltRows is entryBuiltRows for assetCacheCopyBuilt.
func assetCacheBuiltRows(rows []copyRow, entries []string) ([]copyRow, []string) {
+ return entryBuiltRows(rows, entries, "assetCacheCopyBuilt")
+}
+
+// entryBuiltRows turns built entries into the rows to check: one per entry,
+// its file replaced by the entry's "@path" if it has one, and the record's \n
+// and \t (a cell holds one line) turned into the real characters. It also
+// reports an entry named twice (as "<listName> names <entry> twice"), and
+// (checkRunBuilt) an id with no row or a row that is not approved. The edge
+// asset cache and console perf copy gates both build their checks on it.
+func entryBuiltRows(rows []copyRow, entries []string, listName string) ([]copyRow, []string) {
byID := map[string]copyRow{}
for _, r := range rows {
byID[r.ID] = r
@@ -71,7 +77,7 @@ func assetCacheBuiltRows(rows []copyRow, entries []string) ([]copyRow, []string)
seenEntry, seenID := map[string]bool{}, map[string]bool{}
for _, e := range entries {
if seenEntry[e] {
- problems = append(problems, "assetCacheCopyBuilt names "+e+" twice")
+ problems = append(problems, listName+" names "+e+" twice")
continue
}
seenEntry[e] = true
diff --git a/approved_console_perf_copy_test.go b/approved_console_perf_copy_test.go
index 1732bd2d3..85f28aa89 100644
--- a/approved_console_perf_copy_test.go
+++ b/approved_console_perf_copy_test.go
@@ -43,43 +43,11 @@ var consolePerfCopyIDs = func() []string {
// the table.
var consolePerfCopyBuilt = []string{}
-// consolePerfBuiltRows turns built entries into the rows to check: one per
-// entry, its file replaced by the entry's "@path" if it has one, and the
-// record's \n and \t (a cell holds one line) turned into the real characters.
-// It also reports an entry named twice, and (checkRunBuilt) an id with no row
-// or a row that is not approved.
+// consolePerfBuiltRows is entryBuiltRows (approved_asset_cache_copy_test.go)
+// for consolePerfCopyBuilt: the same entry resolution, so the two gates cannot
+// drift apart.
func consolePerfBuiltRows(rows []copyRow, entries []string) ([]copyRow, []string) {
- byID := map[string]copyRow{}
- for _, r := range rows {
- byID[r.ID] = r
- }
- var out []copyRow
- var problems []string
- var ids []string
- seenEntry, seenID := map[string]bool{}, map[string]bool{}
- for _, e := range entries {
- if seenEntry[e] {
- problems = append(problems, "consolePerfCopyBuilt names "+e+" twice")
- continue
- }
- seenEntry[e] = true
- id, path, at := strings.Cut(e, "@")
- if !seenID[id] {
- seenID[id] = true
- ids = append(ids, id)
- }
- r, ok := byID[id]
- if !ok {
- continue // checkRunBuilt reports it
- }
- if at {
- r.File = path
- }
- r.Text = strings.ReplaceAll(r.Text, `\n`, "\n")
- r.Text = strings.ReplaceAll(r.Text, `\t`, "\t")
- out = append(out, r)
- }
- return out, append(problems, checkRunBuilt(rows, ids)...)
+ return entryBuiltRows(rows, entries, "consolePerfCopyBuilt")
}
// checkConsolePerfBuilt is every problem with the built entries: not