Skip to content

Add the in_effect decision status and two decision gate Plays - #4392

Merged
mstomar125 merged 3 commits into
mainfrom
issue-4388-decision-fields
Nov 26, 2026
Merged

mstomar125 merged 3 commits into
mainfrom
issue-4388-decision-fields

Conversation

@mstomar125

Copy link
Copy Markdown
Contributor

Closes #4388

Design: #3729 (comment) (core owner), approved by the owner. A decision records that it is built or a rule in force through its status; no marker field, no typed described_by.

What changed

Type decision: kind concrete, category flat. Sheet changed: packages/core/shape-record/node-types.md (decision_status values).

  • decision_status gains in_effect ("In effect"; closed, core-protected). DecisionStatus serializes as snake_case now (identical for the existing values). Generated TypeScript regenerated.
  • Two core Plays in core_plays.rs, enabled by default, user-editable/disableable:
    • Accepting: refuse accepted unless a task linked to the decision (its tasks reverse edge) is neither done nor cancelled.
    • In effect: refuse in_effect while a linked task is open. A decision with no linked task may go proposed -> in_effect (standing rule). in_effect -> accepted is allowed (with an open task linked).
  • Conditions read directly linked tasks only; specs take no part. They guard with has(node.tasks) because a decision with no edges has no tasks value (found by the test; without it a decision with nothing linked was accepted).
  • Shape record: decision-status-in-effect (core_schema) and decision-gate-plays-seeded (seeded_content, additive).

Known limits

  • The gates fire on a status change, not a link change: unlinking the last task of an accepted decision, or linking a new open task to an in_effect decision, is not caught.
  • They do not fire on create: a decision created already accepted or in_effect is not checked.
  • Typed update: update_decision_node is not gated by the Plays in the unit-test harness (no engine); the integration tests run the engine.

Existing databases (class refuse, not additive)

The core-type comparison reports a stored decision schema without in_effect as a changed field, so a database created by an earlier build is refused at open (schema mismatch) until it is reset, like the earlier ai-chat-message value additions. I recorded the change as class refuse because that is what it does; the two Plays are created on open in any database. The owner's NodeSpace workspace database holds real data, so this release is a reset for that database: export/re-import is the owner's call and no migration is added.

Workspace cleanup (NOT done here; after the core release is installed on the owner's device)

On the device that declares the fields:

  1. Set every decision carrying work_status to in_effect, then clear work_status.
  2. Replace each described_by edge with a mention of that page in the decision's content.
  3. Remove work_status and described_by from the decision schema.
  4. Retire or rewrite the saved query "Accepted decisions with no linked work" and the skill "Resolving an accepted decision that has no work".
  5. Rewrite the task "A decision cannot be accepted until work is linked to it or it is marked built or a standing rule" as the two gates.
    (If the database was reset for this release, the custom declarations and the 82 values are gone with it and steps 1-3 mean re-importing them as in_effect.)

Tests (mutation-checked, each failed for the right reason)

  • a_decision_is_accepted_only_with_an_open_linked_task: nothing linked, spec-only link, cancelled-only task refused; open task accepted. Covers a decision linked from both a task and a spec (tasks vs specs reverse names). Mutation: accepting condition -> false: fails. Also caught the missing has() (reproduce-first).
  • a_decision_goes_in_effect_only_when_its_linked_work_is_finished: standing-rule path, refusal while open, done -> in_effect, back to accepted. Mutation: in-effect condition -> false: fails.
  • spec_plan_and_decision_declare_the_decided_fields (schema values): mutation removing InEffect from ALL: fails.
  • Updated a_superseded_decision_cannot_be_reinstated, play id/seed tables, and the core play counts.

Commands: bun run quality:fix, bun run test:changed (passed), bun run gen:types, node-types:gen, shape:gen, shape:check.

🤖 Generated with Claude Code

mstomar125 and others added 3 commits November 26, 2026 13:32
decision_status gains in_effect (built, or a rule in force). Two core Plays
refuse setting a decision to accepted without an open linked task, and to
in_effect while a linked task is open; they read the decision's tasks edge.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@mstomar125
mstomar125 force-pushed the issue-4388-decision-fields branch from e999d3b to 12957a2 Compare November 26, 2026 12:32
@mstomar125
mstomar125 merged commit 2aeb360 into main Nov 26, 2026
@mstomar125
mstomar125 deleted the issue-4388-decision-fields branch November 26, 2026 12:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add the in_effect decision status and two decision gate Plays so built and standing-rule decisions need no marker field

1 participant