Appendix B Contract Library and Policy Cards (Imaging)


One-Sentence Goal
Define standardized imaging contracts C20-* and instantiable policy cards that span acquisition → publication, enabling automated assertions, SLO guardrails, and auditable traceability.


I. Scope & Targets


II. Terms & Notation


III. Contract Taxonomy & Numbering

Unified numbering: C20-xxx, grouped by topic:

IV. Standard Contract Set C20-* (Assertions)

  1. Metadata & time base (C20-00x)
    • C20-001 meta_complete: required keys present; check_dim(expr) runnable; unique(pk) passes.
    • C20-002 timebase_aligned: record offset/skew/J; assert |offset| ≤ tol_offset, |skew| ≤ tol_skew, J.P99 ≤ tol_jitter.
    • C20-003 arrival_two_forms: compute both
      T_arr = ( 1 / c_ref ) * ( ∫ n_eff d ell ) and T_arr = ( ∫ ( n_eff / c_ref ) d ell ); assert delta_form ≤ tol_Tarr.
  2. Radiometry & units (C20-10x)
    • C20-101 linear_domain: space="linear"; dark/gain corrected by linearize_and_calibrate.
    • C20-102 unit_dim_consistent: all fields declare unit, dim and pass check_dim( y - f(x) ).
    • C20-103 flat_dark_stability: flat mean drift ≤ tol_flat_drift; dark noise ≤ tol_dark_sigma.
    • C20-104 radiometric_monotonic: response monotonic, d y_lin / d exposure ≥ 0 almost everywhere.
  3. Optical resolution (C20-20x)
    • C20-201 mtf_f50_min: f50 ≥ f50_min.
    • C20-202 psf_normalized: ( ∫ PSF dA ) = 1 and PSF ≥ 0.
    • C20-203 otf_support: OTF(f) leakage beyond cutoff ≤ tol_otf_leak.
  4. Sampling & reconstruction (C20-30x)
    • C20-301 demosaic_artifact: zipper/maze artifact_score ≤ tol_demosaic_art.
    • C20-302 resample_aliasing: alias energy ratio alias_ratio ≤ tol_alias.
    • C20-303 superres_gain: MTF_area(gain_band) ≥ gain_sr_min and ringing ≤ tol_ringing.
  5. Noise & denoising (C20-40x)
    • C20-401 noise_model_fit: NoiseModel regression R2 ≥ tol_noise_R2.
    • C20-402 nps_band_limit: band-limited NPS_band.P95 ≤ tol_NPS_band.
    • C20-403 detail_preserve: detail-preservation index DPI ≥ tol_DPI.
  6. FPN & correction (C20-50x)
    • C20-501 prnu_limit: PRNU ≤ tol_PRNU.
    • C20-502 dsnu_limit: DSNU ≤ tol_DSNU.
    • C20-503 bad_pixel_rate: mask_ratio ≤ tol_badpix.
  7. Geometry & registration (C20-60x)
    • C20-601 reproj_error: reprojection err_geo ≤ tol_geo.
    • C20-602 distortion_residual: post-undistort residual ≤ tol_dist_res.
    • C20-603 multimodal_reg: registration error ≤ tol_reg or MI gain ≥ tol_MI_gain.
  8. Color & white balance (C20-70x)
    • C20-701 color_accuracy: DeltaE_00.P95 ≤ tol_dE95, DeltaE_00.P99 ≤ tol_dE99.
    • C20-702 wb_gray_error: neutral-gray deviation ≤ tol_wb_gray.
    • C20-703 gamut_clip_ratio: out-of-gamut fraction ≤ tol_oog_ratio.
  9. HDR & exposure fusion (C20-80x)
    • C20-801 hdr_ghosting: ghosting ≤ tol_ghost.
    • C20-802 saturation_ratio: saturated-pixel ratio ≤ tol_sat_ratio.
    • C20-803 local_contrast_consistency: local-contrast deviation ≤ tol_lcc.
  10. Computational imaging robustness (C20-90x)
    • C20-901 deconv_condition: condition number ≤ tol_cond and iterations ≤ tol_iter.
    • C20-902 cs_residual: residual || y - Phi x ||_2 ≤ tol_cs_res.
    • C20-903 sharpening_ringing: over-sharpen ringing ≤ tol_sharp_ring.
  11. Time/path gating & arrival (C20-100x)
    • C20-1001 gate_window_bound: Δt ≤ tol_gate_width.
    • C20-1002 sync_quality: sync score S_sync ≥ tol_sync.
    • C20-1003 arrival_consistency: delta_form ≤ tol_Tarr (two-form parallelism as above).
  12. Quality panel, SLO & release (C20-110x)
    • C20-1101 latency_p99: T_proc.P99 ≤ tol_P99.
    • C20-1102 drop_rate_bound: drop_rate ≤ tol_drop.
    • C20-1103 utilization_stable: rho < 1 and W_q.P95 ≤ tol_Wq.
    • C20-1104 manifest_signed: hash_sha256(blob) and signature present and match.

V. Policy Card Template & Example


VI. Assertions & Bindings

  1. Entry point: assert_contract(ds|img, C20-*, policy)—invoked post-node and pre-release in the pipeline.
  2. Bindings:
    • Call Methods.Cleaning v1.0 I10-10 assert_contract for generic assertions;
    • Imaging-specific metrics are produced by this volume’s I20-21/22/41/51/61/71/81/91/101/112/113, then compared by the assertion engine to the policy card.
  3. Return semantics: { pass, violations[], sli, audit_report }; severe violations trigger degrade_policy and rollback paths.

VII. Cross-References
Linearization & units (Ch. 4: C20-101/102/103/104); Optics & sampling (Chs. 5–6: C20-201/202/203/301/302/303); Noise & FPN (Chs. 7–8: C20-401/402/403/501/502/503); Geometry & color (Chs. 9–10: C20-601/602/603/701/702/703); HDR & CI (Chs. 11–12: C20-801/802/803/901/902/903); Time/path gating & arrival (Ch. 13: C20-1001/1002/1003); Quality & audit (Ch. 14: C20-1101/1102/1103/1104).
Timebase, two-form arrival, release freeze, and backpressure: Methods.Cleaning v1.0, Chapters 5, 6, 10, 11.


VIII. Risk Control & Rollback

  1. Graded responses:
    • Minor (warn): slight artifact_score excess with stable SLI.img.* → continue publishing with q_score down-weighted.
    • Moderate (rollback): DeltaE_00.P99 or err_geo out-of-bounds → rollback to the last stable manifest.
    • Critical (isolate): delta_form > tol_Tarr or missing manifest_signed → quarantine the batch and halt publication.
  2. Audit: log all violations to audit_report with TraceID, archive in the manifest.

Summary
This appendix supplies an instantiable contract library C20-* and policy-card templates that cover key quality points and runtime SLOs across the imaging chain. Combined with I20-* and the publication/audit interfaces of Methods.Cleaning v1.0, it enables a declarable, revertible, and traceable imaging-release loop.