Task: Make the trade entity regenerable

Table of Contents

This page documents a task in the Redesign ores.trading on data-oriented principles story. It captures the goal, current status, acceptance, and any notes or results.

1. Goal

Regenerating the trade entity produces output byte-identical to the checked-in tree, so the architectural changes that follow can be made in the models rather than by hand.

2. Status

Field Value
State DONE
Parent story Redesign ores.trading on data-oriented principles
Now Nothing.
Waiting on Nothing.
Next Nothing.
Last touched 2026-09-23

3. Acceptance

  • The org grammar expresses the five-group nested domain composition, so trade.hpp regenerates with its sub-structs and its wire format unchanged.
  • The bespoke trade_service and trade_handler members are org-declared rather than hand-written.
  • The trade schema's temporal trigger and its seven non-unique indexes are expressed in the model.
  • The nine ores.qt Trade files regenerate without losing hand-evolved behaviour, or are recorded as a deliberate exception with the reason.
  • Regenerating trade twice is idempotent and leaves the tree clean; the full build and ctest stay green.

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. Notes

6. Test Scenarios

Manual QA scenarios (scaffolded via compass add test_scenario, run through the QA Validation Runner panel) 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
     

7. PRs

PR Title
#2091 [codegen] Express the trade schema and compose its struct from N field groups

8. Review

Round 1, PR #2091. The review found nothing blocking and raised four non-blocking observations.

# Comment summary File Decision Notes
1 A model-declared Domain includes block is discarded unconditionally core.py Accept Live, not hypothetical: trade.org declared one. The loader now refuses the combination, and the dead block is gone – regeneration stayed byte-identical, which proves it was dead.
2 Nothing prevents declaring Domain groups and the identity/audit pair together org_loader.py Accept Refused with a message saying which supersedes which.
3 The docstring should be a terse comment above the code org_loader.py Decline Every function in this module carries a docstring; matching the surrounding code is the house rule the comment skill states. Changing this one would make it the odd one out.
4 "Zero deletions" in the PR body reads wrong against a diff with six PR body Accept The six are the template's clock_timestamp() replacing a stale current_timestamp. Reworded to say no content is lost rather than no lines change.
5 Not raised: a column in no group vanishes from the struct org_loader.py Added The worst of the three silent losses, since it costs a field on the wire rather than a compile error. Guarded and tested.

9. Result

Closed at sprint 25 close. Its work merged in PR #2091.

Emacs 29.3 (Org mode 9.6.15)