Repository navigation
Playbook rule class + save-time invariant eligibility gate (ADR-060 Slice A) - #1773
Merged
Merged
Conversation
…ibility gate (#1739) ADR-060 Slice A. Introduce RuleClass { Invariant, Reactive } (default Reactive, so every existing rule is unchanged and this slice is behavior-neutral — no execution change, and no invariant rules are seeded yet). Add a save-time gate that rejects an invariant rule violating ADR-060 §2 eligibility, naming the offending action: local-writes-only (an exhaustive ActionType classification), deterministic (rejects a condition using the wall-clock CEL functions — the only non-deterministic surface), same-graph scope (rejects a literal target node id), and the statically-decidable self-chaining case of non-chaining depth-1. The general cross-rule / multi-device chaining case is deferred to the runtime causal-depth guard (Slice B / ADR-060 §5), documented in the eligibility validator. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
13 tasks
4 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #1739 — Slice A of 4 implementing ADR-060 (invariant vs reactive playbook rules). This slice is behavior-neutral: it adds the rule class and a save-time validation gate, with no execution change (and no invariant rules are seeded yet).
Change
RuleClass { Invariant, Reactive }on the rule model, defaultReactive(#[serde(default)]), so every existing rule and stored definition is unchanged.validation.rs), run only for invariant rules, rejecting a rule that violates ADR-060 §2 and naming the offending action:ActionType::is_local_write()(a future non-local type won't compile until classified, so it can't silently become invariant-eligible).NON_DETERMINISTIC_FUNCTIONSis exactly the set CEL registers (today/days_since/days_until), the only non-deterministic surface (action params are pure{binding}data refs; no random fn exists).{binding}targets are in scope.Tests
+16 tests: class parse/default, each rejection path (naming the action/function), a valid invariant rule accepted, and the same rule accepted as Reactive but rejected as Invariant (reactive-unaffected).
cargo test -p nodespace-core= 996 lib + integration green; clippy-D warnings+ fmt clean.Next slices (own PRs)
B = synchronous pre-commit invariant execution in the create transaction; C = repair-and-log for remote violations (§7); D = seeded-playbook protection (§8). §6 (DB-side enforcement) is a separate cloud task.