Skip to content

test: fix local test failures and require race runs only for touched packages - #1192

Merged
zzet merged 1 commit into
zzet:mainfrom
vitaliyslion:fix/local-test-failures
Oct 31, 2026
Merged

zzet merged 1 commit into
zzet:mainfrom
vitaliyslion:fix/local-test-failures

Conversation

@vitaliyslion

Copy link
Copy Markdown
Contributor

Summary

Fixes three test failures that show up locally and never in CI, and proposes dropping the "full go test -race ./... before every PR" requirement from the template and contributor docs, since it is rarely followed in practice.

Relates to #1114, #879.

Changes

  • Forest Perl build failure (bsearch.h:72:7: error: expected identifier or '(' before '_Generic'). With glibc 2.43+ and a compiler defaulting to C23 (gcc 15+), glibc defines bsearch as a _Generic macro, which breaks the bsearch the Perl grammar defines in go-sitter-forest/perl v1.9.9. Upstream tree-sitter-perl fixed it in fix: improve error recovery for strings and incomplete calls tree-sitter-perl/tree-sitter-perl#220, but go-sitter-forest has not regenerated perl yet, so there is no version to bump to. Only TestDumpGrammarKinds, a manual research helper, imports that grammar, so it now builds only with -tags grammardump. Regular go test ./... no longer fails on newer distros. This is the local counterpart of Pin Linux CI to Ubuntu 24.04 while the Perl C23 fix is unpublished #1114, which pinned CI to Ubuntu 24.04; that pin can probably go once this lands.
  • internal/releases with tag signing enabled. setupTaggedRepo sets tag.gpgsign false in its temp repo, so a global tag.gpgsign=true no longer turns git tag v0.1 into a signed tag that fails with "no tag message?".
  • TestCheckedBatchContextRollsBackEarlierChunksAndBuiltinAdmission/1. The checkpoint wait helpers allowed 2 s, which is too short for a 4096-row chunk when SQLite itself is race-instrumented (failed every run under plain go test -race). The budget is now 30 s; it only bounds a broken fixture, so passing runs take no longer.
  • make test uses CI's race flags (modernc SQLite and libc excluded from instrumentation) and accepts PKGS to narrow the run: make test PKGS=./internal/<pkg>/....
  • Docs and template. The PR template, CONTRIBUTING.md, README.md and CLAUDE.md ask for the touched packages under make test PKGS=... and state that CI runs the full suite.

Proposal: drop the full race run requirement

The template asks for go test -race ./... before every PR. Locally that takes well over an hour: store_sqlite, indexer and mcp run their tests serially in one process, and plain -race also instruments the transpiled SQLite. CI finishes because scripts/ci-test spreads each package over one worker per CPU and splits indexer across two jobs.

In practice nobody runs it. Across the last 200 PRs (#791 to #1191):

Author Box ticked Box unticked Template removed
Maintainer (94 PRs) 3 7 84
External contributors (92 PRs) 24 36 32
dependabot (14 PRs) 0 0 14

Writing down what is actually done keeps the checkbox meaningful, and the full suite still runs on every PR in CI.

Testing

  • Tests for the touched packages pass (make test PKGS=./internal/<pkg>/...); CI runs the full suite
  • New tests added for new functionality
  • Benchmarks run if performance-relevant

Ran go test -race on internal/parser/forest (with the flags from the docs, no -std=gnu17), internal/releases (with global tag.gpgsign=true), and the checkpoint and checked batch tests in internal/graph/store_sqlite (3/3 under plain -race, previously failing every run). go test -tags grammardump -run TestDumpGrammarKinds ./internal/parser/forest/ still needs -std=gnu17 in CGO_CFLAGS on glibc 2.43+. scripts/check-cgo-flags.sh passes, and make -n test / make -n test PKGS=... expand as expected.

Checklist

  • Code follows existing patterns in the codebase
  • No unnecessary abstractions added
  • Language extractor includes Meta["methods"] for interfaces (if applicable)
  • Methods have EdgeMemberOf edges to their containing type (if applicable)

@zzet
zzet merged commit 953ec71 into zzet:main Oct 31, 2026
25 checks passed
@vitaliyslion
vitaliyslion deleted the fix/local-test-failures branch October 31, 2026 20:03
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.

2 participants