Skip to content

Commit acda3dd

Browse files
jp-fizzbeejayaprabhakarclaude
authored
fix(main): report transition-assertion failures on the inbound link (#362)
CheckTransitionInvariants stores its failure metadata on the *inbound link* (node.Inbound[0].FailedInvariants) rather than on the node's Process.FailedInvariants — see processor.go where the write happens. The failure-reporting branch in modelCheckSingleSpec only looked at the Process field, with these wrong consequences: - Simulation mode: a transition-assertion failure fell through to "FAILED: Model checker failed. Deadlock/stuttering detected", which is misleading (deadlock_detection: false in the spec confirms it was not a deadlock). - Model-checking mode: nothing about the failure was printed at all, only the raw trace dump from dumpFailedNode. Now: if the node has no Process.FailedInvariants, check the inbound link. Print "Transition Invariant: <name>" if found. Add a generic "Model checker failed (no failed-invariant metadata...)" fallback for model-checking mode so silence never happens. Reproducer: a spec with a `transition assertion` that the model checker finds violating — previously misreported. Confirmed both modes now print the assertion name (TerminalStatesRemainTerminal in the test spec). Co-authored-by: jayaprabhakar <jayaprabhakar@gmail.com> Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent c8b74c1 commit acda3dd

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

main.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -870,10 +870,21 @@ func modelCheckSingleSpec(f *ast.File, stateConfig *ast.StateSpaceOptions, dirPa
870870

871871
} else if failedNode != nil {
872872
clearProgressLine()
873+
// Always-assertion failures live on the node's Process.FailedInvariants.
874+
// Transition-assertion failures live on the *inbound link* — see
875+
// processor.go where CheckTransitionInvariants writes to
876+
// node.Inbound[0].FailedInvariants. Without checking the link, a
877+
// transition-assertion failure in simulation falls through to the
878+
// misleading "Deadlock/stuttering" message, and in model-checking
879+
// mode nothing about the failure is printed at all.
873880
if failedNode.FailedInvariants != nil && len(failedNode.FailedInvariants) > 0 && len(failedNode.FailedInvariants[0]) > 0 {
874881
fmt.Println("FAILED: Model checker failed. Invariant: ", f.Invariants[failedNode.FailedInvariants[0][0]].Name)
882+
} else if len(failedNode.Inbound) > 0 && failedNode.Inbound[0].FailedInvariants != nil && len(failedNode.Inbound[0].FailedInvariants[0]) > 0 {
883+
fmt.Println("FAILED: Model checker failed. Transition Invariant:", f.Invariants[failedNode.Inbound[0].FailedInvariants[0][0]].Name)
875884
} else if simulation {
876885
fmt.Println("FAILED: Model checker failed. Deadlock/stuttering detected")
886+
} else {
887+
fmt.Println("FAILED: Model checker failed (no failed-invariant metadata on the failing node; see trace below).")
877888
}
878889
if simulation {
879890
fmt.Println("seed:", p1.Seed)

0 commit comments

Comments
 (0)