Story: Restore the trading guards the versioned model dropped — the remaining work

Table of Contents

This page documents a story in Sprint 30, carried unfinished from Sprint 28 at close. It captures the goal, current status, acceptance criteria, and the tasks that compose it.

1. Goal

Two guarantees went out with the immutable profiles, and nothing replaced them:

  • A trade is no longer refused when it is reported into another party's portfolio. The check and its message are gone from the generated SQL, so the report is accepted.
  • A raw update rewrites every version of a trading row in place. The history a versioned table exists to keep can be written over.

2. Status

Field Value
State BACKLOG
Parent sprint Sprint 30
Now Not yet started. Split from Restore the trading guards the versioned model dropped, which closed in sprint 28 with its done tasks.
Waiting on Nothing.
Next Triage into a sprint.
Last touched 2026-11-08

3. Acceptance

  • A trade cannot be reported in another party's portfolio.
  • The pgTAP suite that proves it is restored.
  • An update to a versioned trading row does not rewrite the versions already written.

4. Tasks

Task State Start End Description
Refuse a portfolio a trade's party does not own BACKLOG     Initial task for: Restore the trading guards the versioned model dropped
Open a new version when a versioned row is updated BACKLOG     Task for: Restore the trading guards the versioned model dropped

5. Decisions

6. Out of scope

7. Notes

Two smaller consequences of the same refactor, found while repairing the pgTAP suites. Neither is worth a task of its own yet:

  • ores_utility_allow_immutable_purge_fn() is inert for trading. Nothing in a trading table consults it any more, so a delete closes the current version with the switch on or off. The pgTAP case that used to purge now asserts that the switch changes nothing.
  • The structures insert trigger checks that a structure is not its own parent after it checks that the parent exists, so a self-parent write is refused as a missing parent and the self-parent branch never runs. The check is unreachable rather than wrong.

Emacs 29.3 (Org mode 9.6.15)