Skip to content

docs(wg): harden the end-state into the consolidation program directory #19

docs(wg): harden the end-state into the consolidation program directory

docs(wg): harden the end-state into the consolidation program directory #19

# -----------------------------------------------------------------
# Freshness check for committed FlatBuffers bindings
# -----------------------------------------------------------------
#
# Why this exists
# ---------------
# The Rust FlatBuffers bindings (`crates/grida/src/io/generated/grida.rs`)
# are committed to git so that `cargo build` works from a clean checkout without
# requiring `flatc`. However, because the file is generated from `format/grida.fbs`,
# it can become stale if someone edits the schema but forgets to regenerate.
#
# This workflow re-runs codegen and asserts that the committed file is identical
# to what `flatc` would produce. If it differs, the check fails with a clear
# error message telling the contributor how to fix it.
#
# (Recreated at the engine migration: the TS-bindings half of this check stayed
# in gridaco/grida as a frozen tombstone with its generator deleted — the Rust
# side here is the schema's only living consumer.)
#
# How to fix a failure
# --------------------
# python3 bin/activate-flatc -- --rust -o crates/grida/src/io/generated format/grida.fbs && mv crates/grida/src/io/generated/grida_generated.rs crates/grida/src/io/generated/grida.rs
# git add crates/grida/src/io/generated/grida.rs
# git commit
# -----------------------------------------------------------------
name: check generated flatbuffers
on:
push:
branches:
- main
pull_request:
paths:
- "format/grida.fbs"
- "crates/grida/src/io/generated/**"
- "bin/activate-flatc"
jobs:
rust-bindings:
name: rust fbs freshness
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Regenerate Rust FlatBuffers bindings
run: |
python3 bin/activate-flatc -- --rust \
-o crates/grida/src/io/generated \
format/grida.fbs
mv crates/grida/src/io/generated/grida_generated.rs \
crates/grida/src/io/generated/grida.rs
- name: Check for uncommitted changes
run: |
if ! git diff --exit-code crates/grida/src/io/generated/grida.rs; then
echo "::error::Generated Rust FlatBuffers bindings are stale. Regenerate with bin/activate-flatc (see the workflow header) and commit the result."
exit 1
fi