Defects in the generated C++ templates
Table of Contents
This page is a capture in the inbox bucket of the product backlog — a pre-sprint idea, not yet pulled into a sprint as a story.
1. What
The G04 review of the generated code in ores.marketdata found five defects
that live in the shared templates, so every component carries them:
- A lost claim reports as an internal error. A service checks the claim in
prepare_change, then writes. If another writer wins in between, the insert trigger raisesVersion conflict(P0002) and the repository throws. Every generated handler catches any exception asfailedwith codeinternal_error, so the caller sees a fault where it should seeconflict. put_manyreads back one row at a time. After its one-statement write, the service reads each written row back with its own query.- Some archetypes have no generated test. Nothing tests the
table,table_ioorhistory_field_mapperoutput; only a live shell run reaches them. - Generators fill foreign keys with random UUIDs. A generated junction or child row then fails its foreign-key check, so tests build such rows by hand.
- The eventing integration test assumes audit columns. It sets
change_reason_codeandchange_commentary, so it does not compile for an entity without them, such as the time-seriesmarket_fixingandmarket_observation.
The same catch also hides bad input. On 2026-10-10 the synthetic BFF routes
wrote an FX feed whose price_source broke a table check, and a feed whose
config_id named no collection, which a validation trigger refuses. Both came
back as failed with internal_error and the raw PostgreSQL text, so the BFF
answers 502 where the person should read a 400 that names the field. A check
violation (23514) or a validation trigger refusal (23503) is invalid,
and the message should not carry SQL.
2. Why
G04 says a finding in generated code is a template defect and is fixed in the template. The first is a correctness defect under a race; the others are cost and coverage gaps that every generated entity inherits.
3. References
- Found by the G04 review in Close the marketdata test coverage.
- The bad-input case was seen in Give the BFF the synthetic routes.
- The first was raised in the review of PR 2643.