Skip to content

os explain flow's example teaches $currentUser as an assignment value, a spelling nothing resolves #14782

Description

@os-litant

Found while working on #14139 (the same literal on the filter surface); out of scope
there, filed unassigned for triage. Suggested domain: domain:cli. That card's triage
comment already anticipated this one: "packages/cli/src/commands/explain.ts's
$currentUser is a default-value sample on a different surface and is out of this card's
scope; if it is also wrong it is a domain:cli card."

The sample

packages/cli/src/commands/explain.ts:128, inside the flow entry's example string —
the text os explain flow prints to an author:

example: `{
  name: 'assign_on_create',
  type: 'autolaunched',
  label: 'Auto-Assign on Create',
  trigger: { object: 'project_task', event: 'afterInsert' },
  steps: [
    { type: 'assignment', field: 'assigned_to', value: '$currentUser' },
  ],
}`,

Note this is a flow step of type: 'assignment' (Set Variable,
packages/spec/src/automation/flow.zod.ts:30) — not a field defaultValue, and not a
query filter. The surface is its own; that is exactly why #14139 left it alone.

What was measured

On origin/main:

  • The literal appears exactly once in non-test, non-CHANGELOG source in the whole
    repository — this sample.
    (git grep -n -F '$currentUser' returns 4 hits: this line,
    two in skills/objectstack-ui/rules/list-views.md which skills/objectstack-ui teaches $currentUser as a filter value, contradicting its own "only two tokens resolve in a filter" contract #14139 is fixing, and
    docs/adr/0017-object-has-many-view.md:216 which is SQL-shaped prose.)
  • The flow template vocabulary is brace-based, not $-prefixed. Flow templates are
    written {record.field} and validated by flow-template-unknown-field
    (packages/lint/src/validate-flow-template-paths.ts:92), whose diagnostics say an
    unresolvable path "resolves to an empty string at runtime (silently)".
  • The $-prefixed sentinels that do exist are enumerated and different: $root
    (approval organization), $trigger, $record, $source. There is no $currentUser
    among them, and no alias table maps it.
  • The acting-user token on the value-producing surface next door is spelled bare:
    DEFAULT_VALUE_TOKEN_CURRENT_USER = 'current_user'
    (packages/spec/src/data/default-value-tokens.ts:67), matched EXACTLY by
    isCurrentUserDefaultToken (:114-116), whose own comment names currentUser as an
    authoring error rather than an accepted spelling. packages/spec/src/data/default-value-shape.ts:225
    carries currentuser only as a near-miss suggestion, and
    default-value-shape.test.ts:54 pins currentUser (camelCase) is a literal.
  • Nothing in packages/services/service-automation strips or resolves a leading $ in an
    assignment value.

What was NOT measured — please settle this in triage

I did not execute an assignment node with this value against a running engine. So the
claim I am confident in is "no declared vocabulary contains this spelling and nothing was
found that resolves it"; the claim I have not proved is "an assignment step therefore
stores the literal string $currentUser into assigned_to". If it does, that is the
lookup('sys_user') column taking a bogus literal — the same failure class as the DDL
incident catalogued in the default-value-tokens.ts module note.

Why it matters

os explain is an authoring aid whose whole audience is authors — increasingly AI authors
— writing their first flow. It is the one place a reader is told what an assignment value
looks like. If the spelling resolves nowhere, the sample teaches a value that either fails
validation or is silently stored as text, and the reader has no other reference to correct
it against.

Likely fix

Decide the correct spelling for "the acting user" on the flow-assignment surface, then make
the sample use it. If no such token exists on this surface, the sample should assign
something that does resolve rather than inventing a sentinel — and the gap itself is worth a
separate decision, since "assign to the current user on create" is the textbook
auto-assignment flow.

Generated by Claude Code

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions