3.4 Fixtures, pins and embedded files
This covers the shared test data under tests/fixtures/, the switches that may
and may not rewrite it, the source hashes that pin the control ABI, and the rules
for files compiled into the Rust core. Read it before editing a fixture, touching
rust/core/src/ffi.rs, adding a Rust source file, or adding an include_str!.
The fixture tree
tests/fixtures/ holds data that more than one language reads. A suite that only
one implementation needs keeps its data beside that implementation. The tree has
four top-level directories. tests/fixtures/README.md is the index and records
the file formats.
| Directory | What lives there | Main readers |
|---|---|---|
api/ | Cross-binding behavior tables (setlistMessages.json, packSelection.json, wpilibVersionGuard.json, rotationLocks.json, mecanumAimLimit.json and others) and the public API snapshots java.txt, python.txt, cpp.txt | Java, Python and C++ tests; several tables also Rust and the editor |
planning/ | Planner conformance (cases.json), Setlist lowering (mergedOccurrences.json), turn-merge, narrow-turn and unheld-turn cases, packLoad/packDump.txt, interactions/, and archived field packs in fields/ | Rust, Java, Python, C++, the wasm crate and editor tests |
sequencing/ | 22 recorded routes (*.route.json with *.trace.json), routeJoins.json, runWindows.json | Rust replay, the C ABI replay, the Java oracle; join and window tables in every binding |
api/
Each JSON table states one behavior every binding must reproduce. The three binding suites read the same file, so a change in wording or a decision moves all three at once. Some examples, with their readers:
setlistMessages.json: exact refusal texts, read by the Java, Python and C++ Setlist tests and by editor tests.setlistTo.json: theto(target)step of a Setlist, its argument forms, refusals and simulated runs, read bySetlistToTest.java,python/tests/test_setlist_to.pyandcpp/tests/test_setlist_to.cpp.savedCalibration.json: saved calibration files that load and files that are refused, read byMeasuredConfigsTest.java,python/tests/test_measured_limits.py,cpp/tests/test_measured_limits.cppandrust/core/tests/calibration.rs, which checks each case against the core’sMeasuredLimits::from_value.packSelection.json: deploy-folder discovery cases, read byjava/src/test/java/com/tempo/PackSelectionTest.java,python/tests/test_pack_selection.pyandcpp/tests/test_pack_selection.cpp.wpilibVersionGuard.json: the refusal rules and messages for a mismatched WPILib or RobotPy.mecanumAimLimit.json: the aim limiter’s steps. The Rust core writes the expected values (the_aim_limiter_matches_its_parity_fixtureinrust/core/tests/mecanum.rs) and the Java, Python and C++ evaluators replay them.
The *.txt files are API snapshots, covered in API surface tracking.
planning/
planning/cases.json is core-derived. conformance_planner_cases in
rust/core/tests/conformance.rs builds every case in memory and byte-compares it
with the committed file. java/src/test/java/com/tempo/ConformanceTest.java,
python/tests/test_conformance.py and cpp/tests/test_conformance.cpp replay the
same cases on their own platforms with the fixture’s tolerance field. The wasm
crate (rust/wasm/src/lib.rs) does not read the file. It compares its preview
output with freshly computed native trajectories on a few copied obstacle-free
cases.
planning/mergedOccurrences.json lists Setlist runs and the planning input each
lowers to. MergedOccurrenceConformanceTest.java,
python/tests/test_merged_occurrences.py and cpp/tests/test_merged_occurrences.cpp
build and serialize every case.
The remaining files are Rust-owned contracts with an editor reader in some cases:
| File or directory | Reader |
|---|---|
turnMergeIntegration.json, turnMergeMaster.json, trenchDepartureRequest.json | rust/core/tests/turn_merge_time.rs |
narrowTurns/ | rust/core/tests/narrow_turns.rs, rust/wasm/src/lib.rs, gui/web/src/planner/routedPreview.test.ts |
unheldTurns/clipCases.json | rust/core/tests/unheld_turn_clearance.rs |
packLoad/packDump.txt | rust/core/tests/pack_load_identity.rs, editor planner worker tests |
interactions/ | rust/core/tests/differential_aims.rs, rust/core/tests/runtime_replay.rs |
planning/fields/ preserves field geometry that tests depend on, independent of
the bundled pack. tests/fixtures/planning/fields/README.md lists each file’s
contract. rebuilt2026Legacy.toml drives the frozen sequencing traces,
rebuilt2026Field.toml and rebuilt2026Sim.toml feed the core tests and tests/robot/java_sim,
and rebuilt2026FieldCenter.toml is the field-center twin of
rebuilt2026Field.toml. These bytes stay unchanged when the bundled pack changes.
See Game packs.
sequencing/
The traces are the sequencing contract. Each <route>.route.json holds the
lowered segments the Java Composer produced (schema, route, originAlliance,
runtimeAllianceForTrace, startPose, config, avoidZoneMask, segments).
Each <route>.trace.json holds what the host sequencer did with them
(schema tempo.sequencing-trace/v1, durationS, finalPose, phaseChanges,
legChanges, firings, and per-tick t, vx, vy, omega).
Three replays compare against them, discrete facts exactly and floats to 1e-9:
rust/core/tests/sequencing_traces.rsreplays theROUTESlist throughAutoRuntime.every_wrapper_trace_replays_identically_through_the_c_abiin the same file drives the routes through thetempo_auto_*C ABI.java/src/test/java/com/tempo/SequencingTraceOracleTest.javarecords each route through the Java wrapper and JNA and compares it with the file.
Twenty routes replay. The other two pairs, geometric and pathTight, use a
removed controller. frozen_routes_with_removed_control_modes_are_rejected
checks that the core refuses them with an unsupported controller error. File
names are camelCase while the route ids inside are kebab-case
(singleLeg.trace.json holds single-leg).
rust/core/tests/support/sequencing.rs maps one to the other.
routeJoins.json is the connecting-drive decision table. rust/core/src/route_join.rs
cites it, and route_join_cases.rs, route_flow.rs, the wasm crate,
RouteJoinTest.java, SetlistLinksTest.java, python/tests/test_route_joins.py,
cpp/tests/test_composer.cpp and cpp/tests/test_setlist_routes.cpp read it, so
every implementation decides each join the same way. runWindows.json
(tempo.run-windows/v1) is read by the Python and C++ native-hook end-to-end tests
and NativeHooksDirectRunTest.java.
Regeneration switches
Two environment variables name regeneration. They behave differently.
| Variable | Where it is read | Effect |
|---|---|---|
TEMPO_REGEN_FIXTURES | regen_requested and check_or_regen in rust/core/tests/conformance.rs; the_aim_limiter_matches_its_parity_fixture in rust/core/tests/mecanum.rs | With the exact value 1, the test writes the generated bytes instead of comparing. Any other value compares. |
TEMPO_REGEN_TRACES | everyRouteReproducesItsRecordedTrace in SequencingTraceOracleTest.java | Any value fails the run with a message naming the frozen traces. Nothing is written. |
regen_requested accepts only "1". The test
regeneration_switch_requires_the_exact_value_one pins that 0, the empty string,
true and 1 all keep the comparing run, so exporting the variable to turn it
off never rewrites a file.
The planner conformance fixture is the one place where regeneration is the normal update path. After a reviewed core change shifts planner output, run:
TEMPO_REGEN_FIXTURES=1 cargo test --manifest-path rust/Cargo.toml -p tempo-core --test conformance
git diff tests/fixtures/planning/
cargo test --manifest-path rust/Cargo.toml -p tempo-core --test conformanceRead the diff before committing it. Every moved number is a behavior change the
three binding conformance suites will then expect. Commit the fixture with the
change that moved it. The aim-limiter fixture follows the same pattern through
--test mecanum. Hand-maintained tables in api/ and planning/ have no writer,
so edit them by hand for an approved behavior change.
Frozen sequencing traces
The traces were recorded by a host-side sequencer that is not part of the tree.
A re-recording would capture the core sequencer’s own output, and the oracle
would then agree with whatever it is compared against. That is why the Java
oracle refuses TEMPO_REGEN_TRACES and no recorder exists in Rust.
To move a trace:
- Make the sequencing change and run
cargo test --manifest-path rust/Cargo.toml -p tempo-core --test sequencing_traces. The suite reports every diverging route with its first differing field. - Confirm each divergence is the behavior the change intends. A route that moves for an unexplained reason is a bug.
- Edit the affected
*.trace.json(and*.route.json, if lowering changed) by hand. Keep the JSON layout and key order. - Rerun the Rust suite, then the Java oracle (
cd java && sh gradlew test). - Commit the edit in a commit whose message names the behavior that moved.
A missing trace fails the Java oracle with a message to restore it from git
history. The traces load tests/fixtures/planning/fields/rebuilt2026Legacy.toml,
so that pack is frozen with them.
The wasm source fingerprint
rust/wasm/build.rs folds FIXED_INPUTS (the Cargo manifests and config,
rust/wasm/Cargo.lock, build.rs itself) and every entry of
rust/wasm/conformanceSources.txt into a 64-bit FNV-1a fingerprint, exposed as
TEMPO_WASM_CONFORMANCE_SOURCE_FINGERPRINT and the conformance_source_fingerprint
export under the conformance feature. verify_fingerprint_vectors fixes the
framing with four test vectors. No tracked file holds an expected value for the
fingerprint and no tracked test compares one. No procedure here re-pins it.
Leave the vectors, the framing, FIXED_INPUTS and SOURCE_ROOTS alone as part
of a source change.
Embedded files
Rust include_str!, include_bytes! and include! read their targets at compile
time, so a missing target breaks a clean clone. The rules are:
- Every embedded target is a file git tracks. An ignored or untracked target compiles locally and fails everywhere else.
- Existing embed sites stay embeds. Converting one to a runtime read changes what the binary was built from and is a separate decision.
- Source-text invariants and bytes compared with compiled hashes must describe the same content the binary was built from.
Before pushing a change that adds an embed or moves an embedded file, check
that git ls-files <target> lists each target and that a clean clone of the
branch builds.
The bundled game packs follow the same rule through a different tool.
tools/packs/sync-bundled-pack.py refuses to generate embedded copies of a TOML that
is not yet tracked. See Game packs.
API surface tracking
tests/fixtures/api/java.txt, python.txt and cpp.txt list the public
declarations of each wrapper, one per line, sorted. The maintainers’ extractor
reads public declarations under java/src/main/java/com/tempo/ (minus
com/tempo/internal), public names and __all__ of every public module under
python/tempo/, and declarations in cpp/include/tempo/ outside
namespace detail and private or protected sections, and regenerates the
snapshots for an approved API change. Formatting churn in a tracked declaration
is a legitimate regeneration. Generated code shows up here too. Registering a
game pack adds a factory such as GamePacks.REBUILT_2026() to java.txt and
cpp.txt and changes all()’s array size in cpp.txt. The test suites compile
and test the wrappers but do not compare these snapshots (see
Pins and surfaces).
Checklist by change
| Change | Run | Expect to edit |
|---|---|---|
| Core change that moves planner output | TEMPO_REGEN_FIXTURES=1 ... --test conformance, then the binding conformance suites | tests/fixtures/planning/cases.json |
| Sequencing behavior change | --test sequencing_traces, Java oracle | Trace JSON, by hand |
| New Rust source file | wasm build | rust/wasm/conformanceSources.txt |
New include_str! target | git ls-files <target> | git add the target first |
| Public wrapper API change | the binding suites | tests/fixtures/api/*.txt, regenerated by the maintainers |