Skip to content

fix(go): move the corpus tests into testutil so consumers never see omni - #174

Open
rjrodger wants to merge 1 commit into
mainfrom
claude/go-tests-in-testutil
Open

rjrodger wants to merge 1 commit into
mainfrom
claude/go-tests-in-testutil

Conversation

@rjrodger

Copy link
Copy Markdown
Contributor

Closes #173.

What was wrong

go/testutil is a nested module so that the published github.com/voxgig/struct/go never names omni. But the parent module's own voxgigstruct_test.go and client_test.go import testutil.

go mod tidy in any downstream module counts the tests of its dependencies. It follows struct/go → struct/go.test → struct/go/testutil → omni, then writes struct/go/testutil into the consumer's go.mod, and omni into its go.sum. One level further down, for a module that imports a module that imports struct (voxgig/station's case), github.com/voxgig/omni/go v0.1.0 // indirect lands in the go.mod. Tidy in the parent module itself wanted to add both too, so the existing comment's claim that it "cannot" was already false.

What changed

  • go/voxgigstruct_test.go → go/testutil/voxgigstruct_test.go. Only the package clause (runner_test) and the corpus path (../../build/test/test.json) changed.
  • go/client_test.go → go/testutil/client_store_test.go. Its TestClient becomes TestClientWithStore, because testutil already has a TestClient. The two differ: this one passes a store map, the other nil.
  • What stays in go/: regex_pathological_test.go and walk_bench_test.go. With the workspace off, go list -test -deps ./... reaches nothing outside the module.
  • go/Makefile.
    • vet runs GOWORK=off go vet ./... first, so a parent-module test that imports anything outside the module fails make vet, and so CI's lint job. A probe test importing testutil passed make test (the workspace hides it, which is how v0.1.6 shipped) and failed this check.
    • fmt now also formats testutil.
  • Docs. The layout and the rule are in go/AGENTS.md, go/README.md, go/DOCS.md and the root AGENTS.md. GOWORK is added to cspell.json.

Verification

  • make -C go test: 106 passes before and after, made of 4 top-level tests and 102 subtests. The only name change is TestClient → TestClientWithStore.

  • A consumer module (go 1.23, importing struct/go, replace to this tree, GOWORK=off go mod tidy):

    go.mod go.sum
    before names struct/go/testutil names omni
    after names neither none written
  • Gates:

    • gofmt, make -C go vet, make -C go lint (golangci-lint, 0 issues) and make -C go audit all pass.
    • tools/omni_isolation.py and its self-test (83/83) pass, as does tools/check_parity.py (23 ok).
    • The comment gate, tools/check_prose.py and Vale (0 errors) pass, as do cspell and markdownlint.

To release

go/v0.1.6 is taken. voxgig/station#32 needs a struct version whose tests do not import testutil, so it would follow a go/VERSION bump to 0.1.7 and make -C go publish. That is a maintainer's call.

🤖 Generated with Claude Code

https://claude.ai/code/session_01QyLex3fTRW9pVUvMegByn3


Generated by Claude Code

The published module github.com/voxgig/struct/go shipped two test files,
voxgigstruct_test.go and client_test.go, that imported the nested harness
module github.com/voxgig/struct/go/testutil. `go mod tidy` in any module
that depends on struct/go follows the imports of its dependencies' tests,
so it resolved struct/go/testutil from the proxy and, through it,
github.com/voxgig/omni/go v0.1.0. Nothing here caught it: go.work resolved
the import locally, so the parent go.mod never had to name testutil, and
tools/omni_isolation.py looks for omni itself, which neither file names.
See #173.

What moved:

- go/voxgigstruct_test.go -> go/testutil/voxgigstruct_test.go, as the
  external test package runner_test. The corpus path goes from
  ../build/test/test.json to ../../build/test/test.json; nothing else
  changes.
- go/client_test.go -> go/testutil/client_store_test.go, also runner_test.
  Its TestClient is now TestClientWithStore: testutil already has a
  TestClient (package runner), and two in one test binary run as
  TestClient/client-check-basic and TestClient/client-check-basic#01. They
  differ in the store they pass to the runner (a map, which omni resolves
  the client options against, versus nil), so both stay. Its commented-out
  imports go.

The tests left in go/, regex_pathological_test.go and walk_bench_test.go,
import only the standard library and the library itself.

