Artifact 455cb1c3f272f7cf1ac604fd8f39beb9280781d57d002be9ced850dfee4526c2:
- File
internal/api/searchkinds_test.go
— part of check-in
[24fdaa723a]
at
2026-08-25 19:05:45
on branch search-guards
— tests: the regression guards that were never added
Seven test files were written this session, reported as landed, and never committed: `zit commit` with no paths captures TRACKED files, and new files need `zit add` first. make check passed every time because they were on disk in the worktree, which proves nothing about what is in the check-in.
What was missing:
- search kinds, held in agreement across four places (the index list, two ops validators, the scope chips, hitOf). This is the guard that caught `doc` and again `file` the moment each was added; without it the validator silently refused a kind the chips offered. - technote edits collapsing to one timeline row, folded in three different orders, because a clone delivers artifacts in wire order. - wiki and technote search matching the CURRENT revision only, the "terrified" case. - Contributors(0) meaning every contributor rather than a silent 100. - the ops phase states, the stalled-store trap, and an empty fleet.
Verified by removing them and running the suite: it stays green, which is precisely the problem — trunk has been passing on their absence. (user: dmestas, size: 1076) [annotate] [blame] [check-ins using] [more...]
package api import ( "reflect" "strings" "testing" "craftdesign.group/quarry/internal/index" ) // The ops validator repeats the index's kind list as a literal `oneof` // tag, which a struct tag cannot compute. Adding "doc" to SearchKinds // left both tags behind and the op refused the kind before the query // ran: rows indexed, chip rendered, every search empty. // // Checked by reflection so the tag and the list cannot drift again. func TestSearchOpValidatorsMatchSearchKinds(t *testing.T) { want := strings.Join(index.SearchKinds, "|") for _, in := range []any{searchIn{}, searchAllIn{}} { typ := reflect.TypeOf(in) f, ok := typ.FieldByName("Kind") if !ok { t.Fatalf("%s has no Kind field", typ.Name()) } tag := f.Tag.Get("validate") got := strings.TrimPrefix(tag, "oneof=") if got == tag { t.Fatalf("%s.Kind validate tag = %q, want a oneof", typ.Name(), tag) } if got != want { t.Errorf("%s.Kind accepts %q but the index files %q — "+ "a kind missing here is refused before the query runs", typ.Name(), got, want) } } }