Story: Hotfix: refdata generator/repository test fixtures out of sync with DB constraints
Table of Contents
This page documents a story in Sprint 22. It captures the goal, current status, acceptance criteria, and the tasks that compose it.
Goal
Get CI green again: 25 failing ores.refdata unit/repository tests on
main, caused by two "Commission: counterparty" codegen-facet commits
(5ef46554b, d5762d746) that introduced generator values violating
DB check constraints and diverging from existing test expectations.
Status
| Field | Value |
|---|---|
| State | DONE |
| Parent sprint | Sprint 22 |
| Now | Nothing. |
| Waiting on | Nothing. |
| Next | Merge #1438. |
| Last touched | 2026-07-05 |
Acceptance
- All previously-failing ores.refdata generator and repository tests pass.
- Root cause identified and documented per symptom cluster.
- No new magic-string change-reason literals introduced; existing ones touched by the fix migrated to the shared constants header.
Tasks
| Task | State | Start | End | Description |
|---|---|---|---|---|
| Scaffold story: Hotfix: refdata generator/repository test fixtures out of sync with DB constraints | DONE | 2026-07-04 | 2026-07-05 | Story scaffolding rides this task: documents, sprint wiring, and the scaffold PR. Close it before merging that PR. |
| Implement Hotfix: refdata generator/repository test fixtures out of sync with DB constraints | DONE | 2026-07-05 | 2026-07-05 | Initial task for: Hotfix: refdata generator/repository test fixtures out of sync with DB constraints |
Decisions
- Root cause: commit
5ef46554b("Populate counterparty codegen facets…") changedcounterparty_generator.cpp'sbusiness_center_codefrom\"WRLD\"(the only seeded business centre) to the invalid\"USNY\", andchange_reason_codefrom\"system.new\"to\"system.test\", without updating the tests that asserted the old values. Commitd5762d746("Close remaining counterparty gaps…") introduced an invalid\"LEI-{idx}\"numeric-suffix pattern forid_schemeinparty_identifier_generator.cppandcounterparty_identifier_generator.cpp(DB only accepts 10 fixed scheme codes, not a per-record suffix). - Fix: reverted
business_center_codeto\"WRLD\"(in both the.cppand its.orgcodegen source),id_schemeto plain\"LEI\", andchange_reason_codeback to matching the siblingparty_generator.cppconvention. - Introduced
codes::synthetic_newandcodes::synthetic_test_datain the existing sharedores.dq.api/domain/change_reason_constants.hppand migrated the 3 touched generators onto them, instead of leaving magic string literals in place — the class of bug that caused this drift in the first place. Wiredores.dq.api.libas a new PRIVATE link dependency ofores.refdata.api.libto make the header available. - Filed a backlog capture
(capture) to migrate the
remaining ~30
ores.refdatagenerators onto the same constants — out of scope for this hotfix. - CI failed again after the above landed, with a different root
cause:
generate_synthetic_counterparty_identifier=/ =generate_synthetic_party_identifierhardcodedid_scheme = "LEI"for every generated instance;LEIcarriesmax_cardinality = 1inrefdata_party_id_schemes_populate.sql, so any batch of 2+ identifiers generated for the same party/counterparty deterministically violated the DB's cardinality trigger (write_multiple_counterparty_identifiers=/ =write_multiple_party_identifiers). Fixed by cycling through all id_scheme codes instead, centralised in a new sharedores.refdata.api/domain/party_id_scheme_constants.hpp(mirroringores.dq'schange_reason_constants.hpppattern) and reused byparty_id_scheme_generator.cpp, which had its own duplicate, unshared list. Verified locally:ores.refdata.core.testspasses 100%. - Also landed on this PR, independent of the refdata fix: a
TimescaleDB troubleshooting recipe
(How do I fix a
TimescaleDB "could not access file" error after an apt upgrade?) —
needed locally to even run the tests after a host apt dist-upgrade
bumped the timescaledb package — and a canary CI change
(
canary-linux.yml: debug build withcode_coverage=1→ release build with no coverage), to cut PR turnaround time; canary's coverage data duplicated whatcontinuous-linux.yml=/ =nightly-linux.ymlalready collect on the same matrix leg.
Out of scope
- Migrating all remaining ores.refdata generators to the shared change-reason constants (captured separately).