artdag: miniKanren CLP(FD) scheduler (schedule.sx) + 15 tests
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 40s

lib/artdag/schedule.sx on lib/minikanren: slot var per node, fd-lt per edge, fd-label
search. schedule-asap (smallest-first labeling) agrees exactly with plan.sx greedy Kahn
waves (cross-validated); schedules enumerates all valid schedules; schedules-capped
filters to <=cap per slot; schedule-valid? independent dep check. Adds a 'schedule' suite
to conformance.sh loading the minikanren CLP(FD) stack. Completes the optional Phase 3/7
miniKanren box. schedule 15/15, total 213/213.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-28 18:01:00 +00:00
parent e184ce984a
commit 4d5bf47f4a
6 changed files with 326 additions and 8 deletions

View File

@@ -31,14 +31,21 @@ edges.
## Status (rolling)
`bash lib/artdag/conformance.sh`**198/198** (11 suites: dag, analyze, plan, execute, optimize, fed, cost, serialize, stats, fault, maude-optimize)
`bash lib/artdag/conformance.sh`**213/213** (12 suites: dag, analyze, plan, execute, optimize, fed, cost, serialize, stats, fault, maude-optimize, schedule)
Base roadmap (Phases 16) COMPLETE + Phase 7 (maude rule-based optimization) COMPLETE
(only optional miniKanren scheduling remains). Now hardening only.
## Integration / merge status (2026-06-28)
**READY TO MERGE `loops/artdag` → `architecture`.** `origin/architecture`'s `lib/artdag/`
**MERGED to architecture (Phase 7) at `b0d845bb`** — local `architecture` now carries
`lib/maude` + artdag Phase 7, conformance green there (198/198 at merge time). The merge
was clean/additive; `architecture` itself was NOT pushed (pushing it triggers a large dev
reload — a deliberate separate call). **NOTE: re-merge needed**`loops/artdag` has since
added `lib/artdag/schedule.sx` (miniKanren CLP(FD) scheduler, 213/213), not yet on
architecture.
(Historical, for the Phase 7 merge above:) `origin/architecture`'s `lib/artdag/`
is stale — it predates the maude-bridge, so it is missing ALL of Phase 7
(`maude-bridge.sx` + `optimize-rules.sx` both absent). `loops/artdag` is 9 commits ahead
of `origin/architecture` (the Phase 7 chain `657d8061..4a02a9c4` + the architecture-merge
@@ -122,7 +129,10 @@ lib/artdag/optimize.sx lib/artdag/federation.sx
nodes have all deps satisfied → run in parallel); respect a max-parallelism limit
- [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
- [x] miniKanren constraint scheduling — `lib/artdag/schedule.sx` on lib/minikanren
CLP(FD): slot var per node, `fd-lt` per edge, `fd-label` search; ASAP solution agrees
with the greedy Kahn waves above, plus full schedule enumeration + parallelism-cap
filter (Phase 3 + Phase 7 optional box)
## Phase 4 — Execute (incremental + memoized)
@@ -209,6 +219,23 @@ be an op token.
## Progress log
- **2026-06-28 Phase 3/7 — miniKanren CLP(FD) scheduler** (schedule suite 15/15, total
213/213). `lib/artdag/schedule.sx` on `lib/minikanren` (read-only substrate): each node
gets a slot var in `[1..max-slots]`, every edge `(input->node)` imposes `fd-lt
slot(input) slot(node)`, `fd-label` searches the finite domains. A solution is a
`{node-id -> slot}` assignment respecting all dependencies; `schedule->batches` groups by
slot into parallel waves. Smallest-first labeling makes `schedule-asap` the tightest
leveling — and it **agrees exactly with `plan.sx`'s greedy Kahn waves** (cross-validated
in the suite: FD batches == `artdag/plan dag 0`). The relational extra over the greedy
planner: `schedules` enumerates EVERY valid schedule, and `schedules-capped` filters to
`<= cap` nodes per slot (cardinality is a post-filter; the FD core handles precedence).
`schedule-valid?` independently checks deps; unsatisfiable bounds return nil. Substrate
load deps: `lib/guest/match.sx` (the kit: `mk-var`) before the minikanren stack, then
`fd.sx`+`clpfd.sx`. Built functionally (`make-var`/`mk-conj`/`reify`/`stream-take`/
`empty-s`) since the node count is runtime data, not macro-time. Gotcha: `artdag/member?`
uses `equal?` (representation-sensitive) — membership of `map`-built lists must compare
with `=`, not `member?`.
- **2026-06-19 Phase 7 — confluence gate is non-vacuous** (maude-optimize 40/40, total
198/198). Added a regression proving `mau/confluent?` actually discriminates: the
Peano-arithmetic variant of the same laws (`0 + N = N`, `s M + N = s(M+N)` instead of