journal + determinism tests + Creusot verification scaffolding

Phase 1 — semantics doc
  docs/002. hsmc-semantics-formal.md

Phase 2 — deterministic execution journal
  hsmc/src/journal.rs (TraceEvent, JournalSink, ActionKind)
  hsmc-macros: __chart_journal! emission at every observable site
    (entry/exit/action/transition/timer arm-cancel-fire/during/emit/
    event delivery/terminate). Per-state during count helpers, stable
    chart-hash via FNV-1a. Action observation moved out of run_action
    and into call sites so ActionKind is accurate.
  Public API on the generated machine: journal(), take_journal(),
    clear_journal(), CHART_HASH.

Phase 3 — verification crate (Creusot scaffolding)
  verification/{Cargo.toml,mise.toml,requirements.txt,INVARIANTS.md}
  verification/src/{event_queue.rs,timer_table.rs} — Pearlite
    contracts on simplified mirrors of the runtime types. cargo
    creusot generates Coma IR cleanly; VCs not yet discharged.
  Correspondence tests drive the verified mirror and the runtime
    type with the same op sequences and assert observable parity.

Tests — 113 deterministic-flow tests across 22 files. Each compares a
  hand-built expected journal byte-for-byte against actual, anchored
  to a spec section: initial entry, lateral/self/up transitions,
  bubbling, timers, emit, ordering, durings, step/dispatch
  equivalence, root-targeting, current_state, termination.

Tooling — mise.toml (root): stable Rust + cargo subcommands.
  verification/mise.toml: pinned nightly-2025-11-13 + opam + python
  venv + uv. just verify is fully self-installing.

Bug fix — root state targetable by the chart's own name (e.g.
  `on(Trig) => ChartName;`) per spec §"How transitions work".

CHART_HASH — stable FNV-1a fingerprint over the chart's structural
  definition; mismatch on replay = different chart.
This commit is contained in:
swaits committed 2026-04-27 20:15:05 -06:00
1 parent 4d7baf7236
commit 081bd28cca
55 files changed
+6476 -151

No files matched your search

@@ -3,15 +3,3 @@ error: field `a` listed twice in `during: tick(...)` — each field can only be
|
19 | during: tick(a, a);
| ^
error[E0405]: cannot find trait `MActions` in this scope
--> tests/ui/t10_1_during_duplicate_field.rs:26:6
|
26 | impl MActions for MActionContext<'_> {}
| ^^^^^^^^ not found in this scope
error[E0425]: cannot find type `MActionContext` in this scope
--> tests/ui/t10_1_during_duplicate_field.rs:26:19
|
26 | impl MActions for MActionContext<'_> {}
| ^^^^^^^^^^^^^^ not found in this scope
@@ -3,15 +3,3 @@ error: field `a` is borrowed by two concurrent durings on state `S` (`one` and `
|
21 | during: two(a);
| ^
error[E0405]: cannot find trait `MActions` in this scope
--> tests/ui/t10_2_during_overlap_same_state.rs:29:6
|
29 | impl MActions for MActionContext<'_> {}
| ^^^^^^^^ not found in this scope
error[E0425]: cannot find type `MActionContext` in this scope
--> tests/ui/t10_2_during_overlap_same_state.rs:29:19
|
29 | impl MActions for MActionContext<'_> {}
| ^^^^^^^^^^^^^^ not found in this scope
@@ -4,18 +4,6 @@ error: duplicate transition on trigger `Go` in state `Red`
15 | on(Go) => Yellow;
| ^^
error[E0405]: cannot find trait `MActions` in this scope
--> tests/ui/t9_1_duplicate_transition.rs:22:6
|
22 | impl MActions for MActionContext<'_> {
| ^^^^^^^^ not found in this scope
error[E0425]: cannot find type `MActionContext` in this scope
--> tests/ui/t9_1_duplicate_transition.rs:22:19
|
22 | impl MActions for MActionContext<'_> {
| ^^^^^^^^^^^^^^ not found in this scope
warning: unused import: `Duration`
--> tests/ui/t9_1_duplicate_transition.rs:1:24
|
@@ -3,15 +3,3 @@ error: state `Parent` has children but no `default` declaration
|
13 | state Parent {
| ^^^^^^
error[E0405]: cannot find trait `MActions` in this scope
--> tests/ui/t9_2_missing_default.rs:20:6
|
20 | impl MActions for MActionContext<'_> {
| ^^^^^^^^ not found in this scope
error[E0425]: cannot find type `MActionContext` in this scope
--> tests/ui/t9_2_missing_default.rs:20:19
|
20 | impl MActions for MActionContext<'_> {
| ^^^^^^^^^^^^^^ not found in this scope
@@ -3,15 +3,3 @@ error: `terminate` is only valid at the root level
|
14 | terminate(Halt);
| ^^^^^^^^^
error[E0405]: cannot find trait `MActions` in this scope
--> tests/ui/t9_3_terminate_in_child.rs:20:6
|
20 | impl MActions for MActionContext<'_> {
| ^^^^^^^^ not found in this scope
error[E0425]: cannot find type `MActionContext` in this scope
--> tests/ui/t9_3_terminate_in_child.rs:20:19
|
20 | impl MActions for MActionContext<'_> {
| ^^^^^^^^^^^^^^ not found in this scope
@@ -3,15 +3,3 @@ error: `default(Cousin)` in state `Parent`: `Cousin` is not a direct child of `P
|
14 | default(Cousin);
| ^^^^^^^
error[E0405]: cannot find trait `MActions` in this scope
--> tests/ui/t9_4_default_non_child.rs:21:6
|
21 | impl MActions for MActionContext<'_> {
| ^^^^^^^^ not found in this scope
error[E0425]: cannot find type `MActionContext` in this scope
--> tests/ui/t9_4_default_non_child.rs:21:19
|
21 | impl MActions for MActionContext<'_> {
| ^^^^^^^^^^^^^^ not found in this scope
@@ -3,15 +3,3 @@ error: `default` in state `Leaf` which has no child states
|
14 | default(Ghost);
| ^^^^^^^
error[E0405]: cannot find trait `MActions` in this scope
--> tests/ui/t9_5_default_childless.rs:20:6
|
20 | impl MActions for MActionContext<'_> {
| ^^^^^^^^ not found in this scope
error[E0425]: cannot find type `MActionContext` in this scope
--> tests/ui/t9_5_default_childless.rs:20:19
|
20 | impl MActions for MActionContext<'_> {
| ^^^^^^^^^^^^^^ not found in this scope
@@ -3,15 +3,3 @@ error: empty state `Empty`
|
14 | state Empty {}
| ^^^^^
error[E0405]: cannot find trait `MActions` in this scope
--> tests/ui/t9_6_empty_state.rs:18:6
|
18 | impl MActions for MActionContext<'_> {
| ^^^^^^^^ not found in this scope
error[E0425]: cannot find type `MActionContext` in this scope
--> tests/ui/t9_6_empty_state.rs:18:19
|
18 | impl MActions for MActionContext<'_> {
| ^^^^^^^^^^^^^^ not found in this scope
@@ -3,15 +3,3 @@ error: multiple `default` declarations in state `Parent`
|
14 | default(A);
| ^^^^^^^
error[E0405]: cannot find trait `MActions` in this scope
--> tests/ui/t9_7_duplicate_default.rs:22:6
|
22 | impl MActions for MActionContext<'_> {
| ^^^^^^^^ not found in this scope
error[E0425]: cannot find type `MActionContext` in this scope
--> tests/ui/t9_7_duplicate_default.rs:22:19
|
22 | impl MActions for MActionContext<'_> {
| ^^^^^^^^^^^^^^ not found in this scope
@@ -35,6 +35,24 @@ warning: unexpected `cfg` condition value: `embassy`
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
= note: this warning originates in the macro `statechart` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: unexpected `cfg` condition value: `journal`
--> tests/ui/t9_8_unknown_target.rs:8:1
|
8 | / statechart! {
9 | | M {
10 | | context: Ctx;
11 | | events: Ev;
... |
17 | | }
| |_^
|
= note: no expected values for `feature`
= note: using a cfg inside a macro will use the cfgs from the destination crate and not the ones from the defining crate
= help: try referring to `statechart` crate for guidance on how handle this unexpected cfg
= help: the macro `statechart` may come from an old version of the `hsmc_macros` crate, try updating your dependency with `cargo update -p hsmc_macros`
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
= note: this warning originates in the macro `statechart` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0046]: not all trait items implemented, missing: `NonExistent`
--> tests/ui/t9_8_unknown_target.rs:19:1
|
@@ -3,15 +3,3 @@ error: multiple `terminate` declarations
|
13 | terminate(Halt);
| ^^^^^^^^^
error[E0405]: cannot find trait `MActions` in this scope
--> tests/ui/t9_9_multiple_terminate.rs:19:6
|
19 | impl MActions for MActionContext<'_> {
| ^^^^^^^^ not found in this scope
error[E0425]: cannot find type `MActionContext` in this scope
--> tests/ui/t9_9_multiple_terminate.rs:19:19
|
19 | impl MActions for MActionContext<'_> {
| ^^^^^^^^^^^^^^ not found in this scope