Skip to main content

Module msg_header

Module msg_header 

Source
Expand description

集中 MsgHeader builder (v1.4.110 P0-1)

取代 v1.4.110 之前散落 15+ 处直接 odr_sys_cmn::MsgHeader { ... } / sim_odr_sys_cmn::MsgHeader { ... } / trade_cmn::CryptoMsgHeader { ... } 构造模式. 普通 real/sim/crypto req_idcrate::trade_query::create_backend_req_id 派生;FIN BFF/position-action 命令则必须保留 durable intent owner 提供的 req_id. 两类路径都防止 v1.4.109 P0 类 dedupe bug (req_id 固定 → backend 幂等 cache → 误返 stale order echo). 见 essentials/2026-05-16-0725-v1.4.109-place-order-msgheader-req-id-not-unique-root-cause-codex-handoff-zh.md.

配套 pre-push Check 6 (.githooks/pre-push, v1.4.110 P0-4) 用 grep 拦截 任何新加的直接构造, 强制走本 module 的 builder.

§四个 shape 差异

  • build_realodr_sys_cmn::MsgHeader (real account, 7 fields, 含 sub_account_id)
  • build_simsim_odr_sys_cmn::MsgHeader (sim account, 7 fields, 含 market 替代 sub_account_id)
  • build_cryptotrade_cmn::CryptoMsgHeader (crypto, 仅 3 fields)
  • build_fin_realfinpb_odr_sys_cmn::MsgHeader (BFF/position action, caller-owned durable request id + optional JP sub-account)

Functions§

build_crypto
构造 crypto trade_cmn::CryptoMsgHeader (仅 3 字段).
build_fin_real
Construct the FIN service real-account header used by Desktop BFF and position-action commands. These commands own a durable request id, so the caller supplies it instead of generating a transport-local id here.
build_real
构造 real-account odr_sys_cmn::MsgHeader.
build_real_trade_account_heartbeat
Build the global account-list heartbeat header.
build_sim
构造 sim-account sim_odr_sys_cmn::MsgHeader.