(
note_plan: dict[str, Any],
bundle: dict[str, Any],
)
| 295 | |
| 296 | |
| 297 | def validate_bundle_contract( |
| 298 | note_plan: dict[str, Any], |
| 299 | bundle: dict[str, Any], |
| 300 | ) -> list[dict[str, Any]]: |
| 301 | if not bundle: |
| 302 | return [] |
| 303 | issues: list[dict[str, Any]] = [] |
| 304 | for old_key in ( |
| 305 | "evidence", |
| 306 | "evidence_pack", |
| 307 | "candidate_chunks", |
| 308 | "section_texts", |
| 309 | "summary", |
| 310 | "summary_hints", |
| 311 | ): |
| 312 | if old_key in bundle: |
| 313 | issues.append(issue("bundle_old_model_input_field_present", field=old_key)) |
| 314 | writing_contract = bundle.get("writing_contract", {}) |
| 315 | if not isinstance(writing_contract, dict): |
| 316 | issues.append(issue("bundle_writing_contract_missing")) |
| 317 | return issues |
| 318 | contracts = writing_contract.get("contracts_by_paper_type", {}) |
| 319 | if not isinstance(contracts, dict) or not contracts: |
| 320 | issues.append(issue("bundle_contracts_by_paper_type_missing")) |
| 321 | return issues |
| 322 | missing = [paper_type for paper_type in PAPER_TYPE_VALUES if paper_type not in contracts] |
| 323 | if missing: |
| 324 | issues.append(issue("bundle_contracts_by_paper_type_incomplete", missing=missing)) |
| 325 | paper_type = normalize_whitespace(str(note_plan.get("paper_type", ""))) |
| 326 | if paper_type and paper_type in PAPER_TYPE_VALUES and paper_type not in contracts: |
| 327 | issues.append(issue("bundle_note_plan_paper_type_contract_missing", paper_type=paper_type)) |
| 328 | return issues |
| 329 | |
| 330 | |
| 331 | def validate_figure_decisions( |
no test coverage detected