fix(ci): make the gate tolerate formatting and give deploy a PG 18 client

The page-registry test parsed the route table one line per route and the
task-meta fixture was byte-compared, so the prettier reformat broke both.
The registry test now splits route objects and ignores comments; the
fixture compares compacted JSON. Also drops a stale router comment that
described the removed redirects, rebuilds ui/dist, regenerates the
contracts artifact, keeps prettier off generated output, and installs
postgresql-client-18 in deploy.yml's gate as quality.yml already does.
This commit is contained in:
sam committed 2026-09-25 01:29:23 +10:00
1 parent 6a8555665e
commit 30e79a026c
10 files changed
+150 -50435

No files matched your search

+18 -6
View File
@@ -16,6 +16,12 @@ func quietContext() context.Context { return context.Background() }
// routePathRe matches one route entry's path in the dashboard's route table.
var routePathRe = regexp.MustCompile(`path:\s*"([^"]+)"`)
// lineCommentRe strips // comments, so prose about a route never reads as one.
var lineCommentRe = regexp.MustCompile(`(?m)^\s*//.*$`)
// navFalseRe marks a route that is not a navigation entry.
var navFalseRe = regexp.MustCompile(`nav:\s*false`)
// dashboardRoutesFromSource reads the dashboard's route table out of the UI
// source.
//
@@ -42,15 +48,21 @@ func dashboardRoutesFromSource(t *testing.T) []string {
block = block[:end]
}
// One route per line. A detail route (nav: false) is addressed by URL but is
// not a navigation entry, so the registry does not carry it.
// Each route runs from its path to the next route's path, however it is
// formatted. A detail route (nav: false) is addressed by URL but is not a
// navigation entry, so the registry does not carry it.
var paths []string
for line := range strings.SplitSeq(block, "\n") {
match := routePathRe.FindStringSubmatch(line)
if match == nil || strings.Contains(line, "nav: false") {
block = lineCommentRe.ReplaceAllString(block, "")
matches := routePathRe.FindAllStringSubmatchIndex(block, -1)
for i, m := range matches {
end := len(block)
if i+1 < len(matches) {
end = matches[i+1][0]
}
if navFalseRe.MatchString(block[m[1]:end]) {
continue
}
paths = append(paths, match[1])
paths = append(paths, block[m[2]:m[3]])
}
if len(paths) == 0 {
t.Fatalf("%s: parsed no routes", path)
+9 -1
View File
@@ -153,7 +153,15 @@ func TestTaskMetaPayloadMatchesFixture(t *testing.T) {
if err != nil {
t.Fatalf("read %s: %v\nrun: go test ./internal/webui -run TestTaskMetaPayloadMatchesFixture -update", fixture, err)
}
if !bytes.Equal(served, committed) {
var servedCompact, committedCompact bytes.Buffer
if err := json.Compact(&servedCompact, served); err != nil {
t.Fatalf("compact served payload: %v", err)
}
if err := json.Compact(&committedCompact, committed); err != nil {
t.Fatalf("compact %s: %v", fixture, err)
}
// Whitespace is formatting, not contract: compare the documents.
if !bytes.Equal(servedCompact.Bytes(), committedCompact.Bytes()) {
t.Errorf("GET /api/task-meta no longer matches %s.\n"+
"The fixture pins the dashboard's freeze-dried snapshot (ui/src/base/task-meta.jsx);\n"+
"ui/test/task-meta-catalogue.test.js fails until both sides agree.\n"+