Task: Point the grouping screen at the completion

Table of Contents

This page documents a task in the Complete a structure from a screen story. It captures the goal, current status, acceptance, and any notes or results.

1. Goal

(Describe what user-visible-or-internal change this task produces.)

2. Status

Field Value
State DONE
Parent story Complete a structure from a screen
Now Nothing.
Waiting on Nothing.
Next Nothing.
Last touched 2026-11-01

3. Acceptance

  • The grouping route completes the structure in one call, and writes no structure or member of its own.
  • Two trades grouped together become one structure whose every leg is live and waiting on Operations.
  • A refusal from the completion reaches the screen as its own message, and nothing is left behind.

4. Plan

One edit, in one place: the grouping route's structure-then-members loop becomes a single call carrying the anchor and the legs.

The decision the arc left open is taken here — grouping completes. The screen is called Group trades and its purpose is to make one deal out of trades already booked; a grouping that left its legs as drafts was the screen doing half its job. The draft flow keeps its place: booking a trade that waits, or adding a leg to a structure that is already live.

What the route keeps is its own checks: the session works for a party, every trade is one this session can read, all legs share one counterparty, the kind exists, and no trade is already grouped. The completion decides everything that needs a transaction.

5. Measurements

Every number this task claims about a tree, with the command that produced it and the commit it was measured at. A number without both is not a measurement, because a clean-up record describes a tree and trunk moves under a branch: a consumer count, a gate's component count and a suite's size all change with no code changing, and the reader of a bare number cannot tell which tree it came from. Where the raw output matters, put it in an evidence/ file beside the task and name that file in the Command column.

What Value Command Commit
       

6. Notes

7. Test Scenarios

Manual QA scenarios (scaffolded via compass add test_scenario) that verify this task. Link new ones here as they're created; the scenario doc itself links back via its "Verifies task" field.

Scenario State Notes
     

8. PRs

PR Title
#4339 [agile] Close the grouping task and its story
#4335 [web] Group trades by completing a structure, not by writing its rows

9. Review

Comment summary File Decision Notes
       

10. Result

The completion has a caller: grouping trades makes one structure whose every leg is live and waiting on Operations.

Piece Where
The call POST /api/structures calls complete_structure_request once, with the anchor and the legs in the order chosen
What the route keeps its checks: a party, readable trades, one counterparty, a known kind, no trade already grouped
What the screen sees the structure's id and reference on success, the completion's message on refusal
The cases two: a grouping completes in one call with the legs in order, and a refusal reaches the caller with nothing written

Emacs 29.3 (Org mode 9.6.15)