Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Brief description of what this PR does.

## Testing

- [ ] All tests pass (`go test -race ./...`)
- [ ] 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

Expand Down
8 changes: 7 additions & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,15 @@ Code intelligence engine written in Go. Indexes repositories into a knowledge gr
```bash
CGO_CFLAGS="-O2 -g -fno-strict-aliasing" CGO_CXXFLAGS="-O2 -g -fno-strict-aliasing" \
go build -o gortex ./cmd/gortex/ # requires CGO (tree-sitter C bindings)
go test -race ./... # all test packages must pass
make test PKGS=./internal/<pkg>/... # packages you touched; CI runs the full suite
```

`make test` (all packages when `PKGS` is unset) runs `go test -race` with SQLite's transpiled C and libc left out of
race instrumentation, as CI does. Plain `go test -race ./...` instruments them
too, which makes `store_sqlite`, `indexer` and `mcp` several times slower and
can trip package timeouts. To run a heavy package with one worker per CPU like
CI: `TEST_RACE=true go run ./scripts/ci-test --partition indexer:1/2`.

Gcc builds must disable strict aliasing in C and C++ dependency packages to avoid
[tree-sitter heap corruption (#821)](https://github.com/zzet/gortex/issues/821).
The flags above preserve Go's default `-O2 -g`; `make` sets them automatically.
Expand Down
5 changes: 3 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ checks and is the right default for most work. Other optional build tags:
### Running Tests

```bash
go test -race ./...
make test PKGS=./internal/<pkg>/... # the packages you touched
make test # every package
```

CI runs the suite under `-race` on Linux. A few packages — `internal/indexer`,
Expand Down Expand Up @@ -163,7 +164,7 @@ tests, and skill drift.
1. Fork the repository
2. Create a feature branch (`git checkout -b feature/my-feature`)
3. Write tests for your changes
4. Ensure all tests pass (`go test -race ./...`)
4. Ensure tests for the packages you touched pass (`make test PKGS=./internal/<pkg>/...`); CI runs the full suite
5. Ensure the linter is clean (`make lint`)
6. Commit with a clear message
7. Open a pull request and fill in the template
Expand Down
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,10 @@ build-gomlx: deps-gomlx
build-hugot: deps-hugot
go build -ldflags '$(LDFLAGS)' -o $(BINARY) ./cmd/gortex/

PKGS ?= ./...

test:
go test -race ./...
go test -race -gcflags=modernc.org/sqlite/lib=-race=false -gcflags=modernc.org/libc/...=-race=false $(PKGS)

bench:
go test -bench=. -benchmem -count=1 -benchtime=1s \
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ Data flow, graph schema (node and edge kinds, multi-repo fields, test taxonomy),

```bash
make build # binary with version stamping
make test # go test -race ./...
make test # go test -race; PKGS=./internal/<pkg>/... narrows it
make lint # golangci-lint
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,15 @@ type checkpointBeginResult struct {
err error
}

// checkpointWaitTimeout only bounds a broken fixture; a race-instrumented
// SQLite needs well over 2s for a 4096-row chunk.
const checkpointWaitTimeout = 30 * time.Second

func waitCheckpointSignal(t *testing.T, signal <-chan struct{}) {
t.Helper()
select {
case <-signal:
case <-time.After(2 * time.Second):
case <-time.After(checkpointWaitTimeout):
t.Fatal("timed out waiting for checkpoint signal")
}
}
Expand All @@ -37,7 +41,7 @@ func waitCheckpointAttemptResult(t *testing.T, result <-chan checkpointAttemptRe
select {
case got := <-result:
return got
case <-time.After(2 * time.Second):
case <-time.After(checkpointWaitTimeout):
t.Fatal("timed out waiting for checkpoint attempt")
return checkpointAttemptResult{}
}
Expand Down
4 changes: 3 additions & 1 deletion internal/parser/forest/dump_kinds_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build grammardump

package forest

import (
Expand Down Expand Up @@ -53,7 +55,7 @@ import (
// TestDumpGrammarKinds is a research helper. It parses a small
// fixture per grammar and prints every named node kind seen, with
// frequencies — feeds the per-language node-kind dispatch table.
// Run with: go test -run TestDumpGrammarKinds -v ./internal/parser/forest/
// Run with: go test -tags grammardump -run TestDumpGrammarKinds -v ./internal/parser/forest/
func TestDumpGrammarKinds(t *testing.T) {
cases := []struct {
name string
Expand Down
1 change: 1 addition & 0 deletions internal/releases/releases_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ func setupTaggedRepo(t *testing.T) string {
runCmd(t, dir, "git", "init", "-q")
runCmd(t, dir, "git", "config", "user.email", "test@example.com")
runCmd(t, dir, "git", "config", "user.name", "Tester")
runCmd(t, dir, "git", "config", "tag.gpgsign", "false")

writeFile(t, filepath.Join(dir, "a.go"), "package main\n")
runCmd(t, dir, "git", "add", "a.go")
Expand Down
Loading