You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
index: what changed between two reads, drawn as an overlay #1028
epic:graph-queryEpic: mixed-substrate graph query and the index (INTENTIUS/behold#1024)wave:3Wave 3 of an epic's rollout: can start once earlier waves land
What changed between two index reads: nodes added and removed, properties changed, edges added and removed, between any two versions of an index in the store. Drawn as an overlay on the graph.
A change made between two emulator reads shows as one changed property. The maintainer runs it.
A scope mismatch is refused by name.
A test shows a type unobserved in one read is not reported as removed.
Part of #1024 (the graph query epic). Design: #1025.
Acceptance: verdict lines and recorded artifacts, never exit codes alone. Anything needing an emulator corpus, an estate run or a real cloud is run by the maintainer by hand. Red-first only for new guards.
Built to the ruling on #1025 and the issue text. Merged into integration/consolidation-graph as eca7423 (unit branch unit/cg-behold-1028). Compile check only: npm ci, npx tsc --noEmit pass on the merge. No tests were run.
Diff: reuse or new
chant has no diff for two observed reads that could be reused. packages/core/src/lifecycle/deep-diff.ts compares a declared tree with a live one, and a path present on only one side is "unclaimed" there rather than a change. Two reads are both observed, so this diff has to be symmetric. Following the maintainer's constraint, I wrote the diff as one pure module, src/graph-db/index-diff.ts. It imports nothing at all (no behold modules, no packages), so it can move into chant unchanged. Its shapes are structural copies of chant's IndexDocument, CoverageEntry, IRNode and IREdge. The one piece of chant it does use, indexCoverageFor from @intentius/chant/lifecycle/index-document, is passed in by behold's loader behind a feature-detect. When the installed chant lacks it, the module's coverageForFallback applies the same rule: an exact entry beats a wildcard, and "*" matches any type or any location. Each answer reports which rule ran in coverageRule. A test checks that the module has no behold imports, and another checks that both rules agree whenever chant's is installed.
What landed
src/graph-db/index-diff.ts: diffIndexVersions(from, to, { coverageFor }).
Nodes added, removed and changed. A property is kind or a leaf path of attrs, with arrays compared as whole values. tags is compared only when attrs show no change, so editing one tag counts as one changed property, not two. facts are never compared.
Edges added and removed, keyed on from, to, kind, viaAttr and relation.
Scope mismatch: when the two stamp.scopeKey values differ, the diff throws IndexScopeMismatch (code: "index-scope-mismatch"), and the message names both keys.
Unobserved, not removed: a node counts as removed only if the later read's coverage says listed for its (type, location). Otherwise it goes in notObserved with side: "to" and the verdict (read-failed, not-in-coverage, ...). The reverse case works the same way: a node counts as added only if the earlier read listed its type, otherwise it is notObserved with side: "from". An edge whose end sits in an unobserved (type, location) is notObserved too, never removed or added. The (type, location) comes from the node's listedType/location, falling back to the path-style id (Q2).
The diff also lists coverage verdicts that changed between the reads. When the digests are equal it returns unchanged: true without walking the graphs.
Loads versions from the same three stores the pane reads: .chant/store/index/, _index/ on refs/chant/snapshots (via git ls-tree/git show), and the per-user store.
Feature-detects chant's coverage rule, calls the diff and builds the overlay data.
Two GET routes, added to GRAPH_ROUTES, so the existing no-action test covers them:
GET /api/graphdb/index-versions
GET /api/graphdb/index-diff?scope=&from=&to=. from and to take a version name or a full <scopeKey>/<version>. By default it uses the only scope and its last two versions. A pair from two scope paths is refused with 409 index-scope-mismatch before either file is read, and the stamps are compared again after reading. A --public serve gets 403.
src/graph-db/pane.ts: mounts the routes (12 lines).
web/index-diff.js, web/graph.html: a "What changed between two reads" section on /graph with scope, from and to pickers. The overlay colours added nodes green, removed red and changed amber, with the changed paths in the tooltip. Not-observed nodes are drawn grey and dashed, never as removed. Both stamps and the per-property before/after are listed. Only changed nodes and their neighbours are drawn, and the overlay gives the count of nodes it left out.
Tests, written and not run:
src/graph-db/index-diff.test.ts, over two fixture versions in src/graph-db/__fixtures__/index-diff/. It covers: one changed property, added/removed, edges added/removed/not observed, the coverage change, the reverse diff, the scope-mismatch refusal (pure and through the route), unobserved-not-removed (missing coverage entry, wildcard listed, wildcard read-failed), the fallback rule against chant's, the routes, and the public refusal.
web/index-diff.test.js.
src/graph-db/templates.ts and src/chant-release.ts were not touched.
Acceptance
A change made between two emulator reads shows as one changed property: maintainer run, commands below.
Scope mismatch refused by name: built and tested in index-diff.test.ts. Waits for epic-ready.
Unobserved type not reported as removed: built and tested in index-diff.test.ts. Waits for epic-ready.
Maintainer run (done-when 1, pinned floci on 4566)
Install a local build of chant's integration/consolidation-graph (and its aws lexicon) beside behold, as #1026's run needs. Then, from the behold integration checkout:
export XDG_DATA_HOME=$(mktemp -d)export AWS_ACCESS_KEY_ID=test AWS_SECRET_ACCESS_KEY=test AWS_REGION=us-east-1
unset AWS_PROFILE AWS_SESSION_TOKEN
aws --endpoint-url http://localhost:4566 s3api create-bucket --bucket behold-1028
# read 1
npx tsx src/cli.ts index aws --endpoint http://localhost:4566 --account 000000000000 --regions us-east-1 --types AWS::S3::Bucket
# the change
aws --endpoint-url http://localhost:4566 s3api put-bucket-versioning --bucket behold-1028 --versioning-configuration Status=Enabled
# read 2 (same flags, so the same scope key; wait at least one second after read 1)
npx tsx src/cli.ts index aws --endpoint http://localhost:4566 --account 000000000000 --regions us-east-1 --types AWS::S3::Bucket
# serve any project dir and ask the diff
npx tsx src/cli.ts serve "$(mktemp -d)" --port 4917 &
curl -s http://127.0.0.1:4917/api/graphdb/index-diff | jq '.diff.counts, .diff.nodes.changed, .coverageRule'
The verdict is counts.properties: 1, plus one nodes.changed entry for .../AWS::S3::Bucket/behold-1028 with attrs.VersioningConfiguration.Status going from absent or Suspended to Enabled. Opening http://127.0.0.1:4917/graph and pressing Diff should draw that bucket amber. Each read's last line, behold index: wrote <version> ..., names the two versions. If floci's Cloud Control does not return VersioningConfiguration for buckets, use a tag change instead (put-bucket-tagging); that also shows as one property under attrs.Tags. Also check the read logs for a real-cloud rejection.
Still missing
Reading through chant's store API (readIndexAt/listIndex) is not wired. The routes read the store layout directly, the same way the pane's sources.ts does, so they work with published chant. An s3 store is therefore not diffed yet. That would be a follow-up behind the same feature-detect.
Once the pure module moves into chant, behold's loader should import it from chant behind the release switch.
behold half of chant#4533. Ruling: behold is a control plane and every model lives in chant (#1024 (comment)). Merged into integration/consolidation-graph as d21d4a2 (unit branch unit/cg-behold-4533). Compile check only: npm ci, npx tsc --noEmit pass on the merge. No tests were run.
The diff now lives in chant as diffIndexVersions in @intentius/chant/lifecycle/index-diff (chant integration 52765b9a0b, along with chant index diff <a> [<b>]).
What landed
src/graph-db/index-diff-routes.ts:
chantIndexDiff() feature-detects chant's diffIndexVersions. It tries @intentius/chant/lifecycle/index-diff, then @intentius/chant/lifecycle, through a specifier the type checker and bundler don't follow (the same pattern as src/chant-edges.ts and src/behold-index.ts).
On a published chant without the function, the bundled ./index-diff.ts runs, using chant's indexCoverageFor when present and its own rule otherwise.
The answer now carries diffModule (chant or behold-fallback) next to coverageRule.
Refusals are matched by code (index-scope-mismatch gives 409, not-an-index-version gives 400), because chant's error classes are different classes from the copy's.
Tests can inject the diff (indexDiff on VersionReaders / IndexDiffDeps).
src/graph-db/index-diff.ts: unchanged apart from the header, which now says it is the fallback copy of chant's module, with TODO(behold#1005) to delete it.
web/index-diff.js: the overlay summary names whose diff ran.
Tests in src/graph-db/index-diff.test.ts, written and not run:
an injected diff is used and named;
a chant-style refusal maps to 409 by code;
the installed chant's diff (or the copy) gives the same answer as the copy over the two fixtures.
Conflict: the merge conflicted in the header comment of index-diff-routes.ts with unit/cg-behold-4532, which renamed the src/chant-index.ts reference to src/behold-index.ts. I kept both changes: the new header text, citing src/behold-index.ts.
Still missing
The routes still read the three store layouts directly (.chant/store/index/, _index/ on refs/chant/snapshots, the per-user store). That keeps them working with published chant, and it means an s3 store is still not diffed by the pane. chant's diffIndexVersionRefs(store, a, b) reads through #4519's store API and handles s3. Calling it behind the same feature-detect is the follow-up, or it comes for free when After the chant release: version pins, floors and the drift-line copy #1005 flips.
Deleting the bundled module and the fallback is listed on behold#1005.
Acceptance
A change made between two emulator reads shows as one changed property: maintainer run, commands in the comment above (unchanged; with a local chant build the answer should say diffModule: "chant").
Scope mismatch refused by name: built and tested. Waits for epic-ready.
Unobserved type not reported as removed: built and tested, now in chant too. Waits for epic-ready.
Ready for the maintainer (consolidation-graph, 2026-10-27)
behold main is 8b74db5, whose tree equals the epic-ready tested tip fd1dd6a. chant main is 47b8594e3. The unit merged at eca7423, and the diff moved into chant (chant#4533) with behold's half at d21d4a2.
What epic-ready proved: src/graph-db/index-diff.test.ts passed 24/24 and web/index-diff.test.js 3/3 in both vitest runs at fd1dd6a. That covers done-when 2 (a scope mismatch is refused by name, both in the pure diff and as 409 index-scope-mismatch through the route) and done-when 3 (a type with no coverage entry, or with a read-failed wildcard, in the later read is reported as not observed, never removed).
Left: done-when 1, a change made between two emulator reads showing as one changed property, with diffModule: "chant" on the local chant build.
Commands: run sheet entry A2 in engine-wt/goals/consolidation-graph-1-runs.md.
A2 run (2026-11-16): one changed property between two emulator reads
This ran on behold main at e28ae9a with chant 0.124.101 and @intentius/chant-lexicon-aws0.124.101 beside it. The emulator was a scratch floci, behold-ladybug-a2-floci on 127.0.0.1:14568, from choudoufu's current pin ghcr.io/lex00/floci@sha256:5ec92ae8..., with floci's dummy key pair.
The diff is chant's on this build. behold imports diffIndexVersions and diffIndexVersionRefs from @intentius/chant/lifecycle/index-diff statically, and the answer has no diffModule field any more, so the diffModule: "chant" check in the ready comment no longer applies.
The run
A DynamoDB table ladybug-a2-items was made with PAY_PER_REQUEST, then read:
aws 000000000000: 3 nodes (3 typed, 0 of unknown kind), 0 derived edges
behold index: wrote 20261116T193232Z-1b0cb5fb2c9b.json under cloud/aws/000000000000/c711efa4b47f in .../a2/xdg/behold
Then aws dynamodb update-table --table-name ladybug-a2-items --deletion-protection-enabled changed one property, and the same command read again (20261116T193233Z-5fc97547f260.json).
GET /api/graphdb/index-diff?scope=cloud/aws/000000000000/c711efa4b47f&from=20261116T193232Z-1b0cb5fb2c9b.json&to=20261116T193233Z-5fc97547f260.json on a serve with that index dir answered:
The /graph page's "What changed between two reads" draws the one table as changed and lists the property, with "2 unchanged nodes not drawn".
A first try that showed two properties
Before that I changed an SQS queue's VisibilityTimeout from 30 to 60 between two reads. The diff showed one changed node with two properties: attrs.Attributes.VisibilityTimeout 30 to 60, and attrs.LastModifiedTimestamp, which floci moves on every attribute change. The diff reported what the listing held, so on any type whose listing carries a modified time, a change will show that time as a second property.
Done-when 1 is met by the DynamoDB pair. Artifacts in the run's worktree under .scratch/a2/: read1.txt to read4.txt, index-diff.json, index-diff-ddb.json, index-versions.json and pane-diff.png.
This closes because every done-when item is met. Run A2 above changed a DynamoDB table's DeletionProtectionEnabled between two floci reads. The diff showed that one property and nothing else. The diff now lives in chant (chant#4533), and its tests in packages/core/src/lifecycle/index-diff.test.ts cover the other two items. The scope mismatch is refused by name with both scope keys. A type with no coverage entry in the later read is reported as not observed.
A2 also found that a listing which carries a modified time, such as an SQS queue's LastModifiedTimestamp, shows that time as a second changed property. The diff reports what the listing holds.
epic:graph-queryEpic: mixed-substrate graph query and the index (INTENTIUS/behold#1024)wave:3Wave 3 of an epic's rollout: can start once earlier waves land
Activity
lex00 commentedon Oct 27, 2026
Built to the ruling on #1025 and the issue text. Merged into
integration/consolidation-graphas eca7423 (unit branchunit/cg-behold-1028). Compile check only:npm ci,npx tsc --noEmitpass on the merge. No tests were run.Diff: reuse or new
chant has no diff for two observed reads that could be reused.
packages/core/src/lifecycle/deep-diff.tscompares a declared tree with a live one, and a path present on only one side is "unclaimed" there rather than a change. Two reads are both observed, so this diff has to be symmetric. Following the maintainer's constraint, I wrote the diff as one pure module,src/graph-db/index-diff.ts. It imports nothing at all (no behold modules, no packages), so it can move into chant unchanged. Its shapes are structural copies of chant'sIndexDocument,CoverageEntry,IRNodeandIREdge. The one piece of chant it does use,indexCoverageForfrom@intentius/chant/lifecycle/index-document, is passed in by behold's loader behind a feature-detect. When the installed chant lacks it, the module'scoverageForFallbackapplies the same rule: an exact entry beats a wildcard, and"*"matches any type or any location. Each answer reports which rule ran incoverageRule. A test checks that the module has no behold imports, and another checks that both rules agree whenever chant's is installed.What landed
src/graph-db/index-diff.ts:diffIndexVersions(from, to, { coverageFor }).kindor a leaf path ofattrs, with arrays compared as whole values.tagsis compared only whenattrsshow no change, so editing one tag counts as one changed property, not two.factsare never compared.stamp.scopeKeyvalues differ, the diff throwsIndexScopeMismatch(code: "index-scope-mismatch"), and the message names both keys.listedfor its (type, location). Otherwise it goes innotObservedwithside: "to"and the verdict (read-failed,not-in-coverage, ...). The reverse case works the same way: a node counts as added only if the earlier read listed its type, otherwise it isnotObservedwithside: "from". An edge whose end sits in an unobserved (type, location) isnotObservedtoo, never removed or added. The (type, location) comes from the node'slistedType/location, falling back to the path-style id (Q2).unchanged: truewithout walking the graphs.src/graph-db/index-diff-routes.ts(behold's part):.chant/store/index/,_index/onrefs/chant/snapshots(viagit ls-tree/git show), and the per-user store.GRAPH_ROUTES, so the existing no-action test covers them:GET /api/graphdb/index-versionsGET /api/graphdb/index-diff?scope=&from=&to=.fromandtotake a version name or a full<scopeKey>/<version>. By default it uses the only scope and its last two versions. A pair from two scope paths is refused with 409index-scope-mismatchbefore either file is read, and the stamps are compared again after reading. A--publicserve gets 403.src/graph-db/pane.ts: mounts the routes (12 lines).web/index-diff.js,web/graph.html: a "What changed between two reads" section on/graphwith scope, from and to pickers. The overlay colours added nodes green, removed red and changed amber, with the changed paths in the tooltip. Not-observed nodes are drawn grey and dashed, never as removed. Both stamps and the per-property before/after are listed. Only changed nodes and their neighbours are drawn, and the overlay gives the count of nodes it left out.src/graph-db/index-diff.test.ts, over two fixture versions insrc/graph-db/__fixtures__/index-diff/. It covers: one changed property, added/removed, edges added/removed/not observed, the coverage change, the reverse diff, the scope-mismatch refusal (pure and through the route), unobserved-not-removed (missing coverage entry, wildcardlisted, wildcardread-failed), the fallback rule against chant's, the routes, and the public refusal.web/index-diff.test.js.src/graph-db/templates.ts and src/chant-release.ts were not touched.
Acceptance
index-diff.test.ts. Waits for epic-ready.index-diff.test.ts. Waits for epic-ready.Maintainer run (done-when 1, pinned floci on 4566)
Install a local build of chant's integration/consolidation-graph (and its aws lexicon) beside behold, as #1026's run needs. Then, from the behold integration checkout:
The verdict is
counts.properties: 1, plus onenodes.changedentry for.../AWS::S3::Bucket/behold-1028withattrs.VersioningConfiguration.Statusgoing from absent orSuspendedtoEnabled. Openinghttp://127.0.0.1:4917/graphand pressing Diff should draw that bucket amber. Each read's last line,behold index: wrote <version> ..., names the two versions. If floci's Cloud Control does not returnVersioningConfigurationfor buckets, use a tag change instead (put-bucket-tagging); that also shows as one property underattrs.Tags. Also check the read logs for a real-cloud rejection.Still missing
readIndexAt/listIndex) is not wired. The routes read the store layout directly, the same way the pane'ssources.tsdoes, so they work with published chant. Ans3store is therefore not diffed yet. That would be a follow-up behind the same feature-detect.lex00 commentedon Oct 27, 2026
behold half of chant#4533. Ruling: behold is a control plane and every model lives in chant (#1024 (comment)). Merged into
integration/consolidation-graphas d21d4a2 (unit branchunit/cg-behold-4533). Compile check only:npm ci,npx tsc --noEmitpass on the merge. No tests were run.The diff now lives in chant as
diffIndexVersionsin@intentius/chant/lifecycle/index-diff(chant integration 52765b9a0b, along withchant index diff <a> [<b>]).What landed
src/graph-db/index-diff-routes.ts:chantIndexDiff()feature-detects chant'sdiffIndexVersions. It tries@intentius/chant/lifecycle/index-diff, then@intentius/chant/lifecycle, through a specifier the type checker and bundler don't follow (the same pattern as src/chant-edges.ts and src/behold-index.ts)../index-diff.tsruns, using chant'sindexCoverageForwhen present and its own rule otherwise.diffModule(chantorbehold-fallback) next tocoverageRule.code(index-scope-mismatchgives 409,not-an-index-versiongives 400), because chant's error classes are different classes from the copy's.indexDiffonVersionReaders/IndexDiffDeps).src/graph-db/index-diff.ts: unchanged apart from the header, which now says it is the fallback copy of chant's module, withTODO(behold#1005)to delete it.web/index-diff.js: the overlay summary names whose diff ran.src/graph-db/index-diff.test.ts, written and not run:Conflict: the merge conflicted in the header comment of
index-diff-routes.tswithunit/cg-behold-4532, which renamed the src/chant-index.ts reference to src/behold-index.ts. I kept both changes: the new header text, citing src/behold-index.ts.Still missing
.chant/store/index/,_index/onrefs/chant/snapshots, the per-user store). That keeps them working with published chant, and it means ans3store is still not diffed by the pane. chant'sdiffIndexVersionRefs(store, a, b)reads through #4519's store API and handles s3. Calling it behind the same feature-detect is the follow-up, or it comes for free when After the chant release: version pins, floors and the drift-line copy #1005 flips.Acceptance
diffModule: "chant").lex00 commentedon Oct 27, 2026
Ready for the maintainer (consolidation-graph, 2026-10-27)
behold main is 8b74db5, whose tree equals the epic-ready tested tip fd1dd6a. chant main is 47b8594e3. The unit merged at eca7423, and the diff moved into chant (chant#4533) with behold's half at d21d4a2.
What epic-ready proved: src/graph-db/index-diff.test.ts passed 24/24 and web/index-diff.test.js 3/3 in both vitest runs at fd1dd6a. That covers done-when 2 (a scope mismatch is refused by name, both in the pure diff and as 409
index-scope-mismatchthrough the route) and done-when 3 (a type with no coverage entry, or with aread-failedwildcard, in the later read is reported as not observed, never removed).Left: done-when 1, a change made between two emulator reads showing as one changed property, with
diffModule: "chant"on the local chant build.Commands: run sheet entry A2 in engine-wt/goals/consolidation-graph-1-runs.md.
lex00 commentedon Nov 16, 2026
A2 run (2026-11-16): one changed property between two emulator reads
This ran on behold main at
e28ae9awith chant0.124.101and@intentius/chant-lexicon-aws0.124.101beside it. The emulator was a scratch floci,behold-ladybug-a2-flocion127.0.0.1:14568, from choudoufu's current pinghcr.io/lex00/floci@sha256:5ec92ae8..., with floci's dummy key pair.The diff is chant's on this build. behold imports
diffIndexVersionsanddiffIndexVersionRefsfrom@intentius/chant/lifecycle/index-diffstatically, and the answer has nodiffModulefield any more, so thediffModule: "chant"check in the ready comment no longer applies.The run
A DynamoDB table
ladybug-a2-itemswas made withPAY_PER_REQUEST, then read:Then
aws dynamodb update-table --table-name ladybug-a2-items --deletion-protection-enabledchanged one property, and the same command read again (20261116T193233Z-5fc97547f260.json).GET /api/graphdb/index-diff?scope=cloud/aws/000000000000/c711efa4b47f&from=20261116T193232Z-1b0cb5fb2c9b.json&to=20261116T193233Z-5fc97547f260.jsonon a serve with that index dir answered:The
/graphpage's "What changed between two reads" draws the one table as changed and lists the property, with "2 unchanged nodes not drawn".A first try that showed two properties
Before that I changed an SQS queue's
VisibilityTimeoutfrom 30 to 60 between two reads. The diff showed one changed node with two properties:attrs.Attributes.VisibilityTimeout30 to 60, andattrs.LastModifiedTimestamp, which floci moves on every attribute change. The diff reported what the listing held, so on any type whose listing carries a modified time, a change will show that time as a second property.Done-when 1 is met by the DynamoDB pair. Artifacts in the run's worktree under
.scratch/a2/:read1.txttoread4.txt,index-diff.json,index-diff-ddb.json,index-versions.jsonandpane-diff.png.lex00 commentedon Nov 17, 2026
This closes because every done-when item is met. Run A2 above changed a DynamoDB table's
DeletionProtectionEnabledbetween two floci reads. The diff showed that one property and nothing else. The diff now lives in chant (chant#4533), and its tests inpackages/core/src/lifecycle/index-diff.test.tscover the other two items. The scope mismatch is refused by name with both scope keys. A type with no coverage entry in the later read is reported as not observed.A2 also found that a listing which carries a modified time, such as an SQS queue's
LastModifiedTimestamp, shows that time as a second changed property. The diff reports what the listing holds.