2.5 KiB
2.5 KiB
Event contracts
Envelope
All bus messages use this envelope:
{
"event_id": "string",
"event_type": "string",
"venue": "string",
"source": "string|null",
"schema_version": 1,
"observed_at": "ISO-8601|null",
"ingested_at": "ISO-8601",
"payload": {},
"raw": {}
}
Topics
Current canonical topic set:
raw.near_intents.quotenorm.swap_demandcmd.execute_tradeexec.trade_result
In Kubernetes bootstrap, Redpanda topic creation is currently handled by the repo-managed bootstrap job applied with the manifest set.
raw.near_intents.quote
event_type:near_intents_quote_rawpayload.message: original venue-native payloadraw: original venue-native payload
norm.swap_demand
event_type:swap_demand- payload:
quote_idasset_inasset_outamount_inamount_outttl_ms
cmd.execute_trade
event_type:execute_trade- payload:
command_ididempotency_keyexecution_keyquote_idasset_inasset_outamount_inamount_outreason
exec.trade_result
event_type:trade_result- payload:
command_ididempotency_keyexecution_keyquote_idstatusresult_codenote
Executor idempotency model
command_idis unique per trade command and currently deterministic ascmd-${quote_id}idempotency_keyis stable for semantic duplicate detection and currently${venue}:${quote_id}execution_keyis the stable partition key and currently${venue}:${asset_in}->${asset_out}- executor persists command state on durable storage before publishing a result
- already-completed
command_ids are skipped on replay or restart - if a command is seen again after a persisted
processingstate, the executor emits a recovered result path instead of blindly duplicating work
Deployment and persistence implications
These contracts are tied to deployment behavior:
- executor duplicate suppression depends on durable persistence at
EXECUTOR_STATE_DIR - local Compose mounts that path for development/runtime testing
- the Hetzner single-node k3s path mounts persistent storage for the executor at
/var/lib/unrip/executor-state - in the current single-node target, that persistence is node-backed and should be treated as required operational state
Operational consequence:
- deleting the executor PVC or losing the node without migration discards idempotency history
- that can allow already-seen commands to be treated as new after recovery