Skip to content

fix(test:apps): inject boxlite_dev tag via GOFLAGS for apps Go tests (#579)#589

Open
G4614 wants to merge 1 commit into
boxlite-ai:mainfrom
G4614:fix/issue-579-libboxlite-dev-path
Open

fix(test:apps): inject boxlite_dev tag via GOFLAGS for apps Go tests (#579)#589
G4614 wants to merge 1 commit into
boxlite-ai:mainfrom
G4614:fix/issue-579-libboxlite-dev-path

Conversation

@G4614
Copy link
Copy Markdown
Contributor

@G4614 G4614 commented May 25, 2026

Set GOFLAGS=-tags=boxlite_dev on the make test:apps recipe so the apps' Go tests link the dev-built target/debug/libboxlite.a (via sdks/go/bridge_cgo_dev.go) instead of the prebuilt bundle absent on dev checkouts — fixes #579.

@G4614 G4614 closed this May 26, 2026
@G4614 G4614 reopened this May 26, 2026
@G4614 G4614 changed the title fix(make): stage libboxlite.a at sdks/go/ so test:apps works on dev (#579) [WIP]fix(make): stage libboxlite.a at sdks/go/ so test:apps works on dev (#579) May 26, 2026
@G4614 G4614 marked this pull request as draft May 26, 2026 07:58
@G4614 G4614 force-pushed the fix/issue-579-libboxlite-dev-path branch from 7a5a78c to 5e4ccff Compare May 26, 2026 10:32
@G4614 G4614 marked this pull request as ready for review May 26, 2026 11:33
@G4614 G4614 force-pushed the fix/issue-579-libboxlite-dev-path branch from 5e4ccff to 256cc9f Compare May 26, 2026 12:29
@G4614 G4614 changed the title [WIP]fix(make): stage libboxlite.a at sdks/go/ so test:apps works on dev (#579) fix(test:apps): inject boxlite_dev tag via local nx-tools wrapper (#579) May 26, 2026
@G4614 G4614 force-pushed the fix/issue-579-libboxlite-dev-path branch from 5c512ba to c240495 Compare May 28, 2026 11:54
@G4614 G4614 marked this pull request as draft May 28, 2026 11:59
@G4614 G4614 force-pushed the fix/issue-579-libboxlite-dev-path branch 2 times, most recently from f763f72 to 0ddf77b Compare May 28, 2026 12:39
…oxlite-ai#579)

apps/ Go test targets must build with `-tags=boxlite_dev` so cgo selects
sdks/go/bridge_cgo_dev.go, which links the in-repo sdks/c/include headers
and the dev-built target/debug/libboxlite.a. Without the tag, go uses
bridge_cgo_prebuilt.go, which needs the downloaded sdks/go/{libboxlite.a,
include} bundle (absent on dev checkouts) and fails to link — issue boxlite-ai#579.

A prior attempt set `options.flags` in apps/nx.json, but released
@nx-go/nx-go ignores it (its go-test argv is hardcoded). Since @nx-go/nx-go
passes process.env through to the spawned `go test`, set
GOFLAGS=-tags=boxlite_dev on the `make test:apps` recipe — the same pattern
test:unit:go already uses for the SDK's own tests. test:apps also gains a
dev:go prerequisite so target/debug/libboxlite.a is built first.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@G4614 G4614 force-pushed the fix/issue-579-libboxlite-dev-path branch from 0ddf77b to f7e61ed Compare May 28, 2026 12:57
@G4614 G4614 changed the title fix(test:apps): inject boxlite_dev tag via local nx-tools wrapper (#579) fix(test:apps): inject boxlite_dev tag via GOFLAGS for apps Go tests (#579) May 28, 2026
@G4614
Copy link
Copy Markdown
Contributor Author

G4614 commented May 28, 2026

Caveat — the tag is injected only via make test:apps, not bare yarn nx test <project>

Line 309 sets GOFLAGS=-tags=boxlite_dev for the nx run-many it spawns, so it covers make test:apps (and CI, which runs through make). A standalone yarn nx test <project> in a shell without GOFLAGS does not get the tag. Consequences:

  • The 8 pure-Go apps — the tag is a no-op, so they're unaffected.
  • runner (the only app importing the cgo bridge), run standalone without the tag:
    • Normal dev checkout (no downloaded prebuilt bundle): loud link failure — the make test:apps fails in dev workflow: libboxlite.a not populated at default-bridge path #579 symptom. Safe; fix by running via make.
    • If a contributor has also run the setup downloader and pulled the prebuilt bundle into their checkout: it silently links the released sdks/go/libboxlite.a instead of their local target/debug build — tests go green but don't exercise local Rust changes.

Neither case affects CI. If standalone nx test ever becomes a common workflow, close the gap by switching the Go test targets to nx:run-commands with inline GOFLAGS (bakes the tag into the target config so it applies however the target is invoked) — not direnv/options.env (the latter is dropped by @nx-go/nx-go:test, which forwards only cwd to the spawned go).


Test plan

  • Tag selects the dev bridge (go list -f '{{.CgoFiles}}' in sdks/go): GOFLAGS=-tags=boxlite_devbridge_cgo_dev.go (in-repo sdks/c/include + target/debug/libboxlite.a); no tag → bridge_cgo_prebuilt.go (needs the absent downloaded bundle, i.e. make test:apps fails in dev workflow: libboxlite.a not populated at default-bridge path #579).
  • Env reaches the Nx-spawned go test (unchanged @nx-go/nx-go:test executor): GOFLAGS=-zzz_bogus yarn nx test api-client-gogo: parsing $GOFLAGS: unknown flag -zzz_bogus; GOFLAGS=-tags=boxlite_dev yarn nx test api-client-goSuccessfully ran target test.

@G4614 G4614 marked this pull request as ready for review May 28, 2026 13:42
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.

make test:apps fails in dev workflow: libboxlite.a not populated at default-bridge path

1 participant