Skip to content

Rename node_type "playbook" to "play" and instance-level identifiers in code #2569

Closed

Description

@malibio

Overview

../nodespace-docs/architecture/playbook-system.md and playbook-engine.md were updated to distinguish two concepts that were previously both called "playbook": the Playbook engine/subsystem (unchanged name) and a Play — a single automation rule-set node instance (trigger → conditions → actions), previously also called "a playbook." The docs rename is committed (nodespace-docs 175836f). Code still uses the old, now-ambiguous terminology throughout.

Problem Statement

Code currently uses "playbook" as both the node_type string for a single rule-set instance AND as the prefix for the engine/subsystem's own types (PlaybookEngine, PlaybookLifecycleManager). Per the docs rename, only the former should change — the engine-level names are correct as-is and should NOT be touched. Left unrenamed, the code and docs now disagree on what "playbook" refers to at the instance level, which will confuse anyone implementing #2562 (which wires the engine into daemon startup) against the current code.

Proposed Solution

Rename instance-level identifiers only, following the docs' precedent exactly: node_type: "playbook" → node_type: "play", and function/type names that refer to a single rule-set instance (not the engine/subsystem) get renamed to use "play". Engine/subsystem-level names (PlaybookEngine, PlaybookLifecycleManager, the packages/core/src/playbook/ module path, PlaybookExecutionContext, ActivePlaybooks, etc.) are explicitly not renamed — they correctly describe the engine, which keeps the name "Playbook".

Architecture Impact

This issue implements the terminology already established in ../nodespace-docs/architecture/playbook-system.md and playbook-engine.md (renamed in nodespace-docs commit 175836f). It does not reverse or supersede any ADR — it's a code/docs consistency fix following an already-made naming decision.

Implementation Approach

Rename: node_type string literal

"playbook" → "play" everywhere it identifies the node type of a single rule-set instance:

  • packages/core/src/playbook/cron_runner.rs:390 — node_type: "playbook".to_string()
  • packages/core/src/playbook/lifecycle.rs:409 — node_type: "playbook".to_string()
  • packages/core/src/playbook/engine.rs:177,181,187 — three node_type == "playbook" match guards
  • packages/core/src/playbook/tests.rs:19 — test fixture node_type: "playbook".to_string()
  • packages/core/src/services/node_service/crud.rs:140,225,1063 — three node.node_type == "playbook" / updated.node_type == "playbook" checks

Rename: functions and error types referring to a single instance

  • validate_playbook_rules → validate_play_rules (packages/core/src/services/node_service/crud.rs, and its declaration/call sites — check packages/core/src/ops/mod.rs and packages/core/src/services/error.rs for the PlaybookValidationFailed error variant, which should become PlayValidationFailed, and packages/daemon/src/services/node_service.rs for its gRPC-status error-mapping)
  • Any other function/variable named for a single playbook instance (not the engine) discovered while implementing — e.g. check packages/core/src/playbook/validation.rs and packages/core/src/playbook/types.rs for instance-scoped naming (a Playbook struct representing one parsed instance, if one exists, would become Play)
  • PlaybookId (if used as "the id of one instance" rather than an engine-internal type) — verify usage at each call site before deciding; do not rename blindly

Explicitly do NOT rename

  • PlaybookEngine, PlaybookLifecycleManager (packages/core/src/playbook/engine.rs, lifecycle.rs) — these name the engine/subsystem, which keeps the name "Playbook"
  • PlaybookExecutionContext, ActivePlaybooks registry, source_playbook_id (cycle-detection/log-attribution fields) — engine-internal, not instance-identifying in the sense this rename targets; use judgment per the docs' own precedent (the docs rename kept these — see playbook-engine.md's diff for exactly which identifiers stayed vs. changed)
  • The packages/core/src/playbook/ module path itself — stays as-is, it's the engine's module
  • enable_playbook/disable_playbook MCP-tool-name references in stale doc sections already being reworked separately by Expose playbook lifecycle and get-workflow-state via CLI and skill guidance #2563 — do not preemptively rename CLI verb names here; Expose playbook lifecycle and get-workflow-state via CLI and skill guidance #2563 designs those fresh

