Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions examples/periodic-review/sample-results/report.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,19 @@ Evidence: `inputs/complete.json`, deployments D1–D4, register R1–R4 and life

## Monitoring and issues

| Expected observation | Evidence | Finding |
|---|---|---|
| E1: D1 pricing | O1, 0.8 bp | Within the 1.0 bp upper limit. |
| E2: D2 stress | No matching observation | Unresolved. O2 concerns pricing use, despite its D2/model/revision labels. |
| E3: D3 origination | O3, 0.03 probability | Breaches the 0.02 upper limit. |
| Expected observation | Metric | Evidence | Inclusive upper limit | Finding |
|---|---|---|---|---|
| E1: D1 pricing | Repricing error (`repricing_error`) | O1: 0.8 bp, 2026-09-30 | ≤ 1 bp | Within limit. |
| E2: D2 stress | Stress reference difference (`stress_reference_difference`) | No matching observation | ≤ 5 USD million | Unresolved; O2 concerns pricing use. |
| E3: D3 origination | Maximum calibration error (`max_calibration_error`) | O3: 0.03 probability, 2026-09-30 | ≤ 0.02 probability | Breach. |

Equality with an upper limit passes. O3's 0.03 is an error in probability units (three percentage points), not a predicted default probability. The available O1/O3 dates fall within September and precede review.

Coverage retains all three expected observations: one within limit, one breach and one unresolved. O2 remains unmatched; its value of USD4 million and favorable producer label do not satisfy E2. The overall monitoring finding is **breach** because E3 is known adverse; E2's gap remains visible. Registry conflicts do not erase independently supplied monitoring evidence for E3.

I1 concerns D2 stress, owned by Market Risk and due September 30. Its producer labels it closed and records action completion September 29. O2 and accepting review V1 both concern pricing use, so neither establishes closure for the stress issue. I1 remains unsupported as closed and is overdue. Their existence, favorable value and later dates do not fix the scope mismatch.
I1 concerns the stress reference difference (`stress_reference_difference`) for D2, RATE-CURVE r3, stress use, owned by Market Risk and due September 30. Its producer labels it closed and records action completion September 29. O2 and accepting review V1 both concern pricing use, so neither establishes closure for the stress issue. I1 remains unsupported as closed and is overdue. Their existence, favorable value and later dates do not fix the scope mismatch.

I2 concerns D3 origination, owned by Credit Analytics, due October 10. Closure evidence is absent and the issue is open; it is not yet overdue. Market Risk needs to supply evidence or a disposition for E2/I1, and Credit Analytics for the E3 breach. These follow-ups are proposed responses, not recorded actions.
I2 concerns maximum calibration error (`max_calibration_error`) for D3, CREDIT-PD r2, origination use, owned by Credit Analytics, due October 10. Its recorded action is to investigate the calibration residual; no action-completion date or closure evidence is supplied. The issue is open and not yet overdue. Market Risk needs to supply evidence or a disposition for E2/I1, and Credit Analytics for the E3 breach. These follow-ups are proposed responses, not recorded actions.

Evidence: `inputs/complete.json`, E1–E3, O1–O3, I1–I2 and V1; `inputs/policy.md`, Monitoring and Issues and closure. The three-way count preserves the expected population.

Expand Down
52 changes: 50 additions & 2 deletions scripts/check_periodic_review.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import copy
import json
import math
import re
from datetime import date
from pathlib import Path

Expand Down Expand Up @@ -93,6 +94,38 @@ def value_finding(obs,expected):
'unmatched_observations':unmatched_observations,'issues':issues,'changes':changes}


