Repository navigation
Description
Audited on master at 5630d74ec9cd912d4e2f325349f1943cbc15bcc6. This is a scoped implementation item under #147, based on the typed control/dataflow/effect audit. Proposed syntax below is illustrative unless explicitly marked as a current reproducer.
Problem and current evidence
nlsc/schema.py:149–217 uses user step numbers as graph keys, silently stops if no node is ready, and derives FSM transitions only from data dependencies. nlsc/graph.py:185–217 sometimes adds a sequential fallback when no dependency transitions exist, so the meaning of the displayed FSM changes with the shape of the value graph.
Current reproducer:
@module duplicate_step
[probe]
PURPOSE: Expose graph identity collision
LOGIC:
1. x = 1
1. y = x + 1
RETURNS: y
The parser retains both statements and Python returns 2. Validation succeeds, but parallel_groups() returns []: the second step overwrites the first in the dictionary and then depends on its own key.
Implementation hints
- Reject duplicate source step numbers with both source locations, or introduce distinct internal node IDs and explicitly define whether duplicate display numbers are legal. Do not silently collapse nodes.
- Validate referenced nodes, value-dependency cycles, and complete traversal. Return structured errors instead of a successful partial schedule.
- Keep data edges, source execution/control edges, and later effect-order edges separate. Cycles in an explicit loop/control graph are legitimate; cycles in an acyclic value scheduling region are not.
- Preserve named LOGIC states as source labels. Derive real fallthrough/branch/back edges from the control representation when available; do not infer transition semantics from whe 8000 ther values happen to be shared.
- Update existing graph APIs compatibly and document whether a view is value dependency, source order, or explicit control.
Acceptance criteria
- Duplicate-step input cannot validate successfully while losing graph nodes.
- Dangling references/cycles in programmatically constructed value graphs produce deterministic diagnostics.
- Every valid step appears exactly once in a complete dependency layering.
- Intervening effect-only steps remain present in a control-flow view even when they introduce no value dependency.
- Conditional edges carry their conditions; explicit loop back edges are represented without claiming a value DAG is cyclic.
- Graph tests cover both dependencies and actual execution paths.
Related: #2/#3 established the current annotations; #86 is an FSM backlog item. This issue fixes graph integrity and meaning, rather than adding another visualization package.
Implementation ordering
Can begin immediately; integrate with the checked IR work under #147. Add the regression fixtures before implementation.
Activity