Skip to content

test(cluster-tool): carry uwreqs.target_amount in the swap-scenario fixture (companion to wire-sysio#550) - #58

Merged
heifner merged 1 commit into
masterfrom
fix/uwreq-fixture-target-amount
Aug 10, 2026
Merged

test(cluster-tool): carry uwreqs.target_amount in the swap-scenario fixture (companion to wire-sysio#550)#58
heifner merged 1 commit into
masterfrom
fix/uwreq-fixture-target-amount

Conversation

@heifner

@heifner heifner commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Companion to wire-sysio#550, opened now so it is reviewed ahead of the regen rather than racing it.

⚠️ Do not merge yet — this is red by construction until the sysio.uwrit regen lands in wire-libraries-ts. That is the point of opening it early; see Sequencing.

What and why

#550 adds one additive field to the uw_request_t row — target_amount: uint64, the caller's original destination amount, retained as the fixed reference the race-time slippage check anchors on:

                     "name": "dst_amount",
                     "type": "uint64"
                 },
+                {
+                    "name": "target_amount",
+                    "type": "uint64"
+                },

uwreqRow() in SwapScenarioContext.test.ts returns the full SysioUwritUwRequestTType rather than a Partial, so the moment the regenerated types carry target_amount as required, the fixture stops compiling — which fails pnpm build (tsconfig.cjs.jest.json is a project reference) and the e2e gate behind it. One line fixes it.

That fixture is the entire surface

I checked every SysioUwritUwRequestTType reference in the repo. All the others are read positions — Promise<…> returns in five flow scenarios (flow-swap-private-reserves, flow-swap-to-wire, flow-reserve-lifecycle, flow-underwriter-slashing, SwapScenarioContext), a predicate parameter, a type alias in flow-swap-non-native-tokens, an array field in this same test. None constructs a row; an additive field cannot break any of them.

Live flow reads are unaffected regardless of merge order. They go through .tables.uwreqs.query()get_table_rows, where nodeop serializes against the on-chain ABI and returns JSON, so the extra field simply arrives and is ignored by name-based reads. There is no host-side binary decoder to misalign either — the underwriter plugin reaches uwreqs over the same JSON-RPC path, not a hand-rolled struct. So the mid-struct insertion, which would matter for a raw binary decode, does not bite.

Sequencing

Verified against today's sdk-core, this errors:

packages/cluster-tool/tests/flow/contexts/SwapScenarioContext.test.ts(65,5): error TS2353:
Object literal may only specify known properties, and 'target_amount' does not exist
in type 'SysioUwritUwRequestTType'.

sdk-core is currently ahead of wire-sysio master and already carries #549's sysio.chalg types, so regenerating today would delete them. Order:

  1. wire-sysio #549 merges
  2. regenerate SysioContractTypes once
  3. the wire-libraries-ts regen PR
  4. this PR — in the same window as step 3, not after, or the gate is red in the gap

This is the same shape as the challenge_id fixture update riding #56 for the #549 regen — one cycle later, for #550.

…ixture

wire-sysio#550 adds one additive field to the `uw_request_t` row —
`target_amount: uint64`, the caller's original destination amount, retained as
the fixed reference the race-time slippage check anchors on.

`uwreqRow()` returns the full `SysioUwritUwRequestTType` rather than a
`Partial`, so once the regenerated `sdk-core` types carry `target_amount` as a
required property the fixture stops compiling and takes `pnpm build` (and the
e2e gate behind it) with it. This adds the field.

That fixture is the whole surface: every other `SysioUwritUwRequestTType`
reference in the repo is a READ position — `Promise<…>` returns in five flow
scenarios, a predicate parameter, a type alias, an array field — none of which
constructs a row and none of which an additive field can break.

The live flow reads are unaffected either way. They go through
`.tables.uwreqs.query()` → `get_table_rows`, where nodeop serializes against
the on-chain ABI and returns JSON; an extra field is simply ignored by
name-based reads.

BLOCKED until the `sysio.uwrit` regen lands in `wire-libraries-ts`. Against
today's `sdk-core` this errors:

  SwapScenarioContext.test.ts(65,5): error TS2353: Object literal may only
  specify known properties, and 'target_amount' does not exist in type
  'SysioUwritUwRequestTType'.

Merge order: wire-sysio#549 → regenerate `SysioContractTypes` once → the
`wire-libraries-ts` PR → this. This must land in the same window as the regen,
not after it, or the gate is red in the gap.

Change-Id: I5c640c1fdc7a9170a4544a9d6fe00a4d18f37bf8
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.

2 participants