artdag: Phase 3 Plan — topological batches + parallelism cap + dirty plan + 18 tests
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 1m0s

plan.sx schedules a dag into Kahn-wave batches (parallel-safe), splits waves
wider than a cap into sub-batches, and plans incrementally over the dirty
closure only (out-of-set deps treated as satisfied cache hits). plan 18/18,
total 54/54.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-07 11:56:13 +00:00
parent b9afe671ae
commit 9a0f3d872c
6 changed files with 243 additions and 9 deletions

View File

@@ -30,7 +30,7 @@ edges.
## Status (rolling)
`bash lib/artdag/conformance.sh`**36/36** (2 suites: dag, analyze)
`bash lib/artdag/conformance.sh`**54/54** (3 suites: dag, analyze, plan)
## Ground rules
@@ -97,10 +97,10 @@ lib/artdag/optimize.sx lib/artdag/federation.sx
## Phase 3 — Plan
- [ ] `lib/artdag/plan.sx` — schedule into topological **batches** (each batch's
- [x] `lib/artdag/plan.sx` — schedule into topological **batches** (each batch's
nodes have all deps satisfied → run in parallel); respect a max-parallelism limit
- [ ] plan over the *dirty* subset only (incremental plan)
- [ ] `lib/artdag/tests/plan.sx` — batch correctness, parallelism cap, dirty-only plan
- [x] plan over the *dirty* subset only (incremental plan)
- [x] `lib/artdag/tests/plan.sx` — batch correctness, parallelism cap, dirty-only plan
- [ ] (optional/later) miniKanren constraint scheduling — flag, don't block on it
## Phase 4 — Execute (incremental + memoized)
@@ -136,6 +136,15 @@ lib/artdag/optimize.sx lib/artdag/federation.sx
## Progress log
- **Phase 3 — Plan** (plan suite 18/18, total 54/54). `lib/artdag/plan.sx`:
`artdag/plan` schedules a dag into Kahn-wave topological batches — each batch's
nodes have all in-scope deps satisfied by earlier batches, so they run in parallel.
A `cap` (>0) splits any wave wider than the cap into consecutive sub-batches;
`cap<=0` is unlimited. `artdag/plan-dirty` schedules only the dirty closure: deps
outside the scheduled set (clean cache hits) count as already satisfied, so a
mid-node change yields just `[[changed]…[downstream]]`. Inspection helpers
`plan-batches`/`plan-width`/`plan-size`/`plan-flatten`.
- **Phase 2 — Analyze on Datalog** (analyze suite 16/16, total 36/36).
`lib/artdag/analyze.sx`: `artdag/edge-facts` projects each `(input-id, node-id)`
pair to an `(edge ...)` fact; `artdag/analyze` builds a `dl-program-data` db with