Verification

  • Re-grep packages/ for "playbook" (case-insensitive) after changes; every remaining hit should be an engine/subsystem-level identifier correctly left alone (cross-check against ../nodespace-docs/architecture/playbook-engine.md's "Deliberately left unchanged" precedent) — not a stray instance-level reference
  • No frontend changes needed — confirmed zero "playbook" references in packages/desktop-app/src (no Svelte component exists for this concept yet)

Acceptance Criteria

  • node_type: "playbook" no longer appears anywhere in packages/ — all sites use "play"
  • validate_playbook_rules renamed to validate_play_rules, all call sites updated
  • PlaybookValidationFailed error variant renamed to PlayValidationFailed (or equivalent), gRPC status mapping in packages/daemon/src/services/node_service.rs updated to match
  • PlaybookEngine, PlaybookLifecycleManager, and other genuinely engine-level identifiers are verified unchanged (explicit check, not just "didn't touch them")
  • Existing playbook/play tests (packages/core/src/playbook/tests.rs) pass under the new naming with no behavior change
  • bun run test:all passes with no new failures
  • Code passes bun run quality:fix

Technical Specifications

Reference Files

  • packages/core/src/playbook/cron_runner.rs, lifecycle.rs, engine.rs, tests.rs, validation.rs, types.rs — instance-level node_type and struct/function naming
  • packages/core/src/services/node_service/crud.rs — node_type == "playbook" checks, validate_playbook_rules
  • packages/core/src/ops/mod.rs, packages/core/src/services/error.rs — PlaybookValidationFailed error variant
  • packages/daemon/src/services/node_service.rs — gRPC error-status mapping for the above
  • ../nodespace-docs/architecture/playbook-system.md, playbook-engine.md — the already-completed docs rename; use their diffs as the precedent for exactly which terms changed vs. stayed

Dependencies

Related Issues

Non-Goals

  • Renaming anything in strategy/ docs (nodespace-docs) — left untouched per the docs rename's own scope, a product-positioning decision, not a code concern
  • Designing or renaming CLI verb names (nodespace playbook ... vs nodespace play ...) — that's Expose playbook lifecycle and get-workflow-state via CLI and skill guidance #2563's scope, done fresh
  • Any change to the future PlaybookNode bundle-record concept (not yet designed, separate ADR/issue)

Activity

  1. self-assigned this
    on Sep 11, 2026
  2. mstomar125 commented on Sep 11, 2026

    @mstomar125
    Contributor

    Implemented in #2572.

    Renamed — `node_type: "playbook"` → `"play"` at every instance-identifying site (including three `query_nodes_by_type("playbook", …)` call sites not in the original line list, in `engine.rs`, `validation.rs`, and `ops/context_ops.rs`, which would have silently matched zero rows post-rename otherwise); `validate_playbook_rules`→`validate_play_rules` and the underlying `validate_playbook`→`validate_play` (a second function found while implementing); `NodeServiceError::PlaybookValidationFailed`→`PlayValidationFailed` (+ daemon gRPC status-mapping test); `ParsedPlaybook`→`ParsedPlay`, `PlaybookStatus`→`PlayStatus`, `PlaybookParseError`→`PlayParseError`, `PlaybookValidationError`→`PlayValidationError`, `PlaybookErrorType`→`PlayErrorType`, `AffectedPlaybook`→`AffectedPlay`; the lifecycle manager's per-instance `activate/deactivate/disable/reenable/get_playbook` methods and `OrderedRuleRef`'s `playbook_id`/`playbook_created_at` fields; plus matching test/benchmark identifiers and doc-comment prose throughout.

    No `PlaybookId` type exists in the codebase — that conditional item in the issue was moot.

    Left unrenamed (verified against the docs diff's own "kept" set): `PlaybookEngine`, `PlaybookLifecycleManager`, `PlaybookExecutionContext`, the `active_playbooks`/`ActivePlaybooks` registry, `source_playbook_id`, `playbook_context`, the `"playbook_engine"` client-id literal, the `"playbook_log"` node type, `scoped_for_playbook`, and the `packages/core/src/playbook/` module path — all explicitly named in the issue. Additionally left unrenamed: `PlaybookInfo`/`WorkspaceContext::active_playbooks` in `ops/context_ops.rs`, because `packages/agent`'s prompt-assembly snapshot tests golden-match its `"ACTIVE PLAYBOOKS:"` output verbatim, and touching it would mean editing `packages/agent` fixtures — out of scope here. Zero `packages/agent` files were touched.

    Verification — re-grepped `packages/` for `"playbook"` (case-insensitive) after the change; every remaining hit is one of the kept identifiers above, a `crate::playbook::` module-path reference, or pre-existing `packages/agent` prose around the untouched `PlaybookInfo`. bun run test:all and bun run quality:fix both green, including the pre-push gate's full re-run.

    Leaving this open for review per convention — will close manually once merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions