artdag: Phase 1 DAG model + structural content addressing + 20 tests
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 1m7s

Content-addressed node = {:op :inputs :params :commutative}; content-id is a
deterministic canonical serialization (sorted param keys; commutative ops sort
inputs). artdag/build validates dangling/cycles, topo-sorts, dedups identical
subgraphs to one id shared across DAGs. conformance.sh + scoreboard (dag 20/20).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-07 11:49:43 +00:00
parent b821e6a79d
commit e4a8dff9ba
6 changed files with 549 additions and 7 deletions

View File

@@ -30,7 +30,7 @@ edges.
## Status (rolling)
`bash lib/artdag/conformance.sh`**0/0** (not yet started)
`bash lib/artdag/conformance.sh`**20/20** (1 suite: dag)
## Ground rules
@@ -78,13 +78,13 @@ lib/artdag/optimize.sx lib/artdag/federation.sx
## Phase 1 — DAG model + content addressing
- [ ] `lib/artdag/dag.sx` — node `{:op :inputs :params}`; structural content-id =
- [x] `lib/artdag/dag.sx` — node `{:op :inputs :params}`; structural content-id =
digest of `(op, sorted input-ids, params)`; build/validate a DAG (no dangling
inputs, no accidental cycles); topological order
- [ ] identical-subgraph sharing: two structurally-equal nodes get the same id
- [ ] `lib/artdag/tests/dag.sx` — id determinism, subgraph sharing, cycle/dangling
- [x] identical-subgraph sharing: two structurally-equal nodes get the same id
- [x] `lib/artdag/tests/dag.sx` — id determinism, subgraph sharing, cycle/dangling
rejection, topo order
- [ ] `lib/artdag/conformance.sh` + scoreboard
- [x] `lib/artdag/conformance.sh` + scoreboard
## Phase 2 — Analyze (Datalog)
@@ -136,8 +136,19 @@ lib/artdag/optimize.sx lib/artdag/federation.sx
## Progress log
(loop fills this in)
- **Phase 1 — DAG model + content addressing** (dag suite 20/20). `lib/artdag/dag.sx`:
node `{:op :inputs :params :commutative}`; `artdag/content-id` = `"node:"` + a
deterministic canonical serialization of `(op, inputs, params)` with dict keys
sorted (param order-insensitive) and commutative ops' inputs sorted (input
order-insensitive); non-commutative inputs ordered. `artdag/build` takes named
entries `(name op (input-names) params [commutative?])`, validates (dangling refs,
cycles via fixpoint topo), resolves input-names→content-ids, dedups identical
subgraphs to one node + one id (shared across DAGs), returns `{:ok :nodes :names
:order}`. No host `sort`/`string<?` — hand-rolled `artdag/str<?` over char-codes.
Gotcha logged: SX `equal?` is representation-sensitive (cons-built vs vector lists
compare unequal even when identical); `=` is true structural equality — conformance
harness compares with `=`. `lib/artdag/conformance.sh` + scoreboard.
## Blockers
(loop fills this in)
(none)