DAG: expose deterministic recompute levels

This commit is contained in:
2026-08-02 17:42:10 -04:00
parent a4b9d04ff4
commit ed5b1f3b67
4 changed files with 15 additions and 2 deletions

View File

@@ -240,9 +240,12 @@ test('dependency graph propagates dirty state and orders dependencies', () => {
const plan = graph.plan(['pad'])
assert.deepEqual(plan.cycles, [])
assert.deepEqual(plan.order, ['pad', 'pocket', 'fillet', 'body'])
assert.deepEqual(plan.levels, [['pad'], ['pocket'], ['fillet'], ['body']])
assert.deepEqual(plan.affected, ['pad', 'pocket', 'fillet', 'body'])
graph.addEdge({ sourceId: 'pad', targetId: 'body', relation: 'expression' })
assert.deepEqual(graph.findCycles(new Set(['pad', 'pocket', 'fillet', 'body'])), [['pad', 'pocket', 'fillet', 'body']])
const branched = new DependencyGraph([{ sourceId: 'left', targetId: 'root', relation: 'link' }, { sourceId: 'right', targetId: 'root', relation: 'link' }], ['root', 'left', 'right'])
assert.deepEqual(branched.plan(['root']).levels, [['root'], ['left', 'right']])
})
test('generation-aware recompute cancels an older run before accepting its result', async () => {