# Judgements: readings the fault specs forced

Committed before any check ran on any fault. Each line is a reading that a spec or a section of `DESIGN-bordereaux.md` left open, how
the code reads it, and why. None was chosen with a check's result in view, because no check has run on any fault.

## The independent author's specs (`bordereaux/author-specs.json`, `bordereaux/blind.py`)

1. "Round money to cents, half up": every amount is held in integer cents and rounded with the book's own half-up rounding, the same one
   the bordereaux are built with, so a clean amount recomputed the same way gives the same cents.
2. "Do nothing if none qualify": the fault is reported as not applied, and never rewritten. It is not counted as caught or missed.
3. B01, B02, B03: `line_no` and `transaction_id` sort as text, as the specs say. The new `fx_rate` is written with six decimals, like every
   clean rate. B01's USD rate is 1, and the book's own `fx_rates` table also holds a USD row of 1.
4. B01: `premium_lines` is written as a count of the month's resulting lines, once the three rows have moved.
5. B04: the two sums use `claim_transactions` as the book holds it before the change. "A positive sum" means more than zero cents.
6. B05: "matches" means the crosswalk's `legacy_key` is a `LEG_INST_NO` and its `target_key` is an `instalment_id` whose
   `source_system` is LEGACY.
7. B06: "the next identifier in the CTX numeric sequence" is the largest number in `claim_txn_id` plus one, at the same width of seven
   digits. The new row keeps every other field of the selected row. Months with no line for the claim are left alone, as "existing" says.
8. B07: "a policy crosswalk match to `leg_policy_master`" is a crosswalk row with entity `policy`, `target_key` equal to `policy_id`,
   `legacy_key` equal to a `LEG_POL_NO`. "Whose legacy `PLAN_CD` maps to MONTHLY" uses `conv_code_map` rows with code set PLAN.
9. B08: "a `claim_txn` crosswalk match to `leg_claim_history`" means `legacy_key` equal to a `LEG_HIST_NO`. "Amount at least 100.00" is at
   least 10,000 cents. All three selected rows fell on one claim, and that is what the selection gives, so it stands.
10. B09: "whose transaction crosswalk matches a `leg_commissions` row" means entity `transaction`, `target_key` equal to the commission's
    `transaction_id`, `legacy_key` equal to a `LEG_TXN_NO`. The new `rate` is the `RATE_PCT` text as it stands (for example 12.50).
11. B10: "for their corresponding entity" means policy, coverage, transaction, claim, claim movement to `claim_txn`, instalment to
    `instalment`. The crosswalk has no commission entity, so commissions are tested on `source_system` alone.
12. B11: the selection finds no row. Three NEW expense payments are booked in 2026-01, on claims reported in 2025-05 and 2025-08. The three
    claims reported in 2026-01 have no expense payment booked in that month. So B11 is reported as not applied. The author worked from 20
    sample rows of each table and could not have known this. Relaxing the selection would be a rewrite, so it is not done.
13. B12: "`limit_after` equal to the original coverage `limit_amount`" compares cents. "No coverage or transaction crosswalk" tests the
    coverage id and each of its transaction ids.

## The declared faults (`bordereaux/faults.py`)

14. F7: the design asks for two in-force converted PROP USD single-coverage policies whose NB or REN was booked in the same month, lowest ids with
    different premiums. The code adds that neither has an END, CAN or REI booked by the cut-over, so each has exactly one premium row and the
    swap is a swap of whole-term premiums, the case the design describes. The pair is the first month with such a pair.
15. F8: "the broker with the lowest id at 10%" is read from `pas_brokers`, by text. The legacy agent code is the same number under `AG0`.

## Scoring (`bordereaux/run.py`)

16. A flag counts for a fault when its check, close and key are absent from the clean book of seed 61409, as section 8 says. A schema test
    counts when it failed on the faulted book and passed on the clean one. A test that errored is listed in `errored_tests` and counts as failed.
17. `caught_without_review_flags` is reported beside `caught`, so a fault seen only through a review rule (R8, R9, R10) is visible as such.
