Task: Baseline, decisions and evidence for ores.trading

Table of Contents

This page documents a task in the Clean ores.trading to the component clean standard story. It captures the goal, current status, acceptance, and any notes or results.

1. Goal

Record the baseline of ores.trading before any edit, so that every later difference is attributable to a known cause, and record the decisions that bound the six PRs. This is item group B of the Component Clean Standard plus the decision record the story needs. It changes no code.

2. Status

Field Value
State DONE
Parent story Clean ores.trading to the component clean standard
Now Nothing.
Waiting on Nothing.
Next Nothing.
Last touched 2026-09-26

3. Acceptance

  • evidence/b01_component_drift_dry_run.txt holds the 2026-09-26 baseline: 1636 changed, 115 created, and the classification of every block by cause.
  • evidence/b02_b03_b04_survey.md holds the model metatype census (B02), the hand-written file classification (B03) and the subject and header inventory (B04).
  • evidence/b05_open_work.txt holds the open pull requests, the branches and the backlog captures that touch ores.trading.
  • evidence/b06_consumer_census.txt holds the consumer census and the 126 headers consumed outside the component.
  • evidence/v02_trading_tests.txt holds the measured test state.
  • evidence/v05_codegen_gates.txt holds every gate output with its exit code, and states which gates read green only because ores.trading is excluded from their registries.
  • The seven decisions D1 to D7 are recorded on the story, each with its reason and its consequence.
  • evidence/pr1_local_checks.txt holds the local checks: compass lint, validate_docs.sh, the site check, and the misspell pass.
  • The sprint 25 release notes and health review no longer claim that ores.trading is drift-free, and the release notes are re-exported from their org source.
  • compass lint passes, validate_docs.sh passes, and the component drift dry run still reports the same 1751 files.

4. Plan

4.1. B01, the baseline

Run the drift check in dry-run mode only. The in-place form writes 1751 files over the tree.

projects/ores.codegen/venv/bin/python projects/ores.codegen/scripts/check_component_drift.py --component trading-cpp --dry-run
projects/ores.codegen/venv/bin/python projects/ores.codegen/scripts/check_model_drift.py --summary

The dry run takes about ten minutes. Keep its full output, then classify every would change block by the first lines of its diff, and write the classification plus the would create list into the evidence file. The categories are the generated-file banner alone, the eventing rename, a substantive template change, and the root CMakeLists.txt.

4.2. B02, the model census

Run the standard survey script, which is read-only.

projects/ores.codegen/venv/bin/python projects/ores.codegen/scripts/survey_component.py --component trading-cpp

It reports 65 models in projects/ores.trading/modeling/: 57 entity, 6 field group, 1 module and 1 component overview. It also reports the 31 entity models that bind a profile and the 26 that do not.

4.3. B03, the hand-written file classification

The same survey splits the 1763 C++ files by the generated marker and classifies each hand-written file. The result is 35 generated files and 1728 hand-written, of which 1593 are generatable, 71 are infrastructure, 0 are dead by path and 64 are unclassified. Record that the "dead" column is a path test and not a consumer census; B06 is the consumer census.

4.4. B04, the protocol inventory

The same survey lists the 49 protocol headers, the 249 distinct raw trading.v1.* subject literals, the finding that 0 of them sit outside a protocol header, and the finding that no model declares a subject. The protocol.org file under core/modeling/ names four trade subjects in prose, which is a reference and not a declaration.

4.5. B05, the open work

gh pr list --state open --limit 100 --json number,title,headRefName
git branch -r | grep -i trading
git worktree list

Result: no worktree works on ores.trading; the open pull requests are clean-marketdata, workflow-identity, clean-iam, clean-variability and clean-service; one remote branch touches trading, origin/feature/trading-model-cleanup, with a single unmerged commit from 2026-09-08 that scaffolds the sprint 25 trading_model_cleanup story. This story supersedes that story, and decision D6 records that the branch is left in place because it is not this worktree's branch.

4.6. B06, the consumer census

grep -rl --include=*.hpp --include=*.cpp '#include "ores.trading' projects/ | sed 's|projects/||; s|/.*||' | sort | uniq -c | sort -rn
grep -rho '#include "ores\.trading[^"]*"' projects/ --include=*.hpp --include=*.cpp --exclude-dir=ores.trading | sort -u

Result: 1446 files inside the component, 38 in ores.shell, 17 in ores.ore, 1 in ores.reporting, and 0 in ores.web. One hundred and twenty-six distinct headers are consumed outside the component. The full symbol-level census belongs to PR 6.

4.7. The decisions

The seven decisions are recorded in the story's * Decisions section. They are D1 the rates wire, D2 the instrument identity, D3 the unmodelled families, D4 M07, D5 the sixteen trade model defects, D6 the stale remote branch, and D7 that this PR changes documentation and evidence only.

4.8. The documentation defect the baseline exposed

The sprint 25 release notes and health review 2 list ores.trading among the drift-free components. Correct both in their org sources, re-export the release notes markdown, and record the correction here. The health review keeps its own list of four closed components and says why analytics is the fifth that the release notes count.

4.9. Items recorded as not applicable here

  • M07: the component has no junction metatype. Record the junction-shaped entities so a later reclassification opens the item.
  • P06: the component warms no event cache.
  • H04: the only per-platform code is the standard _WIN32 export macro.
  • V04 and the rest of the V group belong to PR 6, except V02, which PR 2 must turn green.

