Skip to content

Make one governance check decide whether an archived node participates anywhere #3443

Closed

Description

@malibio

Overview

Implement ADR-087's single participation rule: an archived node takes part in nothing, and every surface asks one governance check instead of comparing lifecycle_status itself.

Problem Statement

lifecycle_status is compared ad hoc in many places, with different results per surface:

  • the store and service layers: packages/core/src/db/sqlite_store/nodes.rs, packages/core/src/services/node_service/mod.rs and crud.rs;
  • the play engine: packages/core/src/playbook/engine.rs, cron_runner.rs, actions.rs, graph_resolver.rs;
  • the daemon and the CLI.

The surfaces disagree:

  • Semantic search filters archived results after searching (packages/core/src/ops/search_ops.rs), but archived nodes keep their vectors.
  • The @ picker doesn't filter them (Keep archived nodes out of the @ mention picker #3428 is the interim fix).
  • Cron scans and action queries skip archived targets; event-triggered rules haven't been audited.
  • The @ picker's type exclusions are a literal list (collection, schema, ai-chat) that misses subtypes.

Proposed Solution

  1. A governance module in core that owns participation:
    • a Rust predicate for in-memory decisions;
    • one SQL fragment for queries;
    • include_archived as the only opt-in, for reads by id and a future unarchive surface.
  2. Replace every lifecycle_status comparison with the predicate or the fragment. This covers semantic and keyword search, default queries and counts, lists (sidebar, type views, collection members, query nodes), the @ picker, workspace context, agent tool reads, and the play engine, both for plays and for triggers and targets.
  3. Per-type participation rules recorded in the registry: embedded, mentionable, excluded from default queries. They follow the extends chain and replace the @ picker's literal list.
  4. Archiving removes a node's vectors; unarchiving re-embeds it.
  5. A test fails if code outside the governance module reads lifecycle_status (allow-list the module and the envelope/serialization code).

Architecture Impact

Implements decisions/087-lifecycle-status-is-governance-and-one-participation-rule.md §1, §2, §4 and §6 (nodespace-docs). The play-specific part (enabled, suspension) is a separate issue that calls this check.

Acceptance Criteria

  • One participation predicate and SQL fragment exist; every surface listed above uses them (tests per surface: an archived node is absent; with include_archived it is present)
  • A test fails on any lifecycle_status read outside the governance module
  • Archiving a node deletes its embeddings; unarchiving re-embeds it (test)
  • The @ picker and default queries use the registry's mentionable / default-query rules, which follow extends (test with a subtype)
  • An archived play doesn't run, and no rule fires on or acts on an archived node, for event, scheduled and action paths (tests)
  • Follows development/node-type-sequence.md; node-types.md participation section updated in the same PR
  • bun run test:changed passes; bun run quality:fix clean
  • The importer (packages/daemon/src/services/import_service.rs, which sets root_props["lifecycle_status"] / properties["lifecycle_status"] next to its real lifecycle update) no longer writes a stray properties.lifecycle_status key; lifecycle is only ever the envelope field (test)
  • Plays neither read nor write lifecycle_status (ADR-087 §5; components/participation.md):
    • It is removed from the fields CEL conditions can read: the core-field list in packages/core/src/playbook/cel.rs and the context it builds, get_node_property in packages/core/src/playbook/graph_resolver.rs, and the workflow-state evaluation.
    • The update_node action no longer accepts a lifecycle_status param. Both write sites in packages/core/src/playbook/actions.rs go, and validation rejects the param.
    • The action queries' lifecycle_status == "active" filters in actions.rs are replaced by the participation check.
    • Tests: a condition naming lifecycle_status fails validation; an update_node action carrying it is rejected; archived targets are still skipped, through the check.
  • Skill and CLI guidance no longer teach lifecycle_status in play conditions or actions; the generated SKILL.md drift check passes

Technical Specifications

Reference Files

  • packages/core/src/db/sqlite_store/nodes.rs, packages/core/src/db/sqlite_store/search.rs, packages/core/src/db/sqlite_store/mod.rs
  • packages/core/src/services/node_service/mod.rs, crud.rs, bulk.rs, schema.rs
  • packages/core/src/ops/search_ops.rs, packages/core/src/ops/query_ops.rs, packages/core/src/ops/context_ops.rs
  • packages/core/src/services/embedding_service.rs
  • packages/core/src/playbook/engine.rs, cron_runner.rs, actions.rs, graph_resolver.rs
  • packages/daemon/src/services/node_service.rs

Dependencies

Related Issues

Non-Goals

  • Play enabled and suspension (separate issue)
  • Any unarchive UI

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions