Specification recovery (#2404) reads a scenario's steps only when the value is constructed inline. When the object is built in Establish and held in a field, the step cannot be read and the whole scenario is skipped with SP0039.
The shapes that lose scenarios:
// the read model is a field, assigned in Establish
Scenario.Given.ForEventSource(id).ReadModel(TargetUser);
// the command is a field
Scenario.Execute(_command);
Measured on a real production application: 77 scenarios are lost this way, out of 643 candidates — the single largest remaining category, ahead of conditional givens (54).
Suggested direction
Follow a field or local one hop: when a step's argument is a reference to a field, property or local of the specification class, find its assignment and read the object construction there, subject to exactly the same discipline that applies inline — constants and command-input references only, nothing computed, nothing conditional.
Deliberately not general dataflow. One hop to a single unconditional assignment covers the shape above; anything with more than one assignment, or an assignment under a branch, should stay unreadable and keep reporting SP0039. The existing rule that a conditional step takes the whole scenario with it must continue to hold — a scenario stating a world nobody specified is worse than a scenario that is honestly skipped.
Acceptance
The two shapes above are recovered; a field assigned in more than one place, or under a condition, still reports SP0039; the count of recovered specifications on the reference application rises by roughly 77; the document still reads back clean under the Screenplay compiler; generation stays deterministic.
Related: #2404, where this limit was measured and deliberately left open.
Specification recovery (#2404) reads a scenario's steps only when the value is constructed inline. When the object is built in
Establishand held in a field, the step cannot be read and the whole scenario is skipped withSP0039.The shapes that lose scenarios:
Measured on a real production application: 77 scenarios are lost this way, out of 643 candidates — the single largest remaining category, ahead of conditional givens (54).
Suggested direction
Follow a field or local one hop: when a step's argument is a reference to a field, property or local of the specification class, find its assignment and read the object construction there, subject to exactly the same discipline that applies inline — constants and command-input references only, nothing computed, nothing conditional.
Deliberately not general dataflow. One hop to a single unconditional assignment covers the shape above; anything with more than one assignment, or an assignment under a branch, should stay unreadable and keep reporting
SP0039. The existing rule that a conditional step takes the whole scenario with it must continue to hold — a scenario stating a world nobody specified is worse than a scenario that is honestly skipped.Acceptance
The two shapes above are recovered; a field assigned in more than one place, or under a condition, still reports
SP0039; the count of recovered specifications on the reference application rises by roughly 77; the document still reads back clean under the Screenplay compiler; generation stays deterministic.Related: #2404, where this limit was measured and deliberately left open.