Skip to content

[docs] Document Action trigger conditions - #977

Open
rosemarYuan wants to merge 2 commits into
apache:mainfrom
rosemarYuan:pr4/docs
Open

[docs] Document Action trigger conditions#977
rosemarYuan wants to merge 2 commits into
apache:mainfrom
rosemarYuan:pr4/docs

Conversation

@rosemarYuan

Copy link
Copy Markdown
Contributor

Linked issue: #754

Purpose of change

This is the third PR in the three-PR stack tracked by #754:

  1. [api][java][python] Introduce EventType constants and unify Action trigger entry #756 — API changes (under review)
  2. [runtime][java][python] Add CEL Action condition filtering #821 — CEL runtime (Java and Python)
  3. This PR —Documentation

PR #821 introduced Action trigger conditions, but the existing documentation still described Actions mainly as event-type listeners. This PR documents the user-visible trigger-condition contract consistently across Java, Python, and YAML.

A trigger condition can be either an exact event type or a condition expression, which uses Common Expression Language (CEL). This change:

  • explains OR semantics across trigger-condition entries, fan-out across matching Actions, exact event-type precedence, and per-Action short-circuit behavior;
  • documents the event data available to condition expressions, including nested values, name collisions, missing values, numeric conversion, and supported macros;
  • explains YAML validation and quoting rules for condition expressions, custom event types, and event aliases;
  • clarifies that event aliases replace only complete event-type entries;
  • provides decorated, annotated, and programmatic Action examples, including a complete Java registration example;
  • documents action.trigger-condition.evaluate-failure-strategy; and

Tests

This is a documentation-only change. No Tests.

API

No public API or runtime behavior is changed. This PR documents the Action trigger-condition APIs and configuration introduced by #821.

Documentation

  • doc-needed
  • doc-not-needed
  • doc-included

@github-actions github-actions Bot added doc-included Your PR already contains the necessary documentation updates. fixVersion/0.4.0 priority/major Default priority of the PR or issue. labels Aug 7, 2026
@rosemarYuan
rosemarYuan marked this pull request as ready for review August 7, 2026 03:16

@weiqingy weiqingy left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking this on. A few questions inline.

Comment on lines +393 to +394
static membership with `"a.b.c" in attributes`. Dynamic access at the root, such as
`attributes[key]`, and expressions over the whole `attributes` map are not supported. Dynamic access

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Not supported" sits in the same register as line 398's "remains absent", but this one is a hard failure: ConditionExpressionCompiler.classifyIdent throws from the ActionMatcher constructor, so the job fails at operator initialization. The fixture dynamic_whole_attributes_index captures the split, plan_validation: pass with runtime_compilation: fail.

Would naming the outcome help a reader tell the two apart? Maybe something like "rejected when the runtime compiles the condition, so the job fails to start", if that reads right to you.

Comment thread docs/content/docs/development/yaml.md Outdated
attribute envelope under `attributes`. Referenced top-level entries from `Event.attributes` are also
available directly. Nested values stay under their top-level attribute path and are never flattened.
For an input event whose attributes are `{input: {status: "ok"}}`, both `input.status` and
`attributes.input.status` are valid, while bare `status` is not. Other event payloads follow the same

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"is not" reads as rejected, though nothing rejects bare status. It clears plan validation and the type check (ConditionExpressionCompiler.java:124 declares non-framework idents SimpleType.DYN), then throws unbound at evaluation. Under the default WARN_AND_SKIP that is logged and treated as false, so the action just never fires.

That default lives only in the configuration.md row this PR adds, and neither page links to it. Would a sentence on the failure semantics plus a link fit here, the way monitoring.md:335 points at event-log.level? Same two gaps on workflow_agent.md, if so.

### Provider aliases

For `clazz:` on resource descriptors and for event names in `trigger_conditions:`, you can use a short alias instead of a fully-qualified class path.
For `clazz:` on resource descriptors and for complete event-type entries in `trigger_conditions:`, you can use a short alias instead of a fully-qualified class path. Event alias replacement is an exact complete-entry lookup: `input` is replaced, while `type == input`, `attributes.kind == 'input'`, and the quoted event type `'input'` remain unchanged.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sentence now frames the alias table below as the menu of legal trigger_conditions values, and that table offers output. An action triggered on output never runs: ActionExecutionOperator.java:247 sends OutputEvents downstream in the if branch, so the getActionsTriggeredBy call in the else at :269 is never reached. Nothing fails and nothing logs.

You document exactly this at workflow_agent.md:472-474. Should the caveat follow the alias table here, or hang off the pointer at 350-351?

Clarify trigger-condition matching and failure semantics.
Deduplicate YAML guidance and document OutputEvent routing behavior.

Generated-by: Codex CLI 0.144.5 (GPT-5.6-sol)
@wenjin272

Copy link
Copy Markdown
Contributor

Thanks for the detailed comments, @weiqingy. I refactored the two pages to keep the trigger-condition contract in workflow_agent.md and only YAML-specific guidance in yaml.md. The three issues you raised are now covered.

Could you please take another look and let me know if you have any further suggestions?

@weiqingy weiqingy left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for addressing the comments. All three are closed, and moving the trigger-condition rules onto one page with yaml.md pointing at it reads much better.

One thing inline that doesn't need to hold this up, otherwise LGTM.

underscores, or hyphens. Quote a name that contains other punctuation or would otherwise be parsed as
an expression, for example `'order:created'`, `'true'`, or `'EventType.custom'`. A quoted name matches
the literal event-type string; it does not reference a built-in `EventType` constant. Quoted names
must be non-empty and cannot contain whitespace, quotes, backslashes, or control characters.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In Java and Python you pass the condition as a string, so an event type that needs quotes ends up with two layers: @Action("'order:created'"). This paragraph shows 'order:created' but never says the inner quotes belong in the string, and the example that made that clear came out in this commit. Drop a layer and @Action("order:created") looks right, but it gets read as an expression rather than an event type (TriggerCondition.java:32 leaves : out of the bare-name pattern), so the plan fails to build. The YAML page still says it outright at yaml.md:292. Since this page owns the rule now, would one line here help? Maybe: "In Java and Python the quotes are part of the condition string, for example @Action("'order:created'")."

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

Labels

doc-included Your PR already contains the necessary documentation updates. fixVersion/0.4.0 priority/major Default priority of the PR or issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants