fix(build): keep the index tools free of the Wails application

The v3 migration put application.Get() in backend/events and a
ServiceStartup hook in backend/explore, both of which cmd/indexbuild
reaches. v3's application package is GTK/WebKit bindings on Linux, so
the index-artifact job — a plain golang container with CGO_ENABLED=0,
on the stated grounds that neither command imports the app — stopped
compiling with "undefined: pointer". That job owns the ~205 GB dump
checkpoint, so it is the worst place to learn this.

Both are behind the indexbuild tag now: the one app.Event.Emit lives in
runtime_wails.go, runtime_indexbuild.go answers ErrNoRuntime (what the
app itself returns before Run, so Deliver's callers need no second
path), and explore's ServiceStartup moves to its own tagged file.

TestIndexToolsDoNotImportWails walks `go list -deps -tags indexbuild`
so the claim the workflow makes is checked rather than assumed.
This commit is contained in:
2026-08-16 14:51:01 -04:00
parent dd17a4d8eb
commit b98840ee37
9 changed files with 173 additions and 31 deletions
+3 -14
View File
@@ -4,8 +4,6 @@ import (
"context"
"errors"
"log/slog"
"github.com/wailsapp/wails/v3/pkg/application"
)
// ErrNoRuntime is returned by Deliver when there is neither a test Sink
@@ -82,16 +80,7 @@ func Deliver(ctx context.Context, name string, data ...any) error {
}
}
// application.Get() returns nil when no app is running — under test,
// before Run, and after shutdown. It does not terminate the
// process, which is what the v2 probe of the private "events"
// context key existed to avoid.
app := application.Get()
if app == nil {
return ErrNoRuntime
}
app.Event.Emit(name, data...)
return nil
// emitRuntime is the only place the Wails application is touched,
// and it is behind a build tag: see runtime_wails.go.
return emitRuntime(name, data...)
}