CI: fail the build when generated TypeScript bindings are stale #8

Open
opened 2026-08-07 12:39:55 +00:00 by grenade · 0 comments
Owner

Goal

dashboard/src/api/generated/ is written by ts-rs during
cargo test -p tireless-entities and committed. Nothing verifies the committed
files match the Rust types, so a change to a domain type can land with stale
bindings and the dashboard compiles against a type that no longer exists.

This already nearly happened: adding JobKind::Discover and two label fields
changed three generated files, and only a manual cargo test regenerated them.

Make the drift a build failure.

Files

  • .gitea/workflows/deploy.yaml — add the check after the test step

Steps

  1. After cargo test --workspace, run git diff --exit-code dashboard/src/api/generated.
  2. Make the failure message say what to do — run cargo test -p tireless-entities
    and commit the result — rather than leaving a bare diff.
  3. Confirm the check passes on a clean tree and fails when a domain type is
    changed without regenerating.

Acceptance

  • git diff --exit-code dashboard/src/api/generated exits zero on a clean
    checkout after cargo test --workspace.
  • Deliberately editing a generated file and re-running the check exits non-zero.
  • cargo test --workspace still passes.

Out of scope

  • Moving generation to a build script or removing the committed files. They are
    committed on purpose so the dashboard builds without a Rust toolchain.
  • Changing TS_RS_EXPORT_DIR or anything in .cargo/config.toml.
  • Any change to the domain types themselves.
## Goal `dashboard/src/api/generated/` is written by ts-rs during `cargo test -p tireless-entities` and committed. Nothing verifies the committed files match the Rust types, so a change to a domain type can land with stale bindings and the dashboard compiles against a type that no longer exists. This already nearly happened: adding `JobKind::Discover` and two label fields changed three generated files, and only a manual `cargo test` regenerated them. Make the drift a build failure. ## Files - `.gitea/workflows/deploy.yaml` — add the check after the test step ## Steps 1. After `cargo test --workspace`, run `git diff --exit-code dashboard/src/api/generated`. 2. Make the failure message say what to do — run `cargo test -p tireless-entities` and commit the result — rather than leaving a bare diff. 3. Confirm the check passes on a clean tree and fails when a domain type is changed without regenerating. ## Acceptance - `git diff --exit-code dashboard/src/api/generated` exits zero on a clean checkout after `cargo test --workspace`. - Deliberately editing a generated file and re-running the check exits non-zero. - `cargo test --workspace` still passes. ## Out of scope - Moving generation to a build script or removing the committed files. They are committed on purpose so the dashboard builds without a Rust toolchain. - Changing `TS_RS_EXPORT_DIR` or anything in `.cargo/config.toml`. - Any change to the domain types themselves.
grenade added the tireless/implement label 2026-08-07 12:40:57 +00:00
Sign in to join this conversation.