def reference_errors(text, packet):
"""Bind selected cells and issue scopes in this authored reference only."""
errors=[]
rows={}
for line in text.splitlines():
if re.match(r'^\| E[0-9]+:',line):
cells=[cell.strip() for cell in line.split('|')[1:-1]]
identifier=cells[0].split(':')[0]
if identifier in rows:errors.append('duplicate reference row '+identifier)
rows[identifier]=cells
expected=packet['expected_observations']
if set(rows)!={row['id'] for row in expected}:errors.append('reference observation population')
for row in expected:
cells=rows.get(row['id'],[])
if len(cells)!=5:
errors.append('reference cell population '+row['id']);continue
if cells[0]!=f"{row['id']}: {row['deployment']} {row['use']}":errors.append('reference scope '+row['id'])
if f"`{row['metric']}`" not in cells[1]:errors.append('reference metric '+row['id'])
if cells[3]!=f"≤ {row['upper_limit']:g} {row['unit']}":errors.append('reference limit '+row['id'])
matches=[obs for obs in packet['observations'] if scope(obs)==scope(row) and obs['period']==row['period']]
if len(matches)==1:
obs=matches[0]
if cells[2]!=f"{obs['id']}: {obs['value']:g} {obs['unit']}, {obs['date']}":errors.append('reference value/date '+row['id'])
elif cells[2]!='No matching observation':errors.append('reference evidence gap '+row['id'])
for issue in packet['issues']:
paragraphs=[part for part in text.split('\n\n') if part.startswith(issue['id']+' concerns ')]
if len(paragraphs)!=1 or any(value not in paragraphs[0] for value in [
issue['deployment'],issue['model']+' '+issue['revision'],issue['use']+' use',
'`'+issue['metric']+'`',issue['owner']]):errors.append('reference issue scope '+issue['id'])
return errors


def main():
packets={case:json.loads((ROOT/'examples/periodic-review/inputs'/f'{case}.json').read_text()) for case in ['complete','missing-baseline','contradictory']}
results={case:review(p) for case,p in packets.items()}
Expand Down Expand Up @@ -138,8 +171,23 @@ def wrong_reference(p):correct_closure(p);p['review_records'][0]['observation']=
try:review(bad)
except AssertionError:checks.append('duplicate record identity rejected')
else:raise AssertionError('Duplicate identity accepted')
print(json.dumps({'scope':'Authored synthetic rule mappings only; no model execution, institutional decision or report evaluation.',
'cases':results,'controls':checks},indent=2))
reference=(ROOT/'examples/periodic-review/sample-results/report.md').read_text()
assert not reference_errors(reference,packets['complete']),reference_errors(reference,packets['complete'])
reference_mutations={
'omit metric':reference.replace('`repricing_error`','`unknown`'),
'substitute probability for error':reference.replace('`max_calibration_error`','`default_probability`'),
'change threshold boundary':reference.replace('≤ 1 bp','< 1 bp'),
'change missing-observation limit':reference.replace('≤ 5 USD million','≤ 4 USD million'),
'change observation date':reference.replace('O3: 0.03 probability, 2026-09-30','O3: 0.03 probability, 2026-08-31'),
'change observation value':reference.replace('O1: 0.8 bp','O1: 0.9 bp'),
'omit issue metric':reference.replace('I1 concerns the stress reference difference (`stress_reference_difference`)','I1 concerns the stress reference difference'),
'change issue revision':reference.replace('D3, CREDIT-PD r2, origination use','D3, CREDIT-PD r1, origination use'),
}
for name,changed in reference_mutations.items():
assert changed!=reference and reference_errors(changed,packets['complete']),name
print(json.dumps({'scope':'Fixed synthetic rule mappings and selected authored-reference bindings; no model execution, institutional decision or general prose evaluation.',
'cases':results,'controls':checks,'reference_rows':3,'reference_issue_scopes':2,
'reference_mutations_rejected':list(reference_mutations)},indent=2))


if __name__=='__main__':main()
2 changes: 2 additions & 0 deletions tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,5 @@ The reproduction-helper tests launch tiny standard-library Python fixtures, not
`python3 scripts/check_quote_sensitivity.py` checks the thirteen retained curve scenarios, fixed-value relationships, twelve sensitivity summaries, exact projections and evidence recovery. Two distinct cash-flow values can identify both nodes; one par value leaves one quote underdetermined. Targeted mutations and authored report-cell checks are not a general prose evaluator. [Interpretation cases](cases/quote-sensitivity.md) remain unexecuted by a model.

`python3 scripts/check_calibration_stability.py` checks retained calibration records, exact coordinate relationships, sharp bounds, packet projections, authored table rows and twelve targeted corruptions. The [interpretation cases](cases/calibration-stability.md) remain authored expectations. These numerical checks do not evaluate arbitrary reports or establish agent fulfillment.

The periodic-review checker also binds three authored reference rows to metric names, input values/dates and inclusive limits, and two issue paragraphs to their exact recorded scopes. Eight targeted mutations exercise those bindings. This is a fixed reference check, not an assessment of arbitrary report content or complete contract fulfillment.
Loading