Skip to content

feat: expose friendly event options for automation setup - #712

Open
ak684 wants to merge 1 commit into
mainfrom
alona/automation-event-metadata
Open

ak684 wants to merge 1 commit into
mainfrom
alona/automation-event-metadata

Conversation

@ak684

@ak684 ak684 commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Automation setup currently receives raw event keys without display names. Add optional eventOptionsBySource metadata with each key's label, group and event/pattern kind, while retaining the existing catalogs for older clients. Exact events appear before wildcard families. Custom sources and sources unavailable to the organization receive no invented catalog.

The metadata covers GitHub, Azure DevOps, Jira Data Center and Bitbucket Data Center. It does not change matching, provider subscriptions or routing. Azure's git.pullrequest.merged is labeled “Pull request merge attempted,” matching Microsoft's event definition; GitHub's closed event is not labeled as a guaranteed merge.

Validation: 41 capabilities/preflight tests pass, plus Ruff and Pyright on changed modules. Endpoint tests verify source scoping, catalog compatibility, unique keys and valid trigger patterns. Canvas consumption is tracked in OpenHands/OpenHands#19461.

Companion UI preview

The attached screenshots and video show the companion Canvas implementation for OpenHands/OpenHands#19461, using this metadata shape. The UI code is on alona/automation-event-ui and is not included in this backend PR. This is the running app with MSW fixture data, not live provider webhook delivery.

The recording uses UI clicks, keyboard navigation and typed text to select two events, add a shared filter, save the draft and inspect the phone layout. The browser test asserts the save response and outgoing event list. Existing automation editing was also checked on an isolated local stack with API readback after UI saves.

Validation evidence 1

Validation evidence 2

Validation evidence 3

3.mp4

Jev-Fast-Audit

⚡ Jev fast audit · estimates · 0.27s · commit 58406b1
Strongest signal: No primary concern selected.
Evidence: No primary concern to locate.
Coverage: complete supplied coverage; 8/8 hunks, 4/4 files.

All estimates and evidence
Estimate Likelihood / value Direct evidence
SQL injection 3.0% No direct hunk selected
Command injection 3.0% No direct hunk selected
Weakened authentication 4.0% No direct hunk selected
Weakened authorization 7.0% No direct hunk selected
Contract regression 12.0% No direct hunk selected
Data loss 3.0% No direct hunk selected
Sensitive data disclosure 3.0% No direct hunk selected
Unexpected data transfer 3.0% No direct hunk selected
Credential misuse 3.0% No direct hunk selected
Untrusted instruction authority 2.0% No direct hunk selected
Package source redirection 3.0% No direct hunk selected
Unverified remote execution 2.0% No direct hunk selected
Privileged environment access 2.0% No direct hunk selected
Security assessment bypass 3.0% No direct hunk selected
Prohibited workload 2.0% No direct hunk selected
Primary concern None selected; confidence 96.0% No primary concern to locate

@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

Coverage

Warning

Your comment is too long (maximum is 65536 characters), so the coverage report was not added. See the job log for how to reduce it.

@all-hands-bot all-hands-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This review was posted by an AI agent (OpenHands).

Scope gate: the capabilities contract belongs to this service, and Canvas consumption is tracked separately in OpenHands/OpenHands#19461 (currently ready-for-dev), so this is the right repository.

Verified on head 58406b1:

  • The change is purely additive: eventOptionsBySource defaults to an empty dict, the existing eventTypes/eventTypesBySource catalogs are unchanged, and matching, provider subscriptions, and routing are untouched — event_options() is display-only and consumed only by GET /v1/capabilities.
  • _EVENT_LABELS covers exactly the four catalog sources. I verified programmatically that every generated option's key is a real catalog key (union of supported_event_patterns and labels, filtered through pattern_can_match), keys are unique, and Azure's keys map 1:1 onto AZURE_DEVOPS_EVENT_TYPES. git.pullrequest.merged is labeled "Pull request merge attempted" per Microsoft's event definition, and GitHub's pull_request.closed is not presented as a guaranteed merge — both consistent with the PR description.
  • The kind classification uses the same wildcard charset the trigger matcher accepts; every advertised pattern self-matches via fnmatch (verified), so a selected "pattern" option works as a trigger on value.
  • Source scoping is correct: custom sources and sources without a catalog get None from event_options() and no invented metadata; catalog keys track eventTypesBySource exactly.
  • Tests: the added endpoint test asserts source scoping, unique keys, the catalog superset, valid patterns via pattern_can_match, and label/kind spot checks. Local run of tests/test_event_schemas.py passes (56 tests, including trigger matching), Ruff and Pyright are clean on the changed modules, and GitHub Actions on this head are all green including unit-tests (success).

No material correctness, security, or compatibility findings.

✅ APPROVED

@ak684
ak684 marked this pull request as ready for review November 25, 2026 18:22
@DevinVinson DevinVinson self-assigned this Nov 25, 2026

This branch has not been deployed

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

Labels

type: feat A new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants