Commit Graph
7 Commits
Author SHA1 Message Date
spark cdf6828fe0 beam: Q61 -- materialise each dependency iterable once, resolve the module locally, drop the dead first pass
topo_sort read graph.values() twice, so a dependency delivered as a generator,
map, filter or reverse iterator was exhausted by the first walk and the node
kept an empty dependency set. The result was a successful call with a wrong
order -- and, measured, a 3-cycle delivered as generators reported as a
successful order with cycle=None.

Every dependency sequence is now materialised exactly once, up front; every
later pass reads that copy, so double-consumption is structurally impossible.
Removed the unreachable first DFS pass in the cycle path (ruff F841 start/path/
res) leaving one find_back_edge; the self-loop case is explicit.

test_toposort.py resolved the module from /root/.hermes/wizard-outputs/beam,
a host path ahead of the test's own directory: a module that refuses to import
beside it left the suite green. It now resolves from Path(__file__).parent and
asserts the imported file's identity. 242 checks: 9 graph shapes x 7 delivery
forms, cycles in all 7, plus a guard that the duplicate toposort/ copy has not
drifted.

Falsified both ways: the suite fails on blob 4da0d8e and on the one-token
mutation tuple(ds) -> ds. CHECK rc 0 (85 unittests OK), verify.py 8/8.
2026-10-24 16:14:24 +00:00
beam a066bfcaab beam: toposort handle None deps as empty 2026-10-24 03:28:55 +00:00
beam a960d5a700 beam: fix hardcoded sys.path in test_lcs/toposort + make merge_intervals discoverable 2026-10-23 15:13:46 +00:00
beam f605e513e0 beam: fix _key mixed-tuple crash in toposort modules (sortable wrapper) 2026-10-23 00:55:57 +00:00
beam 25aaeec39e beam: make toposort _key robust to unorderable node types 2026-10-22 00:29:17 +00:00
beam 972f917f26 beam: fix mixed-type node crash in toposort ready-queue sort 2026-10-21 22:23:27 +00:00
beam faae75aadc beam: deterministic topological sort with cycle-path reporting + tests 2026-10-21 14:15:28 +00:00