5. Notes

  • The component is the largest in the tree and the only one whose regeneration no gate has ever measured.
  • The sprint 25 release notes and health review 2 (1887CE40) list ores.trading among the drift-free components with "zero-diff regeneration verified". At this head it drifts by 1751 files. That is a documentation defect. Correct it in PR 1 or capture it.
  • The sprint 25 story prose describes a September 8 snapshot of 38 orgs and a hand-evolved, unbound trade entity. At this head there are 65 orgs and the trade entity is generated. Do not act on the September prose.
  • Backlog captures that touch this work, read for B05:
    • Finish the eventing payload migration, or read the legacy shape explains the 21 failing tests and the 114 stale triggers.
    • inbox/codegen_dx_improvements/task_fix-trading-model-drift.org.
    • inbox/legacy_entity_event_mappings_remain.org.
    • inbox/ctest_hides_catch2_registration_errors.org.
    • inbox/refresh-the-stale-er-diagram.org and inbox/regenerate_stale_er_diagram.org.
    • inbox/drift_gate_misses_cross_component_outputs.org.
    • next/refactor_trading_reference_type_boilerplate_into_shared_templates.org.
    • next/fix_trading_trade_party_roles_channel_name.org.
    • next/trade_blotter/story.org, next/positions_domain_model.org, next/separate_trade_instrument_detail_dialogs.org.
  • Two claims in the survey output need care. The B03 "dead" column tests paths, not references. The test file lists are complete: all 43 core, 13 api and 2 service entries are present in their component_files.cmake.
  • Eleven untracked shell library directories remain from the scheduler pass. They are open item 10 of that task. They make an in-place drift check fail for reasons that are not trading's.
  • Re-measure every figure at the head this PR merges into. A cited figure is evidence, so a stale one is a defect.

6. Test Scenarios

Scenario State Notes
     

7. PRs

PR Title
#2187 [agile] Record the ores.trading cleanup baseline, plan and decisions
  Raise the PR with the evidence and the decisions.

8. Review

# Comment summary File Decision Notes
1 The acceptance names evidence/b06_external_headers.txt, which does not exist task_clean_trading.org Accept The file list lives in b06_consumer_census.txt; the acceptance now names that file alone
2 The banner figure is 1434 in the prose and 1435 in the evidence story.org, task_sync-trading-drift.org Accept The evidence groups the banner with the root CMakeLists.txt; the story now says so and the two views are the same 1636 changes
3 The health review says four drift-free components and the release notes say five sprint_25 release notes, health review 2 Accept The review lists the four whose stories closed; analytics is the fifth with an open story. The review now says so
4 Five gates are called vacuous, but the evidence marks four story.org, task_trading-shell-wiring-verification.org Accept Component drift, handler permissions, protocol twins and recipe inventory. The CMake check fails honestly
5 The task says "the six decisions D1 to D6" and then refers to D7 task_clean_trading.org Accept Seven decisions, D1 to D7
6 The drift classification is restated in the story, two tasks and the evidence story.org, task_sync-trading-drift.org Decline The restatement is deliberate, so the record survives context compaction. The figures are reconciled instead
7 The consumer header count appears as 120, 126 and 971 story.org, tasks, b06 evidence Accept 126. The evidence line carried the unfiltered count; both are corrected
8 "88 per cent of them are the banner" reads as a share of 1751 story.org Accept 88 per cent of the 1636 changes, which is the claim the PR 2 task already made
9 The permission sentence contradicts the checklist row story.org Accept The gate does not read trading's 98 codes, and 92 of them are unseeded
10 "Twenty-seven models inherit the group" story.org, task_collapse-instrument-identity.org Accept Twenty-six files declare :domain_identity_group:. The twenty-seventh mention is the group file itself
11 Defect 13 is misquoted story.org Accept The id-keyed tables also include trade_identifiers and party_roles
12 The fourth metatype is called "overview" story.org, task_clean_trading.org Accept The metatype is component; the file is component_overview.org
13 The local lint pass is required by the acceptance and recorded nowhere task_clean_trading.org Accept evidence/pr1_local_checks.txt now holds lint, the site check, docs and misspell
14 The sprint 25 documentation correction is outside the acceptance task_clean_trading.org Accept The acceptance and the plan now own the retraction, and the health review reconciles with the release notes
15 The five new tasks carry empty Test Scenarios, PRs and Review tables the five task files Decline The repository's task template carries them and every other task keeps them. They are filled as each task runs
16 A stale figure survives: the B06 section still says "one hundred and twenty distinct headers" task_clean_trading.org Accept The phrase spans a line break, which is why the first pass missed it. Corrected to 126
17 The story ends with an empty * Result heading story.org Accept Sprint 26 stories take that heading when the story closes, not when the first task does. The heading is removed until PR 6

9. Result

PR 1 records the baseline and the decisions and changes no code.

The investigation is on the story: the measured baseline, the four threads inherited from sprint 25, the trade to instrument doctrine that the knowledge base already states, the bond pilot's unfinished work, and the sixteen trade model defects. The story also carries the 49-item checklist with the state of each item on 2026-09-26 and the task that owns it.

The evidence is on the task: the drift dry run with every block classified by cause, the model drift summary, the B02 to B04 survey, the open work, the consumer census, the measured test state, the gate outputs with their exit codes, and the local checks of this PR.

Seven decisions bound the six PRs. D1 accepts the generated per-family rates protocols and deletes the hand consolidation. D2 implements the documented instrument identity, collapse first and security split second. D3 models the unmodelled families. D4 records M07 as not applicable with its reason. D5 assigns the sixteen trade model defects. D6 records and does not delete the stale remote branch. D7 keeps this PR to documentation and evidence.

Two documents were corrected: the sprint 25 release notes, in the org source and re-exported, and health review 2. Both claimed ores.trading was drift-free, and the measurement finds 1751 files.

Every figure in the record was re-measured at b79609d808. The independent review folded fifteen findings into the record: thirteen accepted and two declined with their reasons in the table above.

Emacs 29.3 (Org mode 9.6.15)