Skip to content

Add Wake to the commerce companion cards, and gate it on a token - #6799

Open
viktormarinho wants to merge 1 commit into
mainfrom
fix/wake-commerce-companion-card
Open

Add Wake to the commerce companion cards, and gate it on a token#6799
viktormarinho wants to merge 1 commit into
mainfrom
fix/wake-commerce-companion-card

Conversation

@viktormarinho

@viktormarinho viktormarinho commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Wake was the one commerce platform with no entry in COMMERCE_COMPANION_MCPS. Two consequences, and the second is the one worth reviewing.

1. The card could silently not exist

Without a curated entry, buildCompanionCards falls back to itemsByName[req.bindingType] — looking the registry item up by server_json->>'name'. So the card renders only if the published app name equals the binding id exactly; otherwise if (!item) continue drops it, and the merchant sees no Wake card at all with nothing in the UI to explain it. resolveCandidate has the same coupling on connections.app_name, so even a rendered card would have had nothing to pick.

That is not hypothetical — an app published with its scope inside server_json.name (<scope>/<name> rather than <name>) hits both. Matching by the curated registryAppId makes the card independent of that field.

2. A Wake connection with no credentials read as "connected"

isCompanionConfigured had no case "wake", so Wake fell through to default: true — linked was treated as usable, which is exactly what the satisfied / configured split exists to prevent.

Wake mints static tokens in the merchant's panel, so both live in configuration state (no getAccessToken lane), and the two gate different capabilities independently:

  • storefrontToken → catalog reads
  • apiToken → the admin order lane

Either one alone makes the connection useful, so the guard is an OR, not an AND. That mirrors the refine on the consumer side, where requiring both would make a catalog-only connection fail the orders lane instead of leaving it ineligible.

Changes

  • companions.ts — curated wake entry (registryAppId, area, headline)
  • companions-core.tswake in FALLBACK_COMPANION_REQUIREMENTS so the card survives a CD proxy 401; case "wake" in isCompanionConfigured and in getConnectedDetail (shows the account instead of a gear once configured)
  • companions-core.test.ts — 3 tests: either token alone configures, neither does not

Test

bun test src/routes/commerce-onboarding/companions-core.test.ts → 52 pass / 0 fail.


Summary by cubic

Adds Wake to the commerce companion cards so it no longer silently disappears when the published app name doesn't match the binding id, and treats a Wake connection as configured only when it carries at least one of its two static tokens.

  • Adds a curated wake entry with registryAppId to decouple the card from the app name.
  • Adds a case "wake" to isCompanionConfigured that requires either storefrontToken or apiToken; previously it defaulted to true, misreading a linked-but-unconfigured connection as usable.
  • Includes wake in FALLBACK_COMPANION_REQUIREMENTS and shows the account in the connected detail.

Written for commit a8090d1. Summary will update on new commits.

Review in cubic

…t on a token

Wake was the one commerce platform with no entry in
COMMERCE_COMPANION_MCPS. Without a curated entry buildCompanionCards
falls back to itemsByName[bindingType], looking the registry item up by
server_json.name — so the card depended on the published app name
matching the binding id exactly, and got dropped entirely (`if (!item)
continue`) whenever it didn't. resolveCandidate has the same coupling on
connections.app_name. Matching by the curated registryAppId instead makes
the card independent of that field.

The second half matters more. isCompanionConfigured had no `case "wake"`,
so Wake fell to `default: true` — a linked Wake connection with no
credentials at all read as "connected", which is exactly what the
satisfied/configured split exists to prevent. Wake mints STATIC tokens in
the merchant's panel, so both live in configuration state, and the two
gate different lanes independently (storefrontToken => catalog reads,
apiToken => the admin order lane). Either one alone makes the connection
useful, so the guard is an OR — mirroring the refine on the consumer
side, where a catalog-only connection must leave the orders lane
ineligible rather than failing it.

Also adds the FALLBACK_COMPANION_REQUIREMENTS entry so the card survives
a CD proxy 401, and getConnectedDetail so a configured card shows the
account instead of a gear.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant