psyclaw 0.27.22 → 0.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -5
- package/dist/apps/panel/index.html +2 -2
- package/dist/src/adapters/pi/extension.js +225 -92
- package/dist/src/adapters/pi/extension.js.map +1 -1
- package/dist/src/agents/import.js +44 -32
- package/dist/src/agents/import.js.map +1 -1
- package/dist/src/analysis/hooks.d.ts +1 -0
- package/dist/src/analysis/hooks.js +20 -1
- package/dist/src/analysis/hooks.js.map +1 -1
- package/dist/src/ars/bridge.d.ts +20 -0
- package/dist/src/ars/bridge.js +132 -0
- package/dist/src/ars/bridge.js.map +1 -0
- package/dist/src/ars/contracts.d.ts +55 -0
- package/dist/src/ars/contracts.js +2 -0
- package/dist/src/ars/contracts.js.map +1 -0
- package/dist/src/ars/panel-plan.d.ts +4 -0
- package/dist/src/ars/panel-plan.js +11 -0
- package/dist/src/ars/panel-plan.js.map +1 -0
- package/dist/src/ars/pi-panel-executor.d.ts +30 -0
- package/dist/src/ars/pi-panel-executor.js +140 -0
- package/dist/src/ars/pi-panel-executor.js.map +1 -0
- package/dist/src/ars/profile.d.ts +36 -0
- package/dist/src/ars/profile.js +119 -0
- package/dist/src/ars/profile.js.map +1 -0
- package/dist/src/ars/re-review.d.ts +22 -0
- package/dist/src/ars/re-review.js +172 -0
- package/dist/src/ars/re-review.js.map +1 -0
- package/dist/src/branding.d.ts +2 -4
- package/dist/src/branding.js +3 -5
- package/dist/src/branding.js.map +1 -1
- package/dist/src/bundled-tools.d.ts +3 -0
- package/dist/src/bundled-tools.js +21 -0
- package/dist/src/bundled-tools.js.map +1 -0
- package/dist/src/chat.js +6 -5
- package/dist/src/chat.js.map +1 -1
- package/dist/src/creation/contracts.d.ts +38 -0
- package/dist/src/creation/contracts.js +2 -0
- package/dist/src/creation/contracts.js.map +1 -0
- package/dist/src/creation/service.d.ts +7 -0
- package/dist/src/creation/service.js +196 -0
- package/dist/src/creation/service.js.map +1 -0
- package/dist/src/index.d.ts +10 -0
- package/dist/src/index.js +10 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/install/installer.js +32 -10
- package/dist/src/install/installer.js.map +1 -1
- package/dist/src/orchestration/personas.d.ts +15 -0
- package/dist/src/orchestration/personas.js +51 -0
- package/dist/src/orchestration/personas.js.map +1 -0
- package/dist/src/orchestration/pi-executor.d.ts +1 -0
- package/dist/src/orchestration/pi-executor.js +1 -1
- package/dist/src/orchestration/pi-executor.js.map +1 -1
- package/dist/src/panel/extension.js +29 -8
- package/dist/src/panel/extension.js.map +1 -1
- package/dist/src/panel/server.js +14 -5
- package/dist/src/panel/server.js.map +1 -1
- package/dist/src/project/paths.d.ts +3 -0
- package/dist/src/project/paths.js +7 -0
- package/dist/src/project/paths.js.map +1 -1
- package/dist/src/rules/user-rules.d.ts +8 -0
- package/dist/src/rules/user-rules.js +36 -0
- package/dist/src/rules/user-rules.js.map +1 -0
- package/dist/src/skills/contracts.d.ts +4 -4
- package/dist/src/skills/recommended.js +1 -1
- package/dist/src/skills/registry.js +49 -28
- package/dist/src/skills/registry.js.map +1 -1
- package/dist/src/style/cli-ui.js +0 -1
- package/dist/src/style/cli-ui.js.map +1 -1
- package/package.json +14 -3
- package/scripts/rebrand-pi.mjs +6 -0
- package/skills/recommended/catalog.json +2 -11
- package/vendor/ars/.claude/CLAUDE.md +371 -0
- package/vendor/ars/.command-invariants.toml +24 -0
- package/vendor/ars/CITATION.cff +35 -0
- package/vendor/ars/LICENSE +417 -0
- package/vendor/ars/MODE_REGISTRY.md +76 -0
- package/vendor/ars/NOTICE.md +26 -0
- package/vendor/ars/POSITIONING.md +99 -0
- package/vendor/ars/PSYCLAW_SOURCE.json +10 -0
- package/vendor/ars/README.md +751 -0
- package/vendor/ars/SECURITY.md +52 -0
- package/vendor/ars/THIRD_PARTY.md +70 -0
- package/vendor/ars/academic-paper/SKILL.md +542 -0
- package/vendor/ars/academic-paper/agents/abstract_bilingual_agent.md +171 -0
- package/vendor/ars/academic-paper/agents/argument_builder_agent.md +276 -0
- package/vendor/ars/academic-paper/agents/citation_compliance_agent.md +422 -0
- package/vendor/ars/academic-paper/agents/draft_writer_agent.md +656 -0
- package/vendor/ars/academic-paper/agents/formatter_agent.md +999 -0
- package/vendor/ars/academic-paper/agents/intake_agent.md +393 -0
- package/vendor/ars/academic-paper/agents/literature_strategist_agent.md +626 -0
- package/vendor/ars/academic-paper/agents/peer_reviewer_agent.md +516 -0
- package/vendor/ars/academic-paper/agents/revision_coach_agent.md +334 -0
- package/vendor/ars/academic-paper/agents/socratic_mentor_agent.md +527 -0
- package/vendor/ars/academic-paper/agents/structure_architect_agent.md +401 -0
- package/vendor/ars/academic-paper/agents/visualization_agent.md +441 -0
- package/vendor/ars/academic-paper/examples/chinese_paper_example.md +278 -0
- package/vendor/ars/academic-paper/examples/clinical_citation_verification_checklist.md +95 -0
- package/vendor/ars/academic-paper/examples/clinical_epistemic_status_example.md +100 -0
- package/vendor/ars/academic-paper/examples/commitment_ledger_example.md +147 -0
- package/vendor/ars/academic-paper/examples/imrad_hei_example.md +234 -0
- package/vendor/ars/academic-paper/examples/literature_review_example.md +260 -0
- package/vendor/ars/academic-paper/examples/plan_mode_guided_writing.md +600 -0
- package/vendor/ars/academic-paper/examples/revision_mode_example.md +344 -0
- package/vendor/ars/academic-paper/examples/revision_recovery_example.md +506 -0
- package/vendor/ars/academic-paper/examples/version_family_reconciliation_example.md +89 -0
- package/vendor/ars/academic-paper/references/abstract_writing_guide.md +169 -0
- package/vendor/ars/academic-paper/references/academic_writing_style.md +188 -0
- package/vendor/ars/academic-paper/references/anti_leakage_protocol.md +83 -0
- package/vendor/ars/academic-paper/references/apa7_chinese_citation_guide.md +364 -0
- package/vendor/ars/academic-paper/references/apa7_extended_guide.md +198 -0
- package/vendor/ars/academic-paper/references/changelog.md +11 -0
- package/vendor/ars/academic-paper/references/citation_format_switcher.md +228 -0
- package/vendor/ars/academic-paper/references/committee_correspondence_protocol.md +158 -0
- package/vendor/ars/academic-paper/references/credit_authorship_guide.md +308 -0
- package/vendor/ars/academic-paper/references/disclosure_mode_protocol.md +478 -0
- package/vendor/ars/academic-paper/references/domain_evidence_profiles.md +38 -0
- package/vendor/ars/academic-paper/references/failure_paths.md +349 -0
- package/vendor/ars/academic-paper/references/funding_statement_guide.md +319 -0
- package/vendor/ars/academic-paper/references/hei_domain_glossary.md +169 -0
- package/vendor/ars/academic-paper/references/intro_title_rhetoric_guide.md +114 -0
- package/vendor/ars/academic-paper/references/journal_submission_guide.md +249 -0
- package/vendor/ars/academic-paper/references/latex_template_reference.md +378 -0
- package/vendor/ars/academic-paper/references/mode_selection_guide.md +378 -0
- package/vendor/ars/academic-paper/references/paper_structure_patterns.md +330 -0
- package/vendor/ars/academic-paper/references/plan_mode_protocol.md +112 -0
- package/vendor/ars/academic-paper/references/policy_anchor_disclosure_protocol.md +200 -0
- package/vendor/ars/academic-paper/references/policy_anchor_table.md +157 -0
- package/vendor/ars/academic-paper/references/revision_patch_protocol.md +173 -0
- package/vendor/ars/academic-paper/references/statistical_visualization_standards.md +750 -0
- package/vendor/ars/academic-paper/references/venue_disclosure_policies.md +259 -0
- package/vendor/ars/academic-paper/references/vlm_figure_verification.md +126 -0
- package/vendor/ars/academic-paper/references/workflow_phase_details.md +135 -0
- package/vendor/ars/academic-paper/references/writing_judgment_framework.md +59 -0
- package/vendor/ars/academic-paper/references/writing_quality_check.md +173 -0
- package/vendor/ars/academic-paper/templates/bilingual_abstract_template.md +78 -0
- package/vendor/ars/academic-paper/templates/case_study_template.md +129 -0
- package/vendor/ars/academic-paper/templates/conference_paper_template.md +108 -0
- package/vendor/ars/academic-paper/templates/credit_statement_template.md +132 -0
- package/vendor/ars/academic-paper/templates/funding_statement_template.md +290 -0
- package/vendor/ars/academic-paper/templates/imrad_template.md +183 -0
- package/vendor/ars/academic-paper/templates/latex_article_template.tex +199 -0
- package/vendor/ars/academic-paper/templates/literature_review_template.md +135 -0
- package/vendor/ars/academic-paper/templates/policy_brief_template.md +139 -0
- package/vendor/ars/academic-paper/templates/revision_tracking_template.md +199 -0
- package/vendor/ars/academic-paper/templates/theoretical_paper_template.md +119 -0
- package/vendor/ars/academic-paper-reviewer/SKILL.md +491 -0
- package/vendor/ars/academic-paper-reviewer/agents/devils_advocate_reviewer_agent.md +443 -0
- package/vendor/ars/academic-paper-reviewer/agents/domain_reviewer_agent.md +412 -0
- package/vendor/ars/academic-paper-reviewer/agents/editorial_synthesizer_agent.md +478 -0
- package/vendor/ars/academic-paper-reviewer/agents/eic_agent.md +339 -0
- package/vendor/ars/academic-paper-reviewer/agents/field_analyst_agent.md +221 -0
- package/vendor/ars/academic-paper-reviewer/agents/methodology_reviewer_agent.md +449 -0
- package/vendor/ars/academic-paper-reviewer/agents/perspective_reviewer_agent.md +427 -0
- package/vendor/ars/academic-paper-reviewer/examples/hei_paper_review_example.md +391 -0
- package/vendor/ars/academic-paper-reviewer/examples/interdisciplinary_review_example.md +299 -0
- package/vendor/ars/academic-paper-reviewer/examples/subclaim_decomposition_example.md +80 -0
- package/vendor/ars/academic-paper-reviewer/references/calibration_mode_protocol.md +256 -0
- package/vendor/ars/academic-paper-reviewer/references/changelog.md +10 -0
- package/vendor/ars/academic-paper-reviewer/references/editorial_decision_standards.md +236 -0
- package/vendor/ars/academic-paper-reviewer/references/guided_mode_protocol.md +34 -0
- package/vendor/ars/academic-paper-reviewer/references/integration_guide.md +15 -0
- package/vendor/ars/academic-paper-reviewer/references/quality_rubrics.md +84 -0
- package/vendor/ars/academic-paper-reviewer/references/re_review_mode_protocol.md +340 -0
- package/vendor/ars/academic-paper-reviewer/references/review_criteria_framework.md +98 -0
- package/vendor/ars/academic-paper-reviewer/references/review_panel_provenance_protocol.md +197 -0
- package/vendor/ars/academic-paper-reviewer/references/review_quality_thinking.md +58 -0
- package/vendor/ars/academic-paper-reviewer/references/reviewer_sprint_prompt_source.md +324 -0
- package/vendor/ars/academic-paper-reviewer/references/sprint_contract_protocol.md +296 -0
- package/vendor/ars/academic-paper-reviewer/references/statistical_reporting_standards.md +505 -0
- package/vendor/ars/academic-paper-reviewer/references/top_journals_by_field.md +206 -0
- package/vendor/ars/academic-paper-reviewer/templates/editorial_decision_template.md +235 -0
- package/vendor/ars/academic-paper-reviewer/templates/peer_review_report_template.md +305 -0
- package/vendor/ars/academic-paper-reviewer/templates/revision_response_template.md +248 -0
- package/vendor/ars/academic-pipeline/SKILL.md +736 -0
- package/vendor/ars/academic-pipeline/agents/claim_ref_alignment_audit_agent.md +382 -0
- package/vendor/ars/academic-pipeline/agents/collaboration_depth_agent.md +164 -0
- package/vendor/ars/academic-pipeline/agents/integrity_verification_agent.md +870 -0
- package/vendor/ars/academic-pipeline/agents/pipeline_orchestrator_agent.md +1379 -0
- package/vendor/ars/academic-pipeline/agents/state_tracker_agent.md +622 -0
- package/vendor/ars/academic-pipeline/examples/full_pipeline_example.md +482 -0
- package/vendor/ars/academic-pipeline/examples/integrity_failure_recovery.md +389 -0
- package/vendor/ars/academic-pipeline/examples/mid_entry_example.md +414 -0
- package/vendor/ars/academic-pipeline/references/adapters/.gitkeep +0 -0
- package/vendor/ars/academic-pipeline/references/adapters/overview.md +153 -0
- package/vendor/ars/academic-pipeline/references/ai_research_failure_modes.md +185 -0
- package/vendor/ars/academic-pipeline/references/changelog.md +14 -0
- package/vendor/ars/academic-pipeline/references/claim_audit_calibration_protocol.md +175 -0
- package/vendor/ars/academic-pipeline/references/claim_verification_protocol.md +282 -0
- package/vendor/ars/academic-pipeline/references/external_review_protocol.md +131 -0
- package/vendor/ars/academic-pipeline/references/integrity_review_protocol.md +110 -0
- package/vendor/ars/academic-pipeline/references/literature_corpus_consumers.md +193 -0
- package/vendor/ars/academic-pipeline/references/mode_advisor.md +135 -0
- package/vendor/ars/academic-pipeline/references/passport_as_reset_boundary.md +132 -0
- package/vendor/ars/academic-pipeline/references/pipeline_state_machine.md +405 -0
- package/vendor/ars/academic-pipeline/references/plagiarism_detection_protocol.md +239 -0
- package/vendor/ars/academic-pipeline/references/process_summary_protocol.md +209 -0
- package/vendor/ars/academic-pipeline/references/progress_dashboard_template.md +38 -0
- package/vendor/ars/academic-pipeline/references/reinforcement_content.md +15 -0
- package/vendor/ars/academic-pipeline/references/reproducibility_audit.md +55 -0
- package/vendor/ars/academic-pipeline/references/score_trajectory_protocol.md +78 -0
- package/vendor/ars/academic-pipeline/references/team_collaboration_protocol.md +261 -0
- package/vendor/ars/academic-pipeline/references/two_stage_review_protocol.md +27 -0
- package/vendor/ars/academic-pipeline/templates/pipeline_status_template.md +146 -0
- package/vendor/ars/agents/report_compiler_agent.md +341 -0
- package/vendor/ars/agents/research_architect_agent.md +298 -0
- package/vendor/ars/agents/synthesis_agent.md +356 -0
- package/vendor/ars/commands/ars-3w.md +10 -0
- package/vendor/ars/commands/ars-abstract.md +10 -0
- package/vendor/ars/commands/ars-cache-invalidate.md +20 -0
- package/vendor/ars/commands/ars-citation-check.md +10 -0
- package/vendor/ars/commands/ars-disclosure.md +10 -0
- package/vendor/ars/commands/ars-format-convert.md +10 -0
- package/vendor/ars/commands/ars-full.md +9 -0
- package/vendor/ars/commands/ars-lit-review.md +12 -0
- package/vendor/ars/commands/ars-mark-read.md +18 -0
- package/vendor/ars/commands/ars-outline.md +10 -0
- package/vendor/ars/commands/ars-plan.md +10 -0
- package/vendor/ars/commands/ars-rebuttal-audit.md +12 -0
- package/vendor/ars/commands/ars-reviewer.md +9 -0
- package/vendor/ars/commands/ars-revision-coach.md +9 -0
- package/vendor/ars/commands/ars-revision.md +10 -0
- package/vendor/ars/commands/ars-unmark-read.md +16 -0
- package/vendor/ars/deep-research/SKILL.md +600 -0
- package/vendor/ars/deep-research/agents/bibliography_agent.md +473 -0
- package/vendor/ars/deep-research/agents/devils_advocate_agent.md +192 -0
- package/vendor/ars/deep-research/agents/editor_in_chief_agent.md +167 -0
- package/vendor/ars/deep-research/agents/ethics_review_agent.md +267 -0
- package/vendor/ars/deep-research/agents/meta_analysis_agent.md +325 -0
- package/vendor/ars/deep-research/agents/monitoring_agent.md +209 -0
- package/vendor/ars/deep-research/agents/report_compiler_agent.md +341 -0
- package/vendor/ars/deep-research/agents/research_architect_agent.md +298 -0
- package/vendor/ars/deep-research/agents/research_question_agent.md +216 -0
- package/vendor/ars/deep-research/agents/risk_of_bias_agent.md +231 -0
- package/vendor/ars/deep-research/agents/socratic_mentor_agent.md +764 -0
- package/vendor/ars/deep-research/agents/source_verification_agent.md +219 -0
- package/vendor/ars/deep-research/agents/synthesis_agent.md +356 -0
- package/vendor/ars/deep-research/agents/timeline_extraction_agent.md +99 -0
- package/vendor/ars/deep-research/examples/exploratory_research.md +157 -0
- package/vendor/ars/deep-research/examples/fact_check_mode.md +173 -0
- package/vendor/ars/deep-research/examples/handoff_to_paper.md +318 -0
- package/vendor/ars/deep-research/examples/idea_diversity_coverage_gap_advisory.md +64 -0
- package/vendor/ars/deep-research/examples/policy_analysis.md +161 -0
- package/vendor/ars/deep-research/examples/review_mode.md +253 -0
- package/vendor/ars/deep-research/examples/socratic_guided_research.md +331 -0
- package/vendor/ars/deep-research/examples/systematic_review.md +133 -0
- package/vendor/ars/deep-research/references/apa7_style_guide.md +162 -0
- package/vendor/ars/deep-research/references/argumentation_reasoning_framework.md +68 -0
- package/vendor/ars/deep-research/references/arxiv_api_protocol.md +76 -0
- package/vendor/ars/deep-research/references/changelog.md +22 -0
- package/vendor/ars/deep-research/references/chinese_literature_api_protocol.md +317 -0
- package/vendor/ars/deep-research/references/cross_agent_quality_definitions.md +14 -0
- package/vendor/ars/deep-research/references/crossref_api_protocol.md +84 -0
- package/vendor/ars/deep-research/references/equator_reporting_guidelines.md +482 -0
- package/vendor/ars/deep-research/references/ethics_checklist.md +282 -0
- package/vendor/ars/deep-research/references/failure_paths.md +355 -0
- package/vendor/ars/deep-research/references/interdisciplinary_bridges.md +292 -0
- package/vendor/ars/deep-research/references/irb_decision_tree.md +315 -0
- package/vendor/ars/deep-research/references/literature_monitoring_strategies.md +263 -0
- package/vendor/ars/deep-research/references/logical_fallacies.md +192 -0
- package/vendor/ars/deep-research/references/methodology_patterns.md +462 -0
- package/vendor/ars/deep-research/references/mode_selection_guide.md +331 -0
- package/vendor/ars/deep-research/references/openalex_api_protocol.md +82 -0
- package/vendor/ars/deep-research/references/preregistration_guide.md +324 -0
- package/vendor/ars/deep-research/references/semantic_scholar_api_protocol.md +107 -0
- package/vendor/ars/deep-research/references/socratic_mode_protocol.md +99 -0
- package/vendor/ars/deep-research/references/socratic_questioning_framework.md +232 -0
- package/vendor/ars/deep-research/references/source_quality_hierarchy.md +188 -0
- package/vendor/ars/deep-research/references/systematic_review_protocol.md +95 -0
- package/vendor/ars/deep-research/references/systematic_review_toolkit.md +353 -0
- package/vendor/ars/deep-research/templates/evidence_assessment_template.md +127 -0
- package/vendor/ars/deep-research/templates/literature_matrix_template.md +85 -0
- package/vendor/ars/deep-research/templates/preregistration_template.md +318 -0
- package/vendor/ars/deep-research/templates/prisma_protocol_template.md +248 -0
- package/vendor/ars/deep-research/templates/prisma_report_template.md +415 -0
- package/vendor/ars/deep-research/templates/research_brief_template.md +93 -0
- package/vendor/ars/package.json +24 -0
- package/vendor/ars/pi/README.md +161 -0
- package/vendor/ars/pi/package.json +26 -0
- package/vendor/ars/pi/wrapper.js +193 -0
- package/vendor/ars/pi/wrapper.test.mjs +201 -0
- package/vendor/ars/pyproject.toml +2 -0
- package/vendor/ars/requirements-pdf-content-classifier.txt +5 -0
- package/vendor/ars/scripts/_block_parser.py +396 -0
- package/vendor/ars/scripts/_ci_pytest_manifest.toml +661 -0
- package/vendor/ars/scripts/_claim_audit_constants.py +268 -0
- package/vendor/ars/scripts/_e4_evidence.py +110 -0
- package/vendor/ars/scripts/_eval_threshold_gate.py +73 -0
- package/vendor/ars/scripts/_markdown_lint_util.py +224 -0
- package/vendor/ars/scripts/_next_verified_at_ms.py +176 -0
- package/vendor/ars/scripts/_passport_yaml.py +53 -0
- package/vendor/ars/scripts/_skill_lint.py +254 -0
- package/vendor/ars/scripts/_text_similarity.py +141 -0
- package/vendor/ars/scripts/adapters/README.md +89 -0
- package/vendor/ars/scripts/adapters/_common.py +209 -0
- package/vendor/ars/scripts/adapters/examples/folder_scan/expected_passport.yaml +25 -0
- package/vendor/ars/scripts/adapters/examples/folder_scan/expected_rejection_log.yaml +18 -0
- package/vendor/ars/scripts/adapters/examples/folder_scan/input_fixture/Chen2024_AIAssessment.pdf +0 -0
- package/vendor/ars/scripts/adapters/examples/folder_scan/input_fixture/Wang_2023_formative_feedback.pdf +0 -0
- package/vendor/ars/scripts/adapters/examples/folder_scan/input_fixture/paper1.pdf +0 -0
- package/vendor/ars/scripts/adapters/examples/folder_scan/input_fixture//344/270/255/346/226/207/346/252/224/345/220/215_2024.pdf +0 -0
- package/vendor/ars/scripts/adapters/examples/obsidian/expected_passport.yaml +40 -0
- package/vendor/ars/scripts/adapters/examples/obsidian/expected_rejection_log.yaml +13 -0
- package/vendor/ars/scripts/adapters/examples/obsidian/input_fixture/vault/.gitkeep +0 -0
- package/vendor/ars/scripts/adapters/examples/obsidian/input_fixture/vault/.obsidian/app.json +1 -0
- package/vendor/ars/scripts/adapters/examples/obsidian/input_fixture/vault/_templates/tmpl.md +7 -0
- package/vendor/ars/scripts/adapters/examples/obsidian/input_fixture/vault/chen2024ai.md +13 -0
- package/vendor/ars/scripts/adapters/examples/obsidian/input_fixture/vault/invalid.md +1 -0
- package/vendor/ars/scripts/adapters/examples/obsidian/input_fixture/vault/wang2023formative.md +10 -0
- package/vendor/ars/scripts/adapters/examples/zotero/expected_passport.yaml +34 -0
- package/vendor/ars/scripts/adapters/examples/zotero/expected_rejection_log.yaml +34 -0
- package/vendor/ars/scripts/adapters/examples/zotero/input_fixture/.gitkeep +0 -0
- package/vendor/ars/scripts/adapters/examples/zotero/input_fixture/export.json +43 -0
- package/vendor/ars/scripts/adapters/folder_scan.py +214 -0
- package/vendor/ars/scripts/adapters/obsidian.py +336 -0
- package/vendor/ars/scripts/adapters/tests/.gitkeep +0 -0
- package/vendor/ars/scripts/adapters/tests/conftest.py +77 -0
- package/vendor/ars/scripts/adapters/tests/test_check_corpus_consumer_protocol.py +632 -0
- package/vendor/ars/scripts/adapters/tests/test_check_literature_corpus_schema.py +631 -0
- package/vendor/ars/scripts/adapters/tests/test_common.py +365 -0
- package/vendor/ars/scripts/adapters/tests/test_conftest.py +96 -0
- package/vendor/ars/scripts/adapters/tests/test_folder_scan.py +260 -0
- package/vendor/ars/scripts/adapters/tests/test_literature_corpus_entry_schema.py +745 -0
- package/vendor/ars/scripts/adapters/tests/test_obsidian.py +357 -0
- package/vendor/ars/scripts/adapters/tests/test_rejection_log_schema.py +271 -0
- package/vendor/ars/scripts/adapters/tests/test_sync_adapter_docs.py +88 -0
- package/vendor/ars/scripts/adapters/tests/test_zotero.py +454 -0
- package/vendor/ars/scripts/adapters/zotero.py +318 -0
- package/vendor/ars/scripts/adjudication_activity.py +1592 -0
- package/vendor/ars/scripts/announce-ars-loaded.sh +144 -0
- package/vendor/ars/scripts/ars_anchorize_draft.py +170 -0
- package/vendor/ars/scripts/ars_apply_revision_patch.py +912 -0
- package/vendor/ars/scripts/ars_cache_invalidate.py +40 -0
- package/vendor/ars/scripts/ars_mark_read.py +521 -0
- package/vendor/ars/scripts/ars_phase_scope_manifest.json +33 -0
- package/vendor/ars/scripts/ars_update_check.sh +215 -0
- package/vendor/ars/scripts/ars_write_scope_guard.py +506 -0
- package/vendor/ars/scripts/arxiv_client.py +222 -0
- package/vendor/ars/scripts/audit_snapshot.py +572 -0
- package/vendor/ars/scripts/bibliographic_integrity_signals.py +800 -0
- package/vendor/ars/scripts/bootstrap_timeline_yaml.py +146 -0
- package/vendor/ars/scripts/build_claim_standing_candidate_ledger.py +1238 -0
- package/vendor/ars/scripts/build_claim_standing_query_plan.py +643 -0
- package/vendor/ars/scripts/build_content_coverage_advisory.py +1205 -0
- package/vendor/ars/scripts/build_cross_document_consistency_advisory.py +2332 -0
- package/vendor/ars/scripts/build_review_pathway_rule_trace.py +830 -0
- package/vendor/ars/scripts/build_submission_packet_manifest.py +2310 -0
- package/vendor/ars/scripts/check_215_field_norm.py +173 -0
- package/vendor/ars/scripts/check_216_surface_form.py +250 -0
- package/vendor/ars/scripts/check_268_nested_commitment_ledger.py +180 -0
- package/vendor/ars/scripts/check_390_revision_patch_discipline.py +296 -0
- package/vendor/ars/scripts/check_392_citation_verification_intake.py +126 -0
- package/vendor/ars/scripts/check_394_submission_policy.py +178 -0
- package/vendor/ars/scripts/check_439_format_profile.py +307 -0
- package/vendor/ars/scripts/check_619_disclosure_closeout.py +237 -0
- package/vendor/ars/scripts/check_630_codex_subscription_transport.py +456 -0
- package/vendor/ars/scripts/check_669_review_pathway_rule_trace.py +662 -0
- package/vendor/ars/scripts/check_670_revision_roadmap_integration.py +518 -0
- package/vendor/ars/scripts/check_673_adjudication_activity.py +684 -0
- package/vendor/ars/scripts/check_684_review_criteria_binding.py +557 -0
- package/vendor/ars/scripts/check_agents_mirror_sync.py +115 -0
- package/vendor/ars/scripts/check_audit_artifact_consistency.py +2313 -0
- package/vendor/ars/scripts/check_benchmark_report.py +79 -0
- package/vendor/ars/scripts/check_bibliographic_integrity_signals.py +831 -0
- package/vendor/ars/scripts/check_calibration_tiers.py +235 -0
- package/vendor/ars/scripts/check_changelog_covers_merges.py +289 -0
- package/vendor/ars/scripts/check_ci_pytest_manifest.py +204 -0
- package/vendor/ars/scripts/check_claim_audit_consistency.py +1664 -0
- package/vendor/ars/scripts/check_claim_standing_candidate_ledger_integration.py +500 -0
- package/vendor/ars/scripts/check_claim_standing_freshness.py +253 -0
- package/vendor/ars/scripts/check_claim_standing_transmissions.py +449 -0
- package/vendor/ars/scripts/check_collaboration_depth_rubric.py +180 -0
- package/vendor/ars/scripts/check_command_frontmatter_name.py +116 -0
- package/vendor/ars/scripts/check_committee_correspondence.py +333 -0
- package/vendor/ars/scripts/check_compliance_report.py +108 -0
- package/vendor/ars/scripts/check_content_coverage_advisory_integration.py +796 -0
- package/vendor/ars/scripts/check_control_availability.py +172 -0
- package/vendor/ars/scripts/check_corpus_consumer_protocol.py +404 -0
- package/vendor/ars/scripts/check_cross_document_consistency_advisory_integration.py +1191 -0
- package/vendor/ars/scripts/check_cross_model_handoff_contract.py +234 -0
- package/vendor/ars/scripts/check_cross_model_verification_sync.py +261 -0
- package/vendor/ars/scripts/check_data_access_level.py +131 -0
- package/vendor/ars/scripts/check_data_flows.py +252 -0
- package/vendor/ars/scripts/check_decision_contract.py +464 -0
- package/vendor/ars/scripts/check_degradation_registry.py +326 -0
- package/vendor/ars/scripts/check_distribution_surface_claims.py +226 -0
- package/vendor/ars/scripts/check_domain_evidence_profile.py +538 -0
- package/vendor/ars/scripts/check_e4_promotion.py +195 -0
- package/vendor/ars/scripts/check_evals_gold_set.py +279 -0
- package/vendor/ars/scripts/check_evidence_row_integration.py +396 -0
- package/vendor/ars/scripts/check_experiment_provenance.py +117 -0
- package/vendor/ars/scripts/check_field_norm_severity.py +144 -0
- package/vendor/ars/scripts/check_firm_rules_sync.py +375 -0
- package/vendor/ars/scripts/check_heldout_measurement_report.py +1179 -0
- package/vendor/ars/scripts/check_human_subjects_output_contract.py +139 -0
- package/vendor/ars/scripts/check_human_subjects_reference_migration.py +844 -0
- package/vendor/ars/scripts/check_indirect_prompt_injection_no_call.py +328 -0
- package/vendor/ars/scripts/check_instruction_data_boundary.py +236 -0
- package/vendor/ars/scripts/check_judge_prompt_version.py +125 -0
- package/vendor/ars/scripts/check_literature_corpus_schema.py +402 -0
- package/vendor/ars/scripts/check_model_tiering.py +223 -0
- package/vendor/ars/scripts/check_panel_synthesis.py +1331 -0
- package/vendor/ars/scripts/check_passport_reset_contract.py +214 -0
- package/vendor/ars/scripts/check_pattern_eval_manifest.py +422 -0
- package/vendor/ars/scripts/check_persuasion_invariance_fixtures.py +637 -0
- package/vendor/ars/scripts/check_phase_conformance.py +2180 -0
- package/vendor/ars/scripts/check_pipeline_boundary_semantics.py +600 -0
- package/vendor/ars/scripts/check_pipeline_integrity.py +340 -0
- package/vendor/ars/scripts/check_policy_anchor_protocol.py +159 -0
- package/vendor/ars/scripts/check_policy_anchor_table.py +286 -0
- package/vendor/ars/scripts/check_preprint_venues_consistency.py +123 -0
- package/vendor/ars/scripts/check_prisma_trAIce_freshness.py +84 -0
- package/vendor/ars/scripts/check_promotion_bakeoff_preregistration.py +1303 -0
- package/vendor/ars/scripts/check_ranking_lift.py +323 -0
- package/vendor/ars/scripts/check_re_review_synthesis.py +2719 -0
- package/vendor/ars/scripts/check_receipt_enum_sync.py +203 -0
- package/vendor/ars/scripts/check_repro_lock.py +85 -0
- package/vendor/ars/scripts/check_review_pathway_output.py +276 -0
- package/vendor/ars/scripts/check_reviewer_data_fences.py +224 -0
- package/vendor/ars/scripts/check_reviewer_finding_contract.py +783 -0
- package/vendor/ars/scripts/check_reviewer_role_label.py +447 -0
- package/vendor/ars/scripts/check_reviewer_scoring_honesty.py +292 -0
- package/vendor/ars/scripts/check_reviewer_sprint_prompt_sync.py +409 -0
- package/vendor/ars/scripts/check_revision_claim_drift_suite_v2.py +1622 -0
- package/vendor/ars/scripts/check_revision_token_conservation.py +263 -0
- package/vendor/ars/scripts/check_risk_register.py +280 -0
- package/vendor/ars/scripts/check_role_scoped_contract.py +702 -0
- package/vendor/ars/scripts/check_rq_framing_patterns.py +184 -0
- package/vendor/ars/scripts/check_rubric_weight_consistency.py +32 -0
- package/vendor/ars/scripts/check_seeded_defect_fixtures.py +425 -0
- package/vendor/ars/scripts/check_setup_cross_model_parity.py +139 -0
- package/vendor/ars/scripts/check_spec_consistency.py +1249 -0
- package/vendor/ars/scripts/check_sprint_contract.py +371 -0
- package/vendor/ars/scripts/check_stage_capability_matrix.py +784 -0
- package/vendor/ars/scripts/check_submission_packet_manifest_integration.py +358 -0
- package/vendor/ars/scripts/check_surface_form_parity.py +445 -0
- package/vendor/ars/scripts/check_task_type.py +22 -0
- package/vendor/ars/scripts/check_tools_allowlist.py +538 -0
- package/vendor/ars/scripts/check_tortured_phrase_screening_integration.py +1974 -0
- package/vendor/ars/scripts/check_v3_10_134_write_scope.py +286 -0
- package/vendor/ars/scripts/check_v3_10_policy.py +656 -0
- package/vendor/ars/scripts/check_v3_6_6_ab_manifest.py +364 -0
- package/vendor/ars/scripts/check_v3_6_7_pattern_protection.py +1366 -0
- package/vendor/ars/scripts/check_v3_6_8_audit_scope_block.py +464 -0
- package/vendor/ars/scripts/check_v3_6_8_cite_provenance_pipeline.py +231 -0
- package/vendor/ars/scripts/check_v3_6_8_frontmatter_trust_schema.py +248 -0
- package/vendor/ars/scripts/check_v3_6_8_mark_read_commands.py +79 -0
- package/vendor/ars/scripts/check_v3_6_8_pattern_protection.py +941 -0
- package/vendor/ars/scripts/check_v3_7_3_three_layer_citation.py +318 -0
- package/vendor/ars/scripts/check_v3_8_annotation_literal_sync.py +228 -0
- package/vendor/ars/scripts/check_v3_9_0_triangulation.py +366 -0
- package/vendor/ars/scripts/check_v3_9_2_phase_boundary.py +270 -0
- package/vendor/ars/scripts/check_v3_9_4_temporal_verification.py +139 -0
- package/vendor/ars/scripts/check_venue_disclosure_policies.py +63 -0
- package/vendor/ars/scripts/check_version_consistency.py +826 -0
- package/vendor/ars/scripts/check_workflow_classification.py +223 -0
- package/vendor/ars/scripts/chinese_literature_client.py +1938 -0
- package/vendor/ars/scripts/citation_verification_summary.py +85 -0
- package/vendor/ars/scripts/claim_audit_calibration.py +517 -0
- package/vendor/ars/scripts/claim_audit_finalizer.py +456 -0
- package/vendor/ars/scripts/claim_audit_pipeline.py +1594 -0
- package/vendor/ars/scripts/claim_registry_coverage.py +493 -0
- package/vendor/ars/scripts/claim_standing_discovery.py +784 -0
- package/vendor/ars/scripts/claim_standing_stance_runner.py +758 -0
- package/vendor/ars/scripts/claim_standing_stance_scorer.py +239 -0
- package/vendor/ars/scripts/claim_strength_drift_disposition.py +666 -0
- package/vendor/ars/scripts/contamination_signals.py +689 -0
- package/vendor/ars/scripts/corpus_consumer_manifest.json +19 -0
- package/vendor/ars/scripts/cross_model_codex_transport.py +1374 -0
- package/vendor/ars/scripts/cross_model_codex_verify.sh +6 -0
- package/vendor/ars/scripts/cross_model_handoff.py +359 -0
- package/vendor/ars/scripts/cross_model_smoke_test.sh +183 -0
- package/vendor/ars/scripts/cross_model_smoke_test_codex.sh +35 -0
- package/vendor/ars/scripts/cross_model_verification/gemini_is_grounded.jq +45 -0
- package/vendor/ars/scripts/cross_model_verification/gemini_sources.jq +45 -0
- package/vendor/ars/scripts/cross_model_verification/normalize_compat_verdict.py +57 -0
- package/vendor/ars/scripts/cross_model_verification/openai_has_completed_web_search.jq +15 -0
- package/vendor/ars/scripts/cross_model_verification/openai_sources.jq +17 -0
- package/vendor/ars/scripts/cross_model_verification/openai_text.jq +11 -0
- package/vendor/ars/scripts/crossref_client.py +225 -0
- package/vendor/ars/scripts/dispatch_e4_panel.py +2731 -0
- package/vendor/ars/scripts/evidence_rows.py +2043 -0
- package/vendor/ars/scripts/fixtures/adjudication_activity/author_stage3.json +32 -0
- package/vendor/ars/scripts/fixtures/adjudication_activity/author_stage3_input.json +27 -0
- package/vendor/ars/scripts/fixtures/adjudication_activity/author_stage3_prime.json +32 -0
- package/vendor/ars/scripts/fixtures/adjudication_activity/author_stage3_prime_input.json +27 -0
- package/vendor/ars/scripts/fixtures/adjudication_activity/compliance_override.json +50 -0
- package/vendor/ars/scripts/fixtures/adjudication_activity/compliance_override_action.json +14 -0
- package/vendor/ars/scripts/fixtures/adjudication_activity/compliance_pass.json +44 -0
- package/vendor/ars/scripts/fixtures/adjudication_activity/explicit_user_request_log.json +26 -0
- package/vendor/ars/scripts/fixtures/adjudication_activity/mandatory_checkpoint_log.json +116 -0
- package/vendor/ars/scripts/fixtures/audit_artifact_consistency/README.md +56 -0
- package/vendor/ars/scripts/fixtures/audit_artifact_consistency/negative/a1_pass_with_p1/2026-04-30T15-22-04Z-d8f3.audit_artifact_entry.json +24 -0
- package/vendor/ars/scripts/fixtures/audit_artifact_consistency/negative/a1_pass_with_p1/2026-04-30T15-22-04Z-d8f3.jsonl +4 -0
- package/vendor/ars/scripts/fixtures/audit_artifact_consistency/negative/a1_pass_with_p1/2026-04-30T15-22-04Z-d8f3.meta.json +43 -0
- package/vendor/ars/scripts/fixtures/audit_artifact_consistency/negative/a1_pass_with_p1/2026-04-30T15-22-04Z-d8f3.verdict.yaml +19 -0
- package/vendor/ars/scripts/fixtures/audit_artifact_consistency/negative/a7_orphan_completion/2026-04-30T15-22-04Z-d8f3.jsonl +3 -0
- package/vendor/ars/scripts/fixtures/audit_artifact_consistency/positive/persisted_minor/2026-04-30T15-22-04Z-d8f3.audit_artifact_entry.json +26 -0
- package/vendor/ars/scripts/fixtures/audit_artifact_consistency/positive/persisted_minor/2026-04-30T15-22-04Z-d8f3.jsonl +4 -0
- package/vendor/ars/scripts/fixtures/audit_artifact_consistency/positive/persisted_minor/2026-04-30T15-22-04Z-d8f3.meta.json +43 -0
- package/vendor/ars/scripts/fixtures/audit_artifact_consistency/positive/persisted_minor/2026-04-30T15-22-04Z-d8f3.verdict.yaml +19 -0
- package/vendor/ars/scripts/fixtures/audit_artifact_consistency/positive/proposal_pass/2026-04-30T15-22-04Z-d8f3.audit_artifact_entry.json +24 -0
- package/vendor/ars/scripts/fixtures/audit_artifact_consistency/positive/proposal_pass/2026-04-30T15-22-04Z-d8f3.jsonl +4 -0
- package/vendor/ars/scripts/fixtures/audit_artifact_consistency/positive/proposal_pass/2026-04-30T15-22-04Z-d8f3.meta.json +43 -0
- package/vendor/ars/scripts/fixtures/audit_artifact_consistency/positive/proposal_pass/2026-04-30T15-22-04Z-d8f3.verdict.yaml +12 -0
- package/vendor/ars/scripts/fixtures/bibliographic_integrity_signals/retraction.json +46 -0
- package/vendor/ars/scripts/fixtures/bibliographic_integrity_signals/retraction_check_attestation.json +44 -0
- package/vendor/ars/scripts/fixtures/bibliographic_integrity_signals/tortured_phrase.json +44 -0
- package/vendor/ars/scripts/fixtures/bibliographic_integrity_signals/tortured_phrase_v1_2_abstract_missing.json +107 -0
- package/vendor/ars/scripts/fixtures/bibliographic_integrity_signals/tortured_phrase_v1_2_detected.json +124 -0
- package/vendor/ars/scripts/fixtures/check_evals_gold_set/clean/expected_outcomes.json +77 -0
- package/vendor/ars/scripts/fixtures/check_evals_gold_set/clean/manifest.yaml +37 -0
- package/vendor/ars/scripts/fixtures/check_evals_gold_set/clean/tuples/001-valid-doi-test.json +20 -0
- package/vendor/ars/scripts/fixtures/check_evals_gold_set/clean/tuples/002-valid-arxiv-test.json +19 -0
- package/vendor/ars/scripts/fixtures/check_evals_gold_set/clean/tuples/003-fabricated-test.json +20 -0
- package/vendor/ars/scripts/fixtures/claim_audit_calibration/gold_set.json +344 -0
- package/vendor/ars/scripts/fixtures/claim_standing_candidate_ledger/query_plan.json +108 -0
- package/vendor/ars/scripts/fixtures/claim_standing_candidate_ledger/retrieval_input.json +179 -0
- package/vendor/ars/scripts/fixtures/committee_correspondence/16fd83f6aec7/concern_tracker.json +129 -0
- package/vendor/ars/scripts/fixtures/committee_correspondence/16fd83f6aec7/response_skeleton.md +19 -0
- package/vendor/ars/scripts/fixtures/committee_correspondence/16fd83f6aec7/source_letter.txt +9 -0
- package/vendor/ars/scripts/fixtures/content_coverage_advisory/base_draft.json +48 -0
- package/vendor/ars/scripts/fixtures/content_coverage_advisory/base_inventory.json +38 -0
- package/vendor/ars/scripts/fixtures/content_coverage_advisory/packet/consent.txt +1 -0
- package/vendor/ars/scripts/fixtures/content_coverage_advisory/session_sources.json +3 -0
- package/vendor/ars/scripts/fixtures/cross_document_consistency/README.md +6 -0
- package/vendor/ars/scripts/fixtures/cross_document_consistency/accepted_draft.md +35 -0
- package/vendor/ars/scripts/fixtures/cross_document_consistency/cases.json +75 -0
- package/vendor/ars/scripts/fixtures/cross_document_consistency/preregistration.md +5 -0
- package/vendor/ars/scripts/fixtures/cross_model_codex_transport/forbidden_event.jsonl +4 -0
- package/vendor/ars/scripts/fixtures/cross_model_codex_transport/grounded_verified.jsonl +3 -0
- package/vendor/ars/scripts/fixtures/cross_model_codex_transport/malformed.jsonl +3 -0
- package/vendor/ars/scripts/fixtures/cross_model_codex_transport/missing_search.jsonl +2 -0
- package/vendor/ars/scripts/fixtures/cross_model_codex_transport/multiple_finals.jsonl +4 -0
- package/vendor/ars/scripts/fixtures/cross_model_codex_transport/not_found.jsonl +3 -0
- package/vendor/ars/scripts/fixtures/cross_model_codex_transport/unbound_source.jsonl +3 -0
- package/vendor/ars/scripts/fixtures/cross_model_codex_transport/wrong_search_shape.jsonl +3 -0
- package/vendor/ars/scripts/fixtures/evidence_rows/phase_e_inputs.json +114 -0
- package/vendor/ars/scripts/fixtures/evidence_rows/session_sources.json +5 -0
- package/vendor/ars/scripts/fixtures/human_subjects_authority/cross-border-us-tw-gdpr.json +71 -0
- package/vendor/ars/scripts/fixtures/human_subjects_authority/gdpr-member-state-unresolved.json +62 -0
- package/vendor/ars/scripts/fixtures/human_subjects_authority/missing-data-axis.json +45 -0
- package/vendor/ars/scripts/fixtures/human_subjects_authority/no-profile.json +33 -0
- package/vendor/ars/scripts/fixtures/human_subjects_authority/tw-gdpr-two-axis.json +74 -0
- package/vendor/ars/scripts/fixtures/human_subjects_authority/us-gdpr-two-axis.json +74 -0
- package/vendor/ars/scripts/fixtures/review_pathway_rule_trace/lint-near-misses.json +72 -0
- package/vendor/ars/scripts/fixtures/review_pathway_rule_trace/no-profile-request.json +18 -0
- package/vendor/ars/scripts/fixtures/review_pathway_rule_trace/tw-candidates-request.json +63 -0
- package/vendor/ars/scripts/fixtures/review_pathway_rule_trace/us-candidates-request.json +77 -0
- package/vendor/ars/scripts/fixtures/review_target_context/exact-declaration.json +24 -0
- package/vendor/ars/scripts/fixtures/review_target_context/field-general-declaration.json +24 -0
- package/vendor/ars/scripts/fixtures/review_target_context/msr-2027-technical-full-declaration.json +24 -0
- package/vendor/ars/scripts/fixtures/review_target_context/synthetic-registry.json +92 -0
- package/vendor/ars/scripts/fixtures/revision_claim_drift_v2/README.md +21 -0
- package/vendor/ars/scripts/fixtures/revision_claim_drift_v2/subject_context_attested_only.json +55 -0
- package/vendor/ars/scripts/fixtures/revision_claim_drift_v2/subject_context_machine_supported.json +49 -0
- package/vendor/ars/scripts/fixtures/revision_claim_drift_v2/subject_context_not_isolated.json +56 -0
- package/vendor/ars/scripts/fixtures/revision_claim_drift_v2/subject_context_unknown.json +49 -0
- package/vendor/ars/scripts/fixtures/submission_package/clean/paper.md +16 -0
- package/vendor/ars/scripts/fixtures/submission_package/clean/references.bib +13 -0
- package/vendor/ars/scripts/fixtures/submission_package/fallback_authoryear/paper.md +11 -0
- package/vendor/ars/scripts/fixtures/submission_package/fallback_authoryear/references.bib +13 -0
- package/vendor/ars/scripts/fixtures/submission_package/fallback_latex/paper.tex +9 -0
- package/vendor/ars/scripts/fixtures/submission_package/fallback_latex/references.bib +13 -0
- package/vendor/ars/scripts/fixtures/submission_package/marker_no_join/paper.md +7 -0
- package/vendor/ars/scripts/fixtures/submission_package/orphan_intext/paper.md +8 -0
- package/vendor/ars/scripts/fixtures/submission_package/orphan_intext/references.bib +6 -0
- package/vendor/ars/scripts/fixtures/submission_package/passports/corpus_only.yaml +9 -0
- package/vendor/ars/scripts/fixtures/submission_package/passports/summary_join.yaml +16 -0
- package/vendor/ars/scripts/fixtures/submission_package/profiles/full.yaml +15 -0
- package/vendor/ars/scripts/fixtures/submission_package/profiles/tight.yaml +15 -0
- package/vendor/ars/scripts/fixtures/submission_package/summary_join/paper.md +7 -0
- package/vendor/ars/scripts/fixtures/submission_package/uncited_reference/paper.md +9 -0
- package/vendor/ars/scripts/fixtures/submission_package/uncited_reference/references.bib +13 -0
- package/vendor/ars/scripts/fixtures/submission_package/venue_clean/paper.md +26 -0
- package/vendor/ars/scripts/fixtures/submission_package/venue_clean/references.bib +13 -0
- package/vendor/ars/scripts/fixtures/submission_package/venue_violations/paper.md +20 -0
- package/vendor/ars/scripts/fixtures/submission_package/venue_violations/references.bib +13 -0
- package/vendor/ars/scripts/fixtures/submission_packet_manifest/base_inventory.json +101 -0
- package/vendor/ars/scripts/fixtures/submission_packet_manifest/packet/consent-materials.txt +3 -0
- package/vendor/ars/scripts/fixtures/submission_packet_manifest/packet/training-certificate.txt +2 -0
- package/vendor/ars/scripts/fixtures/submission_packet_manifest/packet/tw-consent-materials.txt +3 -0
- package/vendor/ars/scripts/fixtures/tortured_phrase_screening/corpus_input.yaml +30 -0
- package/vendor/ars/scripts/fixtures/tortured_phrase_screening/own_draft.md +36 -0
- package/vendor/ars/scripts/fixtures/tortured_phrase_screening/own_draft.tex +21 -0
- package/vendor/ars/scripts/fixtures/tortured_phrase_screening/seed_expectations.json +218 -0
- package/vendor/ars/scripts/fixtures/tortured_phrase_screening/snapshot.json +164 -0
- package/vendor/ars/scripts/fixtures/tortured_phrase_screening/snapshot_manifest.json +29 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/README.md +55 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/arxiv/empty_feed.xml +10 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/arxiv/error_5xx.html +7 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/arxiv/id_hit.xml +26 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/chinese_literature/README.md +69 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/chinese_literature/cnki_landing_page.html +13 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/chinese_literature/error_5xx.html +2 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/chinese_literature/esearch_coordinate_ambiguous.json +16 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/chinese_literature/esearch_coordinate_hit.json +16 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/chinese_literature/esearch_coordinate_zero.json +14 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/chinese_literature/esearch_coverage_hit.json +15 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/chinese_literature/esearch_coverage_zero.json +13 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/chinese_literature/esummary_hit.json +43 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/chinese_literature/esummary_issn_mismatch.json +31 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/chinese_literature/esummary_no_doi.json +31 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/chinese_literature/esummary_unknown_ra.json +34 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/chinese_literature/esummary_year_mismatch.json +31 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/chinese_literature/handle_absent.json +4 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/chinese_literature/handle_exists.json +16 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/chinese_literature/handle_internal_error.json +4 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/chinese_literature/istic_csl_hit.json +25 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/chinese_literature/istic_csl_other_title.json +18 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/chinese_literature/ra_cnki.json +6 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/chinese_literature/ra_crossref.json +6 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/chinese_literature/ra_istic.json +6 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/chinese_literature/ra_unknown_prefix.json +6 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/crossref/doi_hit.json +24 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/crossref/error_5xx.html +7 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/crossref/title_search_miss.json +15 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/openalex/doi_hit.json +29 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/openalex/error_5xx.json +4 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/openalex/title_search_miss.json +11 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/semantic_scholar/doi_hit.json +14 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/semantic_scholar/error_5xx.json +3 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/semantic_scholar/title_search_miss.json +5 -0
- package/vendor/ars/scripts/human_read_attestation_resolver.py +467 -0
- package/vendor/ars/scripts/ideation_diversity_assignment_gate.py +430 -0
- package/vendor/ars/scripts/inquiry_branch_ledger.py +2540 -0
- package/vendor/ars/scripts/legacy/ars_apply_revision_patch_v1_0.py +715 -0
- package/vendor/ars/scripts/legacy/check_re_review_synthesis_v1_0.py +2215 -0
- package/vendor/ars/scripts/migrate_literature_corpus_to_v3_10.py +223 -0
- package/vendor/ars/scripts/migrate_literature_corpus_to_v3_7_3.py +277 -0
- package/vendor/ars/scripts/migrate_literature_corpus_to_v3_9_0.py +304 -0
- package/vendor/ars/scripts/model_tiering_manifest.json +46 -0
- package/vendor/ars/scripts/openalex_client.py +232 -0
- package/vendor/ars/scripts/parse_audit_verdict.py +802 -0
- package/vendor/ars/scripts/pdf_content_classifier_worker.py +176 -0
- package/vendor/ars/scripts/pdf_read_preflight.py +1455 -0
- package/vendor/ars/scripts/policy_anchor_disclosure_referee.py +354 -0
- package/vendor/ars/scripts/recompute_receipts.py +1414 -0
- package/vendor/ars/scripts/render_claim_standing_view.py +374 -0
- package/vendor/ars/scripts/render_eval_comment.py +130 -0
- package/vendor/ars/scripts/render_harness_retirement_issue.py +167 -0
- package/vendor/ars/scripts/repro_lock_validation.py +90 -0
- package/vendor/ars/scripts/research_workflow_profile.py +1079 -0
- package/vendor/ars/scripts/resolve_human_subjects_authority.py +1158 -0
- package/vendor/ars/scripts/resolve_review_target_context.py +683 -0
- package/vendor/ars/scripts/resume_e4_record.py +509 -0
- package/vendor/ars/scripts/retraction_status.py +484 -0
- package/vendor/ars/scripts/review_criteria_binding.py +889 -0
- package/vendor/ars/scripts/review_panel_provenance.py +744 -0
- package/vendor/ars/scripts/revision_roadmap.py +1967 -0
- package/vendor/ars/scripts/run_ci_pytest_manifest.py +116 -0
- package/vendor/ars/scripts/run_codex_audit.sh +1191 -0
- package/vendor/ars/scripts/run_evals.py +513 -0
- package/vendor/ars/scripts/run_ideation_diversity_no_call.py +3505 -0
- package/vendor/ars/scripts/run_indirect_prompt_injection_no_call.py +3330 -0
- package/vendor/ars/scripts/run_indirect_prompt_injection_probe.py +399 -0
- package/vendor/ars/scripts/run_review_criteria_constructive_value.py +1895 -0
- package/vendor/ars/scripts/run_role_topology_utility_dry_run.py +606 -0
- package/vendor/ars/scripts/score_review_criteria_constructive_value.py +617 -0
- package/vendor/ars/scripts/semantic_scholar_client.py +291 -0
- package/vendor/ars/scripts/slr_lineage.py +59 -0
- package/vendor/ars/scripts/sync_adapter_docs.py +118 -0
- package/vendor/ars/scripts/temporal_integrity_audit.py +840 -0
- package/vendor/ars/scripts/test_431_exact_or_bust.py +253 -0
- package/vendor/ars/scripts/test__eval_threshold_gate.py +125 -0
- package/vendor/ars/scripts/test__markdown_lint_util.py +129 -0
- package/vendor/ars/scripts/test__next_verified_at_ms.py +256 -0
- package/vendor/ars/scripts/test_adjacent_framing_probe_lint.py +171 -0
- package/vendor/ars/scripts/test_adjudication_activity.py +1515 -0
- package/vendor/ars/scripts/test_ars_anchorize_draft.py +178 -0
- package/vendor/ars/scripts/test_ars_apply_revision_patch.py +1335 -0
- package/vendor/ars/scripts/test_ars_cache_invalidate.py +51 -0
- package/vendor/ars/scripts/test_ars_mark_read.py +910 -0
- package/vendor/ars/scripts/test_ars_update_check.py +816 -0
- package/vendor/ars/scripts/test_ars_write_scope_guard.py +790 -0
- package/vendor/ars/scripts/test_arxiv_client.py +374 -0
- package/vendor/ars/scripts/test_audit_schemas.py +560 -0
- package/vendor/ars/scripts/test_audit_snapshot_render_section_0.py +105 -0
- package/vendor/ars/scripts/test_block_parser.py +259 -0
- package/vendor/ars/scripts/test_bootstrap_timeline_yaml.py +148 -0
- package/vendor/ars/scripts/test_build_claim_standing_candidate_ledger.py +1203 -0
- package/vendor/ars/scripts/test_build_claim_standing_query_plan.py +791 -0
- package/vendor/ars/scripts/test_build_submission_packet_manifest.py +2644 -0
- package/vendor/ars/scripts/test_check_215_field_norm.py +238 -0
- package/vendor/ars/scripts/test_check_216_surface_form.py +341 -0
- package/vendor/ars/scripts/test_check_268_nested_commitment_ledger.py +194 -0
- package/vendor/ars/scripts/test_check_390_revision_patch_discipline.py +279 -0
- package/vendor/ars/scripts/test_check_392_citation_verification_intake.py +144 -0
- package/vendor/ars/scripts/test_check_394_submission_policy.py +200 -0
- package/vendor/ars/scripts/test_check_439_format_profile.py +252 -0
- package/vendor/ars/scripts/test_check_619_disclosure_closeout.py +158 -0
- package/vendor/ars/scripts/test_check_630_codex_subscription_transport.py +245 -0
- package/vendor/ars/scripts/test_check_669_review_pathway_rule_trace.py +304 -0
- package/vendor/ars/scripts/test_check_670_revision_roadmap_integration.py +260 -0
- package/vendor/ars/scripts/test_check_673_adjudication_activity.py +367 -0
- package/vendor/ars/scripts/test_check_684_review_criteria_binding.py +274 -0
- package/vendor/ars/scripts/test_check_agents_mirror_sync.py +137 -0
- package/vendor/ars/scripts/test_check_audit_artifact_consistency.py +2133 -0
- package/vendor/ars/scripts/test_check_benchmark_report.py +117 -0
- package/vendor/ars/scripts/test_check_bibliographic_integrity_signals.py +609 -0
- package/vendor/ars/scripts/test_check_calibration_tiers.py +376 -0
- package/vendor/ars/scripts/test_check_changelog_covers_merges.py +509 -0
- package/vendor/ars/scripts/test_check_ci_pytest_manifest.py +425 -0
- package/vendor/ars/scripts/test_check_claim_standing_candidate_ledger_integration.py +256 -0
- package/vendor/ars/scripts/test_check_claim_standing_freshness.py +277 -0
- package/vendor/ars/scripts/test_check_collaboration_depth_rubric.py +239 -0
- package/vendor/ars/scripts/test_check_command_frontmatter_name.py +178 -0
- package/vendor/ars/scripts/test_check_committee_correspondence.py +298 -0
- package/vendor/ars/scripts/test_check_compliance_report.py +381 -0
- package/vendor/ars/scripts/test_check_content_coverage_advisory_integration.py +308 -0
- package/vendor/ars/scripts/test_check_control_availability.py +361 -0
- package/vendor/ars/scripts/test_check_cross_document_consistency_advisory_integration.py +698 -0
- package/vendor/ars/scripts/test_check_cross_model_handoff_contract.py +301 -0
- package/vendor/ars/scripts/test_check_cross_model_verification_sync.py +203 -0
- package/vendor/ars/scripts/test_check_data_access_level.py +227 -0
- package/vendor/ars/scripts/test_check_data_flows.py +382 -0
- package/vendor/ars/scripts/test_check_decision_contract.py +387 -0
- package/vendor/ars/scripts/test_check_degradation_registry.py +270 -0
- package/vendor/ars/scripts/test_check_distribution_surface_claims.py +225 -0
- package/vendor/ars/scripts/test_check_domain_evidence_profile.py +439 -0
- package/vendor/ars/scripts/test_check_e4_promotion.py +163 -0
- package/vendor/ars/scripts/test_check_evals_gold_set.py +312 -0
- package/vendor/ars/scripts/test_check_evidence_row_integration.py +187 -0
- package/vendor/ars/scripts/test_check_field_norm_severity.py +173 -0
- package/vendor/ars/scripts/test_check_firm_rules_sync.py +342 -0
- package/vendor/ars/scripts/test_check_heldout_measurement_report.py +1508 -0
- package/vendor/ars/scripts/test_check_human_subjects_output_contract.py +129 -0
- package/vendor/ars/scripts/test_check_human_subjects_reference_migration.py +756 -0
- package/vendor/ars/scripts/test_check_instruction_data_boundary.py +204 -0
- package/vendor/ars/scripts/test_check_judge_prompt_version.py +90 -0
- package/vendor/ars/scripts/test_check_model_tiering.py +236 -0
- package/vendor/ars/scripts/test_check_panel_synthesis.py +1658 -0
- package/vendor/ars/scripts/test_check_passport_reset_contract.py +249 -0
- package/vendor/ars/scripts/test_check_pattern_eval_manifest.py +381 -0
- package/vendor/ars/scripts/test_check_persuasion_invariance_fixtures.py +591 -0
- package/vendor/ars/scripts/test_check_phase_conformance.py +4366 -0
- package/vendor/ars/scripts/test_check_pipeline_boundary_semantics.py +931 -0
- package/vendor/ars/scripts/test_check_pipeline_integrity.py +243 -0
- package/vendor/ars/scripts/test_check_policy_anchor_protocol.py +236 -0
- package/vendor/ars/scripts/test_check_policy_anchor_table.py +295 -0
- package/vendor/ars/scripts/test_check_prisma_trAIce_freshness.py +68 -0
- package/vendor/ars/scripts/test_check_promotion_bakeoff_preregistration.py +799 -0
- package/vendor/ars/scripts/test_check_ranking_lift.py +377 -0
- package/vendor/ars/scripts/test_check_re_review_synthesis.py +3398 -0
- package/vendor/ars/scripts/test_check_receipt_enum_sync.py +176 -0
- package/vendor/ars/scripts/test_check_repro_lock.py +107 -0
- package/vendor/ars/scripts/test_check_reviewer_data_fences.py +334 -0
- package/vendor/ars/scripts/test_check_reviewer_finding_contract.py +1107 -0
- package/vendor/ars/scripts/test_check_reviewer_role_label.py +491 -0
- package/vendor/ars/scripts/test_check_reviewer_scoring_honesty.py +222 -0
- package/vendor/ars/scripts/test_check_reviewer_sprint_prompt_sync.py +373 -0
- package/vendor/ars/scripts/test_check_revision_claim_drift_suite_v2.py +1925 -0
- package/vendor/ars/scripts/test_check_revision_token_conservation.py +398 -0
- package/vendor/ars/scripts/test_check_risk_register.py +336 -0
- package/vendor/ars/scripts/test_check_role_scoped_contract.py +1104 -0
- package/vendor/ars/scripts/test_check_rq_framing_patterns.py +110 -0
- package/vendor/ars/scripts/test_check_rubric_weight_consistency.py +32 -0
- package/vendor/ars/scripts/test_check_seeded_defect_fixtures.py +392 -0
- package/vendor/ars/scripts/test_check_setup_cross_model_parity.py +121 -0
- package/vendor/ars/scripts/test_check_spec_consistency.py +1081 -0
- package/vendor/ars/scripts/test_check_sprint_contract.py +458 -0
- package/vendor/ars/scripts/test_check_stage_capability_matrix.py +698 -0
- package/vendor/ars/scripts/test_check_submission_packet_manifest_integration.py +177 -0
- package/vendor/ars/scripts/test_check_surface_form_parity.py +417 -0
- package/vendor/ars/scripts/test_check_task_type.py +116 -0
- package/vendor/ars/scripts/test_check_tools_allowlist.py +835 -0
- package/vendor/ars/scripts/test_check_tortured_phrase_screening_integration.py +1306 -0
- package/vendor/ars/scripts/test_check_v3_10_134_write_scope.py +251 -0
- package/vendor/ars/scripts/test_check_v3_10_policy.py +547 -0
- package/vendor/ars/scripts/test_check_v3_6_7_pattern_protection.py +960 -0
- package/vendor/ars/scripts/test_check_v3_6_8_audit_scope_block.py +1000 -0
- package/vendor/ars/scripts/test_check_v3_6_8_cite_provenance_pipeline.py +454 -0
- package/vendor/ars/scripts/test_check_v3_6_8_frontmatter_trust_schema.py +581 -0
- package/vendor/ars/scripts/test_check_v3_6_8_mark_read_commands.py +120 -0
- package/vendor/ars/scripts/test_check_v3_6_8_pattern_protection.py +1138 -0
- package/vendor/ars/scripts/test_check_v3_7_3_three_layer_citation.py +566 -0
- package/vendor/ars/scripts/test_check_v3_8_annotation_literal_sync.py +262 -0
- package/vendor/ars/scripts/test_check_v3_9_0_triangulation.py +321 -0
- package/vendor/ars/scripts/test_check_v3_9_2_phase_boundary.py +190 -0
- package/vendor/ars/scripts/test_check_v3_9_4_temporal_verification.py +471 -0
- package/vendor/ars/scripts/test_check_version_consistency.py +1462 -0
- package/vendor/ars/scripts/test_check_workflow_classification.py +225 -0
- package/vendor/ars/scripts/test_chinese_literature_client.py +1889 -0
- package/vendor/ars/scripts/test_citation_existence_policy.py +480 -0
- package/vendor/ars/scripts/test_citation_verification_summary.py +342 -0
- package/vendor/ars/scripts/test_claim_audit_calibration.py +882 -0
- package/vendor/ars/scripts/test_claim_audit_finalizer.py +979 -0
- package/vendor/ars/scripts/test_claim_audit_pipeline.py +2398 -0
- package/vendor/ars/scripts/test_claim_audit_schema.py +1778 -0
- package/vendor/ars/scripts/test_claim_intent_manifest.py +666 -0
- package/vendor/ars/scripts/test_claim_registry_coverage.py +246 -0
- package/vendor/ars/scripts/test_claim_standing_discovery.py +579 -0
- package/vendor/ars/scripts/test_claim_standing_pipeline_wiring.py +290 -0
- package/vendor/ars/scripts/test_claim_standing_stance_assets.py +399 -0
- package/vendor/ars/scripts/test_claim_standing_stance_contracts.py +383 -0
- package/vendor/ars/scripts/test_claim_standing_stance_runner.py +349 -0
- package/vendor/ars/scripts/test_claim_standing_transmissions.py +605 -0
- package/vendor/ars/scripts/test_claim_strength_drift_disposition.py +517 -0
- package/vendor/ars/scripts/test_claim_verification_coverage_contract.py +104 -0
- package/vendor/ars/scripts/test_contamination_signals.py +1086 -0
- package/vendor/ars/scripts/test_content_coverage_advisory.py +1767 -0
- package/vendor/ars/scripts/test_cross_document_consistency_advisory.py +1270 -0
- package/vendor/ars/scripts/test_cross_model_codex_transport.py +1152 -0
- package/vendor/ars/scripts/test_cross_model_handoff.py +571 -0
- package/vendor/ars/scripts/test_cross_model_verification_guards.py +792 -0
- package/vendor/ars/scripts/test_crossref_client.py +393 -0
- package/vendor/ars/scripts/test_dispatch_e4_panel.py +4235 -0
- package/vendor/ars/scripts/test_e2e_claim_audit.py +540 -0
- package/vendor/ars/scripts/test_eval_harness_workflow.py +140 -0
- package/vendor/ars/scripts/test_evals_citation_extraction.py +150 -0
- package/vendor/ars/scripts/test_evals_lift_report_schema.py +108 -0
- package/vendor/ars/scripts/test_evidence_rows.py +2593 -0
- package/vendor/ars/scripts/test_experiment_provenance.py +915 -0
- package/vendor/ars/scripts/test_human_read_attestation_resolver.py +477 -0
- package/vendor/ars/scripts/test_ideation_diversity_assignment_gate.py +615 -0
- package/vendor/ars/scripts/test_indirect_prompt_injection_behavior_probe.py +250 -0
- package/vendor/ars/scripts/test_inquiry_branch_ledger.py +2296 -0
- package/vendor/ars/scripts/test_migrate_literature_corpus_to_v3_10.py +248 -0
- package/vendor/ars/scripts/test_migrate_literature_corpus_to_v3_7_3.py +545 -0
- package/vendor/ars/scripts/test_migrate_literature_corpus_to_v3_9_0.py +497 -0
- package/vendor/ars/scripts/test_normalize_compat_verdict.py +149 -0
- package/vendor/ars/scripts/test_openalex_client.py +490 -0
- package/vendor/ars/scripts/test_passport_yaml.py +104 -0
- package/vendor/ars/scripts/test_pattern_eval_runtime.py +1295 -0
- package/vendor/ars/scripts/test_pdf_read_preflight.py +1943 -0
- package/vendor/ars/scripts/test_policy_anchor_disclosure.py +666 -0
- package/vendor/ars/scripts/test_reading_probe_lint.py +218 -0
- package/vendor/ars/scripts/test_recompute_receipts.py +778 -0
- package/vendor/ars/scripts/test_render_claim_standing_view.py +192 -0
- package/vendor/ars/scripts/test_render_eval_comment.py +162 -0
- package/vendor/ars/scripts/test_render_harness_retirement_issue.py +110 -0
- package/vendor/ars/scripts/test_repro_lock_validation_drift.py +100 -0
- package/vendor/ars/scripts/test_research_workflow_profile.py +734 -0
- package/vendor/ars/scripts/test_resolve_human_subjects_authority.py +1219 -0
- package/vendor/ars/scripts/test_resolve_review_target_context.py +703 -0
- package/vendor/ars/scripts/test_resume_e4_record.py +315 -0
- package/vendor/ars/scripts/test_retraction_status.py +456 -0
- package/vendor/ars/scripts/test_review_criteria_binding.py +629 -0
- package/vendor/ars/scripts/test_review_panel_provenance.py +565 -0
- package/vendor/ars/scripts/test_review_pathway_rule_trace.py +821 -0
- package/vendor/ars/scripts/test_revision_roadmap.py +1255 -0
- package/vendor/ars/scripts/test_run_ci_pytest_manifest.py +186 -0
- package/vendor/ars/scripts/test_run_codex_audit_e2e.py +369 -0
- package/vendor/ars/scripts/test_run_evals.py +430 -0
- package/vendor/ars/scripts/test_run_guard_launcher.py +500 -0
- package/vendor/ars/scripts/test_run_ideation_diversity_no_call.py +1833 -0
- package/vendor/ars/scripts/test_run_indirect_prompt_injection_no_call.py +1889 -0
- package/vendor/ars/scripts/test_run_review_criteria_constructive_value.py +586 -0
- package/vendor/ars/scripts/test_run_role_topology_utility_dry_run.py +428 -0
- package/vendor/ars/scripts/test_score_review_criteria_constructive_value.py +340 -0
- package/vendor/ars/scripts/test_semantic_scholar_client.py +554 -0
- package/vendor/ars/scripts/test_slr_lineage_emission.py +230 -0
- package/vendor/ars/scripts/test_socratic_rq_non_generation_contract.py +173 -0
- package/vendor/ars/scripts/test_temporal_integrity_audit.py +438 -0
- package/vendor/ars/scripts/test_text_similarity.py +95 -0
- package/vendor/ars/scripts/test_title_fuzzy_false_positive.py +111 -0
- package/vendor/ars/scripts/test_tortured_phrase_screening.py +2959 -0
- package/vendor/ars/scripts/test_transport_fixture_citation_gate.py +338 -0
- package/vendor/ars/scripts/test_uncited_assertion.py +558 -0
- package/vendor/ars/scripts/test_v3_6_7_phase_6_6.py +1279 -0
- package/vendor/ars/scripts/test_validate_compliance_fixtures.py +36 -0
- package/vendor/ars/scripts/test_validate_ideation_diversity_assets.py +230 -0
- package/vendor/ars/scripts/test_venue_disclosure_contract.py +755 -0
- package/vendor/ars/scripts/test_verification_cache.py +280 -0
- package/vendor/ars/scripts/test_verification_gate.py +461 -0
- package/vendor/ars/scripts/test_verify_passport_cli.py +123 -0
- package/vendor/ars/scripts/test_verify_submission_package.py +1407 -0
- package/vendor/ars/scripts/test_version_records_schema.py +211 -0
- package/vendor/ars/scripts/tortured_phrase_screening.py +3502 -0
- package/vendor/ars/scripts/uncited_assertion_detector.py +254 -0
- package/vendor/ars/scripts/v3_6_7_inversion_manifest.json +9 -0
- package/vendor/ars/scripts/v3_6_8_inversion_manifest.json +10 -0
- package/vendor/ars/scripts/validate_claim_standing_stance_assets.py +249 -0
- package/vendor/ars/scripts/validate_compliance_fixtures.py +56 -0
- package/vendor/ars/scripts/validate_ideation_diversity_assets.py +303 -0
- package/vendor/ars/scripts/venue_disclosure_contract_harness.py +837 -0
- package/vendor/ars/scripts/verification_cache.py +276 -0
- package/vendor/ars/scripts/verification_gate/__init__.py +345 -0
- package/vendor/ars/scripts/verify_passport.py +133 -0
- package/vendor/ars/scripts/verify_submission_package.py +1657 -0
- package/vendor/ars/shared/agents/compliance_agent.md +136 -0
- package/vendor/ars/shared/artifact_reproducibility_pattern.md +173 -0
- package/vendor/ars/shared/benchmark_report.schema.json +81 -0
- package/vendor/ars/shared/benchmark_report_pattern.md +180 -0
- package/vendor/ars/shared/bibliographic_integrity_signals.md +142 -0
- package/vendor/ars/shared/collaboration_depth_rubric.md +154 -0
- package/vendor/ars/shared/compliance_checkpoint_protocol.md +162 -0
- package/vendor/ars/shared/compliance_report.schema.json +187 -0
- package/vendor/ars/shared/contracts/README.md +938 -0
- package/vendor/ars/shared/contracts/activity/adjudication_activity_input.schema.json +555 -0
- package/vendor/ars/shared/contracts/activity/adjudication_activity_store.schema.json +560 -0
- package/vendor/ars/shared/contracts/audit/audit_jsonl.schema.json +128 -0
- package/vendor/ars/shared/contracts/audit/audit_sidecar.schema.json +169 -0
- package/vendor/ars/shared/contracts/audit/audit_verdict.schema.json +133 -0
- package/vendor/ars/shared/contracts/audit/cross_document_consistency_advisory.schema.json +480 -0
- package/vendor/ars/shared/contracts/audit/cross_document_consistency_advisory_draft.schema.json +564 -0
- package/vendor/ars/shared/contracts/audit/cross_document_source_manifest.schema.json +202 -0
- package/vendor/ars/shared/contracts/audit/tortured_phrase_advisory.schema.json +1362 -0
- package/vendor/ars/shared/contracts/audit/tortured_phrase_snapshot.schema.json +208 -0
- package/vendor/ars/shared/contracts/audit/tortured_phrase_snapshot_manifest.schema.json +335 -0
- package/vendor/ars/shared/contracts/capability/stage_capability_matrix.json +434 -0
- package/vendor/ars/shared/contracts/claim_standing/candidate_ledger.schema.json +705 -0
- package/vendor/ars/shared/contracts/claim_standing/query_plan.schema.json +389 -0
- package/vendor/ars/shared/contracts/claim_standing/query_plan_v1_1.schema.json +782 -0
- package/vendor/ars/shared/contracts/claim_standing/retrieval_input.schema.json +440 -0
- package/vendor/ars/shared/contracts/claim_standing/stance_record.schema.json +460 -0
- package/vendor/ars/shared/contracts/claim_standing/transmission_ledger.schema.json +282 -0
- package/vendor/ars/shared/contracts/cross_model/codex_citation_receipt.schema.json +157 -0
- package/vendor/ars/shared/contracts/cross_model/codex_citation_request.schema.json +23 -0
- package/vendor/ars/shared/contracts/cross_model/promotion_bakeoff_sealed_commitment.schema.json +55 -0
- package/vendor/ars/shared/contracts/cross_model/promotion_bakeoff_sealed_reveal.schema.json +50 -0
- package/vendor/ars/shared/contracts/degradation_registry.json +428 -0
- package/vendor/ars/shared/contracts/evaluator/full.json +126 -0
- package/vendor/ars/shared/contracts/evidence/claim_registry.schema.json +50 -0
- package/vendor/ars/shared/contracts/evidence/claim_registry_coverage_report.schema.json +79 -0
- package/vendor/ars/shared/contracts/evidence/evidence_row.schema.json +504 -0
- package/vendor/ars/shared/contracts/evidence/evidence_row_v1_1.schema.json +364 -0
- package/vendor/ars/shared/contracts/evidence/evidence_row_v1_2.schema.json +714 -0
- package/vendor/ars/shared/contracts/evidence/evidence_row_v1_3.schema.json +524 -0
- package/vendor/ars/shared/contracts/human_subjects/authority_profile_registry.schema.json +497 -0
- package/vendor/ars/shared/contracts/human_subjects/committee_correspondence.schema.json +253 -0
- package/vendor/ars/shared/contracts/human_subjects/content_coverage_advisory.schema.json +620 -0
- package/vendor/ars/shared/contracts/human_subjects/irb_context_record.schema.json +329 -0
- package/vendor/ars/shared/contracts/human_subjects/resolved_authority_context.schema.json +347 -0
- package/vendor/ars/shared/contracts/human_subjects/review_pathway_rule_trace.schema.json +265 -0
- package/vendor/ars/shared/contracts/human_subjects/review_pathway_trace_request.schema.json +127 -0
- package/vendor/ars/shared/contracts/human_subjects/submission_packet_inventory.schema.json +240 -0
- package/vendor/ars/shared/contracts/human_subjects/submission_packet_manifest.schema.json +999 -0
- package/vendor/ars/shared/contracts/passport/audit_artifact_entry.schema.json +266 -0
- package/vendor/ars/shared/contracts/passport/bibliographic_integrity_signal.schema.json +1676 -0
- package/vendor/ars/shared/contracts/passport/citation_provenance.schema.json +107 -0
- package/vendor/ars/shared/contracts/passport/citation_verification_summary.schema.json +164 -0
- package/vendor/ars/shared/contracts/passport/claim_audit_result.schema.json +124 -0
- package/vendor/ars/shared/contracts/passport/claim_drift.schema.json +58 -0
- package/vendor/ars/shared/contracts/passport/claim_intent_manifest.schema.json +107 -0
- package/vendor/ars/shared/contracts/passport/constraint_violation.schema.json +65 -0
- package/vendor/ars/shared/contracts/passport/experiment_alignment_result.schema.json +69 -0
- package/vendor/ars/shared/contracts/passport/experiment_provenance_entry.schema.json +169 -0
- package/vendor/ars/shared/contracts/passport/human_read_log.schema.json +86 -0
- package/vendor/ars/shared/contracts/passport/inquiry_ledger_ref.schema.json +22 -0
- package/vendor/ars/shared/contracts/passport/literature_corpus_entry.schema.json +650 -0
- package/vendor/ars/shared/contracts/passport/preregistration_artifact.schema.json +132 -0
- package/vendor/ars/shared/contracts/passport/rejection_log.schema.json +89 -0
- package/vendor/ars/shared/contracts/passport/reset_ledger_entry.schema.json +158 -0
- package/vendor/ars/shared/contracts/passport/temporal_audit_results.schema.json +208 -0
- package/vendor/ars/shared/contracts/passport/terminal_policies.schema.json +50 -0
- package/vendor/ars/shared/contracts/passport/timeline.schema.json +102 -0
- package/vendor/ars/shared/contracts/passport/uncited_assertion.schema.json +56 -0
- package/vendor/ars/shared/contracts/passport/uncited_audit_failure.schema.json +72 -0
- package/vendor/ars/shared/contracts/passport/user_attested_read_resolution.schema.json +87 -0
- package/vendor/ars/shared/contracts/passport/version_records.schema.json +138 -0
- package/vendor/ars/shared/contracts/patch/block_manifest.schema.json +45 -0
- package/vendor/ars/shared/contracts/patch/legacy/v1_0/revision_patch.schema.json +110 -0
- package/vendor/ars/shared/contracts/patch/revision_patch.schema.json +250 -0
- package/vendor/ars/shared/contracts/pdf/pdf_content_classifier_diagnostic.schema.json +39 -0
- package/vendor/ars/shared/contracts/pdf/pdf_content_classifier_worker.schema.json +88 -0
- package/vendor/ars/shared/contracts/pdf/pdf_read_preflight.schema.json +227 -0
- package/vendor/ars/shared/contracts/re_review/input_manifest.schema.json +161 -0
- package/vendor/ars/shared/contracts/re_review/legacy/v1_0/input_manifest.schema.json +134 -0
- package/vendor/ars/shared/contracts/re_review/legacy/v1_0/precommitment.schema.json +193 -0
- package/vendor/ars/shared/contracts/re_review/legacy/v1_0/traceability.schema.json +841 -0
- package/vendor/ars/shared/contracts/re_review/legacy/v1_0/verdict_record.schema.json +244 -0
- package/vendor/ars/shared/contracts/re_review/precommitment.schema.json +193 -0
- package/vendor/ars/shared/contracts/re_review/traceability.schema.json +916 -0
- package/vendor/ars/shared/contracts/re_review/verdict_record.schema.json +245 -0
- package/vendor/ars/shared/contracts/research_workflow/inquiry_branch_ledger.schema.json +449 -0
- package/vendor/ars/shared/contracts/research_workflow/research_workflow_profile.schema.json +222 -0
- package/vendor/ars/shared/contracts/research_workflow/research_workflow_profile_selection_receipt.schema.json +111 -0
- package/vendor/ars/shared/contracts/review_target/constructive_review_findings.schema.json +172 -0
- package/vendor/ars/shared/contracts/review_target/criteria_registry.schema.json +97 -0
- package/vendor/ars/shared/contracts/review_target/review_criteria_binding_manifest.schema.json +235 -0
- package/vendor/ars/shared/contracts/review_target/review_criteria_source_receipt.schema.json +158 -0
- package/vendor/ars/shared/contracts/review_target/review_target_context.schema.json +106 -0
- package/vendor/ars/shared/contracts/review_target/review_target_declaration.schema.json +118 -0
- package/vendor/ars/shared/contracts/reviewer/full.json +114 -0
- package/vendor/ars/shared/contracts/reviewer/methodology_focus.json +75 -0
- package/vendor/ars/shared/contracts/reviewer/review_panel_provenance.schema.json +263 -0
- package/vendor/ars/shared/contracts/reviewer/review_panel_provenance_carrier.schema.json +122 -0
- package/vendor/ars/shared/contracts/reviewer/review_panel_provenance_input.schema.json +120 -0
- package/vendor/ars/shared/contracts/revision/author_adjudication.schema.json +251 -0
- package/vendor/ars/shared/contracts/revision/author_adjudication_input.schema.json +25 -0
- package/vendor/ars/shared/contracts/revision/claim_strength_drift_disposition.schema.json +97 -0
- package/vendor/ars/shared/contracts/revision/claim_strength_drift_disposition_input.schema.json +80 -0
- package/vendor/ars/shared/contracts/revision/claim_strength_drift_findings.schema.json +139 -0
- package/vendor/ars/shared/contracts/revision/claim_surface_manifest.schema.json +99 -0
- package/vendor/ars/shared/contracts/revision/integrity_correction_authorization.schema.json +140 -0
- package/vendor/ars/shared/contracts/revision/integrity_correction_authorization_input.schema.json +28 -0
- package/vendor/ars/shared/contracts/revision/integrity_correction_list.schema.json +48 -0
- package/vendor/ars/shared/contracts/revision/integrity_pass_receipt.schema.json +16 -0
- package/vendor/ars/shared/contracts/revision/revision_evidence_bundle.schema.json +134 -0
- package/vendor/ars/shared/contracts/revision/revision_roadmap.schema.json +334 -0
- package/vendor/ars/shared/contracts/submission/format_profile.example.yaml +33 -0
- package/vendor/ars/shared/contracts/submission/format_profile.schema.json +102 -0
- package/vendor/ars/shared/contracts/submission/submission_verification_report.schema.json +233 -0
- package/vendor/ars/shared/contracts/submission/venue_profile.schema.json +114 -0
- package/vendor/ars/shared/contracts/writer/full.json +87 -0
- package/vendor/ars/shared/cross_model_verification.md +714 -0
- package/vendor/ars/shared/evals_lift_report.schema.json +141 -0
- package/vendor/ars/shared/ground_truth_isolation_pattern.md +275 -0
- package/vendor/ars/shared/handoff_schemas.md +1209 -0
- package/vendor/ars/shared/human_subjects_authority_registry.json +1278 -0
- package/vendor/ars/shared/mode_spectrum.md +57 -0
- package/vendor/ars/shared/model_tiering.md +83 -0
- package/vendor/ars/shared/policy_data/nature_policy.md +56 -0
- package/vendor/ars/shared/prisma_trAIce_protocol.md +157 -0
- package/vendor/ars/shared/raise_framework.md +129 -0
- package/vendor/ars/shared/references/authority_content_coverage_advisory_protocol.md +275 -0
- package/vendor/ars/shared/references/claim_standing_candidate_ledger_protocol.md +66 -0
- package/vendor/ars/shared/references/claim_strength_ladder.md +93 -0
- package/vendor/ars/shared/references/cross_document_consistency_advisory_protocol.md +263 -0
- package/vendor/ars/shared/references/evidence_row_protocol.md +260 -0
- package/vendor/ars/shared/references/firm_rules.md +90 -0
- package/vendor/ars/shared/references/human_subjects_authority_protocol.md +274 -0
- package/vendor/ars/shared/references/intent_clarification_protocol.md +168 -0
- package/vendor/ars/shared/references/irb_terminology_glossary.md +229 -0
- package/vendor/ars/shared/references/protected_hedging_phrases.md +118 -0
- package/vendor/ars/shared/references/psychometric_terminology_glossary.md +109 -0
- package/vendor/ars/shared/references/review_criteria_consumer_protocol.md +238 -0
- package/vendor/ars/shared/references/review_pathway_rule_trace_protocol.md +166 -0
- package/vendor/ars/shared/references/submission_packet_manifest_protocol.md +292 -0
- package/vendor/ars/shared/references/word_count_conventions.md +124 -0
- package/vendor/ars/shared/research_workflow_profiles/field_general.json +1 -0
- package/vendor/ars/shared/review_criteria_registry.json +207 -0
- package/vendor/ars/shared/review_criteria_sources/msr-2027-technical-papers.2026-08-24.json +46 -0
- package/vendor/ars/shared/review_criteria_sources/sigsoft-empirical-standards.2026-08-24.json +31 -0
- package/vendor/ars/shared/sprint_contract.schema.json +482 -0
- package/vendor/ars/shared/style_calibration_protocol.md +151 -0
- package/vendor/ars/shared/templates/codex_audit_multifile_template.md +263 -0
- package/vendor/ars/tools/release-discipline/.toolkit-version +1 -0
- package/vendor/ars/tools/release-discipline/README.md +4 -0
- package/vendor/ars/tools/release-discipline/scripts/_release_doc_alignment_schema.py +1011 -0
- package/vendor/ars/tools/release-discipline/scripts/check_command_invariants.py +497 -0
- package/vendor/ars/tools/release-discipline/scripts/check_release_doc_alignment.py +263 -0
- package/vendor/ars/tools/release-discipline/scripts/sync-toolkit.sh +147 -0
- package/vendor/windows/NOTICE.md +12 -0
- package/vendor/windows/arm64/fd.exe +0 -0
- package/vendor/windows/arm64/licenses/fd/LICENSE-APACHE +201 -0
- package/vendor/windows/arm64/licenses/fd/LICENSE-MIT +21 -0
- package/vendor/windows/arm64/licenses/ripgrep/COPYING +3 -0
- package/vendor/windows/arm64/licenses/ripgrep/LICENSE-MIT +21 -0
- package/vendor/windows/arm64/licenses/ripgrep/UNLICENSE +24 -0
- package/vendor/windows/arm64/rg.exe +0 -0
- package/vendor/windows/x64/fd.exe +0 -0
- package/vendor/windows/x64/licenses/fd/LICENSE-APACHE +201 -0
- package/vendor/windows/x64/licenses/fd/LICENSE-MIT +21 -0
- package/vendor/windows/x64/licenses/ripgrep/COPYING +3 -0
- package/vendor/windows/x64/licenses/ripgrep/LICENSE-MIT +21 -0
- package/vendor/windows/x64/licenses/ripgrep/UNLICENSE +24 -0
- package/vendor/windows/x64/rg.exe +0 -0
|
@@ -0,0 +1,1767 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Hermetic replay, aggregation, renderer, and security tests for #681."""
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import ast
|
|
6
|
+
import copy
|
|
7
|
+
import hashlib
|
|
8
|
+
import json
|
|
9
|
+
import re
|
|
10
|
+
import shutil
|
|
11
|
+
import socket
|
|
12
|
+
import subprocess
|
|
13
|
+
import sys
|
|
14
|
+
import urllib.parse
|
|
15
|
+
from collections.abc import Mapping
|
|
16
|
+
from pathlib import Path
|
|
17
|
+
from typing import Any, Callable
|
|
18
|
+
|
|
19
|
+
import pytest
|
|
20
|
+
from jsonschema import Draft202012Validator, FormatChecker
|
|
21
|
+
from referencing import Registry, Resource
|
|
22
|
+
|
|
23
|
+
import build_content_coverage_advisory as coverage_runtime
|
|
24
|
+
from build_content_coverage_advisory import (
|
|
25
|
+
ContentCoverageAdvisoryError,
|
|
26
|
+
finalize_advisory,
|
|
27
|
+
main,
|
|
28
|
+
render_advisory,
|
|
29
|
+
validate_advisory,
|
|
30
|
+
)
|
|
31
|
+
from build_submission_packet_manifest import build_submission_packet_manifest
|
|
32
|
+
from resolve_human_subjects_authority import digest, resolve
|
|
33
|
+
from test_build_submission_packet_manifest import (
|
|
34
|
+
PACKET_ROOT as SYNTHETIC_PACKET_ROOT,
|
|
35
|
+
_repin_overlay,
|
|
36
|
+
_synthetic_overlay_authority,
|
|
37
|
+
_waiver_inventory,
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
REPO_ROOT = Path(__file__).resolve().parents[1]
|
|
42
|
+
FIXTURES = REPO_ROOT / "scripts" / "fixtures" / "content_coverage_advisory"
|
|
43
|
+
PACKET_ROOT = FIXTURES / "packet"
|
|
44
|
+
BASE_INVENTORY = FIXTURES / "base_inventory.json"
|
|
45
|
+
BASE_DRAFT = FIXTURES / "base_draft.json"
|
|
46
|
+
SESSION_SOURCES = FIXTURES / "session_sources.json"
|
|
47
|
+
AUTHORITY_FIXTURES = REPO_ROOT / "scripts" / "fixtures" / "human_subjects_authority"
|
|
48
|
+
REGISTRY_PATH = REPO_ROOT / "shared" / "human_subjects_authority_registry.json"
|
|
49
|
+
ROW_SCHEMA_PATH = (
|
|
50
|
+
REPO_ROOT / "shared" / "contracts" / "evidence" / "evidence_row_v1_1.schema.json"
|
|
51
|
+
)
|
|
52
|
+
ADVISORY_SCHEMA_PATH = (
|
|
53
|
+
REPO_ROOT
|
|
54
|
+
/ "shared"
|
|
55
|
+
/ "contracts"
|
|
56
|
+
/ "human_subjects"
|
|
57
|
+
/ "content_coverage_advisory.schema.json"
|
|
58
|
+
)
|
|
59
|
+
RUNTIME_PATH = REPO_ROOT / "scripts" / "build_content_coverage_advisory.py"
|
|
60
|
+
|
|
61
|
+
REQUIREMENT_ID = "us.45cfr46.116.informed-consent"
|
|
62
|
+
REQUIREMENT_POINTER = "/profiles/0/requirements/1"
|
|
63
|
+
EXPECTATION_POINTERS = [
|
|
64
|
+
f"{REQUIREMENT_POINTER}/structured_expectations/{index}" for index in range(3)
|
|
65
|
+
]
|
|
66
|
+
SOURCE_TEXT = (
|
|
67
|
+
"Participation is voluntary. Prospective information is provided before consent.\n"
|
|
68
|
+
)
|
|
69
|
+
CAPTURED_AT = "2026-08-09T12:00:00Z"
|
|
70
|
+
ENVELOPE_EXPECTED = {
|
|
71
|
+
"packet_v1.non_clinical": True,
|
|
72
|
+
"packet_v1.single_institution": True,
|
|
73
|
+
"packet_v1.competent_adults_only": True,
|
|
74
|
+
"packet_v1.biospecimens_involved": False,
|
|
75
|
+
"packet_v1.regulated_clinical_trial": False,
|
|
76
|
+
"packet_v1.cross_border_material_transfer": False,
|
|
77
|
+
"packet_v1.multisite_reliance": False,
|
|
78
|
+
}
|
|
79
|
+
REASON_CODES = {
|
|
80
|
+
"ALL_EXPECTATIONS_APPEAR_COVERED",
|
|
81
|
+
"EXPECTATION_NOT_LOCATED",
|
|
82
|
+
"CONFLICTING_COVERAGE_OBSERVATIONS",
|
|
83
|
+
"COVERAGE_CHECK_NOT_PERFORMED",
|
|
84
|
+
"SESSION_CONTENT_NOT_PROVIDED",
|
|
85
|
+
"SOURCE_ACCESS_FAILED",
|
|
86
|
+
"SOURCE_RETRIEVAL_FAILED",
|
|
87
|
+
"DETERMINISTIC_PACKET_GAP",
|
|
88
|
+
"DETERMINISTIC_PACKET_CONFLICT",
|
|
89
|
+
"WAIVER_OR_EXCEPTION_BOUNDARY",
|
|
90
|
+
"EXTERNAL_DEPENDENCY",
|
|
91
|
+
"APPLICABILITY_UNRESOLVED",
|
|
92
|
+
"NO_PROFILED_STRUCTURED_EXPECTATIONS",
|
|
93
|
+
"INSTITUTIONAL_ACCEPTANCE_REQUIRED",
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
def _json(path: Path) -> dict[str, Any]:
|
|
98
|
+
value = json.loads(path.read_text(encoding="utf-8"))
|
|
99
|
+
assert isinstance(value, dict)
|
|
100
|
+
return value
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
def _write_json(path: Path, value: Any) -> None:
|
|
104
|
+
path.write_text(
|
|
105
|
+
json.dumps(value, ensure_ascii=False, sort_keys=True, indent=2) + "\n",
|
|
106
|
+
encoding="utf-8",
|
|
107
|
+
)
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
def _inventory() -> dict[str, Any]:
|
|
111
|
+
return _json(BASE_INVENTORY)
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
def _draft() -> dict[str, Any]:
|
|
115
|
+
return _json(BASE_DRAFT)
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
def _sources() -> dict[str, str]:
|
|
119
|
+
return _json(SESSION_SOURCES) # type: ignore[return-value]
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
def _registry() -> dict[str, Any]:
|
|
123
|
+
return _json(REGISTRY_PATH)
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
def _context() -> dict[str, Any]:
|
|
127
|
+
context = _json(AUTHORITY_FIXTURES / "us-gdpr-two-axis.json")
|
|
128
|
+
known = {row["fact_id"] for row in context["declared_facts"]}
|
|
129
|
+
for fact_id, value in ENVELOPE_EXPECTED.items():
|
|
130
|
+
if fact_id not in known:
|
|
131
|
+
context["declared_facts"].append(
|
|
132
|
+
{
|
|
133
|
+
"fact_id": fact_id,
|
|
134
|
+
"value_type": "boolean",
|
|
135
|
+
"state": "declared",
|
|
136
|
+
"value": value,
|
|
137
|
+
"provenance": "author_declared",
|
|
138
|
+
}
|
|
139
|
+
)
|
|
140
|
+
return context
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
def _repin_profile(context: dict[str, Any], profile: dict[str, Any]) -> None:
|
|
144
|
+
unsigned = copy.deepcopy(profile)
|
|
145
|
+
unsigned.pop("profile_digest", None)
|
|
146
|
+
profile["profile_digest"] = digest(unsigned)
|
|
147
|
+
selected = next(
|
|
148
|
+
row
|
|
149
|
+
for row in context["selected_profiles"]
|
|
150
|
+
if row["profile_id"] == profile["profile_id"]
|
|
151
|
+
)
|
|
152
|
+
selected["profile_digest"] = profile["profile_digest"]
|
|
153
|
+
display = next(
|
|
154
|
+
row
|
|
155
|
+
for axis in context["display_precedence"]
|
|
156
|
+
for row in axis["ordered_authorities"]
|
|
157
|
+
if row["authority_kind"] == "profile"
|
|
158
|
+
and row["authority_id"] == profile["profile_id"]
|
|
159
|
+
)
|
|
160
|
+
display["authority_digest"] = profile["profile_digest"]
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
def _us_profile(registry: dict[str, Any]) -> dict[str, Any]:
|
|
164
|
+
return next(
|
|
165
|
+
row
|
|
166
|
+
for row in registry["profiles"]
|
|
167
|
+
if row["profile_id"] == "us.hhs.45-cfr-46.subpart-a"
|
|
168
|
+
)
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
def _us_requirement(registry: dict[str, Any]) -> dict[str, Any]:
|
|
172
|
+
return next(
|
|
173
|
+
row
|
|
174
|
+
for row in _us_profile(registry)["requirements"]
|
|
175
|
+
if row["requirement_id"] == REQUIREMENT_ID
|
|
176
|
+
)
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
def _case(
|
|
180
|
+
*,
|
|
181
|
+
inventory: dict[str, Any] | None = None,
|
|
182
|
+
packet_root: Path = PACKET_ROOT,
|
|
183
|
+
context: dict[str, Any] | None = None,
|
|
184
|
+
registry: dict[str, Any] | None = None,
|
|
185
|
+
draft: dict[str, Any] | None = None,
|
|
186
|
+
sources: Mapping[str, str] | None = None,
|
|
187
|
+
) -> dict[str, Any]:
|
|
188
|
+
inventory = _inventory() if inventory is None else inventory
|
|
189
|
+
context = _context() if context is None else context
|
|
190
|
+
registry = _registry() if registry is None else registry
|
|
191
|
+
resolved = resolve(context, registry)
|
|
192
|
+
manifest = build_submission_packet_manifest(
|
|
193
|
+
inventory,
|
|
194
|
+
packet_root,
|
|
195
|
+
context=context,
|
|
196
|
+
registry=registry,
|
|
197
|
+
resolved=resolved,
|
|
198
|
+
)
|
|
199
|
+
return {
|
|
200
|
+
"inventory": inventory,
|
|
201
|
+
"packet_root": packet_root,
|
|
202
|
+
"context": context,
|
|
203
|
+
"registry": registry,
|
|
204
|
+
"resolved": resolved,
|
|
205
|
+
"manifest": manifest,
|
|
206
|
+
"draft": _draft() if draft is None else draft,
|
|
207
|
+
"sources": _sources() if sources is None else dict(sources),
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
def _finalize(case: dict[str, Any]) -> dict[str, Any]:
|
|
212
|
+
return finalize_advisory(
|
|
213
|
+
case["draft"],
|
|
214
|
+
case["inventory"],
|
|
215
|
+
case["packet_root"],
|
|
216
|
+
case["context"],
|
|
217
|
+
case["registry"],
|
|
218
|
+
case["resolved"],
|
|
219
|
+
case["manifest"],
|
|
220
|
+
case["sources"],
|
|
221
|
+
)
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
def _validate(advisory: dict[str, Any], case: dict[str, Any]) -> None:
|
|
225
|
+
validate_advisory(
|
|
226
|
+
advisory,
|
|
227
|
+
case["draft"],
|
|
228
|
+
case["inventory"],
|
|
229
|
+
case["packet_root"],
|
|
230
|
+
case["context"],
|
|
231
|
+
case["registry"],
|
|
232
|
+
case["resolved"],
|
|
233
|
+
case["manifest"],
|
|
234
|
+
case["sources"],
|
|
235
|
+
)
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
def _render(
|
|
239
|
+
advisory: dict[str, Any],
|
|
240
|
+
case: dict[str, Any],
|
|
241
|
+
*,
|
|
242
|
+
page: int = 1,
|
|
243
|
+
page_size: int = 25,
|
|
244
|
+
) -> str:
|
|
245
|
+
return render_advisory(
|
|
246
|
+
advisory,
|
|
247
|
+
case["draft"],
|
|
248
|
+
case["inventory"],
|
|
249
|
+
case["packet_root"],
|
|
250
|
+
case["context"],
|
|
251
|
+
case["registry"],
|
|
252
|
+
case["resolved"],
|
|
253
|
+
case["manifest"],
|
|
254
|
+
case["sources"],
|
|
255
|
+
page=page,
|
|
256
|
+
page_size=page_size,
|
|
257
|
+
)
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
def _result(advisory: dict[str, Any], requirement_id: str = REQUIREMENT_ID) -> dict[str, Any]:
|
|
261
|
+
matches = [
|
|
262
|
+
row
|
|
263
|
+
for row in advisory["requirement_results"]
|
|
264
|
+
if row["requirement_ref"]["requirement_id"] == requirement_id
|
|
265
|
+
]
|
|
266
|
+
assert len(matches) == 1, (requirement_id, matches)
|
|
267
|
+
return matches[0]
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
def _canonical_bytes(value: Any) -> bytes:
|
|
271
|
+
return json.dumps(
|
|
272
|
+
value,
|
|
273
|
+
ensure_ascii=False,
|
|
274
|
+
sort_keys=True,
|
|
275
|
+
separators=(",", ":"),
|
|
276
|
+
allow_nan=False,
|
|
277
|
+
).encode("utf-8")
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
def _repin_report(advisory: dict[str, Any]) -> None:
|
|
281
|
+
advisory.pop("report_digest", None)
|
|
282
|
+
advisory["report_digest"] = digest(advisory)
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
def _all_keys(value: Any) -> set[str]:
|
|
286
|
+
if isinstance(value, dict):
|
|
287
|
+
return set(value) | set().union(*(_all_keys(item) for item in value.values()), set())
|
|
288
|
+
if isinstance(value, list):
|
|
289
|
+
return set().union(*(_all_keys(item) for item in value), set())
|
|
290
|
+
return set()
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
def _quote(value: str) -> str:
|
|
294
|
+
return urllib.parse.quote(value, safe="")
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+
def _not_located(judgment: dict[str, Any]) -> None:
|
|
298
|
+
judgment.update(
|
|
299
|
+
{
|
|
300
|
+
"coverage_check_state": "performed",
|
|
301
|
+
"advisory_coverage_status": "NOT_LOCATED",
|
|
302
|
+
"quoted_anchor_encoded": "",
|
|
303
|
+
"captured_at": None,
|
|
304
|
+
"failure_state": None,
|
|
305
|
+
}
|
|
306
|
+
)
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
def _not_checked(judgment: dict[str, Any], failure_state: str) -> None:
|
|
310
|
+
judgment.update(
|
|
311
|
+
{
|
|
312
|
+
"coverage_check_state": "not_checked",
|
|
313
|
+
"advisory_coverage_status": None,
|
|
314
|
+
"quoted_anchor_encoded": "",
|
|
315
|
+
"captured_at": None,
|
|
316
|
+
"failure_state": failure_state,
|
|
317
|
+
}
|
|
318
|
+
)
|
|
319
|
+
|
|
320
|
+
|
|
321
|
+
def _schema_validator() -> Draft202012Validator:
|
|
322
|
+
row_schema = _json(ROW_SCHEMA_PATH)
|
|
323
|
+
advisory_schema = _json(ADVISORY_SCHEMA_PATH)
|
|
324
|
+
resources = Registry().with_resource(
|
|
325
|
+
row_schema["$id"], Resource.from_contents(row_schema)
|
|
326
|
+
)
|
|
327
|
+
return Draft202012Validator(
|
|
328
|
+
advisory_schema,
|
|
329
|
+
registry=resources,
|
|
330
|
+
format_checker=FormatChecker(),
|
|
331
|
+
)
|
|
332
|
+
|
|
333
|
+
|
|
334
|
+
def _draft_errors(draft: dict[str, Any]) -> list[Any]:
|
|
335
|
+
validator = _schema_validator()
|
|
336
|
+
subschema = validator.schema["$defs"]["advisory_draft"]
|
|
337
|
+
return list(validator.evolve(schema=subschema).iter_errors(draft))
|
|
338
|
+
|
|
339
|
+
|
|
340
|
+
def _packet_copy(tmp_path: Path) -> Path:
|
|
341
|
+
target = tmp_path / "packet"
|
|
342
|
+
shutil.copytree(PACKET_ROOT, target)
|
|
343
|
+
return target
|
|
344
|
+
|
|
345
|
+
|
|
346
|
+
def _set_packet_text(
|
|
347
|
+
packet_root: Path,
|
|
348
|
+
inventory: dict[str, Any],
|
|
349
|
+
text: str,
|
|
350
|
+
*,
|
|
351
|
+
artifact_id: str = "fixture.us-consent",
|
|
352
|
+
) -> None:
|
|
353
|
+
artifact = next(
|
|
354
|
+
row for row in inventory["artifacts"] if row["artifact_id"] == artifact_id
|
|
355
|
+
)
|
|
356
|
+
path = packet_root / artifact["relative_path"]
|
|
357
|
+
path.write_text(text, encoding="utf-8")
|
|
358
|
+
payload = text.encode("utf-8")
|
|
359
|
+
artifact["declared_sha256"] = hashlib.sha256(payload).hexdigest()
|
|
360
|
+
artifact["declared_size_bytes"] = len(payload)
|
|
361
|
+
|
|
362
|
+
|
|
363
|
+
def _synthetic_live_draft_and_sources() -> tuple[dict[str, Any], dict[str, str]]:
|
|
364
|
+
source = (SYNTHETIC_PACKET_ROOT / "consent-materials.txt").read_text(
|
|
365
|
+
encoding="utf-8"
|
|
366
|
+
)
|
|
367
|
+
draft = _draft()
|
|
368
|
+
for judgment in list(draft["judgments"]):
|
|
369
|
+
judgment["quoted_anchor_encoded"] = _quote(source.strip())
|
|
370
|
+
return draft, {"fixture.us-consent": source}
|
|
371
|
+
|
|
372
|
+
|
|
373
|
+
def _expectation_count_case(count: int) -> dict[str, Any]:
|
|
374
|
+
context = _context()
|
|
375
|
+
registry = _registry()
|
|
376
|
+
profile = _us_profile(registry)
|
|
377
|
+
requirement = _us_requirement(registry)
|
|
378
|
+
template = copy.deepcopy(requirement["structured_expectations"][0])
|
|
379
|
+
requirement["structured_expectations"] = []
|
|
380
|
+
judgments: list[dict[str, Any]] = []
|
|
381
|
+
for index in range(count):
|
|
382
|
+
expectation = copy.deepcopy(template)
|
|
383
|
+
expectation["field_id"] = f"synthetic.coverage-field-{index:04d}"
|
|
384
|
+
requirement["structured_expectations"].append(expectation)
|
|
385
|
+
judgments.append(
|
|
386
|
+
{
|
|
387
|
+
"requirement_id": REQUIREMENT_ID,
|
|
388
|
+
"expectation_pointer": (
|
|
389
|
+
f"{REQUIREMENT_POINTER}/structured_expectations/{index}"
|
|
390
|
+
),
|
|
391
|
+
"artifact_id": "fixture.us-consent",
|
|
392
|
+
"coverage_check_state": "performed",
|
|
393
|
+
"advisory_coverage_status": "DOCUMENTED",
|
|
394
|
+
"document_locator": {
|
|
395
|
+
"kind": "section",
|
|
396
|
+
"value": f"Synthetic expectation {index:04d}",
|
|
397
|
+
},
|
|
398
|
+
"quoted_anchor_encoded": _quote(SOURCE_TEXT.strip()),
|
|
399
|
+
"captured_at": CAPTURED_AT,
|
|
400
|
+
"failure_state": None,
|
|
401
|
+
}
|
|
402
|
+
)
|
|
403
|
+
_repin_profile(context, profile)
|
|
404
|
+
draft = {
|
|
405
|
+
"schema_version": "content-coverage-advisory-draft/1.0",
|
|
406
|
+
"layer": "LLM-ADVISORY",
|
|
407
|
+
"judgments": judgments,
|
|
408
|
+
}
|
|
409
|
+
return _case(context=context, registry=registry, draft=draft)
|
|
410
|
+
|
|
411
|
+
|
|
412
|
+
def test_schemas_constants_and_reason_vocabulary_are_frozen() -> None:
|
|
413
|
+
row_schema = _json(ROW_SCHEMA_PATH)
|
|
414
|
+
advisory_schema = _json(ADVISORY_SCHEMA_PATH)
|
|
415
|
+
Draft202012Validator.check_schema(row_schema)
|
|
416
|
+
Draft202012Validator.check_schema(advisory_schema)
|
|
417
|
+
assert advisory_schema["additionalProperties"] is False
|
|
418
|
+
assert advisory_schema["properties"]["schema_version"]["const"] == (
|
|
419
|
+
"content-coverage-advisory/1.0"
|
|
420
|
+
)
|
|
421
|
+
assert advisory_schema["properties"]["layer"]["const"] == "LLM-ADVISORY"
|
|
422
|
+
assert advisory_schema["properties"]["evaluation_status"]["const"] == "UNMEASURED"
|
|
423
|
+
assert set(advisory_schema["$defs"]["reason_code"]["enum"]) == REASON_CODES
|
|
424
|
+
assert coverage_runtime.DRAFT_SCHEMA_VERSION == "content-coverage-advisory-draft/1.0"
|
|
425
|
+
assert coverage_runtime.REPORT_SCHEMA_VERSION == "content-coverage-advisory/1.0"
|
|
426
|
+
assert coverage_runtime.LAYER == "LLM-ADVISORY"
|
|
427
|
+
assert coverage_runtime.EVALUATION_STATUS == "UNMEASURED"
|
|
428
|
+
assert coverage_runtime.MAX_JUDGMENTS == 4096
|
|
429
|
+
assert coverage_runtime.MAX_SESSION_CONTENT_BYTES == 64 * 1024 * 1024
|
|
430
|
+
assert coverage_runtime.MAX_TOTAL_SESSION_CONTENT_BYTES == 256 * 1024 * 1024
|
|
431
|
+
assert coverage_runtime.MAX_ADVISORY_BYTES == 8 * 1024 * 1024
|
|
432
|
+
assert coverage_runtime.MAX_RENDER_PAGE_SIZE == 25
|
|
433
|
+
|
|
434
|
+
|
|
435
|
+
def test_session_content_count_and_byte_bounds_are_exact(
|
|
436
|
+
monkeypatch: pytest.MonkeyPatch,
|
|
437
|
+
) -> None:
|
|
438
|
+
assert len(coverage_runtime._validate_session_contents({f"a-{i}": "" for i in range(512)})) == 512
|
|
439
|
+
with pytest.raises(ContentCoverageAdvisoryError, match="exceeds 512"):
|
|
440
|
+
coverage_runtime._validate_session_contents({f"a-{i}": "" for i in range(513)})
|
|
441
|
+
|
|
442
|
+
monkeypatch.setattr(coverage_runtime, "MAX_SESSION_CONTENT_BYTES", 4)
|
|
443
|
+
assert coverage_runtime._validate_session_contents({"a": "1234"}) == {
|
|
444
|
+
"a": "1234"
|
|
445
|
+
}
|
|
446
|
+
with pytest.raises(ContentCoverageAdvisoryError, match="64 MiB"):
|
|
447
|
+
coverage_runtime._validate_session_contents({"a": "12345"})
|
|
448
|
+
|
|
449
|
+
monkeypatch.setattr(coverage_runtime, "MAX_SESSION_CONTENT_BYTES", 8)
|
|
450
|
+
monkeypatch.setattr(coverage_runtime, "MAX_TOTAL_SESSION_CONTENT_BYTES", 8)
|
|
451
|
+
assert coverage_runtime._validate_session_contents({"a": "1234", "b": "5678"}) == {
|
|
452
|
+
"a": "1234",
|
|
453
|
+
"b": "5678",
|
|
454
|
+
}
|
|
455
|
+
with pytest.raises(ContentCoverageAdvisoryError, match="256 MiB total"):
|
|
456
|
+
coverage_runtime._validate_session_contents({"a": "1234", "b": "56789"})
|
|
457
|
+
|
|
458
|
+
|
|
459
|
+
def test_public_api_is_frozen_and_packet_root_is_mandatory() -> None:
|
|
460
|
+
for name in ("finalize_advisory", "validate_advisory", "render_advisory", "main"):
|
|
461
|
+
assert hasattr(coverage_runtime, name)
|
|
462
|
+
tree = ast.parse(RUNTIME_PATH.read_text(encoding="utf-8"))
|
|
463
|
+
functions = {
|
|
464
|
+
node.name: node for node in tree.body if isinstance(node, ast.FunctionDef)
|
|
465
|
+
}
|
|
466
|
+
for name in ("finalize_advisory", "validate_advisory", "render_advisory"):
|
|
467
|
+
parameters = [argument.arg for argument in functions[name].args.args]
|
|
468
|
+
assert "packet_root" in parameters
|
|
469
|
+
assert "manifest" in parameters
|
|
470
|
+
assert "session_sources" in parameters
|
|
471
|
+
|
|
472
|
+
|
|
473
|
+
def test_base_draft_and_final_carrier_pass_closed_schemas_and_exact_replay() -> None:
|
|
474
|
+
case = _case()
|
|
475
|
+
assert _draft_errors(case["draft"]) == []
|
|
476
|
+
advisory = _finalize(case)
|
|
477
|
+
_schema_validator().validate(advisory)
|
|
478
|
+
_validate(advisory, case)
|
|
479
|
+
assert advisory["report_digest"] == digest(
|
|
480
|
+
{key: value for key, value in advisory.items() if key != "report_digest"}
|
|
481
|
+
)
|
|
482
|
+
|
|
483
|
+
|
|
484
|
+
def test_live_mixed_packet_owned_and_external_seam_still_checks_packet_content() -> None:
|
|
485
|
+
case = _case()
|
|
486
|
+
advisory = _finalize(case)
|
|
487
|
+
result = _result(advisory)
|
|
488
|
+
assert result["coverage_check_state"] == "performed"
|
|
489
|
+
assert result["advisory_coverage_status"] == "DOCUMENTED"
|
|
490
|
+
assert result["reason_codes"] == ["ALL_EXPECTATIONS_APPEAR_COVERED"]
|
|
491
|
+
assert len(result["expectation_findings"]) == 3
|
|
492
|
+
refs = result["deterministic_entry_refs"]
|
|
493
|
+
assert [(row["responsibility"], row["deterministic_status"]) for row in refs] == [
|
|
494
|
+
("packet_owned", "DOCUMENTED"),
|
|
495
|
+
("external_dependency", "ACCEPTANCE_UNVERIFIED"),
|
|
496
|
+
]
|
|
497
|
+
assert refs[1]["matched_artifact_ids"] == []
|
|
498
|
+
|
|
499
|
+
|
|
500
|
+
def test_input_binding_and_deterministic_status_are_exact_copies() -> None:
|
|
501
|
+
case = _case()
|
|
502
|
+
advisory = _finalize(case)
|
|
503
|
+
manifest = case["manifest"]
|
|
504
|
+
assert advisory["input_binding"] == {
|
|
505
|
+
"manifest_schema_version": manifest["schema_version"],
|
|
506
|
+
"manifest_digest": manifest["manifest_digest"],
|
|
507
|
+
"inventory_id": manifest["inventory_pointer"]["inventory_id"],
|
|
508
|
+
"inventory_digest": manifest["inventory_pointer"]["inventory_digest"],
|
|
509
|
+
"observation_digest": manifest["packet_pointer"]["observation_digest"],
|
|
510
|
+
"context_record_id": manifest["authority_binding"]["context_pointer"][
|
|
511
|
+
"context_record_id"
|
|
512
|
+
],
|
|
513
|
+
"context_digest": manifest["authority_binding"]["context_pointer"][
|
|
514
|
+
"context_digest"
|
|
515
|
+
],
|
|
516
|
+
"registry_id": manifest["authority_binding"]["registry_pointer"]["registry_id"],
|
|
517
|
+
"registry_version": manifest["authority_binding"]["registry_pointer"][
|
|
518
|
+
"registry_version"
|
|
519
|
+
],
|
|
520
|
+
"registry_as_of": manifest["authority_binding"]["registry_pointer"]["as_of"],
|
|
521
|
+
"registry_digest": manifest["authority_binding"]["registry_pointer"][
|
|
522
|
+
"registry_digest"
|
|
523
|
+
],
|
|
524
|
+
"resolved_digest": manifest["authority_binding"]["resolved_digest"],
|
|
525
|
+
}
|
|
526
|
+
assert advisory["deterministic_status"] == {
|
|
527
|
+
"review_pathway": manifest["administrative_status"]["review_pathway"],
|
|
528
|
+
"submission_readiness": manifest["administrative_status"]["submission_readiness"],
|
|
529
|
+
"authorization_status": manifest["administrative_status"]["authorization_status"],
|
|
530
|
+
"review_timeline": manifest["administrative_status"]["review_timeline"],
|
|
531
|
+
"acceptance_status": manifest["acceptance_boundary"]["status"],
|
|
532
|
+
}
|
|
533
|
+
assert advisory["boundary"] == {
|
|
534
|
+
"deterministic_status_unchanged": True,
|
|
535
|
+
"submission_readiness_unchanged": True,
|
|
536
|
+
"authorization_status_unchanged": True,
|
|
537
|
+
"institutional_acceptance_unchanged": True,
|
|
538
|
+
"adequacy_not_assessed": True,
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
|
|
542
|
+
def test_renderer_shows_exact_authorization_copy_independent_of_readiness() -> None:
|
|
543
|
+
inventory = _inventory()
|
|
544
|
+
authorization = {
|
|
545
|
+
"value": "documented",
|
|
546
|
+
"source_reference": "synthetic.authorization-proof",
|
|
547
|
+
"provenance": "caller_supplied_no_derivation",
|
|
548
|
+
}
|
|
549
|
+
inventory["authorization_status_input"] = copy.deepcopy(authorization)
|
|
550
|
+
complete_case = _case(inventory=inventory)
|
|
551
|
+
complete = _finalize(complete_case)
|
|
552
|
+
|
|
553
|
+
gap_inventory = copy.deepcopy(inventory)
|
|
554
|
+
gap_inventory["artifacts"][0]["evidence_bindings"] = []
|
|
555
|
+
empty_draft = {
|
|
556
|
+
"schema_version": "content-coverage-advisory-draft/1.0",
|
|
557
|
+
"layer": "LLM-ADVISORY",
|
|
558
|
+
"judgments": [],
|
|
559
|
+
}
|
|
560
|
+
gap_case = _case(inventory=gap_inventory, draft=empty_draft, sources={})
|
|
561
|
+
gap = _finalize(gap_case)
|
|
562
|
+
|
|
563
|
+
assert complete["deterministic_status"]["authorization_status"] == authorization
|
|
564
|
+
assert gap["deterministic_status"]["authorization_status"] == authorization
|
|
565
|
+
assert complete["deterministic_status"]["submission_readiness"] != gap[
|
|
566
|
+
"deterministic_status"
|
|
567
|
+
]["submission_readiness"]
|
|
568
|
+
for advisory, case in ((complete, complete_case), (gap, gap_case)):
|
|
569
|
+
rendered = _render(advisory, case)
|
|
570
|
+
assert f"Authorization status: {authorization['value']}" in rendered
|
|
571
|
+
assert (
|
|
572
|
+
"Authorization source reference: "
|
|
573
|
+
+ coverage_runtime._md(authorization["source_reference"])
|
|
574
|
+
) in rendered
|
|
575
|
+
assert (
|
|
576
|
+
"Authorization provenance: "
|
|
577
|
+
+ coverage_runtime._md(authorization["provenance"])
|
|
578
|
+
) in rendered
|
|
579
|
+
|
|
580
|
+
|
|
581
|
+
def test_final_carrier_has_no_parallel_verdict_measurement_or_adequacy_field() -> None:
|
|
582
|
+
advisory = _finalize(_case())
|
|
583
|
+
forbidden = {
|
|
584
|
+
"verdict",
|
|
585
|
+
"adequacy",
|
|
586
|
+
"approval",
|
|
587
|
+
"approval_status",
|
|
588
|
+
"authorization_decision",
|
|
589
|
+
"compliance",
|
|
590
|
+
"confidence",
|
|
591
|
+
"efficacy",
|
|
592
|
+
"measurement",
|
|
593
|
+
"measurement_rows",
|
|
594
|
+
"probability",
|
|
595
|
+
"review_level",
|
|
596
|
+
"score",
|
|
597
|
+
}
|
|
598
|
+
assert _all_keys(advisory).isdisjoint(forbidden)
|
|
599
|
+
assert advisory["evaluation_status"] == "UNMEASURED"
|
|
600
|
+
|
|
601
|
+
|
|
602
|
+
@pytest.mark.parametrize(
|
|
603
|
+
"mutate",
|
|
604
|
+
[
|
|
605
|
+
lambda value: value.__setitem__("layer", "MODEL-ADVISORY"),
|
|
606
|
+
lambda value: value.__setitem__("unknown", True),
|
|
607
|
+
lambda value: value.pop("judgments"),
|
|
608
|
+
lambda value: value["judgments"][0].__setitem__("requirement_id", REQUIREMENT_ID + "\n"),
|
|
609
|
+
lambda value: value["judgments"][0].__setitem__(
|
|
610
|
+
"expectation_pointer", EXPECTATION_POINTERS[0] + "\n"
|
|
611
|
+
),
|
|
612
|
+
lambda value: value["judgments"][0].__setitem__("captured_at", CAPTURED_AT + "\n"),
|
|
613
|
+
lambda value: value["judgments"][0].__setitem__("unexpected", "value"),
|
|
614
|
+
],
|
|
615
|
+
)
|
|
616
|
+
def test_draft_schema_and_runtime_reject_closed_or_absolute_end_mutations(
|
|
617
|
+
mutate: Callable[[dict[str, Any]], Any]
|
|
618
|
+
) -> None:
|
|
619
|
+
case = _case()
|
|
620
|
+
mutate(case["draft"])
|
|
621
|
+
assert _draft_errors(case["draft"])
|
|
622
|
+
with pytest.raises(ContentCoverageAdvisoryError):
|
|
623
|
+
_finalize(case)
|
|
624
|
+
|
|
625
|
+
|
|
626
|
+
@pytest.mark.parametrize(
|
|
627
|
+
("mutation", "schema_rejects"),
|
|
628
|
+
[
|
|
629
|
+
("documented_empty_quote", True),
|
|
630
|
+
("documented_null_time", True),
|
|
631
|
+
("not_located_quote", True),
|
|
632
|
+
("not_located_time", True),
|
|
633
|
+
("performed_failure", False),
|
|
634
|
+
("not_checked_status", True),
|
|
635
|
+
("not_checked_quote", True),
|
|
636
|
+
("not_checked_time", True),
|
|
637
|
+
("not_checked_no_failure", True),
|
|
638
|
+
("bad_timestamp", True),
|
|
639
|
+
],
|
|
640
|
+
)
|
|
641
|
+
def test_draft_state_cross_products_fail_closed(
|
|
642
|
+
mutation: str, schema_rejects: bool
|
|
643
|
+
) -> None:
|
|
644
|
+
case = _case()
|
|
645
|
+
row = case["draft"]["judgments"][0]
|
|
646
|
+
if mutation == "documented_empty_quote":
|
|
647
|
+
row["quoted_anchor_encoded"] = ""
|
|
648
|
+
elif mutation == "documented_null_time":
|
|
649
|
+
row["captured_at"] = None
|
|
650
|
+
elif mutation == "not_located_quote":
|
|
651
|
+
_not_located(row)
|
|
652
|
+
row["quoted_anchor_encoded"] = "unexpected"
|
|
653
|
+
elif mutation == "not_located_time":
|
|
654
|
+
_not_located(row)
|
|
655
|
+
row["captured_at"] = CAPTURED_AT
|
|
656
|
+
elif mutation == "performed_failure":
|
|
657
|
+
row["failure_state"] = "not_checked"
|
|
658
|
+
elif mutation == "not_checked_status":
|
|
659
|
+
_not_checked(row, "not_checked")
|
|
660
|
+
row["advisory_coverage_status"] = "DOCUMENTED"
|
|
661
|
+
elif mutation == "not_checked_quote":
|
|
662
|
+
_not_checked(row, "not_checked")
|
|
663
|
+
row["quoted_anchor_encoded"] = "unexpected"
|
|
664
|
+
elif mutation == "not_checked_time":
|
|
665
|
+
_not_checked(row, "not_checked")
|
|
666
|
+
row["captured_at"] = CAPTURED_AT
|
|
667
|
+
elif mutation == "not_checked_no_failure":
|
|
668
|
+
_not_checked(row, "not_checked")
|
|
669
|
+
row["failure_state"] = None
|
|
670
|
+
else:
|
|
671
|
+
row["captured_at"] = "2026-08-09T24:00:00Z"
|
|
672
|
+
if schema_rejects:
|
|
673
|
+
assert _draft_errors(case["draft"])
|
|
674
|
+
with pytest.raises(ContentCoverageAdvisoryError):
|
|
675
|
+
_finalize(case)
|
|
676
|
+
|
|
677
|
+
|
|
678
|
+
def test_missing_or_duplicate_expectation_accounting_fails() -> None:
|
|
679
|
+
missing = _case()
|
|
680
|
+
missing["draft"]["judgments"].pop()
|
|
681
|
+
with pytest.raises(ContentCoverageAdvisoryError, match="missing explicit draft accounting"):
|
|
682
|
+
_finalize(missing)
|
|
683
|
+
duplicate = _case()
|
|
684
|
+
duplicate["draft"]["judgments"].append(
|
|
685
|
+
copy.deepcopy(duplicate["draft"]["judgments"][0])
|
|
686
|
+
)
|
|
687
|
+
with pytest.raises(ContentCoverageAdvisoryError, match="duplicates"):
|
|
688
|
+
_finalize(duplicate)
|
|
689
|
+
|
|
690
|
+
|
|
691
|
+
@pytest.mark.parametrize("target", ["requirement", "pointer", "artifact"])
|
|
692
|
+
def test_unknown_or_cross_bound_draft_target_is_rejected(target: str) -> None:
|
|
693
|
+
case = _case()
|
|
694
|
+
row = case["draft"]["judgments"][0]
|
|
695
|
+
if target == "requirement":
|
|
696
|
+
row["requirement_id"] = "unknown.requirement"
|
|
697
|
+
elif target == "pointer":
|
|
698
|
+
row["expectation_pointer"] = (
|
|
699
|
+
"/profiles/0/requirements/0/structured_expectations/0"
|
|
700
|
+
)
|
|
701
|
+
else:
|
|
702
|
+
row["artifact_id"] = "unknown.artifact"
|
|
703
|
+
with pytest.raises(ContentCoverageAdvisoryError):
|
|
704
|
+
_finalize(case)
|
|
705
|
+
|
|
706
|
+
|
|
707
|
+
def test_aggregate_precedence_documented_not_located_conflicting_and_partial() -> None:
|
|
708
|
+
documented = _finalize(_case())
|
|
709
|
+
assert _result(documented)["advisory_coverage_status"] == "DOCUMENTED"
|
|
710
|
+
|
|
711
|
+
missing_case = _case()
|
|
712
|
+
_not_located(missing_case["draft"]["judgments"][1])
|
|
713
|
+
not_located = _finalize(missing_case)
|
|
714
|
+
assert _result(not_located)["advisory_coverage_status"] == "NOT_LOCATED"
|
|
715
|
+
assert _result(not_located)["reason_codes"] == ["EXPECTATION_NOT_LOCATED"]
|
|
716
|
+
|
|
717
|
+
conflict_case = _case()
|
|
718
|
+
original = conflict_case["draft"]["judgments"][0]
|
|
719
|
+
original["advisory_coverage_status"] = "CONFLICTING"
|
|
720
|
+
second = copy.deepcopy(original)
|
|
721
|
+
second["quoted_anchor_encoded"] = _quote("Participation is voluntary.")
|
|
722
|
+
second["document_locator"]["value"] = "Consent — second passage"
|
|
723
|
+
conflict_case["draft"]["judgments"].append(second)
|
|
724
|
+
conflicting = _finalize(conflict_case)
|
|
725
|
+
assert _result(conflicting)["advisory_coverage_status"] == "CONFLICTING"
|
|
726
|
+
assert _result(conflicting)["reason_codes"] == [
|
|
727
|
+
"CONFLICTING_COVERAGE_OBSERVATIONS"
|
|
728
|
+
]
|
|
729
|
+
assert len(_result(conflicting)["expectation_findings"][0]["evidence_rows"]) == 2
|
|
730
|
+
|
|
731
|
+
partial_case = _case()
|
|
732
|
+
_not_checked(partial_case["draft"]["judgments"][2], "not_checked")
|
|
733
|
+
partial = _finalize(partial_case)
|
|
734
|
+
assert _result(partial)["coverage_check_state"] == "not_checked"
|
|
735
|
+
assert _result(partial)["advisory_coverage_status"] is None
|
|
736
|
+
assert "COVERAGE_CHECK_NOT_PERFORMED" in _result(partial)["reason_codes"]
|
|
737
|
+
|
|
738
|
+
|
|
739
|
+
@pytest.mark.parametrize("performed_status", ["DOCUMENTED", "NOT_LOCATED", "CONFLICTING"])
|
|
740
|
+
def test_partial_requirement_root_reports_only_unperformed_reasons(
|
|
741
|
+
performed_status: str,
|
|
742
|
+
) -> None:
|
|
743
|
+
case = _case()
|
|
744
|
+
first = case["draft"]["judgments"][0]
|
|
745
|
+
if performed_status == "NOT_LOCATED":
|
|
746
|
+
_not_located(first)
|
|
747
|
+
elif performed_status == "CONFLICTING":
|
|
748
|
+
first["advisory_coverage_status"] = "CONFLICTING"
|
|
749
|
+
second = copy.deepcopy(first)
|
|
750
|
+
second["quoted_anchor_encoded"] = _quote("Participation is voluntary.")
|
|
751
|
+
second["document_locator"]["value"] = "Consent — second passage"
|
|
752
|
+
case["draft"]["judgments"].append(second)
|
|
753
|
+
_not_checked(case["draft"]["judgments"][2], "not_checked")
|
|
754
|
+
|
|
755
|
+
result = _result(_finalize(case))
|
|
756
|
+
assert result["coverage_check_state"] == "not_checked"
|
|
757
|
+
assert result["advisory_coverage_status"] is None
|
|
758
|
+
assert result["reason_codes"] == ["COVERAGE_CHECK_NOT_PERFORMED"]
|
|
759
|
+
assert set(result["reason_codes"]).isdisjoint(
|
|
760
|
+
{
|
|
761
|
+
"ALL_EXPECTATIONS_APPEAR_COVERED",
|
|
762
|
+
"EXPECTATION_NOT_LOCATED",
|
|
763
|
+
"CONFLICTING_COVERAGE_OBSERVATIONS",
|
|
764
|
+
}
|
|
765
|
+
)
|
|
766
|
+
assert any(
|
|
767
|
+
finding["advisory_coverage_status"] == performed_status
|
|
768
|
+
for finding in result["expectation_findings"]
|
|
769
|
+
)
|
|
770
|
+
|
|
771
|
+
|
|
772
|
+
@pytest.mark.parametrize("mutation", ["single", "exact_duplicate"])
|
|
773
|
+
def test_conflicting_requires_two_distinct_replayed_passages(mutation: str) -> None:
|
|
774
|
+
case = _case()
|
|
775
|
+
row = case["draft"]["judgments"][0]
|
|
776
|
+
row["advisory_coverage_status"] = "CONFLICTING"
|
|
777
|
+
if mutation == "exact_duplicate":
|
|
778
|
+
case["draft"]["judgments"].append(copy.deepcopy(row))
|
|
779
|
+
with pytest.raises(ContentCoverageAdvisoryError):
|
|
780
|
+
_finalize(case)
|
|
781
|
+
|
|
782
|
+
|
|
783
|
+
def test_conflicting_cannot_launder_one_passage_through_percent_encoding() -> None:
|
|
784
|
+
case = _case()
|
|
785
|
+
first = case["draft"]["judgments"][0]
|
|
786
|
+
first["advisory_coverage_status"] = "CONFLICTING"
|
|
787
|
+
second = copy.deepcopy(first)
|
|
788
|
+
decoded = urllib.parse.unquote(first["quoted_anchor_encoded"])
|
|
789
|
+
assert decoded and first["quoted_anchor_encoded"].startswith(decoded[0])
|
|
790
|
+
second["quoted_anchor_encoded"] = (
|
|
791
|
+
f"%{ord(decoded[0]):02X}" + second["quoted_anchor_encoded"][1:]
|
|
792
|
+
)
|
|
793
|
+
assert urllib.parse.unquote(second["quoted_anchor_encoded"]) == (
|
|
794
|
+
urllib.parse.unquote(first["quoted_anchor_encoded"])
|
|
795
|
+
)
|
|
796
|
+
case["draft"]["judgments"].append(second)
|
|
797
|
+
with pytest.raises(ContentCoverageAdvisoryError, match="distinct replayed"):
|
|
798
|
+
_finalize(case)
|
|
799
|
+
|
|
800
|
+
|
|
801
|
+
@pytest.mark.parametrize(
|
|
802
|
+
("failure_state", "reason"),
|
|
803
|
+
[
|
|
804
|
+
("not_checked", "COVERAGE_CHECK_NOT_PERFORMED"),
|
|
805
|
+
("source_missing", "SESSION_CONTENT_NOT_PROVIDED"),
|
|
806
|
+
("access_failed", "SOURCE_ACCESS_FAILED"),
|
|
807
|
+
("retrieval_failed", "SOURCE_RETRIEVAL_FAILED"),
|
|
808
|
+
],
|
|
809
|
+
)
|
|
810
|
+
def test_missing_or_unavailable_content_is_not_checked_with_null_status(
|
|
811
|
+
failure_state: str, reason: str
|
|
812
|
+
) -> None:
|
|
813
|
+
case = _case(sources={})
|
|
814
|
+
for judgment in case["draft"]["judgments"]:
|
|
815
|
+
_not_checked(judgment, failure_state)
|
|
816
|
+
advisory = _finalize(case)
|
|
817
|
+
result = _result(advisory)
|
|
818
|
+
assert result["coverage_check_state"] == "not_checked"
|
|
819
|
+
assert result["advisory_coverage_status"] is None
|
|
820
|
+
assert result["reason_codes"] == [reason]
|
|
821
|
+
for finding in result["expectation_findings"]:
|
|
822
|
+
assert finding["coverage_check_state"] == "not_checked"
|
|
823
|
+
assert finding["advisory_coverage_status"] is None
|
|
824
|
+
assert finding["reason_codes"] == [reason]
|
|
825
|
+
row = finding["evidence_rows"][0]
|
|
826
|
+
assert row["excerpt"]["state"] == failure_state
|
|
827
|
+
assert row["source"]["source_content_sha256"] is None
|
|
828
|
+
assert row["source"]["source_content_utf8_bytes"] is None
|
|
829
|
+
assert row["excerpt"]["text"] is None
|
|
830
|
+
|
|
831
|
+
|
|
832
|
+
def test_explicit_failure_cannot_hide_content_that_was_supplied() -> None:
|
|
833
|
+
for failure in ("source_missing", "access_failed", "retrieval_failed"):
|
|
834
|
+
case = _case()
|
|
835
|
+
for judgment in case["draft"]["judgments"]:
|
|
836
|
+
_not_checked(judgment, failure)
|
|
837
|
+
with pytest.raises(ContentCoverageAdvisoryError, match="contradicts"):
|
|
838
|
+
_finalize(case)
|
|
839
|
+
|
|
840
|
+
|
|
841
|
+
def test_external_only_requirement_is_acceptance_unverified_not_missing() -> None:
|
|
842
|
+
inventory = _inventory()
|
|
843
|
+
inventory["packet_responsibility_role_ids"] = ["investigator"]
|
|
844
|
+
case = _case(inventory=inventory, draft={
|
|
845
|
+
"schema_version": "content-coverage-advisory-draft/1.0",
|
|
846
|
+
"layer": "LLM-ADVISORY",
|
|
847
|
+
"judgments": [],
|
|
848
|
+
}, sources={})
|
|
849
|
+
advisory = _finalize(case)
|
|
850
|
+
result = _result(advisory)
|
|
851
|
+
assert result["coverage_check_state"] == "not_checked"
|
|
852
|
+
assert result["advisory_coverage_status"] == "ACCEPTANCE_UNVERIFIED"
|
|
853
|
+
assert result["reason_codes"] == [
|
|
854
|
+
"EXTERNAL_DEPENDENCY",
|
|
855
|
+
"INSTITUTIONAL_ACCEPTANCE_REQUIRED",
|
|
856
|
+
]
|
|
857
|
+
assert result["expectation_findings"] == []
|
|
858
|
+
assert "EXPECTATION_NOT_LOCATED" not in result["reason_codes"]
|
|
859
|
+
|
|
860
|
+
|
|
861
|
+
def test_profiled_waiver_route_stays_acceptance_boundary_without_false_gap() -> None:
|
|
862
|
+
context, registry, _resolved, _overlay = _synthetic_overlay_authority()
|
|
863
|
+
draft, sources = _synthetic_live_draft_and_sources()
|
|
864
|
+
case = _case(
|
|
865
|
+
inventory=_waiver_inventory(),
|
|
866
|
+
packet_root=SYNTHETIC_PACKET_ROOT,
|
|
867
|
+
context=context,
|
|
868
|
+
registry=registry,
|
|
869
|
+
draft=draft,
|
|
870
|
+
sources=sources,
|
|
871
|
+
)
|
|
872
|
+
result = _result(_finalize(case), "synthetic.packet.base-consent")
|
|
873
|
+
assert result["coverage_check_state"] == "not_checked"
|
|
874
|
+
assert result["advisory_coverage_status"] == "ACCEPTANCE_UNVERIFIED"
|
|
875
|
+
assert result["reason_codes"] == [
|
|
876
|
+
"WAIVER_OR_EXCEPTION_BOUNDARY",
|
|
877
|
+
"INSTITUTIONAL_ACCEPTANCE_REQUIRED",
|
|
878
|
+
]
|
|
879
|
+
assert result["expectation_findings"] == []
|
|
880
|
+
assert result["deterministic_entry_refs"][0]["deterministic_status"] == (
|
|
881
|
+
"ACCEPTANCE_UNVERIFIED"
|
|
882
|
+
)
|
|
883
|
+
assert result["deterministic_entry_refs"][0]["matched_artifact_ids"] == []
|
|
884
|
+
assert "EXPECTATION_NOT_LOCATED" not in result["reason_codes"]
|
|
885
|
+
assert "DETERMINISTIC_PACKET_GAP" not in result["reason_codes"]
|
|
886
|
+
|
|
887
|
+
targeted = copy.deepcopy(case)
|
|
888
|
+
extra = copy.deepcopy(targeted["draft"]["judgments"][0])
|
|
889
|
+
extra["requirement_id"] = "synthetic.packet.base-consent"
|
|
890
|
+
extra["expectation_pointer"] = (
|
|
891
|
+
result["requirement_ref"]["requirement_pointer"]
|
|
892
|
+
+ "/structured_expectations/0"
|
|
893
|
+
)
|
|
894
|
+
targeted["draft"]["judgments"].append(extra)
|
|
895
|
+
with pytest.raises(ContentCoverageAdvisoryError, match="targets ineligible"):
|
|
896
|
+
_finalize(targeted)
|
|
897
|
+
|
|
898
|
+
|
|
899
|
+
@pytest.mark.parametrize(
|
|
900
|
+
"route_state", ["external_authority_required", "not_profiled_in_bounded_profile"]
|
|
901
|
+
)
|
|
902
|
+
def test_unprofiled_or_external_waiver_route_preserves_deterministic_gap(
|
|
903
|
+
route_state: str,
|
|
904
|
+
) -> None:
|
|
905
|
+
context, registry, _resolved, overlay = _synthetic_overlay_authority()
|
|
906
|
+
base = next(
|
|
907
|
+
row
|
|
908
|
+
for row in overlay["requirements"]
|
|
909
|
+
if row["requirement_id"] == "synthetic.packet.base-consent"
|
|
910
|
+
)
|
|
911
|
+
base["waiver_or_exception_route"] = {
|
|
912
|
+
"state": route_state,
|
|
913
|
+
"requirement_ids": [],
|
|
914
|
+
"decision_maker_role": (
|
|
915
|
+
"institutional_review_office"
|
|
916
|
+
if route_state == "external_authority_required"
|
|
917
|
+
else None
|
|
918
|
+
),
|
|
919
|
+
}
|
|
920
|
+
_repin_overlay(context, overlay)
|
|
921
|
+
draft, sources = _synthetic_live_draft_and_sources()
|
|
922
|
+
case = _case(
|
|
923
|
+
inventory=_waiver_inventory(),
|
|
924
|
+
packet_root=SYNTHETIC_PACKET_ROOT,
|
|
925
|
+
context=context,
|
|
926
|
+
registry=registry,
|
|
927
|
+
draft=draft,
|
|
928
|
+
sources=sources,
|
|
929
|
+
)
|
|
930
|
+
result = _result(_finalize(case), "synthetic.packet.base-consent")
|
|
931
|
+
assert result["coverage_check_state"] == "not_checked"
|
|
932
|
+
assert result["advisory_coverage_status"] is None
|
|
933
|
+
assert result["reason_codes"] == ["DETERMINISTIC_PACKET_GAP"]
|
|
934
|
+
assert result["expectation_findings"] == []
|
|
935
|
+
|
|
936
|
+
|
|
937
|
+
def test_deterministic_packet_gap_or_conflict_never_becomes_content_not_located() -> None:
|
|
938
|
+
gap_inventory = _inventory()
|
|
939
|
+
gap_inventory["artifacts"][0]["evidence_bindings"] = []
|
|
940
|
+
empty_draft = {
|
|
941
|
+
"schema_version": "content-coverage-advisory-draft/1.0",
|
|
942
|
+
"layer": "LLM-ADVISORY",
|
|
943
|
+
"judgments": [],
|
|
944
|
+
}
|
|
945
|
+
gap = _finalize(_case(inventory=gap_inventory, draft=empty_draft, sources={}))
|
|
946
|
+
assert _result(gap)["advisory_coverage_status"] is None
|
|
947
|
+
assert _result(gap)["reason_codes"] == ["DETERMINISTIC_PACKET_GAP"]
|
|
948
|
+
|
|
949
|
+
conflict_inventory = _inventory()
|
|
950
|
+
conflict_inventory["artifacts"][0]["declared_sha256"] = "0" * 64
|
|
951
|
+
conflict = _finalize(
|
|
952
|
+
_case(inventory=conflict_inventory, draft=empty_draft, sources={})
|
|
953
|
+
)
|
|
954
|
+
assert _result(conflict)["advisory_coverage_status"] is None
|
|
955
|
+
assert _result(conflict)["reason_codes"] == [
|
|
956
|
+
"DETERMINISTIC_PACKET_CONFLICT"
|
|
957
|
+
]
|
|
958
|
+
|
|
959
|
+
|
|
960
|
+
def test_not_located_requires_checked_no_match_for_every_eligible_artifact(
|
|
961
|
+
tmp_path: Path,
|
|
962
|
+
) -> None:
|
|
963
|
+
context = _context()
|
|
964
|
+
registry = _registry()
|
|
965
|
+
profile = _us_profile(registry)
|
|
966
|
+
requirement = _us_requirement(registry)
|
|
967
|
+
second_evidence = copy.deepcopy(requirement["evidence_expected"][0])
|
|
968
|
+
second_evidence["evidence_id"] = "consent.participant-materials-second"
|
|
969
|
+
requirement["evidence_expected"].append(second_evidence)
|
|
970
|
+
_repin_profile(context, profile)
|
|
971
|
+
|
|
972
|
+
packet = _packet_copy(tmp_path)
|
|
973
|
+
(packet / "consent-second.txt").write_text(SOURCE_TEXT, encoding="utf-8")
|
|
974
|
+
inventory = _inventory()
|
|
975
|
+
second_artifact = copy.deepcopy(inventory["artifacts"][0])
|
|
976
|
+
second_artifact["artifact_id"] = "fixture.us-consent-second"
|
|
977
|
+
second_artifact["relative_path"] = "consent-second.txt"
|
|
978
|
+
second_artifact["evidence_bindings"] = [
|
|
979
|
+
{
|
|
980
|
+
"requirement_id": REQUIREMENT_ID,
|
|
981
|
+
"evidence_id": "consent.participant-materials-second",
|
|
982
|
+
}
|
|
983
|
+
]
|
|
984
|
+
inventory["artifacts"].append(second_artifact)
|
|
985
|
+
draft = _draft()
|
|
986
|
+
for judgment in list(draft["judgments"]):
|
|
987
|
+
_not_located(judgment)
|
|
988
|
+
duplicate = copy.deepcopy(judgment)
|
|
989
|
+
duplicate["artifact_id"] = "fixture.us-consent-second"
|
|
990
|
+
draft["judgments"].append(duplicate)
|
|
991
|
+
sources = {
|
|
992
|
+
"fixture.us-consent": SOURCE_TEXT,
|
|
993
|
+
"fixture.us-consent-second": SOURCE_TEXT,
|
|
994
|
+
}
|
|
995
|
+
complete_case = _case(
|
|
996
|
+
inventory=inventory,
|
|
997
|
+
packet_root=packet,
|
|
998
|
+
context=context,
|
|
999
|
+
registry=registry,
|
|
1000
|
+
draft=draft,
|
|
1001
|
+
sources=sources,
|
|
1002
|
+
)
|
|
1003
|
+
result = _result(_finalize(complete_case))
|
|
1004
|
+
assert result["coverage_check_state"] == "performed"
|
|
1005
|
+
assert result["advisory_coverage_status"] == "NOT_LOCATED"
|
|
1006
|
+
assert result["reason_codes"] == ["EXPECTATION_NOT_LOCATED"]
|
|
1007
|
+
assert all(
|
|
1008
|
+
{row["source"]["artifact_id"] for row in finding["evidence_rows"]}
|
|
1009
|
+
== {"fixture.us-consent", "fixture.us-consent-second"}
|
|
1010
|
+
for finding in result["expectation_findings"]
|
|
1011
|
+
)
|
|
1012
|
+
|
|
1013
|
+
partial = copy.deepcopy(complete_case)
|
|
1014
|
+
partial["draft"]["judgments"].pop()
|
|
1015
|
+
with pytest.raises(ContentCoverageAdvisoryError, match="every eligible artifact"):
|
|
1016
|
+
_finalize(partial)
|
|
1017
|
+
|
|
1018
|
+
|
|
1019
|
+
def test_conditional_false_is_copied_only_as_excluded_and_renderer_is_neutral() -> None:
|
|
1020
|
+
context = _context()
|
|
1021
|
+
registry = _registry()
|
|
1022
|
+
profile = _us_profile(registry)
|
|
1023
|
+
requirement = _us_requirement(registry)
|
|
1024
|
+
requirement["applies_if"] = {
|
|
1025
|
+
"op": "fact_equals",
|
|
1026
|
+
"fact_id": "packet_v1.non_clinical",
|
|
1027
|
+
"value": False,
|
|
1028
|
+
}
|
|
1029
|
+
_repin_profile(context, profile)
|
|
1030
|
+
empty_draft = {
|
|
1031
|
+
"schema_version": "content-coverage-advisory-draft/1.0",
|
|
1032
|
+
"layer": "LLM-ADVISORY",
|
|
1033
|
+
"judgments": [],
|
|
1034
|
+
}
|
|
1035
|
+
case = _case(context=context, registry=registry, draft=empty_draft, sources={})
|
|
1036
|
+
advisory = _finalize(case)
|
|
1037
|
+
assert advisory["requirement_results"] == []
|
|
1038
|
+
assert len(advisory["excluded_requirements"]) == 1
|
|
1039
|
+
excluded = advisory["excluded_requirements"][0]
|
|
1040
|
+
assert excluded["requirement_ref"]["requirement_id"] == REQUIREMENT_ID
|
|
1041
|
+
assert excluded["requirement_ref"]["requirement_pointer"] == REQUIREMENT_POINTER
|
|
1042
|
+
assert excluded["exclusion_basis"] == "resolved_predicate_false"
|
|
1043
|
+
rendered = _render(advisory, case)
|
|
1044
|
+
assert "APPLICABILITY_UNRESOLVED" not in rendered
|
|
1045
|
+
assert coverage_runtime._md(REQUIREMENT_ID) in rendered
|
|
1046
|
+
assert coverage_runtime._md(REQUIREMENT_POINTER) in rendered
|
|
1047
|
+
assert r"resolved\_predicate\_false" not in rendered # renderer uses entities
|
|
1048
|
+
assert "resolved_predicate_false" in rendered
|
|
1049
|
+
assert "no applicable advisory requirement results" in rendered
|
|
1050
|
+
|
|
1051
|
+
|
|
1052
|
+
def test_unprovided_overlay_marks_each_base_requirement_applicability_unresolved() -> None:
|
|
1053
|
+
context = _context()
|
|
1054
|
+
context["overlay_selection_state"]["institutional"] = "not_provided"
|
|
1055
|
+
empty_draft = {
|
|
1056
|
+
"schema_version": "content-coverage-advisory-draft/1.0",
|
|
1057
|
+
"layer": "LLM-ADVISORY",
|
|
1058
|
+
"judgments": [],
|
|
1059
|
+
}
|
|
1060
|
+
case = _case(context=context, draft=empty_draft, sources={})
|
|
1061
|
+
assert case["manifest"]["entries"]
|
|
1062
|
+
assert case["manifest"]["unresolved_reasons"] == [
|
|
1063
|
+
{
|
|
1064
|
+
"status": "APPLICABILITY_UNRESOLVED",
|
|
1065
|
+
"code": "OVERLAY_SELECTION_NOT_PROVIDED",
|
|
1066
|
+
"fact_id": None,
|
|
1067
|
+
"overlay_kind": "institutional",
|
|
1068
|
+
}
|
|
1069
|
+
]
|
|
1070
|
+
|
|
1071
|
+
class BombMapping(Mapping[str, str]):
|
|
1072
|
+
def __getitem__(self, key: str) -> str:
|
|
1073
|
+
raise AssertionError("overlay-unresolved flow consumed session content")
|
|
1074
|
+
|
|
1075
|
+
def __iter__(self):
|
|
1076
|
+
raise AssertionError("overlay-unresolved flow consumed session content")
|
|
1077
|
+
|
|
1078
|
+
def __len__(self) -> int:
|
|
1079
|
+
raise AssertionError("overlay-unresolved flow consumed session content")
|
|
1080
|
+
|
|
1081
|
+
case["sources"] = BombMapping()
|
|
1082
|
+
advisory = _finalize(case)
|
|
1083
|
+
result = _result(advisory)
|
|
1084
|
+
assert result["coverage_check_state"] == "not_checked"
|
|
1085
|
+
assert result["advisory_coverage_status"] == "APPLICABILITY_UNRESOLVED"
|
|
1086
|
+
assert result["reason_codes"] == ["APPLICABILITY_UNRESOLVED"]
|
|
1087
|
+
assert result["expectation_findings"] == []
|
|
1088
|
+
assert "SESSION_CONTENT_NOT_PROVIDED" not in result["reason_codes"]
|
|
1089
|
+
assert "ALL_EXPECTATIONS_APPEAR_COVERED" not in result["reason_codes"]
|
|
1090
|
+
|
|
1091
|
+
targeted = copy.deepcopy(case)
|
|
1092
|
+
targeted["draft"] = _draft()
|
|
1093
|
+
targeted["sources"] = {}
|
|
1094
|
+
with pytest.raises(ContentCoverageAdvisoryError, match="targets ineligible"):
|
|
1095
|
+
_finalize(targeted)
|
|
1096
|
+
|
|
1097
|
+
|
|
1098
|
+
def test_closed_capability_gate_fails_before_draft_or_content_consumption() -> None:
|
|
1099
|
+
context = _context()
|
|
1100
|
+
context["declared_facts"] = [
|
|
1101
|
+
row
|
|
1102
|
+
for row in context["declared_facts"]
|
|
1103
|
+
if row["fact_id"] != "packet_v1.non_clinical"
|
|
1104
|
+
]
|
|
1105
|
+
case = _case(context=context, draft={}, sources={})
|
|
1106
|
+
assert case["manifest"]["capability_envelope"]["state"] == "unresolved"
|
|
1107
|
+
assert case["manifest"]["entries"] == []
|
|
1108
|
+
|
|
1109
|
+
class BombMapping(Mapping[str, str]):
|
|
1110
|
+
def __getitem__(self, key: str) -> str:
|
|
1111
|
+
raise AssertionError("closed gate consumed session content")
|
|
1112
|
+
|
|
1113
|
+
def __iter__(self):
|
|
1114
|
+
raise AssertionError("closed gate consumed session content")
|
|
1115
|
+
|
|
1116
|
+
def __len__(self) -> int:
|
|
1117
|
+
raise AssertionError("closed gate consumed session content")
|
|
1118
|
+
|
|
1119
|
+
case["draft"] = {"explode_if_consumed": object()}
|
|
1120
|
+
case["sources"] = BombMapping()
|
|
1121
|
+
with pytest.raises(
|
|
1122
|
+
ContentCoverageAdvisoryError, match="manifest.capability_envelope"
|
|
1123
|
+
):
|
|
1124
|
+
_finalize(case)
|
|
1125
|
+
|
|
1126
|
+
|
|
1127
|
+
def test_no_profiled_expectations_is_not_checked_never_covered() -> None:
|
|
1128
|
+
context = _context()
|
|
1129
|
+
registry = _registry()
|
|
1130
|
+
profile = _us_profile(registry)
|
|
1131
|
+
_us_requirement(registry)["structured_expectations"] = []
|
|
1132
|
+
_repin_profile(context, profile)
|
|
1133
|
+
empty_draft = {
|
|
1134
|
+
"schema_version": "content-coverage-advisory-draft/1.0",
|
|
1135
|
+
"layer": "LLM-ADVISORY",
|
|
1136
|
+
"judgments": [],
|
|
1137
|
+
}
|
|
1138
|
+
advisory = _finalize(
|
|
1139
|
+
_case(context=context, registry=registry, draft=empty_draft)
|
|
1140
|
+
)
|
|
1141
|
+
result = _result(advisory)
|
|
1142
|
+
assert result["coverage_check_state"] == "not_checked"
|
|
1143
|
+
assert result["advisory_coverage_status"] is None
|
|
1144
|
+
assert result["reason_codes"] == ["NO_PROFILED_STRUCTURED_EXPECTATIONS"]
|
|
1145
|
+
assert result["expectation_findings"] == []
|
|
1146
|
+
|
|
1147
|
+
|
|
1148
|
+
def test_resolved_empty_surface_renders_neutral_none_without_applicability_claim() -> None:
|
|
1149
|
+
context = _context()
|
|
1150
|
+
registry = _registry()
|
|
1151
|
+
profile = _us_profile(registry)
|
|
1152
|
+
requirement = _us_requirement(registry)
|
|
1153
|
+
requirement["consumer_scopes"] = [
|
|
1154
|
+
scope for scope in requirement["consumer_scopes"] if scope != "submission_packet"
|
|
1155
|
+
]
|
|
1156
|
+
_repin_profile(context, profile)
|
|
1157
|
+
empty_draft = {
|
|
1158
|
+
"schema_version": "content-coverage-advisory-draft/1.0",
|
|
1159
|
+
"layer": "LLM-ADVISORY",
|
|
1160
|
+
"judgments": [],
|
|
1161
|
+
}
|
|
1162
|
+
case = _case(context=context, registry=registry, draft=empty_draft, sources={})
|
|
1163
|
+
advisory = _finalize(case)
|
|
1164
|
+
assert advisory["requirement_results"] == []
|
|
1165
|
+
assert advisory["excluded_requirements"] == []
|
|
1166
|
+
rendered = _render(advisory, case)
|
|
1167
|
+
assert "no applicable advisory requirement results" in rendered
|
|
1168
|
+
assert "APPLICABILITY_UNRESOLVED" not in rendered
|
|
1169
|
+
assert "EXPECTATION_NOT_LOCATED" not in rendered
|
|
1170
|
+
|
|
1171
|
+
|
|
1172
|
+
def test_confirmed_at_reconfirmation_does_not_change_advisory_timestamp_or_digest() -> None:
|
|
1173
|
+
baseline_case = _case()
|
|
1174
|
+
baseline = _finalize(baseline_case)
|
|
1175
|
+
context = copy.deepcopy(baseline_case["context"])
|
|
1176
|
+
context["confirmed_at"] = "2026-08-09T15:45:00+08:00"
|
|
1177
|
+
replay_case = _case(context=context)
|
|
1178
|
+
after = _finalize(replay_case)
|
|
1179
|
+
assert after == baseline
|
|
1180
|
+
timestamps = {
|
|
1181
|
+
row["excerpt"]["captured_at"]
|
|
1182
|
+
for result in after["requirement_results"]
|
|
1183
|
+
for finding in result["expectation_findings"]
|
|
1184
|
+
for row in finding["evidence_rows"]
|
|
1185
|
+
}
|
|
1186
|
+
assert timestamps == {CAPTURED_AT}
|
|
1187
|
+
|
|
1188
|
+
|
|
1189
|
+
def test_draft_judgment_and_json_key_order_do_not_change_bytes() -> None:
|
|
1190
|
+
case = _case()
|
|
1191
|
+
baseline = _finalize(case)
|
|
1192
|
+
reordered = copy.deepcopy(case)
|
|
1193
|
+
reordered["draft"] = json.loads(
|
|
1194
|
+
json.dumps(reordered["draft"], ensure_ascii=False, sort_keys=True)
|
|
1195
|
+
)
|
|
1196
|
+
reordered["draft"]["judgments"].reverse()
|
|
1197
|
+
assert _finalize(reordered) == baseline
|
|
1198
|
+
|
|
1199
|
+
|
|
1200
|
+
def test_same_artifact_conflict_observation_permutation_is_byte_identical() -> None:
|
|
1201
|
+
case = _case()
|
|
1202
|
+
first = case["draft"]["judgments"][0]
|
|
1203
|
+
first["advisory_coverage_status"] = "CONFLICTING"
|
|
1204
|
+
second = copy.deepcopy(first)
|
|
1205
|
+
second["quoted_anchor_encoded"] = _quote("Participation is voluntary.")
|
|
1206
|
+
second["document_locator"]["value"] = "Consent — second passage"
|
|
1207
|
+
case["draft"]["judgments"].append(second)
|
|
1208
|
+
baseline = _finalize(case)
|
|
1209
|
+
|
|
1210
|
+
permuted = copy.deepcopy(case)
|
|
1211
|
+
permuted["draft"] = {
|
|
1212
|
+
key: permuted["draft"][key]
|
|
1213
|
+
for key in reversed(tuple(permuted["draft"]))
|
|
1214
|
+
}
|
|
1215
|
+
permuted["draft"]["judgments"] = [
|
|
1216
|
+
{key: row[key] for key in reversed(tuple(row))}
|
|
1217
|
+
for row in reversed(permuted["draft"]["judgments"])
|
|
1218
|
+
]
|
|
1219
|
+
after = _finalize(permuted)
|
|
1220
|
+
assert after == baseline
|
|
1221
|
+
assert _canonical_bytes(after) == _canonical_bytes(baseline)
|
|
1222
|
+
|
|
1223
|
+
|
|
1224
|
+
def test_manifest_replay_failure_happens_before_draft_or_content_consumption() -> None:
|
|
1225
|
+
case = _case()
|
|
1226
|
+
case["manifest"]["entries"][0]["matched_artifact_ids"] = []
|
|
1227
|
+
_repin_report(case["manifest"])
|
|
1228
|
+
|
|
1229
|
+
class BombMapping(Mapping[str, str]):
|
|
1230
|
+
def __getitem__(self, key: str) -> str:
|
|
1231
|
+
raise AssertionError("content consumed before replay")
|
|
1232
|
+
|
|
1233
|
+
def __iter__(self):
|
|
1234
|
+
raise AssertionError("content consumed before replay")
|
|
1235
|
+
|
|
1236
|
+
def __len__(self) -> int:
|
|
1237
|
+
raise AssertionError("content consumed before replay")
|
|
1238
|
+
|
|
1239
|
+
case["draft"] = {"explode_if_consumed": object()}
|
|
1240
|
+
case["sources"] = BombMapping()
|
|
1241
|
+
with pytest.raises(ContentCoverageAdvisoryError, match="manifest replay"):
|
|
1242
|
+
_finalize(case)
|
|
1243
|
+
|
|
1244
|
+
|
|
1245
|
+
@pytest.mark.parametrize(
|
|
1246
|
+
"mutation",
|
|
1247
|
+
[
|
|
1248
|
+
"layer",
|
|
1249
|
+
"evaluation",
|
|
1250
|
+
"input_digest",
|
|
1251
|
+
"deterministic_readiness",
|
|
1252
|
+
"entry_status",
|
|
1253
|
+
"requirement_pointer",
|
|
1254
|
+
"expectation_digest",
|
|
1255
|
+
"evidence_span",
|
|
1256
|
+
"boundary",
|
|
1257
|
+
],
|
|
1258
|
+
)
|
|
1259
|
+
def test_resigned_final_advisory_mutations_fail_exact_replay(mutation: str) -> None:
|
|
1260
|
+
case = _case()
|
|
1261
|
+
advisory = _finalize(case)
|
|
1262
|
+
result = _result(advisory)
|
|
1263
|
+
if mutation == "layer":
|
|
1264
|
+
advisory["layer"] = "MODEL-ADVISORY"
|
|
1265
|
+
elif mutation == "evaluation":
|
|
1266
|
+
advisory["evaluation_status"] = "MEASURED"
|
|
1267
|
+
elif mutation == "input_digest":
|
|
1268
|
+
advisory["input_binding"]["manifest_digest"] = "0" * 64
|
|
1269
|
+
elif mutation == "deterministic_readiness":
|
|
1270
|
+
advisory["deterministic_status"]["submission_readiness"] = "gaps_located"
|
|
1271
|
+
elif mutation == "entry_status":
|
|
1272
|
+
result["deterministic_entry_refs"][0]["deterministic_status"] = "NOT_LOCATED"
|
|
1273
|
+
elif mutation == "requirement_pointer":
|
|
1274
|
+
result["requirement_ref"]["requirement_pointer"] = "/profiles/0/requirements/0"
|
|
1275
|
+
elif mutation == "expectation_digest":
|
|
1276
|
+
result["expectation_findings"][0]["expectation_ref"]["expectation_digest"] = "0" * 64
|
|
1277
|
+
elif mutation == "evidence_span":
|
|
1278
|
+
evidence = result["expectation_findings"][0]["evidence_rows"][0]
|
|
1279
|
+
evidence["excerpt"]["source_span_utf8"]["start"] += 1
|
|
1280
|
+
evidence["row_sha256"] = digest(
|
|
1281
|
+
{key: value for key, value in evidence.items() if key != "row_sha256"}
|
|
1282
|
+
)
|
|
1283
|
+
else:
|
|
1284
|
+
advisory["boundary"]["authorization_status_unchanged"] = False
|
|
1285
|
+
_repin_report(advisory)
|
|
1286
|
+
with pytest.raises(ContentCoverageAdvisoryError):
|
|
1287
|
+
_validate(advisory, case)
|
|
1288
|
+
|
|
1289
|
+
|
|
1290
|
+
def test_unknown_session_source_is_rejected_without_ambient_lookup() -> None:
|
|
1291
|
+
case = _case()
|
|
1292
|
+
case["sources"]["unknown.artifact"] = "sentinel"
|
|
1293
|
+
with pytest.raises(ContentCoverageAdvisoryError, match="unknown artifact"):
|
|
1294
|
+
_finalize(case)
|
|
1295
|
+
|
|
1296
|
+
|
|
1297
|
+
@pytest.mark.parametrize("mutation", ["lying_length", "duplicate_items"])
|
|
1298
|
+
def test_adversarial_session_mapping_cannot_bypass_bounds_or_overwrite(
|
|
1299
|
+
mutation: str,
|
|
1300
|
+
) -> None:
|
|
1301
|
+
case = _case()
|
|
1302
|
+
if mutation == "lying_length":
|
|
1303
|
+
pairs = [(f"synthetic.artifact-{index}", "x") for index in range(513)]
|
|
1304
|
+
expected = "exceeds 512"
|
|
1305
|
+
else:
|
|
1306
|
+
pairs = [
|
|
1307
|
+
("fixture.us-consent", SOURCE_TEXT),
|
|
1308
|
+
("fixture.us-consent", "attacker overwrite"),
|
|
1309
|
+
]
|
|
1310
|
+
expected = "duplicate"
|
|
1311
|
+
|
|
1312
|
+
class AdversarialMapping(Mapping[str, str]):
|
|
1313
|
+
def __getitem__(self, key: str) -> str:
|
|
1314
|
+
for candidate, value in pairs:
|
|
1315
|
+
if candidate == key:
|
|
1316
|
+
return value
|
|
1317
|
+
raise KeyError(key)
|
|
1318
|
+
|
|
1319
|
+
def __iter__(self):
|
|
1320
|
+
return iter(())
|
|
1321
|
+
|
|
1322
|
+
def __len__(self) -> int:
|
|
1323
|
+
return 0
|
|
1324
|
+
|
|
1325
|
+
def items(self):
|
|
1326
|
+
return iter(pairs)
|
|
1327
|
+
|
|
1328
|
+
case["sources"] = AdversarialMapping()
|
|
1329
|
+
with pytest.raises(ContentCoverageAdvisoryError, match=expected):
|
|
1330
|
+
_finalize(case)
|
|
1331
|
+
|
|
1332
|
+
|
|
1333
|
+
def test_runtime_has_no_model_network_process_or_ambient_scan() -> None:
|
|
1334
|
+
tree = ast.parse(RUNTIME_PATH.read_text(encoding="utf-8"))
|
|
1335
|
+
forbidden_imports = {"anthropic", "http", "openai", "requests", "socket", "subprocess"}
|
|
1336
|
+
forbidden_calls = {
|
|
1337
|
+
"fwalk",
|
|
1338
|
+
"glob",
|
|
1339
|
+
"iglob",
|
|
1340
|
+
"iterdir",
|
|
1341
|
+
"listdir",
|
|
1342
|
+
"rglob",
|
|
1343
|
+
"scandir",
|
|
1344
|
+
"walk",
|
|
1345
|
+
}
|
|
1346
|
+
for node in ast.walk(tree):
|
|
1347
|
+
if isinstance(node, ast.Import):
|
|
1348
|
+
assert all(alias.name.split(".", 1)[0] not in forbidden_imports for alias in node.names)
|
|
1349
|
+
elif isinstance(node, ast.ImportFrom) and node.module:
|
|
1350
|
+
assert node.module.split(".", 1)[0] not in forbidden_imports
|
|
1351
|
+
assert not node.module.startswith("urllib.request")
|
|
1352
|
+
elif isinstance(node, ast.Call):
|
|
1353
|
+
name = (
|
|
1354
|
+
node.func.attr
|
|
1355
|
+
if isinstance(node.func, ast.Attribute)
|
|
1356
|
+
else node.func.id
|
|
1357
|
+
if isinstance(node.func, ast.Name)
|
|
1358
|
+
else None
|
|
1359
|
+
)
|
|
1360
|
+
assert name not in forbidden_calls
|
|
1361
|
+
|
|
1362
|
+
|
|
1363
|
+
def test_in_process_finalize_and_render_never_open_a_socket(
|
|
1364
|
+
monkeypatch: pytest.MonkeyPatch,
|
|
1365
|
+
) -> None:
|
|
1366
|
+
def forbidden(*args: Any, **kwargs: Any) -> None:
|
|
1367
|
+
raise AssertionError("network access is forbidden")
|
|
1368
|
+
|
|
1369
|
+
monkeypatch.setattr(socket, "socket", forbidden)
|
|
1370
|
+
monkeypatch.setattr(socket, "create_connection", forbidden)
|
|
1371
|
+
case = _case()
|
|
1372
|
+
advisory = _finalize(case)
|
|
1373
|
+
assert "LLM-ADVISORY" in _render(advisory, case)
|
|
1374
|
+
|
|
1375
|
+
|
|
1376
|
+
def test_renderer_escapes_locator_and_excerpt_injection(tmp_path: Path) -> None:
|
|
1377
|
+
packet = _packet_copy(tmp_path)
|
|
1378
|
+
inventory = _inventory()
|
|
1379
|
+
injected = (
|
|
1380
|
+
"<script>alert(1)</script> | [click](https://example.invalid) "
|
|
1381
|
+
")"
|
|
1382
|
+
)
|
|
1383
|
+
text = f"{injected}\n"
|
|
1384
|
+
_set_packet_text(packet, inventory, text)
|
|
1385
|
+
draft = _draft()
|
|
1386
|
+
for index, judgment in enumerate(draft["judgments"]):
|
|
1387
|
+
judgment["quoted_anchor_encoded"] = _quote(injected)
|
|
1388
|
+
judgment["document_locator"]["value"] = (
|
|
1389
|
+
f"<img src=x onerror=alert({index})> | [link](https://example.invalid)"
|
|
1390
|
+
)
|
|
1391
|
+
case = _case(
|
|
1392
|
+
inventory=inventory,
|
|
1393
|
+
packet_root=packet,
|
|
1394
|
+
draft=draft,
|
|
1395
|
+
sources={"fixture.us-consent": text},
|
|
1396
|
+
)
|
|
1397
|
+
advisory = _finalize(case)
|
|
1398
|
+
rendered = _render(advisory, case)
|
|
1399
|
+
for unsafe in (
|
|
1400
|
+
"<script>",
|
|
1401
|
+
"</script>",
|
|
1402
|
+
"<img",
|
|
1403
|
+
"](https://",
|
|
1404
|
+
"javascript:",
|
|
1405
|
+
" | [",
|
|
1406
|
+
):
|
|
1407
|
+
assert unsafe not in rendered
|
|
1408
|
+
assert "<script>" in rendered
|
|
1409
|
+
assert "LLM-ADVISORY" in rendered
|
|
1410
|
+
assert "UNMEASURED" in rendered
|
|
1411
|
+
|
|
1412
|
+
|
|
1413
|
+
@pytest.mark.parametrize("field", ["locator", "quote"])
|
|
1414
|
+
def test_bidi_and_line_injection_are_rejected(field: str) -> None:
|
|
1415
|
+
case = _case()
|
|
1416
|
+
if field == "locator":
|
|
1417
|
+
case["draft"]["judgments"][0]["document_locator"]["value"] = "safe\u202eevil"
|
|
1418
|
+
else:
|
|
1419
|
+
case["draft"]["judgments"][0]["quoted_anchor_encoded"] = _quote("safe\nrow")
|
|
1420
|
+
with pytest.raises(ContentCoverageAdvisoryError):
|
|
1421
|
+
_finalize(case)
|
|
1422
|
+
|
|
1423
|
+
|
|
1424
|
+
def test_advisory_byte_limit_is_inclusive_and_applies_to_build_validate_render(
|
|
1425
|
+
monkeypatch: pytest.MonkeyPatch,
|
|
1426
|
+
) -> None:
|
|
1427
|
+
case = _case()
|
|
1428
|
+
baseline = _finalize(case)
|
|
1429
|
+
exact_size = len(_canonical_bytes(baseline))
|
|
1430
|
+
monkeypatch.setattr(coverage_runtime, "MAX_ADVISORY_BYTES", exact_size)
|
|
1431
|
+
at_limit = _finalize(case)
|
|
1432
|
+
_validate(at_limit, case)
|
|
1433
|
+
assert "LLM-ADVISORY" in _render(at_limit, case)
|
|
1434
|
+
monkeypatch.setattr(coverage_runtime, "MAX_ADVISORY_BYTES", exact_size - 1)
|
|
1435
|
+
with pytest.raises(ContentCoverageAdvisoryError, match="exceeds"):
|
|
1436
|
+
_finalize(case)
|
|
1437
|
+
with pytest.raises(ContentCoverageAdvisoryError, match="exceeds"):
|
|
1438
|
+
_validate(baseline, case)
|
|
1439
|
+
with pytest.raises(ContentCoverageAdvisoryError, match="exceeds"):
|
|
1440
|
+
_render(baseline, case)
|
|
1441
|
+
|
|
1442
|
+
|
|
1443
|
+
@pytest.mark.parametrize(
|
|
1444
|
+
("page", "page_size"),
|
|
1445
|
+
[(0, 25), (1, 0), (1, 26), (2, 25), (True, 25), (1, True)],
|
|
1446
|
+
)
|
|
1447
|
+
def test_renderer_rejects_invalid_page_or_size(page: Any, page_size: Any) -> None:
|
|
1448
|
+
case = _case()
|
|
1449
|
+
advisory = _finalize(case)
|
|
1450
|
+
with pytest.raises(ValueError):
|
|
1451
|
+
_render(advisory, case, page=page, page_size=page_size)
|
|
1452
|
+
|
|
1453
|
+
|
|
1454
|
+
def test_renderer_emits_one_bounded_page_with_navigation() -> None:
|
|
1455
|
+
case = _case()
|
|
1456
|
+
advisory = _finalize(case)
|
|
1457
|
+
rendered = _render(advisory, case, page=1, page_size=2)
|
|
1458
|
+
assert "Page 1/2" in rendered
|
|
1459
|
+
assert "Previous page none; Next page 2" in rendered
|
|
1460
|
+
assert "EVR\\-CC\\-000001" in rendered
|
|
1461
|
+
assert "EVR\\-CC\\-000002" in rendered
|
|
1462
|
+
assert "EVR\\-CC\\-000003" not in rendered
|
|
1463
|
+
second = _render(advisory, case, page=2, page_size=2)
|
|
1464
|
+
assert "Page 2/2" in second
|
|
1465
|
+
assert "Previous page 1; Next page none" in second
|
|
1466
|
+
assert "EVR\\-CC\\-000003" in second
|
|
1467
|
+
assert "EVR\\-CC\\-000001" not in second
|
|
1468
|
+
|
|
1469
|
+
|
|
1470
|
+
@pytest.mark.parametrize("count", [0, 1, 25, 26])
|
|
1471
|
+
def test_renderer_paging_boundaries_preserve_all_rows_once(count: int) -> None:
|
|
1472
|
+
case = _expectation_count_case(count)
|
|
1473
|
+
advisory = _finalize(case)
|
|
1474
|
+
rows = [
|
|
1475
|
+
row
|
|
1476
|
+
for result in advisory["requirement_results"]
|
|
1477
|
+
for finding in result["expectation_findings"]
|
|
1478
|
+
for row in finding["evidence_rows"]
|
|
1479
|
+
]
|
|
1480
|
+
assert len(rows) == count
|
|
1481
|
+
assert [row["row_id"] for row in rows] == [
|
|
1482
|
+
f"EVR-CC-{index:06d}" for index in range(1, count + 1)
|
|
1483
|
+
]
|
|
1484
|
+
pages = max(1, (count + 24) // 25)
|
|
1485
|
+
observed: list[str] = []
|
|
1486
|
+
for page in range(1, pages + 1):
|
|
1487
|
+
rendered = _render(advisory, case, page=page)
|
|
1488
|
+
page_rows = [
|
|
1489
|
+
token.replace("\\-", "-")
|
|
1490
|
+
for token in re.findall(r"EVR\\-CC\\-[0-9]{6}", rendered)
|
|
1491
|
+
]
|
|
1492
|
+
assert len(page_rows) <= 25
|
|
1493
|
+
observed.extend(page_rows)
|
|
1494
|
+
if count:
|
|
1495
|
+
assert f"Page {page}/{pages}" in rendered
|
|
1496
|
+
assert observed == [row["row_id"] for row in rows]
|
|
1497
|
+
|
|
1498
|
+
|
|
1499
|
+
def test_one_thousand_one_rows_traverse_without_loss_reorder_or_all_pages(
|
|
1500
|
+
monkeypatch: pytest.MonkeyPatch,
|
|
1501
|
+
) -> None:
|
|
1502
|
+
case = _expectation_count_case(1001)
|
|
1503
|
+
advisory = _finalize(case)
|
|
1504
|
+
_validate(advisory, case)
|
|
1505
|
+
expected = [f"EVR-CC-{index:06d}" for index in range(1, 1002)]
|
|
1506
|
+
persisted = [
|
|
1507
|
+
row["row_id"]
|
|
1508
|
+
for result in advisory["requirement_results"]
|
|
1509
|
+
for finding in result["expectation_findings"]
|
|
1510
|
+
for row in finding["evidence_rows"]
|
|
1511
|
+
]
|
|
1512
|
+
assert persisted == expected
|
|
1513
|
+
|
|
1514
|
+
# Exact replay was exercised above. Keep page traversal focused on the
|
|
1515
|
+
# renderer/paginator rather than rebuilding the same 1001-row carrier 41 times.
|
|
1516
|
+
monkeypatch.setattr(coverage_runtime, "validate_advisory", lambda *_args, **_kwargs: None)
|
|
1517
|
+
for page, page_expected in (
|
|
1518
|
+
(1, expected[:25]),
|
|
1519
|
+
(41, expected[1000:]),
|
|
1520
|
+
):
|
|
1521
|
+
rendered = _render(advisory, case, page=page)
|
|
1522
|
+
page_rows = [
|
|
1523
|
+
token.replace("\\-", "-")
|
|
1524
|
+
for token in re.findall(r"EVR\\-CC\\-[0-9]{6}", rendered)
|
|
1525
|
+
]
|
|
1526
|
+
assert page_rows == page_expected
|
|
1527
|
+
assert f"Page {page}/41" in rendered
|
|
1528
|
+
|
|
1529
|
+
calls: list[tuple[int, int, int]] = []
|
|
1530
|
+
|
|
1531
|
+
def fast_bounded_renderer(
|
|
1532
|
+
rows: list[dict[str, Any]],
|
|
1533
|
+
*,
|
|
1534
|
+
page: int,
|
|
1535
|
+
page_size: int,
|
|
1536
|
+
session_sources: Mapping[str, str],
|
|
1537
|
+
) -> str:
|
|
1538
|
+
del session_sources
|
|
1539
|
+
calls.append((len(rows), page, page_size))
|
|
1540
|
+
start = (page - 1) * page_size
|
|
1541
|
+
if start >= len(rows):
|
|
1542
|
+
raise ValueError("page outside full carrier")
|
|
1543
|
+
selected = rows[start : start + page_size]
|
|
1544
|
+
return "\n".join(row["row_id"].replace("-", "\\-") for row in selected)
|
|
1545
|
+
|
|
1546
|
+
monkeypatch.setattr(
|
|
1547
|
+
coverage_runtime, "render_evidence_rows_markdown", fast_bounded_renderer
|
|
1548
|
+
)
|
|
1549
|
+
observed: list[str] = []
|
|
1550
|
+
for page in range(1, 42):
|
|
1551
|
+
rendered = _render(advisory, case, page=page)
|
|
1552
|
+
page_rows = [
|
|
1553
|
+
token.replace("\\-", "-")
|
|
1554
|
+
for token in re.findall(r"EVR\\-CC\\-[0-9]{6}", rendered)
|
|
1555
|
+
]
|
|
1556
|
+
assert 1 <= len(page_rows) <= 25
|
|
1557
|
+
observed.extend(page_rows)
|
|
1558
|
+
assert observed == expected
|
|
1559
|
+
assert calls == [(1001, page, 25) for page in range(1, 42)]
|
|
1560
|
+
with pytest.raises(ValueError):
|
|
1561
|
+
_render(advisory, case, page=42)
|
|
1562
|
+
|
|
1563
|
+
|
|
1564
|
+
def _cli_case(tmp_path: Path) -> tuple[dict[str, Any], dict[str, Path]]:
|
|
1565
|
+
case = _case()
|
|
1566
|
+
advisory = _finalize(case)
|
|
1567
|
+
paths = {
|
|
1568
|
+
name: tmp_path / f"{name}.json"
|
|
1569
|
+
for name in (
|
|
1570
|
+
"draft",
|
|
1571
|
+
"inventory",
|
|
1572
|
+
"context",
|
|
1573
|
+
"registry",
|
|
1574
|
+
"resolved",
|
|
1575
|
+
"manifest",
|
|
1576
|
+
"sources",
|
|
1577
|
+
"advisory",
|
|
1578
|
+
)
|
|
1579
|
+
}
|
|
1580
|
+
for name in paths:
|
|
1581
|
+
value = advisory if name == "advisory" else case[name]
|
|
1582
|
+
_write_json(paths[name], value)
|
|
1583
|
+
paths["built"] = tmp_path / "built.json"
|
|
1584
|
+
paths["rendered"] = tmp_path / "rendered.md"
|
|
1585
|
+
return case, paths
|
|
1586
|
+
|
|
1587
|
+
|
|
1588
|
+
def _cli_common(paths: dict[str, Path]) -> list[str]:
|
|
1589
|
+
return [
|
|
1590
|
+
"--draft",
|
|
1591
|
+
str(paths["draft"]),
|
|
1592
|
+
"--inventory",
|
|
1593
|
+
str(paths["inventory"]),
|
|
1594
|
+
"--packet-root",
|
|
1595
|
+
str(PACKET_ROOT),
|
|
1596
|
+
"--context",
|
|
1597
|
+
str(paths["context"]),
|
|
1598
|
+
"--registry",
|
|
1599
|
+
str(paths["registry"]),
|
|
1600
|
+
"--resolved",
|
|
1601
|
+
str(paths["resolved"]),
|
|
1602
|
+
"--manifest",
|
|
1603
|
+
str(paths["manifest"]),
|
|
1604
|
+
"--source-map",
|
|
1605
|
+
str(paths["sources"]),
|
|
1606
|
+
]
|
|
1607
|
+
|
|
1608
|
+
|
|
1609
|
+
def test_cli_build_validate_render_require_full_named_replay(tmp_path: Path) -> None:
|
|
1610
|
+
_case_value, paths = _cli_case(tmp_path)
|
|
1611
|
+
common = _cli_common(paths)
|
|
1612
|
+
assert main(["build", *common, "--output", str(paths["built"])]) == 0
|
|
1613
|
+
assert _json(paths["built"]) == _json(paths["advisory"])
|
|
1614
|
+
assert paths["built"].read_bytes() == _canonical_bytes(_json(paths["advisory"]))
|
|
1615
|
+
assert not paths["built"].read_bytes().endswith(b"\n")
|
|
1616
|
+
assert main(["validate", *common, "--advisory", str(paths["built"])]) == 0
|
|
1617
|
+
assert (
|
|
1618
|
+
main(
|
|
1619
|
+
[
|
|
1620
|
+
"render",
|
|
1621
|
+
*common,
|
|
1622
|
+
"--advisory",
|
|
1623
|
+
str(paths["built"]),
|
|
1624
|
+
"--output",
|
|
1625
|
+
str(paths["rendered"]),
|
|
1626
|
+
]
|
|
1627
|
+
)
|
|
1628
|
+
== 0
|
|
1629
|
+
)
|
|
1630
|
+
rendered = paths["rendered"].read_text(encoding="utf-8")
|
|
1631
|
+
assert "LLM-ADVISORY" in rendered
|
|
1632
|
+
assert "UNMEASURED" in rendered
|
|
1633
|
+
|
|
1634
|
+
|
|
1635
|
+
def test_cli_closed_gate_fails_before_opening_draft_or_source_map(
|
|
1636
|
+
tmp_path: Path, capsys: pytest.CaptureFixture[str]
|
|
1637
|
+
) -> None:
|
|
1638
|
+
context = _context()
|
|
1639
|
+
context["declared_facts"] = [
|
|
1640
|
+
row
|
|
1641
|
+
for row in context["declared_facts"]
|
|
1642
|
+
if row["fact_id"] != "packet_v1.non_clinical"
|
|
1643
|
+
]
|
|
1644
|
+
closed = _case(context=context, draft={}, sources={})
|
|
1645
|
+
_case_value, paths = _cli_case(tmp_path)
|
|
1646
|
+
for name in ("context", "resolved", "manifest"):
|
|
1647
|
+
_write_json(paths[name], closed[name])
|
|
1648
|
+
paths["draft"] = tmp_path / "must-not-open-draft.json"
|
|
1649
|
+
paths["sources"] = tmp_path / "must-not-open-source-map.json"
|
|
1650
|
+
|
|
1651
|
+
assert main(["build", *_cli_common(paths)]) == 2
|
|
1652
|
+
error = capsys.readouterr().err
|
|
1653
|
+
assert "manifest.capability_envelope" in error
|
|
1654
|
+
assert "must-not-open" not in error
|
|
1655
|
+
|
|
1656
|
+
|
|
1657
|
+
def test_cli_overlay_unresolved_does_not_open_source_map(tmp_path: Path) -> None:
|
|
1658
|
+
context = _context()
|
|
1659
|
+
context["overlay_selection_state"]["institutional"] = "not_provided"
|
|
1660
|
+
empty_draft = {
|
|
1661
|
+
"schema_version": "content-coverage-advisory-draft/1.0",
|
|
1662
|
+
"layer": "LLM-ADVISORY",
|
|
1663
|
+
"judgments": [],
|
|
1664
|
+
}
|
|
1665
|
+
unresolved = _case(context=context, draft=empty_draft, sources={})
|
|
1666
|
+
_case_value, paths = _cli_case(tmp_path)
|
|
1667
|
+
for name in ("draft", "context", "resolved", "manifest"):
|
|
1668
|
+
_write_json(paths[name], unresolved[name])
|
|
1669
|
+
paths["sources"] = tmp_path / "must-not-open-source-map.json"
|
|
1670
|
+
|
|
1671
|
+
assert main(["build", *_cli_common(paths), "--output", str(paths["built"])]) == 0
|
|
1672
|
+
result = _result(_json(paths["built"]))
|
|
1673
|
+
assert result["coverage_check_state"] == "not_checked"
|
|
1674
|
+
assert result["advisory_coverage_status"] == "APPLICABILITY_UNRESOLVED"
|
|
1675
|
+
assert result["reason_codes"] == ["APPLICABILITY_UNRESOLVED"]
|
|
1676
|
+
assert result["expectation_findings"] == []
|
|
1677
|
+
|
|
1678
|
+
|
|
1679
|
+
@pytest.mark.parametrize(
|
|
1680
|
+
("target", "payload"),
|
|
1681
|
+
[
|
|
1682
|
+
("draft", '{"layer":"a","layer":"b"}'),
|
|
1683
|
+
("inventory", '{"schema_version":"a","schema_version":"b"}'),
|
|
1684
|
+
("context", '{"value":NaN}'),
|
|
1685
|
+
("registry", '{"value":Infinity}'),
|
|
1686
|
+
("resolved", '{"value":-Infinity}'),
|
|
1687
|
+
("manifest", '{"schema_version":"a","schema_version":"b"}'),
|
|
1688
|
+
("sources", '{"fixture.us-consent":"a","fixture.us-consent":"b"}'),
|
|
1689
|
+
("advisory", '{"layer":"a","layer":"b"}'),
|
|
1690
|
+
],
|
|
1691
|
+
)
|
|
1692
|
+
def test_cli_rejects_duplicate_or_nonfinite_named_json(
|
|
1693
|
+
tmp_path: Path, target: str, payload: str
|
|
1694
|
+
) -> None:
|
|
1695
|
+
_case_value, paths = _cli_case(tmp_path)
|
|
1696
|
+
paths[target].write_text(payload, encoding="utf-8")
|
|
1697
|
+
command = "validate" if target == "advisory" else "build"
|
|
1698
|
+
argv = [command, *_cli_common(paths)]
|
|
1699
|
+
if command == "validate":
|
|
1700
|
+
argv.extend(["--advisory", str(paths["advisory"])])
|
|
1701
|
+
assert main(argv) == 2
|
|
1702
|
+
|
|
1703
|
+
|
|
1704
|
+
def test_cli_rejects_abbreviations_all_pages_and_missing_packet_root(
|
|
1705
|
+
tmp_path: Path,
|
|
1706
|
+
) -> None:
|
|
1707
|
+
_case_value, paths = _cli_case(tmp_path)
|
|
1708
|
+
common = _cli_common(paths)
|
|
1709
|
+
with pytest.raises(SystemExit) as abbreviated:
|
|
1710
|
+
main(["build", "--dra", str(paths["draft"])])
|
|
1711
|
+
assert abbreviated.value.code == 2
|
|
1712
|
+
with pytest.raises(SystemExit) as unbounded:
|
|
1713
|
+
main(
|
|
1714
|
+
[
|
|
1715
|
+
"render",
|
|
1716
|
+
*common,
|
|
1717
|
+
"--advisory",
|
|
1718
|
+
str(paths["advisory"]),
|
|
1719
|
+
"--all",
|
|
1720
|
+
]
|
|
1721
|
+
)
|
|
1722
|
+
assert unbounded.value.code == 2
|
|
1723
|
+
without_root = common[:]
|
|
1724
|
+
root_index = without_root.index("--packet-root")
|
|
1725
|
+
del without_root[root_index : root_index + 2]
|
|
1726
|
+
with pytest.raises(SystemExit) as missing:
|
|
1727
|
+
main(["build", *without_root])
|
|
1728
|
+
assert missing.value.code == 2
|
|
1729
|
+
|
|
1730
|
+
|
|
1731
|
+
def test_cli_render_rejects_resigned_but_forged_advisory(tmp_path: Path) -> None:
|
|
1732
|
+
_case_value, paths = _cli_case(tmp_path)
|
|
1733
|
+
forged = _json(paths["advisory"])
|
|
1734
|
+
forged["requirement_results"][0]["advisory_coverage_status"] = "NOT_LOCATED"
|
|
1735
|
+
_repin_report(forged)
|
|
1736
|
+
_write_json(paths["advisory"], forged)
|
|
1737
|
+
assert (
|
|
1738
|
+
main(
|
|
1739
|
+
[
|
|
1740
|
+
"render",
|
|
1741
|
+
*_cli_common(paths),
|
|
1742
|
+
"--advisory",
|
|
1743
|
+
str(paths["advisory"]),
|
|
1744
|
+
]
|
|
1745
|
+
)
|
|
1746
|
+
== 2
|
|
1747
|
+
)
|
|
1748
|
+
|
|
1749
|
+
|
|
1750
|
+
def test_cli_subprocess_does_not_offer_unbounded_all_option(tmp_path: Path) -> None:
|
|
1751
|
+
_case_value, paths = _cli_case(tmp_path)
|
|
1752
|
+
result = subprocess.run(
|
|
1753
|
+
[
|
|
1754
|
+
sys.executable,
|
|
1755
|
+
str(RUNTIME_PATH),
|
|
1756
|
+
"render",
|
|
1757
|
+
*_cli_common(paths),
|
|
1758
|
+
"--advisory",
|
|
1759
|
+
str(paths["advisory"]),
|
|
1760
|
+
"--all",
|
|
1761
|
+
],
|
|
1762
|
+
text=True,
|
|
1763
|
+
capture_output=True,
|
|
1764
|
+
check=False,
|
|
1765
|
+
)
|
|
1766
|
+
assert result.returncode == 2
|
|
1767
|
+
assert "--all" in result.stderr
|