Skip to content
Merged
Changes from 4 commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
b309e4e
WIP: T-21 affected_set.dag Wave-0 implementation — IRT-1 whole/change…
briansrls May 19, 2026
11c7cfb
WIP: T-21 affected_set.dag Wave-0 implementation — IRT-1 whole/change…
briansrls May 19, 2026
3ff9fae
WIP: T-21 affected_set.dag Wave-0 implementation — IRT-1 whole/change…
briansrls May 19, 2026
1e15af2
WIP: T-21 affected_set.dag Wave-0 implementation — IRT-1 whole/change…
briansrls May 19, 2026
ac7a960
WIP: T-21 affected_set.dag Wave-0 implementation — IRT-1 whole/change…
briansrls May 19, 2026
a284b65
WIP: T-21 affected_set.dag Wave-0 implementation — IRT-1 whole/change…
briansrls May 19, 2026
98acfe3
WIP: T-21 affected_set.dag Wave-0 implementation — IRT-1 whole/change…
briansrls May 19, 2026
69bce37
WIP: T-21 affected_set.dag Wave-0 implementation — IRT-1 whole/change…
briansrls May 19, 2026
f6d6c3a
WIP: T-21 affected_set.dag Wave-0 implementation — IRT-1 whole/change…
briansrls May 19, 2026
a22d65f
Unify affected frontier rerun authority
briansrls May 19, 2026
8ea7b03
WIP: T-21 affected_set.dag Wave-0 implementation — IRT-1 whole/change…
briansrls May 19, 2026
8d64ff8
Name transitive affected frontier receipt
briansrls May 19, 2026
0918255
WIP: T-21 affected_set.dag Wave-0 implementation — IRT-1 whole/change…
briansrls May 19, 2026
8599e11
Merge remote-tracking branch 'origin/main' into session/neat-badger-436
briansrls May 19, 2026
6f237e0
WIP: T-21 affected_set.dag Wave-0 implementation — IRT-1 whole/change…
briansrls May 19, 2026
fd20dac
WIP: T-21 affected_set.dag Wave-0 implementation — IRT-1 whole/change…
briansrls May 19, 2026
4280cba
Fit affected read hooks to bridge
briansrls May 19, 2026
e021b6e
WIP: T-21 affected_set.dag Wave-0 implementation — IRT-1 whole/change…
briansrls May 19, 2026
85a433b
WIP: T-21 affected_set.dag Wave-0 implementation — IRT-1 whole/change…
briansrls May 19, 2026
6efcab9
WIP: T-21 affected_set.dag Wave-0 implementation — IRT-1 whole/change…
briansrls May 19, 2026
19377cf
WIP: T-21 affected_set.dag Wave-0 implementation — IRT-1 whole/change…
briansrls May 19, 2026
9f4850b
Fix affected-set boundary dimension authority
briansrls May 19, 2026
f785f0e
WIP: T-21 affected_set.dag Wave-0 implementation — IRT-1 whole/change…
briansrls May 19, 2026
aead718
Merge remote-tracking branch 'origin/main' into session/neat-badger-436
briansrls May 19, 2026
f49e633
WIP: T-21 affected_set.dag Wave-0 implementation — IRT-1 whole/change…
briansrls May 19, 2026
495e03a
Fail closed post-edit dag receipt
briansrls May 19, 2026
b5bbdec
WIP: T-21 affected_set.dag Wave-0 implementation — IRT-1 whole/change…
briansrls May 19, 2026
3193c8e
WIP: T-21 affected_set.dag Wave-0 implementation — IRT-1 whole/change…
briansrls May 19, 2026
f36b6c8
WIP: T-21 affected_set.dag Wave-0 implementation — IRT-1 whole/change…
briansrls May 19, 2026
bd54256
Record affected-set exclusion receipt refinements
briansrls May 19, 2026
d827396
WIP: T-21 affected_set.dag Wave-0 implementation — IRT-1 whole/change…
briansrls May 19, 2026
49cdd7d
WIP: T-21 affected_set.dag Wave-0 implementation — IRT-1 whole/change…
briansrls May 19, 2026
70b6d9d
WIP: T-21 affected_set.dag Wave-0 implementation — IRT-1 whole/change…
briansrls May 19, 2026
f49dbca
WIP: T-21 affected_set.dag Wave-0 implementation — IRT-1 whole/change…
briansrls May 19, 2026
f1483a7
Merge remote-tracking branch 'origin/main' into session/neat-badger-436
briansrls May 19, 2026
e5d95ef
WIP: T-21 affected_set.dag Wave-0 implementation — IRT-1 whole/change…
briansrls May 19, 2026
33b96e0
WIP: T-21 affected_set.dag Wave-0 implementation — IRT-1 whole/change…
briansrls May 19, 2026
7a87a03
Fix affected-set boundary prune ordering
briansrls May 19, 2026
b5cef0c
WIP: T-21 affected_set.dag Wave-0 implementation — IRT-1 whole/change…
briansrls May 19, 2026
12e75ad
WIP: T-21 affected_set.dag Wave-0 implementation — IRT-1 whole/change…
briansrls May 19, 2026
6bade1e
Document affected-set non-empty proof bridge
briansrls May 19, 2026
80e7e5b
Import affected-set witness constructor
briansrls May 19, 2026
56c2bc1
WIP: T-21 affected_set.dag Wave-0 implementation — IRT-1 whole/change…
briansrls May 19, 2026
bd0751c
WIP: T-21 affected_set.dag Wave-0 implementation — IRT-1 whole/change…
briansrls May 19, 2026
b66bc15
WIP: T-21 affected_set.dag Wave-0 implementation — IRT-1 whole/change…
briansrls May 19, 2026
5892f82
Merge remote-tracking branch 'origin/main' into session/neat-badger-436
briansrls May 19, 2026
9a3e51f
WIP: T-21 affected_set.dag Wave-0 implementation — IRT-1 whole/change…
briansrls May 19, 2026
5cad48f
WIP: T-21 affected_set.dag Wave-0 implementation — IRT-1 whole/change…
briansrls May 19, 2026
e6874be
WIP: T-21 affected_set.dag Wave-0 implementation — IRT-1 whole/change…
briansrls May 19, 2026
6d99f26
WIP: T-21 affected_set.dag Wave-0 implementation — IRT-1 whole/change…
briansrls May 19, 2026
37ec8f7
WIP: T-21 affected_set.dag Wave-0 implementation — IRT-1 whole/change…
briansrls May 19, 2026
b014e41
WIP: T-21 affected_set.dag Wave-0 implementation — IRT-1 whole/change…
briansrls May 19, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
169 changes: 165 additions & 4 deletions src/v4/lens/affected_set.dag
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
// src/v4/lens/affected_set.dag
// Scope: canonical affected-set authority for CI/incremental re-execution; fail-closed B-4/B-5 node frontier.
// Owns: Dag, AffectedDimension, ExclusionKey, ExclusionProof, FrontierDecision, ReExecFrontier, AffectedSetRead.
// Consumes: Map, Diff, Node, Path, Symbol, Witness; B-4 resolved Symbol equality; B-5 per-Arrow signature effects.
// Status: scaffold; dissolves when T-21 read body, CI use, and .dag TestClaims land.
// Owns: Dag, AffectedDimension, ExclusionKey, ExclusionProof, FrontierDecision, ReExecFrontier, AffectedFrontierMode, AffectedSetRead, affected_set.
// Consumes: Map, Diff, Edit, Hash, Node, Path, Symbol, Witness; B1 content_hash receipts; B-4 resolved Symbol equality; B-5 per-Arrow signature effects.
// Status: Wave-0 front: read body + changed-subgraph gate landed; dissolves when CI use and .dag TestClaims land.

