Repository navigation
Description
Overview
The playbook engine's date support is read-only and condition-scoped: CEL registers exactly three date functions (days_since, days_until, today — packages/core/src/playbook/cel.rs, ~lines 344-346, 370-384), all of which compare an existing date string against "now" and return either a boolean-usable day count or today's own date. None of them compute a new date offset from an existing one (e.g. "14 days after this date"). This blocks any Play that needs to derive a future/past date and write it as a field value — a scheduled Cycle-creation Play computing a new Cycle's end_date from start_date + duration_days is the motivating, concrete case.
Problem Statement
This is a compound gap, not a single missing function, confirmed by direct inspection of both halves of the engine:
- No date-arithmetic function exists. CEL's registered function set has nothing like
add_days(date, n) -> date.days_since/days_untilonly produce integers from a fixed "now" anchor; there is no way to add an offset to an arbitrary date and get a new date string back. - Even if one existed, actions can't use it.
packages/core/src/playbook/actions.rshas no CEL evaluation anywhere in its action-execution path — confirmed via search forcel/Cel/CELin that file (zero hits). Actionparamsvalues are resolved through a completely separate mechanism,resolve_bindings_in_string/resolve_bindings_in_value(~lines 504-580): a{path}-style path-substitution/interpolation scheme (e.g.{trigger.status},{item.id}), not expression evaluation. CEL programs (cel.rs) are compiled and run only for trigger conditions, never for action values. So a date-arithmetic CEL function, on its own, would only be reachable from a condition (useful for "is this date more than N days old," whichdays_sincealready covers) — not from an action writing a computed date onto a node, which is the actual need.
No existing ADR or architecture doc names either gap as known/deferred — confirmed via search of ../nodespace-docs/decisions/ and ../nodespace-docs/architecture/.
Proposed Solution
Two coupled pieces of work, both required together for the motivating case to be expressible:
- A date-arithmetic function, e.g.
add_days(date_string, n) -> date_string, registered alongside the existing three incel.rs, followingparse_date_and_compute_days's existing parsing precedent (accepts both full ISO 8601 datetime and bareYYYY-MM-DD). - A way for an action value to be computed, not just path-substituted. The binding-interpolation mechanism in
actions.rsneeds a way to express "the value of this action param is the result of evaluating this CEL expression against the current binding context" — not a full CEL condition, but a computed value at action-execution time. Two shapes worth weighing during design:- Extend the existing
{path}interpolation syntax to also accept a function-call form, e.g.{add_days(item.start_date, 14)}, evaluated through the same binding-resolution machinery rather than a separate CEL program. - Run a real (short) CEL program for any action param value that isn't a bare
{path}, giving action values the same expression power conditions already have, with the binding context's resolved values exposed as CEL variables.
- Extend the existing
The second shape gives more power for less special-casing (reuses cel.rs machinery directly rather than teaching resolve_bindings_in_string new syntax) but changes the performance/complexity profile of every action-value resolution, not just date arithmetic specifically — this needs a real design decision, not a default pick, during implementation.
Architecture Impact
No existing ADR documents playbook action-value expression capabilities as closed or deliberately scoped to path-substitution-only — this is additive new capability, not a reversal.
Acceptance Criteria
- Design decision made and documented (extend
{path}interpolation vs. full CEL evaluation for action values) with rationale -
add_days(date_string, n)(or equivalent) is available wherever the design lands it — at minimum, usable from an action computing a new date field value - A scheduled Play can compute
end_date = start_date + N daysand write it as a new node's field value end-to-end (integration test) - Existing
{path}interpolation and CEL condition behavior is unaffected for every case that doesn't use the new capability - Tests pass (
bun run test:all) - Code passes
bun run quality:fix
Technical Specifications
Reference Files
packages/core/src/playbook/cel.rs—parse_date_and_compute_days(~line 387), existing function registration (~lines 344-346) — precedent and registration point foradd_dayspackages/core/src/playbook/actions.rs—resolve_bindings_in_string/resolve_bindings_in_value(~lines 504-580),BindingContext::resolve_binding(~line 274) — where computed-value support needs to be added, one way or another
Dependencies
None — this is a standalone engine capability, usable independent of any specific recipe.
Related Issues
- Add methodology recipe mechanism (TS source, generated CLI reference doc) with Linear-style as first recipe #2596 (Linear-style methodology recipe) — the Cycle-creation Play's
end_datecomputation is a direct consumer of this capability once it exists; Add methodology recipe mechanism (TS source, generated CLI reference doc) with Linear-style as first recipe #2596 cannot express its cycle-rollover date math without this landing first - Add collection-aggregation action to the playbook engine (sum/count over a for_each collection) #2639 (collection-aggregation action) — a related but distinct engine gap found during the same design pass; that issue is about reducing a collection to one value, this one is about computing a new date from an existing one. Both are prerequisites for different pieces of the same Cycle-creation Play
Non-Goals
- Any specific recipe content (Cycle schema, the Cycle-creation Play itself) — this issue is the general engine capability only
- Date arithmetic beyond day-offset (month/year-aware calculations, business-day-aware calculations, etc.) — day-offset is sufficient for the motivating case; broader calendar arithmetic can follow as a real need surfaces
Activity
mstomar125 commentedon Sep 17, 2026
Frontend: 5134 passed
Add sum(collection, field) / count(collection) aggregate binding call…