# Review and CI probes

## Atomic nested-writer probe

```python
conn.execute("BEGIN IMMEDIATE")
deep_mapping_writer(conn, ..., commit=False)
assert conn.in_transaction is True
conn.rollback()
assert conn.execute("SELECT COUNT(*) FROM mappings").fetchone()[0] == 0
assert conn.execute("SELECT COUNT(*) FROM audit_log WHERE ...").fetchone()[0] == 0
```

Repeat through the full batch with item 1 valid and item 2 intentionally invalid. Assert every table touched by item 1 remains unchanged.

## Case-insensitive migration probe

1. Seed a lowercase canonical identity into the pre-migration schema.
2. Run duplicate detection using the intended normalized expression.
3. Apply the migration and expression index.
4. Attempt the uppercase/whitespace variant.
5. Require an integrity error and verify only one canonical identity remains.

Example invariant:

```sql
CREATE UNIQUE INDEX ... ON instruments(UPPER(TRIM(isin)))
WHERE isin IS NOT NULL AND TRIM(isin) != '';
```

## Omitted historical-currency probe

- Confirm a non-USD mapping, such as an EUR-traded instrument.
- Return a historical provider row containing only `date` and `close`.
- The provider adapter must return empty/missing currency, not USD.
- The orchestrator resolves EUR from the confirmed mapping and persists EUR.
- Without a confirmed mapping currency, require `currency_missing`; do not persist the quote.

## Historical date matrix

| Scenario | Required result |
|---|---|
| Exact requested date | Persist exact actual date |
| Prior eligible trading day within boundary | Persist actual prior date |
| Future-only row | Reject; `price_missing` plus optional diagnostic |
| Current profile available but history absent | Do not call profile; `price_missing` |
| No eligible history | `price_missing` |
| Same rerun | Idempotent; no duplicate rows |

## Remote CI diagnosis

1. Read workflow run conclusion.
2. Enumerate jobs and failed steps.
3. Fetch the exact failed-step log.
4. Correct only the diagnosed violation.
5. Push an additive follow-up commit when the PR is already published.
6. Wait for the new workflow run and verify every required job conclusion.

For repository safety failures involving documentation, do not weaken the scanner. Move the artifact to an allowed location or use a permitted representation such as YAML/Markdown.

## Release evidence checklist

- Exact branch/head SHA
- Complete local suite result and test count
- Lint/type/build/diff results
- Final review findings and focused regression results
- Remote workflow run ID and all job conclusions
- Merged main SHA
- Pre-deployment timer state, business digest, backup checksum, copied-DB migration and integrity result
- Post-deployment schema, service state, confirmation result, idempotency digest, and side-effect/UAT checks
