Repository navigation
fix(validate): read the spec doc at runtime in the error-code test (fixes Nix channel) - #1659
Merged
Merged
Conversation
error_codes_documented_in_spec used include_str! on spec/core/validation.md — a workspace-root file OUTSIDE the crate, so it is not packaged to crates.io. Building the PUBLISHED crate's tests (as the Nix release channel does) failed to compile: 'couldn't read ../../../spec/core/validation.md: No such file or directory'. This broke the Test Nix release channel across the 0.17.x releases. Read the spec at runtime relative to CARGO_MANIFEST_DIR and skip gracefully when it is absent (the published-crate case), instead of include_str! at compile time. The drift guard still runs in the workspace (where the spec is present); it is a test-only change — no shipped artifact (library, binary, or component) is affected. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the rustledger-validate error-code drift-guard test so it no longer depends on include_str!() for a workspace-root spec file that isn’t present in published-crate builds (fixing Nix channel failures when running tests from crates.io sources).
Changes:
- Switches the spec lookup from compile-time
include_str!()to runtime file IO relative toCARGO_MANIFEST_DIR. - Gracefully skips the drift-guard test when the spec file is absent (published crate / Nix channel scenario).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Contributor
📊 Benchmark Results
vs main branch (2026-06-30)
What do these numbers mean?
|
Contributor
✅ Compatibility Test Results
What's tested
Full results available in workflow artifacts |
Merged
robcohen
added a commit
that referenced
this pull request
Jul 1, 2026
Patch release: fix the Nix release-channel build by reading the validation spec at runtime instead of include_str! on a non-packaged workspace-root file (#1659). Test-only fix; no library/binary/component behavior change. Workspace 0.17.2 -> 0.17.3 (cargo set-version); packages/mcp-server bumped to match. Co-authored-by: Claude Opus 4.8 <[email protected]>
robcohen
added a commit
that referenced
this pull request
Jul 2, 2026
…1685) * test(core): behavior-replay conformance against the TLA+ model (MBT) The specs bounds are tiny (Conservation: 207 states / 678 transitions), so TLC can enumerate the COMPLETE state graph. New model-based-testing layer: - scripts/tla-behaviors.py: TLC -dump dot,actionlabels state graph -> edge-coverage behavior corpus (one behavior per transition = shortest canonical path to the source state + the transition). Output is canonical (content-derived ordering, no node ids), so regeneration is byte-stable regardless of TLC dump order. --self-test included. - spec/tla/behaviors/Conservation.json: the committed corpus (678 behaviors covering all 678 transitions). - tests/tla_behavior_replay.rs: replays EVERY behavior against the real Inventory, asserting after each step (a) the abstraction — units == spec inventory, harness accumulators == totalAdded/totalReduced — and (b) enabledness: a model-enabled Reduce may not Err. Hermetic (no Java/TLC in cargo test); graceful skip when spec/ is not packaged (published-crate / crane builds, the #1659 lesson). - tla.yml: lockstep guard — regenerates the corpus from the spec and fails on drift, so the replay test can never silently certify against a stale model. - RUST_MAPPING.md: documents the layer and how to extend it to more specs. Exhaustive conformance up to the model bound: strictly stronger than the sampled tla_proptest properties, one notch below a refinement proof. Co-Authored-By: Claude Opus 4.8 <[email protected]> * fix(tla-behaviors): derive actions from state deltas — TLC-version-agnostic edge parsing The PR's own lockstep guard caught the exact failure mode it exists for: CI's tla2tools (1.8.0) emits dot edges the 1.7.4-tuned label regex didn't match, so CI regenerated a corpus with 207 states but ZERO transitions and the byte-diff failed. Fixes: - Edge regex matches any 'id -> id' line; the action label is optional decoration. Semantics are DERIVED from the state delta (totalAdded grew -> Add, totalReduced grew -> Reduce), so committed corpus and CI regeneration agree regardless of TLC's dot dialect. - The generator now REFUSES to emit a vacuous corpus (states without transitions = parse failure, hard error instead of a garbage diff). - Stutter self-loops (emitted by some TLC versions) are skipped, and coverage.transitions counts only semantic edges, keeping the byte-diff stable across versions. - Self-test extended: stripping all action labels must produce the identical corpus. Committed corpus regenerated with the new derivation: byte-identical (678 behaviors / 678 transitions), confirming the change is purely parsing. Co-Authored-By: Claude Opus 4.8 <[email protected]> --------- Co-authored-by: Claude Opus 4.8 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the
Test Nixrelease-channel failure (surfaced verifying the v0.17.2 channel run).Root cause
rustledger-validate'serror_codes_documented_in_spectest did:That reaches the workspace-root
spec/dir, outside the crate, so it isn't packaged to crates.io. When the Nix channel builds and tests the published crate, the test module fails to compile:It's a
#[cfg(test)]test, so it never affected the library/binary/component or normalcargo installconsumers — only test builds of the published crate (Nix,cargo testfrom crates.io). It's been red on Nix across the 0.17.x releases.Fix
Read the spec at runtime relative to
CARGO_MANIFEST_DIR, and skip gracefully when it's absent (the published-crate case), instead ofinclude_str!at compile time. The drift guard still runs in the workspace (spec present) — verified passing here.Test-only change; no shipped artifact changes. Verified: the test passes in-workspace, clippy
-D warnings+ fmt clean.🤖 Generated with Claude Code