feat(automation): honor flow status for enable/disable + expose runtime enable/bound state#2597
Merged
Merged
Conversation
…me enable/bound state
The engine bound and ran every registered flow, ignoring the persisted `status`
— an author couldn't turn an automation off or tell whether one was live.
- registerFlow honors `status`: `obsolete`/`invalid` → disabled (trigger not
bound, execute() refuses). `draft`/`active`/legacy-no-status → enabled, so
existing flows are unaffected (zero regression). This persists the Studio's
on/off switch via the existing `status` field (applied on publish rebind); a
flip back out of a disabled status re-enables on re-register; a runtime
toggleFlow() override on a still-enabled flow is preserved.
- New getFlowRuntimeStates() + GET /api/v1/automation/_status → [{name, enabled,
bound}] for every flow — the truth behind the Studio's status badges.
Tests: draft/active bind+enable, obsolete neither binds nor enables + execute
refuses, obsolete→active re-enables+re-binds, _status route shape. Endpoint
runtime-verified on the showcase (20 flows; screen/manual flows correctly
bound:false, all enabled).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
📓 Docs Drift CheckThis PR changes 2 package(s): 20 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why (UX eval #6 — automation enable/disable entry + status)
The engine bound and ran every registered flow, ignoring the persisted
status. So an author had no way to turn an automation off (short of deleting it), or to see whether one was live. The Studio header even says "Off by default · review before enabling" — nothing enforced or reflected it. This is the engine half of "a clear on/off switch + visible enabled/bound status"; the objectui half (badges + switch) follows.What
registerFlowhonorsstatus:obsolete/invalid→ disabled (trigger not bound,execute()refuses);draft/active— and legacy flows with no explicit status — stay enabled, so existing flows are unaffected (zero regression; confirmed showcase flows mixstatus:'active'with default-draft, both keep firing). This persists the Studio switch via the existingstatusfield (applied on the next publish rebind); a flip back out of a disabled status re-enables on re-register; a runtimetoggleFlow()override on a still-enabled flow is preserved.getFlowRuntimeStates()+GET /api/v1/automation/_status→[{ name, enabled, bound }]for every registered flow — the truth behind the Studio's badges (persistedstatusis metadata; actually enabled + bound is engine state). Underscore-prefixed so no flow name shadows it; degrades to[]on an older service.Verification
Unit (
@objectstack/service-automation239,@objectstack/runtime147): draft/active bind + enable (unchanged);obsoleteneither binds nor enables andexecute()refuses it; obsolete→active re-enables + re-binds on re-register;_statusroute shape + not shadowed by/:name.Runtime — clean showcase:
GET /automation/_statusreturned all 20 flowsenabled:true,bound14/6 — the 6 unbound are screen/manually-launched flows with no trigger (correctlybound:false). Endpoint reflects real engine state.🤖 Generated with Claude Code