You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Faults() with several starts reports a fault as uncaught when only another start can trigger it #35
EntitySpec.Faults() throws when an entity has several starts and a declared fault can only fire from one of them. The fault is caught from the start where it can happen, but it reads as uncaught from the others.
What happened
A payment has two kinds, card and invoice, and some operations only apply to one kind. The spec is given one start of each kind with .From(card, invoice). It declares a fault for each kind, such as "Charge charges an invoice" and "Capture forgets the receipt". Faults() fails with:
No requirement detects these faults: Charge charges an invoice, SendInvoice loses the number, MarkPaid reopens
Swapping the order to .From(invoice, card) makes the other kind's faults the uncaught ones. Every fault is caught when the spec has a single start.
Cause
EntitySpec.Faults (src/Nullean.Entities.CsCheck/EntitySpec.cs, around line 370) loops over Starts() and calls Build(start, autoFaults: true).Spec.Faults(..., throwOnUncaught: ...) once per start. It throws on the first start that does not catch every fault, including faults that start never triggers.
What would you like instead
A declared fault counts as caught when any start catches it, and the run fails only for a fault that no start catches. A fault that never fires from any start would ideally be reported as such ("never triggered"), not as "uncaught".
Workaround
One spec per start, each with only the faults that start can reach.
Reproduced and fixed in #104. EntitySpec.Faults()/SampleFaults() let CsCheck throw on uncaught faults separately for each start, so a fault only one start can trigger (the other start never reaches the state) failed the run even though another start caught it. Now all starts run first, and it throws only for faults uncaught from every start. The new test failed before the fix with No requirement detects these faults. I ran it on net10.0 only.
Activity
Mpdreamz commentedon Nov 19, 2026
Reproduced and fixed in #104.
EntitySpec.Faults()/SampleFaults()let CsCheck throw on uncaught faults separately for each start, so a fault only one start can trigger (the other start never reaches the state) failed the run even though another start caught it. Now all starts run first, and it throws only for faults uncaught from every start. The new test failed before the fix withNo requirement detects these faults. I ran it on net10.0 only.