# Flatbuffers schemas

## Pinned flatc version

The committed bindings — Go under `<schema>/` and TS under
`ui/frontend/src/proto/galaxy/fbs/` — and the flatbuffers runtimes
(`github.com/google/flatbuffers` in the Go modules, `flatbuffers` in
`ui/frontend/package.json`) are all on **flatc 25.9.23**. Regenerate
only with that exact version: a different flatc silently churns output
and can flip nullable-scalar wire defaults (`= null` builder slots
switch between the presence-preserving `null` form and the value-omitting
`0` form). The `fbs-go` / `fbs-ts` targets refuse to run on a mismatch,
and the `fbs-codegen` CI workflow fails if the committed bindings differ
from a pinned-flatc regeneration.

Distro packages are too old (e.g. Debian trixie ships `flatbuffers-compiler`
23.5.26). Install the pinned binary from the release page:
<https://github.com/google/flatbuffers/releases/tag/v25.9.23>.

## Generating sources

Regenerate both sides with the pinned `flatc` on `PATH`:

```shell
make -C pkg/schema/fbs fbs-go   # Go bindings into pkg/schema/fbs/<schema>/
make -C ui fbs-ts               # TS bindings into ui/frontend/src/proto/galaxy/fbs/
```

`fbs-go` runs, for every schema in this directory:

```shell
flatc --go --go-module-name galaxy/schema/fbs {file}.fbs
```

The `--go-module-name` flag rewrites cross-namespace imports to the
fully-qualified module path (e.g. `common "galaxy/schema/fbs/common"`)
so the generated code links inside this Go module without local
replace directives. Omitting the flag yields imports such as
`common "common"` which fail to resolve.
