fix(messaging): prefer flow main when select_app_flow is ambiguous#116
Open
BimaPangestu28 wants to merge 1 commit into
Open
fix(messaging): prefer flow main when select_app_flow is ambiguous#116BimaPangestu28 wants to merge 1 commit into
main when select_app_flow is ambiguous#116BimaPangestu28 wants to merge 1 commit into
Conversation
`select_app_flow` previously errored with `APP_FLOW_NOT_RESOLVED` whenever an app pack shipped more than one messaging flow without an explicit `default` flow. That broke any pack that ships a primary `main` flow alongside auxiliary helpers — e.g. `supply-chain-demo` ships `main`, `on_message`, `order_tracking_flow`, `reorder_flow`, and `stock_check_flow`, all `kind: messaging`. Add a `main` fallback between the existing `default`-name lookup and the single-messaging-flow check. The fallback is restricted to messaging flows so non-messaging domains stay unaffected. Single-flow packs (e.g. `hr-onboarding-demo`) keep resolving via the existing one-flow path with no behavior change. Tests cover three scenarios: - ambiguous messaging set with a `main` resolves to `main` - ambiguous set whose `main` is a non-messaging kind still errors - the prior "exactly two messaging, no `main`" case still errors with the same available-flows hint
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.
Summary
select_app_flowerrored withAPP_FLOW_NOT_RESOLVEDwhenever an app pack shipped >1 messaging flow without an explicitdefaultflow.mainfallback (restricted tokind: messaging) between the existingdefault-name lookup and the single-messaging-flow heuristic.defaultflow.Why
Multi-flow app packs were silently broken. Concrete repro:
supply-chain-demoships five messaging flows (main,on_message,order_tracking_flow,reorder_flow,stock_check_flow). When the user opens the webchat URL for that bundle and types anything, the runtime logs:…and no flow ever runs (
state/runs/messaging/stays empty,flow.logis empty,parsed events=0in operator log even though the activity arrived).The
mainflow already carries the entrypoint the wizard intends to surface (entrypoints: { default: "show_welcome" }). Treating it as the natural fallback matches the conventiongtbundlealready uses when it scaffolds packs.Test plan
cargo test -p greentic-start --lib select_app_flow— local: 4/4 pass (2 new, 2 existing unchanged)cargo clippy -p greentic-start --all-targets -- -D warnings— clean locallycargo fmt -p greentic-start --check— clean locallygreentic-startagainst this branch, install over~/.local/bin/greentic-start, thengtc start supply-chain-demo-bundle→ user message in webchat → verify flowmainruns (welcome card appears) instead of erroring withselect app default flow.gtc start hr-onboarding-demo-bundle→ still resolves tomainvia the single-messaging-flow path (no behavior change).Related
card_spec); together with this PR, the supply-chain-demo bundle should render its welcome card end-to-end.