Task: Roll a run's counterparties up to their groups

Table of Contents

This page documents a task in the Prove the report grid run end to end — the remaining work story. It captures the goal, current status, acceptance, and any notes or results.

1. Goal

A credit reader sees a counterparty group's aggregate above the names that make it up, and can check the two against each other.

2. Status

Field Value
State DONE
Parent story Prove the report grid run end to end — the remaining work
Now Nothing.
Waiting on Nothing.
Next Nothing.
Last touched 2026-10-26

3. Acceptance

  • A counterparty with a parent carries its group's name.
  • A group row states the sum of its members' trades, NPV and notional.
  • Members sit under their group, indented, ordered largest first.
  • A counterparty with no parent stands on its own, and its Show the trades still works.

4. Plan

(Implementation strategy. Written when work starts; key decisions are distilled into the parent story's * Decisions at close, but the plan itself stays — it is the historical record of what we did.)

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
#3887 [web] Roll a run's counterparties up to their groups

9. Review

Comment summary File Decision Notes
       

10. Result

The counterparty level states each group above its members.

A counterparty that names a parent carries the parent's name, and a group row sits above the members that share it. The group's trades, NPV and notional are the sums of its members, so the two can be checked against each other. Members are indented under their group and ordered largest first, groups are ordered by their own figure, and a counterparty with no parent stands on its own.

The run that shows it is 71d08bde-2fd9-4ce5-b455-86766722fc99, on the NPV definition of ACME Corporation HK Ltd. Its counterparty level draws fourteen rows: seven groups and their members, among them 株式会社三菱UFJフィナンシャル・グループ with two members adding to 4,788,523.77 HKD, and DBS GROUP HOLDINGS LTD above DBS BANK LTD. at 2,606,275.49 HKD.

Show the trades stays on members, because the filter reads one counterparty's trades; a group's trades are its members' and are read one by one.

The group names come from the tenant's whole counterparty list rather than from the trades, because a parent need not trade in the run and would otherwise be unnamed.

The review found the case where a parent does trade: its own row has no parent, so it was left standing beside a group with the same key, and the group's figure left its trades out. The parent is now one of its own group's members, so its trades are counted once and its row sits under the group it leads; group and member rows take distinct React keys. A parent whose name was not read is left standing, because grouping under a blank name hides the grouping the reader came for. The two summing helpers are one, and the comment that had drifted sits above the function it describes again.

Emacs 29.3 (Org mode 9.6.15)