module v4.lens.affected_set


import v4.std.collection { Map }
import v4.std.node { Diff, Node, Path, Symbol }
import v4.std.node { Diff, Edit, Hash, Node, Path, Symbol }
import v4.std.witness { Witness }


Expand All @@ -17,6 +17,8 @@ type Dag = Node

type AffectedDimension = Symbol

data affected_dimension_value: Symbol = affected_dimension_value


type ExclusionKey {
at: Path
Expand All @@ -28,6 +30,13 @@ type ExclusionKey {
type ExclusionProof
= EmptyDimensionDelta { subject: Path }
| DimensionNotRead { producer: Path }
| UnchangedPureBoundary { subject: Path, content_hash: Hash }


// 🟢 coproduct dissolution — DECISIONS.md #3153-subsumed; IRT-1 whole/changed-subgraph gate.
type AffectedFrontierMode
= ChangedSubgraph { roots: List<Path> }
| WholeDagFailClosed { reason: Symbol }


// 🟢 coproduct dissolution — DECISIONS.md #3153-subsumed
Expand All @@ -37,10 +46,162 @@ type FrontierDecision


type ReExecFrontier {
mode: AffectedFrontierMode
decisions: Map<ExclusionKey, FrontierDecision>
}


type AffectedSetRead {
hash_receipt: fn(Dag, Path, Node) -> HashReceipt
read: fn(Dag, Diff) -> Witness<ReExecFrontier>
}


// 🟡 coproduct dissolution — DECISIONS.md #3153-subsumed; dissolves into B1 content_hash read receipts.
type HashReceipt
= HashUnchanged { content_hash: Hash }
| HashChanged
| HashUnknown { reason: Symbol }


// 🟡 coproduct dissolution — DECISIONS.md #3153-subsumed; dissolves when T-21 .dag TestClaims prove boundary cases.
type BoundaryReceipt
= BoundaryPruned { proof: ExclusionProof }
| BoundaryExpands
| BoundaryUnknown { reason: Symbol }


This comment was marked as resolved.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified against current head bd54256880477c8be7fe47dfe014ae99249e03f2: this is already structurally prevented. BoundaryPruned carries BoundaryExclusionProof, not ExclusionProof; BoundaryExclusionProof only has UnchangedPureBoundary, while dimension/key-specific evidence remains in ExclusionProof for FrontierDecision.Excluded. — sent from neat-badger-436

type FrontierAcc {
mode: AffectedFrontierMode
decisions: Map<ExclusionKey, FrontierDecision>
roots: List<Path>
}


fn empty_frontier_acc() -> FrontierAcc {
FrontierAcc {
mode: ChangedSubgraph { roots: [] },
decisions: empty_map(),
roots: []
}
}


fn frontier_from_acc(acc: FrontierAcc) -> ReExecFrontier {
ReExecFrontier {
mode: acc.mode,
decisions: acc.decisions
}
}


fn root_key(path: Path) -> ExclusionKey {
ExclusionKey {
at: path,
dimension: affected_dimension_value

This comment was marked as resolved.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Valid finding. Fixed across 6f237e09a/fd20dacff with bridge-shape cleanup in 4280cba3c: AffectedSetRead now has changed_dimension_receipt: fn(Dag, Edit) -> ChangedDimensionReceipt, with ChangedDimensions { dimensions } | ChangedDimensionsUnknown { reason }. On BoundaryExpands, expand_changed_dimensions folds the proven dimensions and seeds root_key(path: edit.at, dimension: dimension) for each one. If changed dimensions are unknown, it escalates to WholeDagFailClosed; the old single sentinel root key is only used for the unchanged-pure prune proof. Validation: v4 source-root compile passed with 0 diagnostics and git diff --check was clean. — sent from neat-badger-436

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow-up valid for the remaining sentinel use. Fixed on current head 9f4850b0fbd4c7b635265b55228894fc47ecf44f by deleting affected_dimension_value entirely and making BoundaryPruned leave the frontier unchanged instead of writing an Excluded decision under a fabricated AffectedDimension. Changed roots are still keyed only by proven dimensions from ChangedDimensionReceipt; unchanged/pure boundary pruning is represented by absence of a rerun decision, not a synthetic dimension value. Validation: v4 source-root compile completed with 0 diagnostics and git diff --check was clean. — sent from neat-badger-436

}
}


fn mark_rerun(acc: FrontierAcc, key: ExclusionKey) -> FrontierAcc {
FrontierAcc {
mode: acc.mode,
decisions: map_insert(acc.decisions, key, Rerun),
roots: acc.roots
}
}


fn mark_excluded(acc: FrontierAcc, key: ExclusionKey, proof: ExclusionProof) -> FrontierAcc {
FrontierAcc {
mode: acc.mode,
decisions: map_insert(acc.decisions, key, Excluded { proof: proof }),
roots: acc.roots
}
}

This comment was marked as resolved.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified against current head f6d6c3a13f1830aa40bcccc76965419480ce191a: this is already structurally prevented in the current file. mark_whole_dag(acc, reason) ignores the accumulator and returns only WholeDagAcc { reason: reason }; frontier_from_acc then translates that arm to WholeDagFailClosed { reason: reason } with no decisions field. Prior Excluded decisions exist only inside ChangedSubgraphAcc { roots, decisions } / ChangedSubgraphFrontier { roots, decisions }, which is mutually exclusive with the whole-DAG arm. So the current substrate cannot represent both whole-DAG rerun and root pruning in the same frontier value. — sent from neat-badger-436


fn mark_whole_dag(acc: FrontierAcc, reason: Symbol) -> FrontierAcc {
FrontierAcc {
mode: WholeDagFailClosed { reason: reason },
decisions: acc.decisions,
roots: acc.roots
}
}


fn append_root(acc: FrontierAcc, path: Path) -> FrontierAcc {
match acc.mode {
WholeDagFailClosed { reason: r } =>
FrontierAcc {
mode: WholeDagFailClosed { reason: r },
decisions: acc.decisions,
roots: list_push(acc.roots, path)
}
ChangedSubgraph { roots: _ } =>
FrontierAcc {
mode: ChangedSubgraph { roots: list_push(acc.roots, path) },
decisions: acc.decisions,
roots: list_push(acc.roots, path)
}
}
}


fn boundary_receipt(read_model: AffectedSetRead, dag: Dag, path: Path, replacement: Node) -> BoundaryReceipt {
match read_model.hash_receipt(dag, path, replacement) {
HashUnchanged { content_hash: h } =>
BoundaryPruned {
proof: UnchangedPureBoundary {

This comment was marked as resolved.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Valid finding. Fixed in 8ea7b0373 by making the boundary receipt explicitly carry the purity/effect side of the proof: AffectedSetRead.hash_receipt is now boundary_hash_receipt, and the unchanged arm is HashUnchangedPure { content_hash } rather than plain HashUnchanged. boundary_receipt can now produce UnchangedPureBoundary only from that combined B1 content-hash + B-5 purity/effect receipt; unknown or non-pure cases must use HashUnknown or HashChanged, which expand/fail closed instead of pruning on hash alone. DECISIONS.md #3153-subsumed was updated in the same change to name boundary_hash_receipt and state prune-only-at-unchanged/pure boundaries. Validation: v4 source-root compile completed with 0 diagnostics and git diff --check was clean. — sent from neat-badger-436

subject: path,
content_hash: h
}
}
HashChanged => BoundaryExpands
HashUnknown { reason: r } => BoundaryUnknown { reason: r }
}
}


fn seed_edit_frontier(
read_model: AffectedSetRead,
dag: Dag,
acc: FrontierAcc,
edit: Edit
) -> FrontierAcc {
match boundary_receipt(
read_model: read_model,
dag: dag,
path: edit.at,
replacement: edit.replacement
) {
BoundaryPruned { proof: p } =>
mark_excluded(acc: acc, key: root_key(path: edit.at), proof: p)
BoundaryExpands =>
append_root(
acc: mark_rerun(acc: acc, key: root_key(path: edit.at)),
path: edit.at
)
BoundaryUnknown { reason: r } =>
mark_whole_dag(
acc: mark_rerun(acc: acc, key: root_key(path: edit.at)),
reason: r
)
}
}


fn affected_set(read_model: AffectedSetRead, dag: Dag, diff: Diff) -> Witness<ReExecFrontier> {
Holds {
value: frontier_from_acc(
acc: fold(diff.edits, init: empty_frontier_acc(), f: fn(acc, edit) {

This comment was marked as resolved.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Valid finding. Addressed on current head 9f4850b0fbd4c7b635265b55228894fc47ecf44f by threading explicit current-Dag authority through the ordered Diff fold. The read surface now includes AffectedCurrentDagRead.post_edit_dag, affected_set(read_model, current_dag_read, dag, diff) folds an AffectedFoldAcc { dag, frontier }, and seed_edit_fold_acc evaluates each edit against acc.dag while carrying next_dag forward for later edits. Unknown boundary receipts still fail closed to WholeDagFailClosed; known expand/prune paths advance the current Dag before the next edit. Validation: cargo run -p v2-compiler -- compile --source-root src/v4 --output-dir /tmp/v4-t21-check --target dag completed with 0 diagnostics, and git diff --check is clean. — sent from neat-badger-436

seed_edit_frontier(
read_model: read_model,
dag: dag,
acc: acc,
edit: edit
)
})
)
}
}
Loading