go/Makefile: `vet` first vets this module with GOWORK=off, where any import
from outside it fails to resolve. A probe test in go/ importing testutil
passed `make test` under the workspace and failed `make vet` with "no
required module provides package github.com/voxgig/struct/go/testutil".
`make lint` runs `vet`, so the lint-go CI job enforces it. `fmt` now formats
testutil as well, from inside it, because go fmt has no workspace mode
(`go fmt ./testutil/...` fails even with go.work present). test, lint and
audit are unchanged: they already name ./testutil/..., which now holds the
corpus. The comments in the Makefile, testutil/go.mod and .gitignore, the
layout in go/AGENTS.md, go/README.md and go/DOCS.md, and the Go row of the
root AGENTS.md table follow the move. cspell.json learns GOWORK.

Evidence, before -> after:

- make -C go test: 106 PASS lines, 4 top-level tests and 102 subtests,
  0 FAIL, 0 SKIP -> the same 106, 4 and 102. github.com/voxgig/struct/go
  goes from 104 PASS lines to 1 (TestRegexPathological); .../go/testutil
  from 2 to 105. The one name change is TestClient -> TestClientWithStore,
  with its client-check-basic subtest; TestStruct and its 100 subtests move
  unchanged.
- GOWORK=off go mod tidy -diff in go/ wanted to add
  `require github.com/voxgig/struct/go/testutil v0.0.0-20261009084424-3ab807cc2ae7`
  and `require github.com/voxgig/omni/go v0.1.0 // indirect` to the
  published go.mod -> no diff. testutil was tidy before and is after.
- GOWORK=off go list -test -deps ./... in go/ now reaches nothing outside
  github.com/voxgig/struct/go.
- A throwaway consumer (go 1.23, imports struct/go, replace to this tree),
  GOWORK=off go mod tidy: go.mod gained
  `github.com/voxgig/struct/go/testutil v0.0.0-20261009084424-3ab807cc2ae7 // indirect`
  and go.sum four lines naming testutil and omni/go v0.1.0, with
  `go mod why -m` giving consumer -> struct/go -> struct/go.test ->
  struct/go/testutil -> omni/go/compat/struct -> go.mod names neither, no
  go.sum is written, and `go mod why -m` answers "main module does not need
  module" for both.
- One level further down, top -> mid -> struct/go, the case voxgig/station's
  consumers hit: with struct/go v0.1.6, top's tidied go.mod gained
  `github.com/voxgig/omni/go v0.1.0 // indirect` -> with this tree, nothing
  naming omni or testutil, and no go.sum.

Gates, all green: gofmt -l; make -C go vet, lint (golangci-lint 2.5.0,
0 issues), audit (govulncheck: 0 vulnerabilities affect the code; gosec
silent), fmt (no changes); GOWORK=off go vet in each module alone;
tools/omni_isolation.py all clean (64 shipped source files, was 66: the
moved files are harness files now), selftest 83/83; tools/check_parity.py;
comment gate clean, its tests 9/9; tools/check_prose.py on 50 pages;
Vale 3.14.0 at error level on 50 pages; cspell and markdownlint over every
*.md; check_doc_examples.py and gen_doc_examples.py --check.

Releasing it needs go/VERSION past 0.1.6, whose go/v0.1.6 tag is taken,
then a go/v0.1.7 tag that voxgig/station can require.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QyLex3fTRW9pVUvMegByn3
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-15T00:27:06.376550Z fd1bd82 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

rjrodger pushed a commit to voxgig/likeness that referenced this pull request Oct 15, 2026
voxgig/station#28 places a credential the API takes in the query
string, so Joplin's `token` now carries the real value (station#25),
and #40 passes sekreto every plugin in Ruby, so Ruby opens the vault
(station#33). Both are on station main at 9021c99, which also carries
#32: station's go.mod now requires real versions of sekreto and struct.

So Go, Python and Ruby take station at 9021c99. In go.mod the
placeholder replaces for sekreto and struct go, and sekreto is required
at its real revision. Only station's own replace stays, until station
tags go/v0.0.1 (station#27). go mod tidy now records omni/go as
indirect where it recorded struct/go/testutil. Both come from struct's
test files, which voxgig/struct#174 moves.

The matrix goes from 2 to 6 of 20 cells green: Joplin and Notion from
Go, Python and Ruby. Its declarations follow. query-token and
rb-station-plugins hold no cell now and are removed. Ruby's Obsidian
`list` waits on sdkgen#419, as Go's and Python's do, and Ruby's Linear
waits on sdkgen#400. TypeScript still waits on a station release
(station#34, voxgig/station#62), which carries both fixes, so its
Joplin cell no longer names the query token behind it.

make check passes: TypeScript 616 tests, 614 pass, 2 skip; Go; Python
628 OK; Ruby 639 runs, 0 failures; C; parity across the four on 259
entries; the matrix at 6 of 20, its self-test red on every planted
fault.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014Va59RuFMjP54gQmU9cr14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

go: the library's own tests import testutil, so every downstream go mod tidy pulls in omni

1 participant