Repository navigation
Closed
Labels
Description
Overview
A saved query that lists "what can be started" has to restate the conditions the gate Plays already hold, and the two can drift when someone edits a rule. This issue lets a write be evaluated against the rules without being made, and lets a saved query keep only the nodes for which a stated change would not be rejected, so a view follows the rules as they stand. It also makes sorting by an enum follow the schema's declared order for every enum, not only priority.
Problem Statement
- No dry run. Nothing can ask "would setting this task's status to
in_progressbe rejected?" The workflow-state read evaluates a node as it stands and cannot take a proposed value. - Views restate rules. The seeded "Ready tasks" query states the blocker and plan-approval conditions itself. A user who edits or switches off the gate Play changes what can be started and not what the view shows.
- Rank sort is hard-coded. Sorting by
priorityontaskandprojectuses a built-in rank; every other enum sorts alphabetically by stored value, so a status column sortscancelled, done, in_progress, in_review, open.
Proposed Solution
- Dry run. A write can be asked for as a dry run. The invariant rules that would run are evaluated against the proposed change, and the result says whether it would be rejected and with what message. Nothing is written.
permittedfilter. A saved-query filter that keeps the nodes for which a stated property change would not be rejected, evaluated as a dry run per candidate after the query's other filters.- Enum order. Sorting by any enum field orders by each value's position in the schema's declared values.
When the filter exists, the seeded "Ready tasks" query drops its restated conditions.
Documentation
- ADR-094 §9 - the dry run and the
permittedfilter, what they predict and their limits; rank sort for any enum; Build order steps 6 and 7 - ADR-060 - invariant rules: synchronous, in the write transaction, originating device only
- ADR-092 §7 - the Ready query states its conditions until this exists
- Playbook engine - notes there is no dry-run mode today
- Updates:
architecture/playbook-engine.mdandarchitecture/playbook-system.md(dry run), the saved-query docs (thepermittedfilter, enum order),packages/skill/references/cli.md
Architecture Impact
Implements ADR-094 §9. No decision changes. ADR-092 §7's interim statement of conditions in the Ready query is removed when the filter lands.
Acceptance Criteria
Dry run
-
nodespace node updateandnodespace node set-statusaccept a dry-run flag; the result says allowed or rejected, and on rejection carries the rule's message, play and rule name; nothing is written and no version changes - The dry run evaluates the same rules, with the same condition inputs, as the real write: a property-changed event with the stored value as old and the proposed value as new
- It uses the one invariant execution path in a conditions-only mode; there is no second implementation of rule matching
- A condition that cannot be resolved is reported as such and treated as a rejection, as on a real write
- No action other than
rejectis executed; the dry run predicts rejections only, and the docs say so - The built-in agent's update tool accepts the same flag
permitted filter
- A saved query can include a filter naming a property and a value; it keeps the nodes for which that change would not be rejected
- It is evaluated after the query's other filters, and sort and limit apply to what it keeps
- A candidate whose rules cannot be resolved is excluded and counted in the result, and the query does not fail
- A Play's scheduled selector refuses a saved query that uses it, as it refuses relative dates
- Switching off or editing a gate Play changes what the filter keeps, with no change to the query
- The seeded "Ready tasks" query uses the filter for the change to
in_progressand no longer states the blocker or plan conditions; the tests that pinned those conditions now pin the behaviour through the rules
Enum order
- Sorting by an enum field orders by the position of each value in the schema's declared core values followed by user values, for any enum on any type, ascending and descending
-
priorityontaskandprojectsorts as it does today, through the same generic path; the hard-coded rank is removed - A value not in the schema's list sorts last
General
-
references/cli.mddocuments the dry-run flag;bun run skill:checkpasses - Docs updated as listed under Documentation
- Code passes
bun run quality:fix - Tests pass (
bun run test:changed)
Technical Specifications
Reference Files
packages/core/src/services/node_service/invariants.rs-execute_matched_invariant_rules_in_tx, the one invariant execution loop, and how conditions are resolvedpackages/core/src/playbook/workflow_state.rs- current-state evaluation;trigger.property.*is deliberately absent therepackages/core/src/playbook/cel.rs,packages/core/src/playbook/actions.rs- condition inputs and therejectactionpackages/core/src/playbook/selectors.rs- where a selector refuses query forms it cannot runpackages/core/src/services/query_service/mod.rs- filters, and the hard-codedpriorityrank sortpackages/nodespace-types/src/query.rs,packages/nodespace-types/src/priority.rspackages/cli/src/commands/node.rs
Implementation Details
- Confirm what a real invariant evaluation sees for the trigger node's own row (stored or proposed) and reproduce it exactly in the dry run.
- The result is a prediction. The graph can change between the dry run and the write, and the rule on the write is what decides; say so in the CLI help.
- A
permittedfilter costs a rule evaluation per candidate. Evaluate it last.
Dependencies
- Run a saved query by id or title, narrow it at run time, negate filters, and filter into link and object values #3554 (running saved queries and the filter forms this adds to)
- Make spec, plan and decision core types with checklist criteria and seeded rules; remove the installable methodologies #3542 (the gate Plays the Ready query will follow)
Related Issues
- Seed the spec, plan, task, review and decision procedures as built-in skills, the work queues they are attached to, and a skill-authoring skill #3543 (seeds the "Ready tasks" query this changes)
Non-Goals
- Predicting failures of actions other than
reject - A dry run of reactive or scheduled rules
Activity
malibio commentedon Oct 5, 2026
Baseline — Frontend: 322 test files passed, 5875 tests passed