Repository navigation
Evaluate a write without making it, filter a saved query by what the rules permit, and sort any enum by its declared order - #3644
Conversation
Pragmatic Code Review — PR #3644 (issue #3559)Review Type: Initial Review (no prior reviews or comments on the PR; reviewed at How this was checked: read the full diff against SummaryA net improvement, and a careful one. The design holds its central promise: there is one rule loop ( No blockers. Two things are worth fixing in this PR (the Requirements Check Dry run
Enum order
General
Code Review Findings 🟡 Important1.
Fix: tie the exemption to the tool that implements the flag, e.g. 2. A
Fix: validate the value once when the filter is checked (for a named 3. The unresolved count is dropped on the ad hoc query paths
🟢 Suggestions4. Candidates are loaded unbounded before the limit is filled
5. The proposed node keeps the stored On the write, the trigger node is the row read back, with a new 6. Setting a field to its current value changes nothing, matches no rule, and is kept (pinned by 7. Nit: The name and 8. Nit:
9. Nit: fixed sleeps in
Things checked and found sound
Recommendation: APPROVE — with findings 1 and 2 recommended before merge (both small), and 3 as a follow-on decision. The unmet "Ready tasks" criterion is an acceptable deferral to #3543. |
malibio
left a comment
There was a problem hiding this comment.
Automated pragmatic-code-review: APPROVE (posted as a comment — GitHub blocks self-approval). Full findings in the review comment above.
Address-review summaryAddressed
Skipped
Rust workspace: 5473 passed. Re-Review DecisionDecision: RE-REVIEW NEEDED — finding 2 changed error handling on the query path (new logic), so the new commit gets a second look. |
Pragmatic Code Review — PR #3644 (issue #3559)Review Type: Re-Review (of How this was checked: read Previous Review Summary
Previous findings
Code Review Findings 🟡 ImportantA. The up-front enum check reads the target type's values only, so it refuses a value a subtype added
So for a base-type query whose The same refusal applies when the query is saved ( I did not run this; it follows from Fix: refuse only when no type the query can return lists the value. 🟢 SuggestionsB. The enum value list is assembled a third time; the write path's own check is available
C. The validation-class list in The three variants cover what Checked and found sound
Recommendation: APPROVE — the commit resolves the two findings that were asked for before merge. Finding A is a narrow over-refusal introduced by the fix for finding 2; it is cheap to fix and worth doing in this PR, but it fails loudly, needs a user-defined subtype with an extended enum to reach, and does not block. |
malibio
left a comment
There was a problem hiding this comment.
Automated pragmatic-code-review (re-review): APPROVE (posted as a comment — GitHub blocks self-approval). Full findings in the review comment above.
Address-review summary (re-review)
Core suite: 2842 passed. Re-Review DecisionDecision: NO RE-REVIEW NEEDED — the change widens one fail-fast check exactly as the reviewer specified, is covered by a new test, and touches no other logic. |
…rules permit, and sort any enum by its declared order
361e425 to
eace0d7
Compare
Closes #3559. Implements ADR-094 §9 (Build order steps 6 and 7).
What changed
Dry run of a write
nodespace node update --dry-runandnodespace node set-status --dry-runreport whether a rule would reject the change, with the rule's message, play and rule name. Nothing is written and no version changes. The agent'supdate_nodetakesdry_runtoo.DryRunUpdateNode(UpdateNodeRequest) returns (DryRunUpdateResponse), the wayCountQueryreusesExecuteQueryRequest.execute_matched_invariant_rules) takes anInvariantRunmode;ConditionsOnlyevaluates conditions exactly as a write does and, of the actions, carries outrejectalone. The action loop skips every other action before resolving its bindings.prepare_update, split out of the version-checked update so the write and the dry run build the node through the same steps (merge, bucketing, validation, title).unresolvedand counts as not allowed, as the write fails closed on it.update_nodecall is not counted as a write by the agent loop (is_write_call).permittedquery filter{"type":"permitted","operator":"equals","property":"status","value":"in_progress"}keeps the nodes for which that change would not be rejected: a dry run per candidate.query_ops::run_definition, after the statement's other filters and sorting, in sort order until the limit is filled, so sort and limit apply to what it keeps.QueryServicerefuses a definition that still holds one, so no caller can run the statement without it.permitted_unresolvedonRunSavedQuery, the CLI and the agent'srun_query); the query does not fail.CountQueryand saved-query membership (applicable skills) all go through the same evaluation.Enum order
prioritygoes through the same generic path.Priority::rank,USER_RANKandABSENT_RANKare removed;SortConfig::rank_scopeis replaced bySortConfig::rank(EnumRank).Behaviour changes to note
Not done here
permitted_filter_test.rs, which runs a "Ready tasks"-shaped saved query (open + permittedin_progress) against the seeded gate Plays, including switching one off and editing another. ADR-092 §7 and ADR-094 now describe the Ready query as using the filter, and 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 has a note to seed it that way.Tests
core:dry_run_tests(dry run vs. the write it predicts),permitted_filter_test(seeded gate Plays, running engine), query ops / query service (enum order, filter validation, the service's refusal), selector validation.daemon:DryRunUpdateNode, and the filter overRunSavedQuery/ExecuteQuery/CountQuery.cli: flag parsing, output, and that a dry run writes nothing.agent:update_nodewithdry_run.matchesFilterdeclines apermittedfilter.Docs (nodespace-docs, pushed to
mainalongside the merge):architecture/playbook-engine.md,architecture/playbook-system.md,components/query-node.md,architecture/data-layer.md, ADR-092 §7, ADR-094.🤖 Generated with Claude Code