Skip to content

feat(skills): scs-order-flow — order flow via relais#6

Merged
willamhou merged 4 commits into
masterfrom
feat/scs-order-flow
Jun 14, 2026
Merged

feat(skills): scs-order-flow — order flow via relais#6
willamhou merged 4 commits into
masterfrom
feat/scs-order-flow

Conversation

@willamhou

Copy link
Copy Markdown
Owner

What

Ports the verified SCS production order flow onto the relais scs (legacy) site, as a loadable skill plus two reference scripts.

Every HTTP step maps to a relais exec scs.* call; acs_token is injected from the vault (never in --data):

login.dogoods.website_goods_toshoppingcarts.createcustomers.customers_receive_listgetShoppingCartsshoppingcarts.updateshoppingcarts.selectorders.order_for_all

Files

  • scripts/order_flow_test.ps1 — original PowerShell flow (field-set source of truth)
  • scripts/order_flow_relais.py — executable relais-native port (--submit places a real order; omit for a dry cart run)
  • skills/scs-order-flow/SKILL.md — loadable skill: parse rules, receiver rule, cart rule, the 8-step mapping, and safety boundaries

Verified live against production (api.tffair.cn)

End-to-end through the master relais build — order_id 192076 placed (拉弗格10年 ×2, receiver 测试/receive_id 93, total_amt 598). Two findings baked into the skill:

  • goods.website_goods_to needs no edi_api prefix — the swagger spec path /1/goods/website_goods_to is equivalent.
  • customer_id / receive_address_id must be strings — numbers are rejected as err_code 201 请求json格式错误.

🤖 Generated with Claude Code

willamhou and others added 2 commits June 14, 2026 10:42
Port the verified SCS production order flow onto the relais `scs` (legacy)
site. Every HTTP step (login -> goods query -> add cart -> match receiver ->
fix quantity -> select -> submit order) maps to a `relais exec scs.*` call;
acs_token is injected from the vault, never passed in --data.

- scripts/order_flow_test.ps1   reference PowerShell flow (field-set source)
- scripts/order_flow_relais.py  executable relais-native port (--submit to order)
- skills/scs-order-flow/SKILL.md loadable skill: parse/receiver/cart rules,
  8-step mapping, and two findings verified live against api.tffair.cn:
    * goods.website_goods_to needs no `edi_api` prefix (spec path is equivalent)
    * customer_id / receive_address_id must be strings (else err_code 201)

Verified end-to-end against production: order_id 192076 placed via relais.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Drive the full order flow through ScsLegacyAdapter against a mock server:
goods query -> add cart -> match receiver -> query cart -> select -> submit
order. Pins offline the two facts verified live: goods.website_goods_to needs
no `edi_api` prefix, and customer_id/receive_address_id are sent as strings;
plus acs_token body injection and per-step routing.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a16752a856

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread skills/scs-order-flow/SKILL.md Outdated
Comment on lines +63 to +64
| login_name | `QLLKHZHH` |
| password | `QLLKHZHH` |

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Remove production credentials from the skill

This skill documents a reusable production login/password while the surrounding instructions point at https://api.tffair.cn and describe how to submit real orders. Anyone with access to the repo can use these values to get an acs_token and mutate the account or place orders, so the credentials should be removed and supplied only through the vault or user-provided secrets.

Useful? React with 👍 / 👎.

acs_token = $Token
customer_id = $CustomerId
is_recycle_bottle = 0
receive_address_id = $receiveId

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Stringify receive_address_id in the PowerShell flow

When receive_id is parsed from the address response as a number, this sends receive_address_id as a JSON number even though the new skill notes that getShoppingCarts rejects numeric receive_address_id with err_code 201, and the Python port explicitly casts it to str. Cast $receiveId to a string here so the flow does not fail immediately after adding the cart item.

Useful? React with 👍 / 👎.

willamhou and others added 2 commits June 14, 2026 10:56
…odex review)

order_flow_relais.py:
- abort on malformed relais output instead of silently using {} for `data`
- match the just-created cart item by EXACT cart id only (drop fuzzy
  same-goods fallback that could submit the wrong existing item); normalize
  ids to strings for all comparisons
- validate total_amt is present before the irreversible order call
- correct --submit help: a no-order run still mutates cart state

scs_legacy_order_flow_test.rs:
- stateful cart reads: first read unselected (select_status 2), second read
  selected (1), so the "exactly one selected" check tracks a real transition
- assert select is called exactly once with the precise select payload
- assert order body carries shopping_cart_ids + string customer id/total_amt

SKILL.md: quote string-typed placeholders (receive_address_id, total_amt).
README: call the test the happy-path (submit) flow, not the full flow.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…l doc

The skill embedded the default account's login + plaintext password. Replace
them with operator/env placeholders ($SCS_LOGIN / $SCS_PASSWORD) and a note to
source credentials at run time. The PowerShell reference already takes creds as
parameters, not hard-coded.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@willamhou willamhou merged commit 2eddd06 into master Jun 14, 2026
1 check passed
@willamhou willamhou deleted the feat/scs-order-flow branch June 14, 2026 03:15
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