Commit 478ca2a
committed
contract(class_view): add compute_dag_topo_order — the recompute ORDER, not just the acyclic gate
Inc 0 landed `compute_dag_is_acyclic` (the registry-build cycle gate). The
sheet/cascade harness (probe-excel-compute-dag-v1 Inc 2) needs the actual
topological recompute ORDER: edit a cell → recompute its transitive dependents
in an order where each target follows everything it depends on.
`compute_dag_topo_order(edges) -> Option<Vec<u8>>` is Kahn over the same 64-bit
field masks (allocation = one Vec of the ≤64 target positions). Returns the
target positions in a valid recompute order; `None` on a cycle (mirroring
`compute_dag_is_acyclic == false`). Leaves (positions only ever read, never a
target) are excluded — they are the already-present values a recompute reads.
This is the same structure Stockfish NNUE proves at world-champion strength:
"only small input changes between neighboring positions → incrementally update
the affected accumulator dependents in dependency order." Re-derivation, not
invention.
Tests: chain (f0→f1→f2, f1 before f2), diamond (both precedents before the
join), empty (Some(vec![]) not None), cycle (None). 13/13 class_view green,
clippy clean.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CcpLeEC3XK8Eye53GKBVvi1 parent 82ce4c3 commit 478ca2a
1 file changed
Lines changed: 103 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
211 | 211 | | |
212 | 212 | | |
213 | 213 | | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
214 | 265 | | |
215 | 266 | | |
216 | 267 | | |
| |||
503 | 554 | | |
504 | 555 | | |
505 | 556 | | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
506 | 609 | | |
507 | 610 | | |
508 | 611 | | |
| |||
0 commit comments