Skip to content

Guarded screen actions: pick the command from the selected item's state #68

Closed

Description

@woksin

Screenplay 4.81 lets a screen offer one action whose command depends on the selected item (Cratis/Screenplay#432):

action "Close"
  when status == Open execute CloseTicket
  when status == Pending execute CancelTicket
  otherwise hidden

The first alternative whose condition holds decides; a condition on a missing or null field does not match; when none holds, the otherwise fallback runs (execute <Command>) or the action is hidden (otherwise hidden, also the default); with no item selected the action is hidden even when a fallback exists. Screenplay notes that running the selection needs renderer support.

Scene cannot express this today, so Stage refuses such screens (STAGE-SCENE-ACTION-001, Cratis/Stage#209):

  • CoreAction in Scene 4.2.0 (Source/JavaScript/react/core/ScreenplayCoreComponents.tsx) raises one cratis.scene.command with a single command and no selected item; no guarded-action component is registered in coreComponents.ts.
  • InteractionBinding in Scene.Model 4.7.0 has an optional guard for an action sequence, not ordered first-match command selection or visibility; ExecuteCommandAction carries only a command.

Needed in Scene: a core:guarded-action element (model and wire schema, React component, registry and package entry) with ordered alternatives of structured conditions plus command and input bindings, a selected-item binding from the screen or table, first-match evaluation where null or missing fields never match (also for inequality), an execute or hidden fallback with hidden as default, hiding when nothing is selected, and post-success navigation for the chosen command. Conformance specs in .NET and TypeScript.

Once it exists, Stage maps the syntax onto it and wires a command route and form for every alternative and the fallback.

Status

State: Done — Shipped in Scene v4.83.0 (PR #272, merge e0f199d).
Branch: studio-856-auto-merge (#272)
Scope: core:guarded-action (ordered first-match alternatives, selected item, hidden/execute fallback) plus first-match interaction branches; unblocks Stage#209. Planning first.
Plan: Add a core:guarded-action element using the property shape Stage already emits: an item binding, ordered alternatives (each a condition, a command and its arguments), a hidden or execute fallback, and post-success navigation. Add optional first-match alternatives/otherwise to InteractionBinding. C# and TypeScript evaluators share one fixture corpus; null and missing fields follow Screenplay 0029, and guards that cannot be evaluated fail closed. Additive minor release.
Delivered: Nothing yet.
Remaining: To be confirmed.
Follow-ups: None.

Activity

  1. self-assigned this
    on Oct 8, 2026
  2. woksin commented on Oct 9, 2026

    @woksin
    ContributorAuthor

    Screenplay 4.99 (decision 0048) extends guarded actions to interactions: on click, on double click and on select take ordered when branches, each selecting a whole action list, plus otherwise. No match means nothing runs. InteractionBinding needs the same first-match alternatives as core:guarded-action. Could the new element accept the shape Stage currently carries in core:action properties (alternatives, otherwise)?

    Until the Scene runtime evaluates them, Stage refuses guarded actions and guarded interactions at render and run time (STAGE-SCENE-ACTION-001, STAGE-SCENE-INTERACTION-001; Cratis/Stage#267) instead of showing an always-visible button that sends no command (Cratis/Stage#209). Full support in Stage waits on this issue.

  3. github-actions commented on Oct 26, 2026

    @github-actions
    Contributor

    Closed by release v4.83.0.

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions