psyclaw 0.27.23 → 0.28.1
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/agents/recommended/catalog.json +99 -0
- package/dist/apps/panel/index.html +5 -5
- package/dist/src/adapters/pi/extension.js +339 -94
- package/dist/src/adapters/pi/extension.js.map +1 -1
- package/dist/src/adapters/pi/rpc.d.ts +2 -0
- package/dist/src/adapters/pi/rpc.js +9 -2
- package/dist/src/adapters/pi/rpc.js.map +1 -1
- package/dist/src/agents/import.js +44 -32
- package/dist/src/agents/import.js.map +1 -1
- package/dist/src/agents/recommended-personas.d.ts +42 -0
- package/dist/src/agents/recommended-personas.js +135 -0
- package/dist/src/agents/recommended-personas.js.map +1 -0
- 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/cli.js +6 -3
- package/dist/src/cli.js.map +1 -1
- package/dist/src/creation/contracts.d.ts +41 -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 +208 -0
- package/dist/src/creation/service.js.map +1 -0
- package/dist/src/index.d.ts +11 -0
- package/dist/src/index.js +11 -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/bundled-personas.d.ts +16 -0
- package/dist/src/orchestration/bundled-personas.js +101 -0
- package/dist/src/orchestration/bundled-personas.js.map +1 -0
- package/dist/src/orchestration/effects.d.ts +8 -0
- package/dist/src/orchestration/effects.js +39 -0
- package/dist/src/orchestration/effects.js.map +1 -0
- package/dist/src/orchestration/personas.d.ts +16 -0
- package/dist/src/orchestration/personas.js +64 -0
- package/dist/src/orchestration/personas.js.map +1 -0
- package/dist/src/orchestration/pi-executor.d.ts +9 -4
- package/dist/src/orchestration/pi-executor.js +55 -22
- package/dist/src/orchestration/pi-executor.js.map +1 -1
- package/dist/src/orchestration/research-agents.d.ts +3 -7
- package/dist/src/orchestration/research-agents.js +5 -69
- package/dist/src/orchestration/research-agents.js.map +1 -1
- package/dist/src/panel/server.js +19 -4
- 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.d.ts +14 -0
- package/dist/src/style/cli-ui.js +45 -1
- package/dist/src/style/cli-ui.js.map +1 -1
- package/dist/src/tui/skill-manager.js +1 -1
- package/dist/src/tui/skill-manager.js.map +1 -1
- package/dist/src/updates/update.js +9 -3
- package/dist/src/updates/update.js.map +1 -1
- package/package.json +15 -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,2644 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Hermetic contract, replay, and adversarial tests for issue #667."""
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import ast
|
|
6
|
+
import copy
|
|
7
|
+
import hashlib
|
|
8
|
+
import json
|
|
9
|
+
import os
|
|
10
|
+
import shutil
|
|
11
|
+
import socket
|
|
12
|
+
import subprocess
|
|
13
|
+
import sys
|
|
14
|
+
from pathlib import Path
|
|
15
|
+
from typing import Any, Callable
|
|
16
|
+
|
|
17
|
+
import pytest
|
|
18
|
+
from jsonschema import Draft202012Validator, FormatChecker
|
|
19
|
+
|
|
20
|
+
import build_submission_packet_manifest as packet_runtime
|
|
21
|
+
from build_submission_packet_manifest import (
|
|
22
|
+
ContractError,
|
|
23
|
+
build_submission_packet_manifest,
|
|
24
|
+
observe_submission_packet,
|
|
25
|
+
render_submission_packet_manifest,
|
|
26
|
+
validate_submission_packet_inventory,
|
|
27
|
+
validate_submission_packet_manifest,
|
|
28
|
+
)
|
|
29
|
+
from resolve_human_subjects_authority import digest, resolve
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
REPO_ROOT = Path(__file__).resolve().parents[1]
|
|
33
|
+
FIXTURES = REPO_ROOT / "scripts" / "fixtures" / "submission_packet_manifest"
|
|
34
|
+
PACKET_ROOT = FIXTURES / "packet"
|
|
35
|
+
BASE_INVENTORY = FIXTURES / "base_inventory.json"
|
|
36
|
+
AUTHORITY_FIXTURES = REPO_ROOT / "scripts" / "fixtures" / "human_subjects_authority"
|
|
37
|
+
REGISTRY_PATH = REPO_ROOT / "shared" / "human_subjects_authority_registry.json"
|
|
38
|
+
CONTRACTS = REPO_ROOT / "shared" / "contracts" / "human_subjects"
|
|
39
|
+
RUNTIME = REPO_ROOT / "scripts" / "build_submission_packet_manifest.py"
|
|
40
|
+
|
|
41
|
+
INVENTORY_SCHEMA = "submission_packet_inventory.schema.json"
|
|
42
|
+
MANIFEST_SCHEMA = "submission_packet_manifest.schema.json"
|
|
43
|
+
BOUNDARY_FOOTER = (
|
|
44
|
+
"Human-subjects boundary: This output does not authorize recruitment, "
|
|
45
|
+
"consent, access to identifiable data, intervention, or data collection."
|
|
46
|
+
)
|
|
47
|
+
RENDERED_BOUNDARY = (
|
|
48
|
+
"> **Human-subjects boundary:** This output does not authorize recruitment, "
|
|
49
|
+
"consent, access to identifiable data, intervention, or data collection."
|
|
50
|
+
)
|
|
51
|
+
ENVELOPE_EXPECTED = {
|
|
52
|
+
"packet_v1.non_clinical": True,
|
|
53
|
+
"packet_v1.single_institution": True,
|
|
54
|
+
"packet_v1.competent_adults_only": True,
|
|
55
|
+
"packet_v1.biospecimens_involved": False,
|
|
56
|
+
"packet_v1.regulated_clinical_trial": False,
|
|
57
|
+
"packet_v1.cross_border_material_transfer": False,
|
|
58
|
+
"packet_v1.multisite_reliance": False,
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def _json(path: Path) -> dict[str, Any]:
|
|
63
|
+
value = json.loads(path.read_text(encoding="utf-8"))
|
|
64
|
+
assert isinstance(value, dict)
|
|
65
|
+
return value
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def _write_json(path: Path, value: dict[str, Any]) -> None:
|
|
69
|
+
path.write_text(
|
|
70
|
+
json.dumps(value, ensure_ascii=False, sort_keys=True, indent=2) + "\n",
|
|
71
|
+
encoding="utf-8",
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
def _inventory() -> dict[str, Any]:
|
|
76
|
+
return _json(BASE_INVENTORY)
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
def _registry() -> dict[str, Any]:
|
|
80
|
+
return _json(REGISTRY_PATH)
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
def _context(name: str = "us-gdpr-two-axis.json") -> dict[str, Any]:
|
|
84
|
+
context = _json(AUTHORITY_FIXTURES / name)
|
|
85
|
+
known = {row["fact_id"] for row in context["declared_facts"]}
|
|
86
|
+
for fact_id, value in ENVELOPE_EXPECTED.items():
|
|
87
|
+
if fact_id not in known:
|
|
88
|
+
context["declared_facts"].append(
|
|
89
|
+
{
|
|
90
|
+
"fact_id": fact_id,
|
|
91
|
+
"value_type": "boolean",
|
|
92
|
+
"state": "declared",
|
|
93
|
+
"value": value,
|
|
94
|
+
"provenance": "author_declared",
|
|
95
|
+
}
|
|
96
|
+
)
|
|
97
|
+
return context
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
def _authority(
|
|
101
|
+
name: str = "us-gdpr-two-axis.json",
|
|
102
|
+
) -> tuple[dict[str, Any], dict[str, Any], dict[str, Any]]:
|
|
103
|
+
context = _context(name)
|
|
104
|
+
registry = _registry()
|
|
105
|
+
return context, registry, resolve(context, registry)
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
def _build(
|
|
109
|
+
inventory: dict[str, Any] | None = None,
|
|
110
|
+
packet_root: Path = PACKET_ROOT,
|
|
111
|
+
context: dict[str, Any] | None = None,
|
|
112
|
+
registry: dict[str, Any] | None = None,
|
|
113
|
+
resolved: dict[str, Any] | None = None,
|
|
114
|
+
) -> dict[str, Any]:
|
|
115
|
+
if context is None and registry is None and resolved is None:
|
|
116
|
+
context, registry, resolved = _authority()
|
|
117
|
+
return build_submission_packet_manifest(
|
|
118
|
+
_inventory() if inventory is None else inventory,
|
|
119
|
+
packet_root,
|
|
120
|
+
context=context,
|
|
121
|
+
registry=registry,
|
|
122
|
+
resolved=resolved,
|
|
123
|
+
)
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
def _validator(name: str) -> Draft202012Validator:
|
|
127
|
+
schema = _json(CONTRACTS / name)
|
|
128
|
+
return Draft202012Validator(schema, format_checker=FormatChecker())
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
def _artifact(inventory: dict[str, Any], artifact_id: str) -> dict[str, Any]:
|
|
132
|
+
return next(row for row in inventory["artifacts"] if row["artifact_id"] == artifact_id)
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
def _entry(
|
|
136
|
+
manifest: dict[str, Any], requirement_id: str, evidence_id: str | None = None
|
|
137
|
+
) -> dict[str, Any]:
|
|
138
|
+
matches = [
|
|
139
|
+
row
|
|
140
|
+
for row in manifest["entries"]
|
|
141
|
+
if row["requirement_ref"]["requirement_id"] == requirement_id
|
|
142
|
+
and (
|
|
143
|
+
evidence_id is None
|
|
144
|
+
or row["evidence_ref"]["evidence_id"] == evidence_id
|
|
145
|
+
)
|
|
146
|
+
]
|
|
147
|
+
assert len(matches) == 1, (requirement_id, evidence_id, matches)
|
|
148
|
+
return matches[0]
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
def _all_keys(value: Any) -> set[str]:
|
|
152
|
+
if isinstance(value, dict):
|
|
153
|
+
return set(value) | set().union(*(_all_keys(item) for item in value.values()), set())
|
|
154
|
+
if isinstance(value, list):
|
|
155
|
+
return set().union(*(_all_keys(item) for item in value), set())
|
|
156
|
+
return set()
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
def _repin_manifest(manifest: dict[str, Any]) -> None:
|
|
160
|
+
manifest.pop("manifest_digest", None)
|
|
161
|
+
manifest["manifest_digest"] = digest(manifest)
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
def _repin_overlay(context: dict[str, Any], overlay: dict[str, Any]) -> None:
|
|
165
|
+
unsigned = copy.deepcopy(overlay)
|
|
166
|
+
unsigned.pop("overlay_digest", None)
|
|
167
|
+
overlay["overlay_digest"] = digest(unsigned)
|
|
168
|
+
selected = next(
|
|
169
|
+
row
|
|
170
|
+
for row in context["selected_overlays"]
|
|
171
|
+
if row["overlay_id"] == overlay["overlay_id"]
|
|
172
|
+
)
|
|
173
|
+
selected["overlay_digest"] = overlay["overlay_digest"]
|
|
174
|
+
display = next(
|
|
175
|
+
row
|
|
176
|
+
for axis in context["display_precedence"]
|
|
177
|
+
for row in axis["ordered_authorities"]
|
|
178
|
+
if row["authority_id"] == overlay["overlay_id"]
|
|
179
|
+
)
|
|
180
|
+
display["authority_digest"] = overlay["overlay_digest"]
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
def _repin_profile(context: dict[str, Any], profile: dict[str, Any]) -> None:
|
|
184
|
+
unsigned = copy.deepcopy(profile)
|
|
185
|
+
unsigned.pop("profile_digest", None)
|
|
186
|
+
profile["profile_digest"] = digest(unsigned)
|
|
187
|
+
selected = next(
|
|
188
|
+
row
|
|
189
|
+
for row in context["selected_profiles"]
|
|
190
|
+
if row["profile_id"] == profile["profile_id"]
|
|
191
|
+
)
|
|
192
|
+
selected["profile_digest"] = profile["profile_digest"]
|
|
193
|
+
display = next(
|
|
194
|
+
row
|
|
195
|
+
for axis in context["display_precedence"]
|
|
196
|
+
for row in axis["ordered_authorities"]
|
|
197
|
+
if row["authority_kind"] == "profile"
|
|
198
|
+
and row["authority_id"] == profile["profile_id"]
|
|
199
|
+
)
|
|
200
|
+
display["authority_digest"] = profile["profile_digest"]
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
def _packet_copy(tmp_path: Path) -> Path:
|
|
204
|
+
target = tmp_path / "packet"
|
|
205
|
+
shutil.copytree(PACKET_ROOT, target)
|
|
206
|
+
return target
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
def _reason_codes(manifest: dict[str, Any]) -> set[str]:
|
|
210
|
+
return {row["code"] for row in manifest["unresolved_reasons"]}
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
def _synthetic_overlay_authority() -> tuple[
|
|
214
|
+
dict[str, Any], dict[str, Any], dict[str, Any], dict[str, Any]
|
|
215
|
+
]:
|
|
216
|
+
"""Add test-only certificate and exactly profiled waiver rows."""
|
|
217
|
+
context = _context()
|
|
218
|
+
registry = _registry()
|
|
219
|
+
us_profile = next(
|
|
220
|
+
row
|
|
221
|
+
for row in registry["profiles"]
|
|
222
|
+
if row["profile_id"] == "us.hhs.45-cfr-46.subpart-a"
|
|
223
|
+
)
|
|
224
|
+
template = next(
|
|
225
|
+
row
|
|
226
|
+
for row in us_profile["requirements"]
|
|
227
|
+
if row["requirement_id"] == "us.45cfr46.116.informed-consent"
|
|
228
|
+
)
|
|
229
|
+
base = copy.deepcopy(template)
|
|
230
|
+
base.update(
|
|
231
|
+
{
|
|
232
|
+
"requirement_id": "synthetic.packet.base-consent",
|
|
233
|
+
"title": "Synthetic packet base attachment",
|
|
234
|
+
"summary": "Test-only structural attachment row.",
|
|
235
|
+
"obligated_actor": "investigator",
|
|
236
|
+
"consumer_scopes": ["submission_packet"],
|
|
237
|
+
"applies_if": {
|
|
238
|
+
"op": "fact_equals",
|
|
239
|
+
"fact_id": "activity.human_subjects",
|
|
240
|
+
"value": True,
|
|
241
|
+
},
|
|
242
|
+
"structured_expectations": [
|
|
243
|
+
{
|
|
244
|
+
"field_id": "synthetic.prose-meaning-must-never-be-read",
|
|
245
|
+
"operator": "present",
|
|
246
|
+
"value": True,
|
|
247
|
+
}
|
|
248
|
+
],
|
|
249
|
+
"evidence_expected": [
|
|
250
|
+
{
|
|
251
|
+
"evidence_id": "synthetic.base-consent",
|
|
252
|
+
"held_by": "investigator",
|
|
253
|
+
"artifact_type": "consent_materials",
|
|
254
|
+
"description": "Test-only base attachment.",
|
|
255
|
+
}
|
|
256
|
+
],
|
|
257
|
+
"waiver_or_exception_route": {
|
|
258
|
+
"state": "profiled",
|
|
259
|
+
"requirement_ids": ["synthetic.packet.waiver-route"],
|
|
260
|
+
"decision_maker_role": "institutional_review_office",
|
|
261
|
+
},
|
|
262
|
+
"interaction": {
|
|
263
|
+
"collision_key": "synthetic.packet.base",
|
|
264
|
+
"policy": "parallel_authorities",
|
|
265
|
+
},
|
|
266
|
+
}
|
|
267
|
+
)
|
|
268
|
+
route = copy.deepcopy(template)
|
|
269
|
+
route.update(
|
|
270
|
+
{
|
|
271
|
+
"requirement_id": "synthetic.packet.waiver-route",
|
|
272
|
+
"title": "Synthetic profiled route record",
|
|
273
|
+
"summary": "Test-only route evidence row.",
|
|
274
|
+
"obligated_actor": "investigator",
|
|
275
|
+
"consumer_scopes": ["submission_packet"],
|
|
276
|
+
"applies_if": {
|
|
277
|
+
"op": "fact_equals",
|
|
278
|
+
"fact_id": "activity.human_subjects",
|
|
279
|
+
"value": True,
|
|
280
|
+
},
|
|
281
|
+
"structured_expectations": [],
|
|
282
|
+
"evidence_expected": [
|
|
283
|
+
{
|
|
284
|
+
"evidence_id": "synthetic.waiver-decision",
|
|
285
|
+
"held_by": "investigator",
|
|
286
|
+
"artifact_type": "training_certificate",
|
|
287
|
+
"description": "Test-only located decision artifact.",
|
|
288
|
+
}
|
|
289
|
+
],
|
|
290
|
+
"waiver_or_exception_route": {
|
|
291
|
+
"state": "not_applicable",
|
|
292
|
+
"requirement_ids": [],
|
|
293
|
+
"decision_maker_role": None,
|
|
294
|
+
},
|
|
295
|
+
"interaction": {
|
|
296
|
+
"collision_key": "synthetic.packet.route",
|
|
297
|
+
"policy": "parallel_authorities",
|
|
298
|
+
},
|
|
299
|
+
}
|
|
300
|
+
)
|
|
301
|
+
overlay = {
|
|
302
|
+
"overlay_id": "synthetic.institution.packet-routes",
|
|
303
|
+
"overlay_version": "1.0",
|
|
304
|
+
"overlay_digest": "0" * 64,
|
|
305
|
+
"overlay_kind": "institutional",
|
|
306
|
+
"axis": "review_ethics",
|
|
307
|
+
"issuer": "Synthetic Institution",
|
|
308
|
+
"title": "Synthetic packet route overlay",
|
|
309
|
+
"authority_scope_ids": list(us_profile["authority_scope_ids"]),
|
|
310
|
+
"target_profiles": [
|
|
311
|
+
{
|
|
312
|
+
"axis": us_profile["axis"],
|
|
313
|
+
"profile_id": us_profile["profile_id"],
|
|
314
|
+
"profile_version": us_profile["profile_version"],
|
|
315
|
+
"profile_digest": us_profile["profile_digest"],
|
|
316
|
+
}
|
|
317
|
+
],
|
|
318
|
+
"source_ids": list(us_profile["source_ids"]),
|
|
319
|
+
"operation": "add",
|
|
320
|
+
"requirements_removed": False,
|
|
321
|
+
"requirements": [base, route],
|
|
322
|
+
}
|
|
323
|
+
unsigned = copy.deepcopy(overlay)
|
|
324
|
+
unsigned.pop("overlay_digest")
|
|
325
|
+
overlay["overlay_digest"] = digest(unsigned)
|
|
326
|
+
registry["overlays"].append(overlay)
|
|
327
|
+
context["overlay_selection_state"]["institutional"] = "selected"
|
|
328
|
+
context["selected_overlays"].append(
|
|
329
|
+
{
|
|
330
|
+
"overlay_kind": "institutional",
|
|
331
|
+
"axis": "review_ethics",
|
|
332
|
+
"overlay_id": overlay["overlay_id"],
|
|
333
|
+
"overlay_version": overlay["overlay_version"],
|
|
334
|
+
"overlay_digest": overlay["overlay_digest"],
|
|
335
|
+
}
|
|
336
|
+
)
|
|
337
|
+
review = next(
|
|
338
|
+
row for row in context["display_precedence"] if row["axis"] == "review_ethics"
|
|
339
|
+
)
|
|
340
|
+
review["ordered_authorities"].append(
|
|
341
|
+
{
|
|
342
|
+
"authority_kind": "institutional_overlay",
|
|
343
|
+
"axis": "review_ethics",
|
|
344
|
+
"authority_id": overlay["overlay_id"],
|
|
345
|
+
"authority_version": overlay["overlay_version"],
|
|
346
|
+
"authority_digest": overlay["overlay_digest"],
|
|
347
|
+
}
|
|
348
|
+
)
|
|
349
|
+
return context, registry, resolve(context, registry), overlay
|
|
350
|
+
|
|
351
|
+
|
|
352
|
+
def _waiver_inventory() -> dict[str, Any]:
|
|
353
|
+
inventory = _inventory()
|
|
354
|
+
inventory["waiver_or_exception_claims"] = [
|
|
355
|
+
{
|
|
356
|
+
"requirement_id": "synthetic.packet.base-consent",
|
|
357
|
+
"route_requirement_ids": ["synthetic.packet.waiver-route"],
|
|
358
|
+
"decision_artifact_id": "fixture.training-certificate",
|
|
359
|
+
"declared_by": "author",
|
|
360
|
+
}
|
|
361
|
+
]
|
|
362
|
+
return inventory
|
|
363
|
+
|
|
364
|
+
|
|
365
|
+
def test_schemas_and_base_inventory_are_closed_and_valid() -> None:
|
|
366
|
+
for name in (INVENTORY_SCHEMA, MANIFEST_SCHEMA):
|
|
367
|
+
Draft202012Validator.check_schema(_json(CONTRACTS / name))
|
|
368
|
+
inventory = _inventory()
|
|
369
|
+
_validator(INVENTORY_SCHEMA).validate(inventory)
|
|
370
|
+
validate_submission_packet_inventory(inventory)
|
|
371
|
+
|
|
372
|
+
|
|
373
|
+
def test_all_seven_capability_facts_are_registry_catalogued_booleans() -> None:
|
|
374
|
+
definitions = {row["fact_id"]: row for row in _registry()["fact_definitions"]}
|
|
375
|
+
assert set(ENVELOPE_EXPECTED) <= set(definitions)
|
|
376
|
+
for fact_id in ENVELOPE_EXPECTED:
|
|
377
|
+
assert definitions[fact_id]["value_type"] == "boolean"
|
|
378
|
+
assert definitions[fact_id]["allowed_values"] is None
|
|
379
|
+
|
|
380
|
+
|
|
381
|
+
def test_base_fixture_observation_is_explicit_and_scan_free() -> None:
|
|
382
|
+
observed = observe_submission_packet(_inventory(), PACKET_ROOT)
|
|
383
|
+
assert {row["artifact_id"] for row in observed} == {
|
|
384
|
+
"fixture.us-consent",
|
|
385
|
+
"fixture.tw-consent",
|
|
386
|
+
"fixture.training-certificate",
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
|
|
390
|
+
def test_manifest_schema_and_deterministic_replay_pass() -> None:
|
|
391
|
+
inventory = _inventory()
|
|
392
|
+
context, registry, resolved = _authority()
|
|
393
|
+
manifest = _build(inventory, PACKET_ROOT, context, registry, resolved)
|
|
394
|
+
_validator(MANIFEST_SCHEMA).validate(manifest)
|
|
395
|
+
validate_submission_packet_manifest(
|
|
396
|
+
manifest,
|
|
397
|
+
inventory,
|
|
398
|
+
PACKET_ROOT,
|
|
399
|
+
context=context,
|
|
400
|
+
registry=registry,
|
|
401
|
+
resolved=resolved,
|
|
402
|
+
)
|
|
403
|
+
|
|
404
|
+
|
|
405
|
+
@pytest.mark.parametrize(
|
|
406
|
+
"mutate",
|
|
407
|
+
[
|
|
408
|
+
lambda value: value.__setitem__("unknown", True),
|
|
409
|
+
lambda value: value["artifacts"].append(copy.deepcopy(value["artifacts"][0])),
|
|
410
|
+
lambda value: value["artifacts"][1].__setitem__(
|
|
411
|
+
"relative_path", value["artifacts"][0]["relative_path"]
|
|
412
|
+
),
|
|
413
|
+
lambda value: value["artifacts"][0]["evidence_bindings"].append(
|
|
414
|
+
copy.deepcopy(value["artifacts"][0]["evidence_bindings"][0])
|
|
415
|
+
),
|
|
416
|
+
lambda value: value["packet_responsibility_role_ids"].append(
|
|
417
|
+
value["packet_responsibility_role_ids"][0]
|
|
418
|
+
),
|
|
419
|
+
lambda value: value["authorization_status_input"].update(
|
|
420
|
+
{"value": "not_provided", "source_reference": "invented.source"}
|
|
421
|
+
),
|
|
422
|
+
lambda value: value["artifacts"][0]["declared_structure"].update(
|
|
423
|
+
{"document_date": "2026-02-30"}
|
|
424
|
+
),
|
|
425
|
+
lambda value: value["artifacts"][0].update({"declared_size_bytes": True}),
|
|
426
|
+
],
|
|
427
|
+
)
|
|
428
|
+
def test_inventory_closed_shape_and_semantic_duplicates_fail(
|
|
429
|
+
mutate: Callable[[dict[str, Any]], None]
|
|
430
|
+
) -> None:
|
|
431
|
+
inventory = _inventory()
|
|
432
|
+
mutate(inventory)
|
|
433
|
+
with pytest.raises(ContractError):
|
|
434
|
+
validate_submission_packet_inventory(inventory)
|
|
435
|
+
|
|
436
|
+
|
|
437
|
+
@pytest.mark.parametrize(
|
|
438
|
+
"relative_path",
|
|
439
|
+
[
|
|
440
|
+
"/absolute.txt",
|
|
441
|
+
"../escape.txt",
|
|
442
|
+
"a/../escape.txt",
|
|
443
|
+
"a/./file.txt",
|
|
444
|
+
"a//file.txt",
|
|
445
|
+
"a\\file.txt",
|
|
446
|
+
"C:/drive.txt",
|
|
447
|
+
".",
|
|
448
|
+
"folder/",
|
|
449
|
+
"\u202efile.txt",
|
|
450
|
+
],
|
|
451
|
+
)
|
|
452
|
+
def test_inventory_paths_must_be_normalized_relative_posix(
|
|
453
|
+
relative_path: str,
|
|
454
|
+
) -> None:
|
|
455
|
+
inventory = _inventory()
|
|
456
|
+
inventory["artifacts"][0]["relative_path"] = relative_path
|
|
457
|
+
with pytest.raises(ContractError):
|
|
458
|
+
validate_submission_packet_inventory(inventory)
|
|
459
|
+
|
|
460
|
+
|
|
461
|
+
@pytest.mark.parametrize(
|
|
462
|
+
"mutate",
|
|
463
|
+
[
|
|
464
|
+
lambda value: value.__setitem__("inventory_id", "valid.id\n"),
|
|
465
|
+
lambda value: value["artifacts"][0]["declared_structure"].__setitem__(
|
|
466
|
+
"version_id", "v1\n"
|
|
467
|
+
),
|
|
468
|
+
lambda value: value["artifacts"][0].__setitem__(
|
|
469
|
+
"declared_sha256", "0" * 64 + "\n"
|
|
470
|
+
),
|
|
471
|
+
lambda value: value["artifacts"][0].__setitem__(
|
|
472
|
+
"relative_path", "consent-materials.txt\n"
|
|
473
|
+
),
|
|
474
|
+
lambda value: value["artifacts"][0].__setitem__(
|
|
475
|
+
"media_type", "text/plain\n"
|
|
476
|
+
),
|
|
477
|
+
lambda value: value["artifacts"][0]["declared_structure"].__setitem__(
|
|
478
|
+
"document_date", "2026-W01-1"
|
|
479
|
+
),
|
|
480
|
+
],
|
|
481
|
+
)
|
|
482
|
+
def test_inventory_schema_runtime_absolute_end_parity(
|
|
483
|
+
mutate: Callable[[dict[str, Any]], None]
|
|
484
|
+
) -> None:
|
|
485
|
+
inventory = _inventory()
|
|
486
|
+
mutate(inventory)
|
|
487
|
+
assert list(_validator(INVENTORY_SCHEMA).iter_errors(inventory))
|
|
488
|
+
with pytest.raises(ContractError):
|
|
489
|
+
validate_submission_packet_inventory(inventory)
|
|
490
|
+
|
|
491
|
+
|
|
492
|
+
def test_lone_surrogate_path_fails_schema_public_validation_and_context_free_build() -> None:
|
|
493
|
+
inventory = _inventory()
|
|
494
|
+
inventory["artifacts"][0]["relative_path"] = "surrogate-\ud800.txt"
|
|
495
|
+
assert list(_validator(INVENTORY_SCHEMA).iter_errors(inventory))
|
|
496
|
+
with pytest.raises(ContractError, match="surrogate"):
|
|
497
|
+
validate_submission_packet_inventory(inventory)
|
|
498
|
+
with pytest.raises(ContractError, match="surrogate"):
|
|
499
|
+
build_submission_packet_manifest(inventory, PACKET_ROOT)
|
|
500
|
+
manifest = _build()
|
|
501
|
+
manifest["packet_observations"][0]["relative_path"] = "surrogate-\ud800.txt"
|
|
502
|
+
assert list(_validator(MANIFEST_SCHEMA).iter_errors(manifest))
|
|
503
|
+
with pytest.raises(ContractError, match="canonical JSON"):
|
|
504
|
+
render_submission_packet_manifest(manifest)
|
|
505
|
+
|
|
506
|
+
|
|
507
|
+
def test_reserved_format_control_fails_schema_and_runtime_on_both_contracts() -> None:
|
|
508
|
+
reserved_format_control = "\U00013439"
|
|
509
|
+
inventory = _inventory()
|
|
510
|
+
inventory["artifacts"][0]["relative_path"] = (
|
|
511
|
+
f"reserved-{reserved_format_control}.txt"
|
|
512
|
+
)
|
|
513
|
+
assert list(_validator(INVENTORY_SCHEMA).iter_errors(inventory))
|
|
514
|
+
with pytest.raises(ContractError, match="format"):
|
|
515
|
+
validate_submission_packet_inventory(inventory)
|
|
516
|
+
with pytest.raises(ContractError, match="format"):
|
|
517
|
+
build_submission_packet_manifest(inventory, PACKET_ROOT)
|
|
518
|
+
|
|
519
|
+
manifest = _build()
|
|
520
|
+
manifest["packet_observations"][0]["relative_path"] = (
|
|
521
|
+
f"reserved-{reserved_format_control}.txt"
|
|
522
|
+
)
|
|
523
|
+
_repin_manifest(manifest)
|
|
524
|
+
assert list(_validator(MANIFEST_SCHEMA).iter_errors(manifest))
|
|
525
|
+
with pytest.raises(ContractError, match="format"):
|
|
526
|
+
render_submission_packet_manifest(manifest)
|
|
527
|
+
|
|
528
|
+
|
|
529
|
+
def test_missing_explicit_attachment_is_observed_not_located(tmp_path: Path) -> None:
|
|
530
|
+
packet = _packet_copy(tmp_path)
|
|
531
|
+
(packet / "consent-materials.txt").unlink()
|
|
532
|
+
rows = observe_submission_packet(_inventory(), packet)
|
|
533
|
+
row = next(item for item in rows if item["artifact_id"] == "fixture.us-consent")
|
|
534
|
+
assert row == {
|
|
535
|
+
"artifact_id": "fixture.us-consent",
|
|
536
|
+
"relative_path": "consent-materials.txt",
|
|
537
|
+
"state": "not_located",
|
|
538
|
+
"observed_sha256": None,
|
|
539
|
+
"observed_size_bytes": None,
|
|
540
|
+
"status": "CONFLICTING",
|
|
541
|
+
"reason_codes": ["DECLARED_ATTACHMENT_NOT_LOCATED"],
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
|
|
545
|
+
@pytest.mark.parametrize(
|
|
546
|
+
("mutation", "expected_reasons"),
|
|
547
|
+
[
|
|
548
|
+
("missing", ["DECLARED_ATTACHMENT_NOT_LOCATED"]),
|
|
549
|
+
("digest", ["ARTIFACT_DIGEST_MISMATCH"]),
|
|
550
|
+
("certificate_holder", ["CERTIFICATE_HOLDER_MISMATCH"]),
|
|
551
|
+
],
|
|
552
|
+
)
|
|
553
|
+
def test_unbound_declared_conflict_stays_visible_without_changing_readiness(
|
|
554
|
+
tmp_path: Path, mutation: str, expected_reasons: list[str]
|
|
555
|
+
) -> None:
|
|
556
|
+
packet = _packet_copy(tmp_path)
|
|
557
|
+
inventory = _inventory()
|
|
558
|
+
artifact = _artifact(inventory, "fixture.training-certificate")
|
|
559
|
+
path = packet / artifact["relative_path"]
|
|
560
|
+
if mutation == "missing":
|
|
561
|
+
path.unlink()
|
|
562
|
+
elif mutation == "digest":
|
|
563
|
+
original = path.read_bytes()
|
|
564
|
+
replacement = bytes([original[0] ^ 1]) + original[1:]
|
|
565
|
+
assert len(replacement) == len(original)
|
|
566
|
+
path.write_bytes(replacement)
|
|
567
|
+
else:
|
|
568
|
+
certificate = artifact["declared_structure"]["certificate"]
|
|
569
|
+
assert certificate is not None
|
|
570
|
+
certificate["holder_role_id"] = "principal_investigator"
|
|
571
|
+
manifest = _build(inventory, packet)
|
|
572
|
+
observation = next(
|
|
573
|
+
row
|
|
574
|
+
for row in manifest["packet_observations"]
|
|
575
|
+
if row["artifact_id"] == artifact["artifact_id"]
|
|
576
|
+
)
|
|
577
|
+
assert observation["status"] == "CONFLICTING"
|
|
578
|
+
assert observation["reason_codes"] == expected_reasons
|
|
579
|
+
assert not any(
|
|
580
|
+
artifact["artifact_id"] in row["matched_artifact_ids"]
|
|
581
|
+
for row in manifest["entries"]
|
|
582
|
+
)
|
|
583
|
+
assert manifest["administrative_status"]["submission_readiness"] == (
|
|
584
|
+
"no_listed_gaps_located"
|
|
585
|
+
)
|
|
586
|
+
|
|
587
|
+
|
|
588
|
+
def test_packet_root_symlink_is_rejected(tmp_path: Path) -> None:
|
|
589
|
+
packet = _packet_copy(tmp_path)
|
|
590
|
+
redirected = tmp_path / "redirected"
|
|
591
|
+
packet.rename(redirected)
|
|
592
|
+
packet.symlink_to(redirected, target_is_directory=True)
|
|
593
|
+
with pytest.raises(ContractError, match="symlink"):
|
|
594
|
+
observe_submission_packet(_inventory(), packet)
|
|
595
|
+
|
|
596
|
+
|
|
597
|
+
def test_packet_root_with_symlinked_ancestor_is_rejected(tmp_path: Path) -> None:
|
|
598
|
+
real_parent = tmp_path / "real-parent"
|
|
599
|
+
real_parent.mkdir()
|
|
600
|
+
_packet_copy(real_parent)
|
|
601
|
+
linked_parent = tmp_path / "linked-parent"
|
|
602
|
+
linked_parent.symlink_to(real_parent, target_is_directory=True)
|
|
603
|
+
with pytest.raises(ContractError, match="symlink"):
|
|
604
|
+
observe_submission_packet(_inventory(), linked_parent / "packet")
|
|
605
|
+
|
|
606
|
+
|
|
607
|
+
@pytest.mark.parametrize("link_parent", [False, True])
|
|
608
|
+
def test_packet_member_or_parent_symlink_is_rejected(
|
|
609
|
+
tmp_path: Path, link_parent: bool
|
|
610
|
+
) -> None:
|
|
611
|
+
inventory = _inventory()
|
|
612
|
+
packet = _packet_copy(tmp_path)
|
|
613
|
+
if link_parent:
|
|
614
|
+
real = tmp_path / "real-subdir"
|
|
615
|
+
real.mkdir()
|
|
616
|
+
shutil.copy2(packet / "consent-materials.txt", real / "consent-materials.txt")
|
|
617
|
+
(packet / "linked").symlink_to(real, target_is_directory=True)
|
|
618
|
+
_artifact(inventory, "fixture.us-consent")["relative_path"] = (
|
|
619
|
+
"linked/consent-materials.txt"
|
|
620
|
+
)
|
|
621
|
+
else:
|
|
622
|
+
original = packet / "consent-materials.txt"
|
|
623
|
+
real = packet / "consent-real.txt"
|
|
624
|
+
original.rename(real)
|
|
625
|
+
original.symlink_to(real.name)
|
|
626
|
+
with pytest.raises(ContractError, match="symlink"):
|
|
627
|
+
observe_submission_packet(inventory, packet)
|
|
628
|
+
|
|
629
|
+
|
|
630
|
+
def test_broken_symlink_is_rejected_not_folded_into_absence(tmp_path: Path) -> None:
|
|
631
|
+
packet = _packet_copy(tmp_path)
|
|
632
|
+
path = packet / "consent-materials.txt"
|
|
633
|
+
path.unlink()
|
|
634
|
+
path.symlink_to("missing-target.txt")
|
|
635
|
+
with pytest.raises(ContractError, match="symlink"):
|
|
636
|
+
observe_submission_packet(_inventory(), packet)
|
|
637
|
+
|
|
638
|
+
|
|
639
|
+
def test_final_member_swap_to_symlink_cannot_escape_anchored_root(
|
|
640
|
+
tmp_path: Path, monkeypatch: pytest.MonkeyPatch
|
|
641
|
+
) -> None:
|
|
642
|
+
inventory = _inventory()
|
|
643
|
+
packet = _packet_copy(tmp_path)
|
|
644
|
+
artifact = _artifact(inventory, "fixture.us-consent")
|
|
645
|
+
target = packet / artifact["relative_path"]
|
|
646
|
+
outside = tmp_path / "outside-secret.txt"
|
|
647
|
+
outside.write_bytes(b"OUTSIDE-SYMLINK-TARGET-667\n")
|
|
648
|
+
original_open = os.open
|
|
649
|
+
swapped = False
|
|
650
|
+
|
|
651
|
+
def racing_open(
|
|
652
|
+
path: str | bytes | os.PathLike[str] | os.PathLike[bytes],
|
|
653
|
+
flags: int,
|
|
654
|
+
mode: int = 0o777,
|
|
655
|
+
*,
|
|
656
|
+
dir_fd: int | None = None,
|
|
657
|
+
) -> int:
|
|
658
|
+
nonlocal swapped
|
|
659
|
+
if (
|
|
660
|
+
not swapped
|
|
661
|
+
and dir_fd is not None
|
|
662
|
+
and not flags & os.O_DIRECTORY
|
|
663
|
+
and os.fsdecode(path) == target.name
|
|
664
|
+
):
|
|
665
|
+
swapped = True
|
|
666
|
+
target.unlink()
|
|
667
|
+
target.symlink_to(outside)
|
|
668
|
+
return original_open(path, flags, mode, dir_fd=dir_fd)
|
|
669
|
+
|
|
670
|
+
monkeypatch.setattr(os, "open", racing_open)
|
|
671
|
+
with pytest.raises(ContractError, match="symlink"):
|
|
672
|
+
observe_submission_packet(inventory, packet)
|
|
673
|
+
assert swapped is True
|
|
674
|
+
assert target.is_symlink()
|
|
675
|
+
|
|
676
|
+
|
|
677
|
+
def test_member_parent_swap_after_open_stays_on_anchored_directory(
|
|
678
|
+
tmp_path: Path, monkeypatch: pytest.MonkeyPatch
|
|
679
|
+
) -> None:
|
|
680
|
+
inventory = _inventory()
|
|
681
|
+
packet = _packet_copy(tmp_path)
|
|
682
|
+
artifact = _artifact(inventory, "fixture.us-consent")
|
|
683
|
+
original_path = packet / artifact["relative_path"]
|
|
684
|
+
expected = original_path.read_bytes()
|
|
685
|
+
member_parent = packet / "nested"
|
|
686
|
+
member_parent.mkdir()
|
|
687
|
+
original_path.rename(member_parent / original_path.name)
|
|
688
|
+
artifact["relative_path"] = f"nested/{original_path.name}"
|
|
689
|
+
|
|
690
|
+
outside_parent = tmp_path / "outside-parent"
|
|
691
|
+
outside_parent.mkdir()
|
|
692
|
+
(outside_parent / original_path.name).write_bytes(b"OUTSIDE-PARENT-TARGET-667\n")
|
|
693
|
+
moved_parent = packet / "opened-parent"
|
|
694
|
+
original_open_directory = packet_runtime._open_directory_at
|
|
695
|
+
swapped = False
|
|
696
|
+
|
|
697
|
+
def swap_after_open(
|
|
698
|
+
parent_fd: int,
|
|
699
|
+
component: str,
|
|
700
|
+
contract_path: str,
|
|
701
|
+
*,
|
|
702
|
+
missing_ok: bool,
|
|
703
|
+
) -> int | None:
|
|
704
|
+
nonlocal swapped
|
|
705
|
+
opened = original_open_directory(
|
|
706
|
+
parent_fd,
|
|
707
|
+
component,
|
|
708
|
+
contract_path,
|
|
709
|
+
missing_ok=missing_ok,
|
|
710
|
+
)
|
|
711
|
+
if component == "nested" and opened is not None and not swapped:
|
|
712
|
+
swapped = True
|
|
713
|
+
member_parent.rename(moved_parent)
|
|
714
|
+
member_parent.symlink_to(outside_parent, target_is_directory=True)
|
|
715
|
+
return opened
|
|
716
|
+
|
|
717
|
+
monkeypatch.setattr(packet_runtime, "_open_directory_at", swap_after_open)
|
|
718
|
+
observations = observe_submission_packet(inventory, packet)
|
|
719
|
+
row = next(
|
|
720
|
+
item for item in observations if item["artifact_id"] == artifact["artifact_id"]
|
|
721
|
+
)
|
|
722
|
+
assert swapped is True
|
|
723
|
+
assert member_parent.is_symlink()
|
|
724
|
+
assert row["observed_sha256"] == hashlib.sha256(expected).hexdigest()
|
|
725
|
+
assert row["observed_sha256"] != hashlib.sha256(
|
|
726
|
+
(outside_parent / original_path.name).read_bytes()
|
|
727
|
+
).hexdigest()
|
|
728
|
+
|
|
729
|
+
|
|
730
|
+
def test_descriptor_safe_open_has_no_unsafe_platform_fallback(
|
|
731
|
+
monkeypatch: pytest.MonkeyPatch,
|
|
732
|
+
) -> None:
|
|
733
|
+
monkeypatch.delattr(packet_runtime.os, "O_NOFOLLOW")
|
|
734
|
+
with pytest.raises(ContractError, match="descriptor-relative O_NOFOLLOW"):
|
|
735
|
+
observe_submission_packet(_inventory(), PACKET_ROOT)
|
|
736
|
+
|
|
737
|
+
|
|
738
|
+
@pytest.mark.parametrize("kind", ["directory", "fifo"])
|
|
739
|
+
def test_non_regular_explicit_attachment_is_rejected(tmp_path: Path, kind: str) -> None:
|
|
740
|
+
packet = _packet_copy(tmp_path)
|
|
741
|
+
path = packet / "consent-materials.txt"
|
|
742
|
+
path.unlink()
|
|
743
|
+
if kind == "directory":
|
|
744
|
+
path.mkdir()
|
|
745
|
+
else:
|
|
746
|
+
if not hasattr(os, "mkfifo"):
|
|
747
|
+
pytest.skip("FIFO creation is unavailable")
|
|
748
|
+
os.mkfifo(path)
|
|
749
|
+
with pytest.raises(ContractError, match="regular file"):
|
|
750
|
+
observe_submission_packet(_inventory(), packet)
|
|
751
|
+
|
|
752
|
+
|
|
753
|
+
def test_observer_opens_only_inventory_paths_and_ignores_sibling_sentinel(
|
|
754
|
+
tmp_path: Path, monkeypatch: pytest.MonkeyPatch
|
|
755
|
+
) -> None:
|
|
756
|
+
packet = _packet_copy(tmp_path)
|
|
757
|
+
sentinel = packet / "consent-final-approved-secret.txt"
|
|
758
|
+
sentinel.write_text("UNLISTED-SENTINEL-667", encoding="utf-8")
|
|
759
|
+
inventory = _inventory()
|
|
760
|
+
opened: list[str] = []
|
|
761
|
+
original_open = os.open
|
|
762
|
+
|
|
763
|
+
def tracked_open(
|
|
764
|
+
path: str | bytes | os.PathLike[str] | os.PathLike[bytes],
|
|
765
|
+
flags: int,
|
|
766
|
+
mode: int = 0o777,
|
|
767
|
+
*,
|
|
768
|
+
dir_fd: int | None = None,
|
|
769
|
+
) -> int:
|
|
770
|
+
if dir_fd is not None and not flags & os.O_DIRECTORY:
|
|
771
|
+
opened.append(os.fsdecode(path))
|
|
772
|
+
return original_open(path, flags, mode, dir_fd=dir_fd)
|
|
773
|
+
|
|
774
|
+
monkeypatch.setattr(os, "open", tracked_open)
|
|
775
|
+
rows = observe_submission_packet(inventory, packet)
|
|
776
|
+
expected = {row["relative_path"] for row in inventory["artifacts"]}
|
|
777
|
+
assert set(opened) == expected
|
|
778
|
+
assert sentinel.name not in opened
|
|
779
|
+
assert "UNLISTED-SENTINEL-667" not in json.dumps(rows)
|
|
780
|
+
|
|
781
|
+
|
|
782
|
+
def test_observer_limits_are_enforced_without_large_fixture(
|
|
783
|
+
monkeypatch: pytest.MonkeyPatch,
|
|
784
|
+
) -> None:
|
|
785
|
+
inventory = _inventory()
|
|
786
|
+
for artifact in inventory["artifacts"]:
|
|
787
|
+
artifact["declared_size_bytes"] = 0
|
|
788
|
+
monkeypatch.setattr(packet_runtime, "MAX_ARTIFACT_BYTES", 32)
|
|
789
|
+
with pytest.raises(ContractError, match="observation limit"):
|
|
790
|
+
observe_submission_packet(inventory, PACKET_ROOT)
|
|
791
|
+
|
|
792
|
+
|
|
793
|
+
def test_total_observer_limit_is_enforced_without_large_fixture(
|
|
794
|
+
monkeypatch: pytest.MonkeyPatch,
|
|
795
|
+
) -> None:
|
|
796
|
+
inventory = _inventory()
|
|
797
|
+
declared_total = sum(
|
|
798
|
+
artifact["declared_size_bytes"] for artifact in inventory["artifacts"]
|
|
799
|
+
)
|
|
800
|
+
monkeypatch.setattr(packet_runtime, "MAX_TOTAL_BYTES", declared_total - 1)
|
|
801
|
+
with pytest.raises(ContractError, match="total limit"):
|
|
802
|
+
observe_submission_packet(inventory, PACKET_ROOT)
|
|
803
|
+
|
|
804
|
+
|
|
805
|
+
def test_runtime_has_no_directory_scan_network_or_model_client() -> None:
|
|
806
|
+
tree = ast.parse(RUNTIME.read_text(encoding="utf-8"))
|
|
807
|
+
imported: set[str] = set()
|
|
808
|
+
forbidden_calls = {
|
|
809
|
+
"glob",
|
|
810
|
+
"iglob",
|
|
811
|
+
"rglob",
|
|
812
|
+
"iterdir",
|
|
813
|
+
"listdir",
|
|
814
|
+
"scandir",
|
|
815
|
+
"walk",
|
|
816
|
+
"fwalk",
|
|
817
|
+
}
|
|
818
|
+
calls: set[str] = set()
|
|
819
|
+
for node in ast.walk(tree):
|
|
820
|
+
if isinstance(node, ast.Import):
|
|
821
|
+
imported.update(alias.name.split(".")[0] for alias in node.names)
|
|
822
|
+
elif isinstance(node, ast.ImportFrom) and node.module:
|
|
823
|
+
imported.add(node.module.split(".")[0])
|
|
824
|
+
elif isinstance(node, ast.Call) and isinstance(node.func, ast.Attribute):
|
|
825
|
+
calls.add(node.func.attr)
|
|
826
|
+
assert imported.isdisjoint(
|
|
827
|
+
{
|
|
828
|
+
"socket",
|
|
829
|
+
"urllib",
|
|
830
|
+
"http",
|
|
831
|
+
"requests",
|
|
832
|
+
"httpx",
|
|
833
|
+
"openai",
|
|
834
|
+
"anthropic",
|
|
835
|
+
"subprocess",
|
|
836
|
+
}
|
|
837
|
+
)
|
|
838
|
+
assert calls.isdisjoint(forbidden_calls)
|
|
839
|
+
|
|
840
|
+
|
|
841
|
+
def test_in_process_builder_never_opens_a_socket(
|
|
842
|
+
monkeypatch: pytest.MonkeyPatch,
|
|
843
|
+
) -> None:
|
|
844
|
+
def fail_connect(*args: Any, **kwargs: Any) -> None:
|
|
845
|
+
raise AssertionError("packet manifest attempted network access")
|
|
846
|
+
|
|
847
|
+
monkeypatch.setattr(socket.socket, "connect", fail_connect)
|
|
848
|
+
_build()
|
|
849
|
+
|
|
850
|
+
|
|
851
|
+
def test_no_authority_triplet_returns_explicit_unresolved_manifest() -> None:
|
|
852
|
+
manifest = build_submission_packet_manifest(_inventory(), PACKET_ROOT)
|
|
853
|
+
assert manifest["authority_binding"]["state"] == "not_provided"
|
|
854
|
+
assert manifest["entries"] == []
|
|
855
|
+
assert manifest["excluded_requirements"] == []
|
|
856
|
+
assert manifest["administrative_status"]["submission_readiness"] == "unresolved"
|
|
857
|
+
assert "AUTHORITY_INPUT_NOT_PROVIDED" in _reason_codes(manifest)
|
|
858
|
+
assert "V1_ENVELOPE_FACT_MISSING" in _reason_codes(manifest)
|
|
859
|
+
|
|
860
|
+
|
|
861
|
+
@pytest.mark.parametrize("provided", [(True, False, False), (False, True, False), (False, False, True), (True, True, False), (True, False, True), (False, True, True)])
|
|
862
|
+
def test_partial_authority_triplet_fails_closed(
|
|
863
|
+
provided: tuple[bool, bool, bool]
|
|
864
|
+
) -> None:
|
|
865
|
+
context, registry, resolved = _authority()
|
|
866
|
+
values = (context, registry, resolved)
|
|
867
|
+
args = [value if use else None for value, use in zip(values, provided)]
|
|
868
|
+
with pytest.raises(ContractError, match="all-or-none"):
|
|
869
|
+
build_submission_packet_manifest(
|
|
870
|
+
_inventory(),
|
|
871
|
+
PACKET_ROOT,
|
|
872
|
+
context=args[0],
|
|
873
|
+
registry=args[1],
|
|
874
|
+
resolved=args[2],
|
|
875
|
+
)
|
|
876
|
+
|
|
877
|
+
|
|
878
|
+
def test_schema_shaped_resolved_tamper_is_rejected_with_or_without_resigning() -> None:
|
|
879
|
+
context, registry, resolved = _authority()
|
|
880
|
+
for resign in (False, True):
|
|
881
|
+
tampered = copy.deepcopy(resolved)
|
|
882
|
+
tampered["requirement_results"][0]["consumer_scopes"].append(
|
|
883
|
+
"submission_packet"
|
|
884
|
+
)
|
|
885
|
+
if resign:
|
|
886
|
+
tampered.pop("resolved_digest")
|
|
887
|
+
tampered["resolved_digest"] = digest(tampered)
|
|
888
|
+
with pytest.raises(ContractError):
|
|
889
|
+
_build(_inventory(), PACKET_ROOT, context, registry, tampered)
|
|
890
|
+
|
|
891
|
+
|
|
892
|
+
def test_upstream_week_date_residue_cannot_escape_the_667_date_contract() -> None:
|
|
893
|
+
context = _context()
|
|
894
|
+
registry = _registry()
|
|
895
|
+
registry["as_of"] = "2026-W52-7"
|
|
896
|
+
resolved = resolve(context, registry)
|
|
897
|
+
with pytest.raises(ContractError, match="real ISO 8601 date"):
|
|
898
|
+
_build(_inventory(), PACKET_ROOT, context, registry, resolved)
|
|
899
|
+
|
|
900
|
+
|
|
901
|
+
def test_replayed_closed_authority_gate_stays_unresolved_without_default_profile() -> None:
|
|
902
|
+
context = _context("no-profile.json")
|
|
903
|
+
registry = _registry()
|
|
904
|
+
resolved = resolve(context, registry)
|
|
905
|
+
manifest = _build(_inventory(), PACKET_ROOT, context, registry, resolved)
|
|
906
|
+
assert manifest["authority_binding"]["state"] == "replay_validated"
|
|
907
|
+
assert manifest["authority_binding"]["resolution_state"] == "jurisdiction_unresolved"
|
|
908
|
+
assert manifest["entries"] == []
|
|
909
|
+
assert manifest["administrative_status"]["submission_readiness"] == "unresolved"
|
|
910
|
+
assert "AUTHORITY_RESOLUTION_NOT_PERMITTED" in _reason_codes(manifest)
|
|
911
|
+
|
|
912
|
+
|
|
913
|
+
@pytest.mark.parametrize("fact_id", tuple(ENVELOPE_EXPECTED))
|
|
914
|
+
@pytest.mark.parametrize("case", ["missing", "unknown", "outside"])
|
|
915
|
+
def test_each_v1_envelope_fact_is_load_bearing(
|
|
916
|
+
fact_id: str, case: str
|
|
917
|
+
) -> None:
|
|
918
|
+
context = _context()
|
|
919
|
+
rows = context["declared_facts"]
|
|
920
|
+
row = next(item for item in rows if item["fact_id"] == fact_id)
|
|
921
|
+
if case == "missing":
|
|
922
|
+
rows.remove(row)
|
|
923
|
+
expected_code = "V1_ENVELOPE_FACT_MISSING"
|
|
924
|
+
elif case == "unknown":
|
|
925
|
+
row["state"] = "unknown"
|
|
926
|
+
row["value"] = None
|
|
927
|
+
expected_code = "V1_ENVELOPE_FACT_UNKNOWN"
|
|
928
|
+
else:
|
|
929
|
+
row["value"] = not ENVELOPE_EXPECTED[fact_id]
|
|
930
|
+
expected_code = "V1_ENVELOPE_OUTSIDE"
|
|
931
|
+
registry = _registry()
|
|
932
|
+
resolved = resolve(context, registry)
|
|
933
|
+
manifest = _build(_inventory(), PACKET_ROOT, context, registry, resolved)
|
|
934
|
+
assert manifest["capability_envelope"]["state"] == "unresolved"
|
|
935
|
+
assert manifest["entries"] == []
|
|
936
|
+
assert manifest["administrative_status"]["submission_readiness"] == "unresolved"
|
|
937
|
+
assert any(
|
|
938
|
+
reason["code"] == expected_code and reason["fact_id"] == fact_id
|
|
939
|
+
for reason in manifest["unresolved_reasons"]
|
|
940
|
+
)
|
|
941
|
+
|
|
942
|
+
|
|
943
|
+
def test_all_seven_v1_envelope_facts_pass_together() -> None:
|
|
944
|
+
manifest = _build()
|
|
945
|
+
assert manifest["capability_envelope"]["state"] == "within_v1"
|
|
946
|
+
assert manifest["capability_envelope"]["reason_codes"] == []
|
|
947
|
+
assert {
|
|
948
|
+
row["fact_id"]: (row["required_value"], row["declared_value"])
|
|
949
|
+
for row in manifest["capability_envelope"]["facts"]
|
|
950
|
+
} == {key: (value, value) for key, value in ENVELOPE_EXPECTED.items()}
|
|
951
|
+
|
|
952
|
+
|
|
953
|
+
@pytest.mark.parametrize("overlay_kind", ["institutional", "funder"])
|
|
954
|
+
def test_not_provided_overlay_remains_visible_and_readiness_unresolved(
|
|
955
|
+
overlay_kind: str,
|
|
956
|
+
) -> None:
|
|
957
|
+
context = _context()
|
|
958
|
+
context["overlay_selection_state"][overlay_kind] = "not_provided"
|
|
959
|
+
registry = _registry()
|
|
960
|
+
resolved = resolve(context, registry)
|
|
961
|
+
manifest = _build(_inventory(), PACKET_ROOT, context, registry, resolved)
|
|
962
|
+
assert manifest["overlay_selection_state"][overlay_kind] == "not_provided"
|
|
963
|
+
assert manifest["administrative_status"]["submission_readiness"] == "unresolved"
|
|
964
|
+
assert any(
|
|
965
|
+
reason["code"] == "OVERLAY_SELECTION_NOT_PROVIDED"
|
|
966
|
+
and reason["overlay_kind"] == overlay_kind
|
|
967
|
+
for reason in manifest["unresolved_reasons"]
|
|
968
|
+
)
|
|
969
|
+
|
|
970
|
+
|
|
971
|
+
def test_us_packet_rows_respect_actor_scope_and_evidence_holder_boundaries() -> None:
|
|
972
|
+
manifest = _build()
|
|
973
|
+
participant = _entry(
|
|
974
|
+
manifest,
|
|
975
|
+
"us.45cfr46.116.informed-consent",
|
|
976
|
+
"consent.participant-materials",
|
|
977
|
+
)
|
|
978
|
+
determination = _entry(
|
|
979
|
+
manifest,
|
|
980
|
+
"us.45cfr46.116.informed-consent",
|
|
981
|
+
"consent.irb-determination",
|
|
982
|
+
)
|
|
983
|
+
assert participant["responsibility"] == "packet_owned"
|
|
984
|
+
assert participant["status"] == "DOCUMENTED"
|
|
985
|
+
assert participant["reason_codes"] == ["STRUCTURE_DOCUMENTED"]
|
|
986
|
+
assert participant["matched_artifact_ids"] == ["fixture.us-consent"]
|
|
987
|
+
assert determination["responsibility"] == "external_dependency"
|
|
988
|
+
assert determination["status"] == "ACCEPTANCE_UNVERIFIED"
|
|
989
|
+
assert determination["readiness_effect"] == "none"
|
|
990
|
+
assert determination["matched_artifact_ids"] == []
|
|
991
|
+
requirement_ids = {
|
|
992
|
+
row["requirement_ref"]["requirement_id"] for row in manifest["entries"]
|
|
993
|
+
}
|
|
994
|
+
assert "us.45cfr46.107.irb-composition" not in requirement_ids
|
|
995
|
+
assert not any(item.startswith("eu.gdpr") for item in requirement_ids)
|
|
996
|
+
assert manifest["administrative_status"]["submission_readiness"] == (
|
|
997
|
+
"no_listed_gaps_located"
|
|
998
|
+
)
|
|
999
|
+
|
|
1000
|
+
|
|
1001
|
+
def test_exact_obligated_actor_match_is_required_before_packet_ownership() -> None:
|
|
1002
|
+
inventory = _inventory()
|
|
1003
|
+
inventory["packet_responsibility_role_ids"].remove("investigator_and_irb")
|
|
1004
|
+
manifest = _build(inventory)
|
|
1005
|
+
participant = _entry(
|
|
1006
|
+
manifest,
|
|
1007
|
+
"us.45cfr46.116.informed-consent",
|
|
1008
|
+
"consent.participant-materials",
|
|
1009
|
+
)
|
|
1010
|
+
assert participant["responsibility"] == "external_dependency"
|
|
1011
|
+
assert participant["status"] == "ACCEPTANCE_UNVERIFIED"
|
|
1012
|
+
assert participant["readiness_effect"] == "none"
|
|
1013
|
+
|
|
1014
|
+
|
|
1015
|
+
def test_same_packet_inventory_produces_distinct_exact_us_and_tw_manifests() -> None:
|
|
1016
|
+
inventory = _inventory()
|
|
1017
|
+
us_context, registry, us_resolved = _authority("us-gdpr-two-axis.json")
|
|
1018
|
+
tw_context = _context("tw-gdpr-two-axis.json")
|
|
1019
|
+
tw_resolved = resolve(tw_context, registry)
|
|
1020
|
+
us = _build(inventory, PACKET_ROOT, us_context, registry, us_resolved)
|
|
1021
|
+
tw = _build(inventory, PACKET_ROOT, tw_context, registry, tw_resolved)
|
|
1022
|
+
us_row = _entry(
|
|
1023
|
+
us,
|
|
1024
|
+
"us.45cfr46.116.informed-consent",
|
|
1025
|
+
"consent.participant-materials",
|
|
1026
|
+
)
|
|
1027
|
+
tw_row = _entry(
|
|
1028
|
+
tw,
|
|
1029
|
+
"tw.hsra.article-14.consent-information",
|
|
1030
|
+
"consent.article-14-materials",
|
|
1031
|
+
)
|
|
1032
|
+
assert us_row["status"] == tw_row["status"] == "DOCUMENTED"
|
|
1033
|
+
assert us_row["matched_artifact_ids"] == ["fixture.us-consent"]
|
|
1034
|
+
assert tw_row["matched_artifact_ids"] == ["fixture.tw-consent"]
|
|
1035
|
+
assert us["manifest_digest"] != tw["manifest_digest"]
|
|
1036
|
+
assert not any(
|
|
1037
|
+
row["requirement_ref"]["requirement_id"].startswith("tw.")
|
|
1038
|
+
for row in us["entries"]
|
|
1039
|
+
)
|
|
1040
|
+
assert not any(
|
|
1041
|
+
row["requirement_ref"]["requirement_id"].startswith("us.")
|
|
1042
|
+
for row in tw["entries"]
|
|
1043
|
+
)
|
|
1044
|
+
|
|
1045
|
+
|
|
1046
|
+
def test_same_packet_conditional_fact_true_false_unknown_is_not_inferred() -> None:
|
|
1047
|
+
context, registry, _resolved, overlay = _synthetic_overlay_authority()
|
|
1048
|
+
base = next(
|
|
1049
|
+
row
|
|
1050
|
+
for row in overlay["requirements"]
|
|
1051
|
+
if row["requirement_id"] == "synthetic.packet.base-consent"
|
|
1052
|
+
)
|
|
1053
|
+
base["applies_if"] = {
|
|
1054
|
+
"op": "fact_equals",
|
|
1055
|
+
"fact_id": "data.special_category",
|
|
1056
|
+
"value": True,
|
|
1057
|
+
}
|
|
1058
|
+
_repin_overlay(context, overlay)
|
|
1059
|
+
special = next(
|
|
1060
|
+
row
|
|
1061
|
+
for row in context["declared_facts"]
|
|
1062
|
+
if row["fact_id"] == "data.special_category"
|
|
1063
|
+
)
|
|
1064
|
+
|
|
1065
|
+
special["state"], special["value"] = "declared", False
|
|
1066
|
+
false_manifest = _build(
|
|
1067
|
+
_inventory(), PACKET_ROOT, context, registry, resolve(context, registry)
|
|
1068
|
+
)
|
|
1069
|
+
assert any(
|
|
1070
|
+
row["requirement_ref"]["requirement_id"]
|
|
1071
|
+
== "synthetic.packet.base-consent"
|
|
1072
|
+
for row in false_manifest["excluded_requirements"]
|
|
1073
|
+
)
|
|
1074
|
+
|
|
1075
|
+
special["value"] = True
|
|
1076
|
+
true_manifest = _build(
|
|
1077
|
+
_inventory(), PACKET_ROOT, context, registry, resolve(context, registry)
|
|
1078
|
+
)
|
|
1079
|
+
assert _entry(
|
|
1080
|
+
true_manifest,
|
|
1081
|
+
"synthetic.packet.base-consent",
|
|
1082
|
+
"synthetic.base-consent",
|
|
1083
|
+
)["status"] == "NOT_LOCATED"
|
|
1084
|
+
|
|
1085
|
+
special["state"], special["value"] = "unknown", None
|
|
1086
|
+
unknown_manifest = _build(
|
|
1087
|
+
_inventory(), PACKET_ROOT, context, registry, resolve(context, registry)
|
|
1088
|
+
)
|
|
1089
|
+
assert unknown_manifest["entries"] == []
|
|
1090
|
+
assert unknown_manifest["excluded_requirements"] == []
|
|
1091
|
+
assert "AUTHORITY_RESOLUTION_NOT_PERMITTED" in _reason_codes(unknown_manifest)
|
|
1092
|
+
assert len(
|
|
1093
|
+
{
|
|
1094
|
+
false_manifest["manifest_digest"],
|
|
1095
|
+
true_manifest["manifest_digest"],
|
|
1096
|
+
unknown_manifest["manifest_digest"],
|
|
1097
|
+
}
|
|
1098
|
+
) == 3
|
|
1099
|
+
|
|
1100
|
+
|
|
1101
|
+
def test_parallel_collision_entries_survive_display_precedence_changes() -> None:
|
|
1102
|
+
context, registry, _resolved, overlay = _synthetic_overlay_authority()
|
|
1103
|
+
base = next(
|
|
1104
|
+
row
|
|
1105
|
+
for row in overlay["requirements"]
|
|
1106
|
+
if row["requirement_id"] == "synthetic.packet.base-consent"
|
|
1107
|
+
)
|
|
1108
|
+
base["interaction"]["collision_key"] = "participant.information"
|
|
1109
|
+
_repin_overlay(context, overlay)
|
|
1110
|
+
first_resolved = resolve(context, registry)
|
|
1111
|
+
collision = next(
|
|
1112
|
+
row
|
|
1113
|
+
for row in first_resolved["collisions"]
|
|
1114
|
+
if row["collision_key"] == "participant.information"
|
|
1115
|
+
)
|
|
1116
|
+
assert {
|
|
1117
|
+
"us.45cfr46.116.informed-consent",
|
|
1118
|
+
"synthetic.packet.base-consent",
|
|
1119
|
+
} <= set(collision["requirement_ids"])
|
|
1120
|
+
first = _build(_inventory(), PACKET_ROOT, context, registry, first_resolved)
|
|
1121
|
+
live = _entry(
|
|
1122
|
+
first,
|
|
1123
|
+
"us.45cfr46.116.informed-consent",
|
|
1124
|
+
"consent.participant-materials",
|
|
1125
|
+
)
|
|
1126
|
+
parallel = _entry(
|
|
1127
|
+
first,
|
|
1128
|
+
"synthetic.packet.base-consent",
|
|
1129
|
+
"synthetic.base-consent",
|
|
1130
|
+
)
|
|
1131
|
+
assert live["requirement_ref"]["authority_kind"] == "profile"
|
|
1132
|
+
assert live["requirement_ref"]["requirement_pointer"].startswith("/profiles/")
|
|
1133
|
+
assert parallel["requirement_ref"]["authority_kind"] == "institutional_overlay"
|
|
1134
|
+
assert parallel["requirement_ref"]["requirement_pointer"].startswith("/overlays/")
|
|
1135
|
+
assert live["requirement_ref"]["authority_digest"] != parallel[
|
|
1136
|
+
"requirement_ref"
|
|
1137
|
+
]["authority_digest"]
|
|
1138
|
+
|
|
1139
|
+
review = next(
|
|
1140
|
+
row
|
|
1141
|
+
for row in context["display_precedence"]
|
|
1142
|
+
if row["axis"] == "review_ethics"
|
|
1143
|
+
)
|
|
1144
|
+
review["ordered_authorities"].reverse()
|
|
1145
|
+
second_resolved = resolve(context, registry)
|
|
1146
|
+
assert second_resolved["trace_order"] != first_resolved["trace_order"]
|
|
1147
|
+
second = _build(_inventory(), PACKET_ROOT, context, registry, second_resolved)
|
|
1148
|
+
assert second["entries"] == first["entries"]
|
|
1149
|
+
assert second["excluded_requirements"] == first["excluded_requirements"]
|
|
1150
|
+
assert second["authority_binding"] != first["authority_binding"]
|
|
1151
|
+
|
|
1152
|
+
|
|
1153
|
+
def _bounded_requirement_result(requirement_id: str, applicability: str) -> dict[str, Any]:
|
|
1154
|
+
return {
|
|
1155
|
+
"requirement_id": requirement_id,
|
|
1156
|
+
"authority_kind": "profile",
|
|
1157
|
+
"authority_id": "synthetic.profile",
|
|
1158
|
+
"authority_version": "1.0",
|
|
1159
|
+
"authority_digest": "0" * 64,
|
|
1160
|
+
"axis": "review_ethics",
|
|
1161
|
+
"obligated_actor": "investigator",
|
|
1162
|
+
"consumer_scopes": ["submission_packet"],
|
|
1163
|
+
"applicability": applicability,
|
|
1164
|
+
"predicate_trace": [],
|
|
1165
|
+
"requirement_digest": "0" * 64,
|
|
1166
|
+
"requirement_pointer": "/profiles/0/requirements/0",
|
|
1167
|
+
"authority_anchor_pointer": "/profiles/0/requirements/0/authority_anchor",
|
|
1168
|
+
}
|
|
1169
|
+
|
|
1170
|
+
|
|
1171
|
+
def test_manifest_entry_bound_accepts_4096_and_rejects_4097(
|
|
1172
|
+
monkeypatch: pytest.MonkeyPatch,
|
|
1173
|
+
) -> None:
|
|
1174
|
+
evidence_rows = [
|
|
1175
|
+
{
|
|
1176
|
+
"evidence_id": f"synthetic.evidence.{index:04d}",
|
|
1177
|
+
"held_by": "external_holder",
|
|
1178
|
+
"artifact_type": "synthetic_artifact",
|
|
1179
|
+
"description": "Digest-only synthetic row.",
|
|
1180
|
+
}
|
|
1181
|
+
for index in range(packet_runtime.MAX_MANIFEST_ENTRIES)
|
|
1182
|
+
]
|
|
1183
|
+
|
|
1184
|
+
def fake_requirement(
|
|
1185
|
+
_result: dict[str, Any], _registry: dict[str, Any]
|
|
1186
|
+
) -> tuple[dict[str, Any], list[dict[str, Any]]]:
|
|
1187
|
+
return {"waiver_or_exception_route": None}, evidence_rows
|
|
1188
|
+
|
|
1189
|
+
monkeypatch.setattr(packet_runtime, "_resolved_requirement", fake_requirement)
|
|
1190
|
+
inventory = {
|
|
1191
|
+
"packet_responsibility_role_ids": ["investigator"],
|
|
1192
|
+
"waiver_or_exception_claims": [],
|
|
1193
|
+
"artifacts": [],
|
|
1194
|
+
}
|
|
1195
|
+
resolved = {
|
|
1196
|
+
"requirement_results": [
|
|
1197
|
+
_bounded_requirement_result("synthetic.requirement", "true")
|
|
1198
|
+
]
|
|
1199
|
+
}
|
|
1200
|
+
entries, excluded = packet_runtime._evidence_entries(
|
|
1201
|
+
inventory, {}, {}, resolved, []
|
|
1202
|
+
)
|
|
1203
|
+
assert len(entries) == packet_runtime.MAX_MANIFEST_ENTRIES
|
|
1204
|
+
assert excluded == []
|
|
1205
|
+
|
|
1206
|
+
evidence_rows.append(
|
|
1207
|
+
{
|
|
1208
|
+
"evidence_id": "synthetic.evidence.overflow",
|
|
1209
|
+
"held_by": "external_holder",
|
|
1210
|
+
"artifact_type": "synthetic_artifact",
|
|
1211
|
+
"description": "Overflow row.",
|
|
1212
|
+
}
|
|
1213
|
+
)
|
|
1214
|
+
with pytest.raises(ContractError, match="4096 submission-packet evidence entries"):
|
|
1215
|
+
packet_runtime._evidence_entries(inventory, {}, {}, resolved, [])
|
|
1216
|
+
|
|
1217
|
+
|
|
1218
|
+
def test_manifest_canonical_byte_bound_is_inclusive(
|
|
1219
|
+
monkeypatch: pytest.MonkeyPatch,
|
|
1220
|
+
) -> None:
|
|
1221
|
+
assert packet_runtime.MAX_MANIFEST_BYTES == 8 * 1024 * 1024
|
|
1222
|
+
inventory = _inventory()
|
|
1223
|
+
context, registry, resolved = _authority()
|
|
1224
|
+
baseline = _build(inventory, PACKET_ROOT, context, registry, resolved)
|
|
1225
|
+
exact_size = len(packet_runtime._canonical_bytes(baseline))
|
|
1226
|
+
|
|
1227
|
+
monkeypatch.setattr(packet_runtime, "MAX_MANIFEST_BYTES", exact_size)
|
|
1228
|
+
assert _build(inventory, PACKET_ROOT, context, registry, resolved) == baseline
|
|
1229
|
+
validate_submission_packet_manifest(
|
|
1230
|
+
baseline,
|
|
1231
|
+
inventory,
|
|
1232
|
+
PACKET_ROOT,
|
|
1233
|
+
context=context,
|
|
1234
|
+
registry=registry,
|
|
1235
|
+
resolved=resolved,
|
|
1236
|
+
)
|
|
1237
|
+
assert render_submission_packet_manifest(baseline).startswith(
|
|
1238
|
+
"# Human-Subjects Submission-Packet Manifest"
|
|
1239
|
+
)
|
|
1240
|
+
|
|
1241
|
+
monkeypatch.setattr(packet_runtime, "MAX_MANIFEST_BYTES", exact_size - 1)
|
|
1242
|
+
with pytest.raises(ContractError, match="canonical JSON exceeds"):
|
|
1243
|
+
_build(inventory, PACKET_ROOT, context, registry, resolved)
|
|
1244
|
+
with pytest.raises(ContractError, match="canonical JSON exceeds"):
|
|
1245
|
+
validate_submission_packet_manifest(
|
|
1246
|
+
baseline,
|
|
1247
|
+
inventory,
|
|
1248
|
+
PACKET_ROOT,
|
|
1249
|
+
context=context,
|
|
1250
|
+
registry=registry,
|
|
1251
|
+
resolved=resolved,
|
|
1252
|
+
)
|
|
1253
|
+
with pytest.raises(ContractError, match="canonical JSON exceeds"):
|
|
1254
|
+
render_submission_packet_manifest(baseline)
|
|
1255
|
+
|
|
1256
|
+
|
|
1257
|
+
def test_consumer_scope_bound_accepts_512_and_rejects_513(
|
|
1258
|
+
monkeypatch: pytest.MonkeyPatch,
|
|
1259
|
+
) -> None:
|
|
1260
|
+
evidence_rows = [
|
|
1261
|
+
{
|
|
1262
|
+
"evidence_id": "synthetic.evidence",
|
|
1263
|
+
"held_by": "external_holder",
|
|
1264
|
+
"artifact_type": "synthetic_artifact",
|
|
1265
|
+
"description": "Bounded scope row.",
|
|
1266
|
+
}
|
|
1267
|
+
]
|
|
1268
|
+
monkeypatch.setattr(
|
|
1269
|
+
packet_runtime,
|
|
1270
|
+
"_resolved_requirement",
|
|
1271
|
+
lambda _result, _registry: ({"waiver_or_exception_route": None}, evidence_rows),
|
|
1272
|
+
)
|
|
1273
|
+
inventory = {
|
|
1274
|
+
"packet_responsibility_role_ids": ["investigator"],
|
|
1275
|
+
"waiver_or_exception_claims": [],
|
|
1276
|
+
"artifacts": [],
|
|
1277
|
+
}
|
|
1278
|
+
result = _bounded_requirement_result("synthetic.requirement", "true")
|
|
1279
|
+
result["consumer_scopes"] = sorted(
|
|
1280
|
+
["submission_packet"]
|
|
1281
|
+
+ [
|
|
1282
|
+
f"synthetic.scope.{index:04d}"
|
|
1283
|
+
for index in range(packet_runtime.MAX_CONSUMER_SCOPES - 1)
|
|
1284
|
+
]
|
|
1285
|
+
)
|
|
1286
|
+
entries, _excluded = packet_runtime._evidence_entries(
|
|
1287
|
+
inventory, {}, {}, {"requirement_results": [result]}, []
|
|
1288
|
+
)
|
|
1289
|
+
assert len(entries[0]["requirement_ref"]["consumer_scopes"]) == (
|
|
1290
|
+
packet_runtime.MAX_CONSUMER_SCOPES
|
|
1291
|
+
)
|
|
1292
|
+
|
|
1293
|
+
result["consumer_scopes"].append("synthetic.scope.overflow")
|
|
1294
|
+
with pytest.raises(ContractError, match="consumer scopes exceed 512"):
|
|
1295
|
+
packet_runtime._evidence_entries(
|
|
1296
|
+
inventory, {}, {}, {"requirement_results": [result]}, []
|
|
1297
|
+
)
|
|
1298
|
+
|
|
1299
|
+
|
|
1300
|
+
def test_evidence_expansion_indexes_inventory_bindings_once(
|
|
1301
|
+
monkeypatch: pytest.MonkeyPatch,
|
|
1302
|
+
) -> None:
|
|
1303
|
+
class CountingBindings(list[dict[str, str]]):
|
|
1304
|
+
iterations = 0
|
|
1305
|
+
|
|
1306
|
+
def __iter__(self): # type: ignore[no-untyped-def]
|
|
1307
|
+
type(self).iterations += 1
|
|
1308
|
+
return super().__iter__()
|
|
1309
|
+
|
|
1310
|
+
bindings = CountingBindings(
|
|
1311
|
+
[
|
|
1312
|
+
{
|
|
1313
|
+
"requirement_id": "synthetic.requirement",
|
|
1314
|
+
"evidence_id": "synthetic.evidence.0000",
|
|
1315
|
+
}
|
|
1316
|
+
]
|
|
1317
|
+
)
|
|
1318
|
+
artifact = {
|
|
1319
|
+
"artifact_id": "synthetic.artifact",
|
|
1320
|
+
"evidence_bindings": bindings,
|
|
1321
|
+
}
|
|
1322
|
+
inventory = {
|
|
1323
|
+
"packet_responsibility_role_ids": ["investigator"],
|
|
1324
|
+
"waiver_or_exception_claims": [],
|
|
1325
|
+
"artifacts": [artifact],
|
|
1326
|
+
}
|
|
1327
|
+
evidence_rows = [
|
|
1328
|
+
{
|
|
1329
|
+
"evidence_id": f"synthetic.evidence.{index:04d}",
|
|
1330
|
+
"held_by": "external_holder",
|
|
1331
|
+
"artifact_type": "synthetic_artifact",
|
|
1332
|
+
"description": "Indexed synthetic row.",
|
|
1333
|
+
}
|
|
1334
|
+
for index in range(128)
|
|
1335
|
+
]
|
|
1336
|
+
monkeypatch.setattr(
|
|
1337
|
+
packet_runtime,
|
|
1338
|
+
"_resolved_requirement",
|
|
1339
|
+
lambda _result, _registry: ({"waiver_or_exception_route": None}, evidence_rows),
|
|
1340
|
+
)
|
|
1341
|
+
result = _bounded_requirement_result("synthetic.requirement", "true")
|
|
1342
|
+
entries, _excluded = packet_runtime._evidence_entries(
|
|
1343
|
+
inventory, {}, {}, {"requirement_results": [result]}, []
|
|
1344
|
+
)
|
|
1345
|
+
assert len(entries) == len(evidence_rows)
|
|
1346
|
+
assert CountingBindings.iterations == 1
|
|
1347
|
+
|
|
1348
|
+
|
|
1349
|
+
def test_profiled_route_result_is_cached_per_requirement(
|
|
1350
|
+
monkeypatch: pytest.MonkeyPatch,
|
|
1351
|
+
) -> None:
|
|
1352
|
+
inventory = {
|
|
1353
|
+
"packet_responsibility_role_ids": ["investigator"],
|
|
1354
|
+
"waiver_or_exception_claims": [],
|
|
1355
|
+
"artifacts": [],
|
|
1356
|
+
}
|
|
1357
|
+
evidence_rows = [
|
|
1358
|
+
{
|
|
1359
|
+
"evidence_id": f"synthetic.evidence.{index:04d}",
|
|
1360
|
+
"held_by": "investigator",
|
|
1361
|
+
"artifact_type": "synthetic_artifact",
|
|
1362
|
+
"description": "Missing synthetic row.",
|
|
1363
|
+
}
|
|
1364
|
+
for index in range(128)
|
|
1365
|
+
]
|
|
1366
|
+
monkeypatch.setattr(
|
|
1367
|
+
packet_runtime,
|
|
1368
|
+
"_resolved_requirement",
|
|
1369
|
+
lambda _result, _registry: (
|
|
1370
|
+
{
|
|
1371
|
+
"waiver_or_exception_route": {
|
|
1372
|
+
"state": "profiled",
|
|
1373
|
+
"requirement_ids": ["synthetic.route"],
|
|
1374
|
+
}
|
|
1375
|
+
},
|
|
1376
|
+
evidence_rows,
|
|
1377
|
+
),
|
|
1378
|
+
)
|
|
1379
|
+
calls = 0
|
|
1380
|
+
|
|
1381
|
+
def counted_route(*_args: Any, **_kwargs: Any) -> bool:
|
|
1382
|
+
nonlocal calls
|
|
1383
|
+
calls += 1
|
|
1384
|
+
return False
|
|
1385
|
+
|
|
1386
|
+
monkeypatch.setattr(
|
|
1387
|
+
packet_runtime, "_located_profiled_route_claim", counted_route
|
|
1388
|
+
)
|
|
1389
|
+
result = _bounded_requirement_result("synthetic.requirement", "true")
|
|
1390
|
+
entries, _excluded = packet_runtime._evidence_entries(
|
|
1391
|
+
inventory, {}, {}, {"requirement_results": [result]}, []
|
|
1392
|
+
)
|
|
1393
|
+
assert len(entries) == len(evidence_rows)
|
|
1394
|
+
assert calls == 1
|
|
1395
|
+
|
|
1396
|
+
|
|
1397
|
+
def test_excluded_requirement_bound_accepts_4096_and_rejects_4097() -> None:
|
|
1398
|
+
inventory = {
|
|
1399
|
+
"packet_responsibility_role_ids": ["investigator"],
|
|
1400
|
+
"waiver_or_exception_claims": [],
|
|
1401
|
+
"artifacts": [],
|
|
1402
|
+
}
|
|
1403
|
+
results = [
|
|
1404
|
+
_bounded_requirement_result(f"synthetic.requirement.{index:04d}", "false")
|
|
1405
|
+
for index in range(packet_runtime.MAX_EXCLUDED_REQUIREMENTS)
|
|
1406
|
+
]
|
|
1407
|
+
_entries, excluded = packet_runtime._evidence_entries(
|
|
1408
|
+
inventory, {}, {}, {"requirement_results": results}, []
|
|
1409
|
+
)
|
|
1410
|
+
assert len(excluded) == packet_runtime.MAX_EXCLUDED_REQUIREMENTS
|
|
1411
|
+
|
|
1412
|
+
results.append(
|
|
1413
|
+
_bounded_requirement_result("synthetic.requirement.overflow", "false")
|
|
1414
|
+
)
|
|
1415
|
+
with pytest.raises(
|
|
1416
|
+
ContractError, match="4096 excluded submission-packet requirements"
|
|
1417
|
+
):
|
|
1418
|
+
packet_runtime._evidence_entries(
|
|
1419
|
+
inventory, {}, {}, {"requirement_results": results}, []
|
|
1420
|
+
)
|
|
1421
|
+
|
|
1422
|
+
|
|
1423
|
+
def test_absent_binding_is_not_located_but_external_evidence_is_not_a_false_gap() -> None:
|
|
1424
|
+
inventory = _inventory()
|
|
1425
|
+
_artifact(inventory, "fixture.us-consent")["evidence_bindings"] = []
|
|
1426
|
+
manifest = _build(inventory)
|
|
1427
|
+
participant = _entry(
|
|
1428
|
+
manifest,
|
|
1429
|
+
"us.45cfr46.116.informed-consent",
|
|
1430
|
+
"consent.participant-materials",
|
|
1431
|
+
)
|
|
1432
|
+
determination = _entry(
|
|
1433
|
+
manifest,
|
|
1434
|
+
"us.45cfr46.116.informed-consent",
|
|
1435
|
+
"consent.irb-determination",
|
|
1436
|
+
)
|
|
1437
|
+
assert participant["status"] == "NOT_LOCATED"
|
|
1438
|
+
assert participant["readiness_effect"] == "gap"
|
|
1439
|
+
assert participant["reason_codes"] == ["EXPECTED_PACKET_ARTIFACT_NOT_LOCATED"]
|
|
1440
|
+
assert determination["status"] == "ACCEPTANCE_UNVERIFIED"
|
|
1441
|
+
assert determination["readiness_effect"] == "none"
|
|
1442
|
+
assert manifest["administrative_status"]["submission_readiness"] == "gaps_located"
|
|
1443
|
+
|
|
1444
|
+
|
|
1445
|
+
def test_two_artifacts_claiming_one_evidence_binding_conflict(tmp_path: Path) -> None:
|
|
1446
|
+
packet = _packet_copy(tmp_path)
|
|
1447
|
+
inventory = _inventory()
|
|
1448
|
+
duplicate = copy.deepcopy(_artifact(inventory, "fixture.us-consent"))
|
|
1449
|
+
duplicate["artifact_id"] = "fixture.us-consent-copy"
|
|
1450
|
+
duplicate["relative_path"] = "us-consent-copy.txt"
|
|
1451
|
+
shutil.copy2(packet / "consent-materials.txt", packet / duplicate["relative_path"])
|
|
1452
|
+
inventory["artifacts"].append(duplicate)
|
|
1453
|
+
manifest = _build(inventory, packet)
|
|
1454
|
+
row = _entry(
|
|
1455
|
+
manifest,
|
|
1456
|
+
"us.45cfr46.116.informed-consent",
|
|
1457
|
+
"consent.participant-materials",
|
|
1458
|
+
)
|
|
1459
|
+
assert row["status"] == "CONFLICTING"
|
|
1460
|
+
assert row["readiness_effect"] == "gap"
|
|
1461
|
+
assert "DUPLICATE_EVIDENCE_BINDING" in row["reason_codes"]
|
|
1462
|
+
assert row["matched_artifact_ids"] == [
|
|
1463
|
+
"fixture.us-consent",
|
|
1464
|
+
"fixture.us-consent-copy",
|
|
1465
|
+
]
|
|
1466
|
+
|
|
1467
|
+
|
|
1468
|
+
@pytest.mark.parametrize(
|
|
1469
|
+
("mutation", "reason"),
|
|
1470
|
+
[
|
|
1471
|
+
("missing_file", "DECLARED_ATTACHMENT_NOT_LOCATED"),
|
|
1472
|
+
("digest", "ARTIFACT_DIGEST_MISMATCH"),
|
|
1473
|
+
("size", "ARTIFACT_SIZE_MISMATCH"),
|
|
1474
|
+
("type", "ARTIFACT_TYPE_MISMATCH"),
|
|
1475
|
+
("holder", "ARTIFACT_HOLDER_MISMATCH"),
|
|
1476
|
+
],
|
|
1477
|
+
)
|
|
1478
|
+
def test_declared_attachment_internal_conflicts_are_deterministic(
|
|
1479
|
+
tmp_path: Path, mutation: str, reason: str
|
|
1480
|
+
) -> None:
|
|
1481
|
+
packet = _packet_copy(tmp_path)
|
|
1482
|
+
inventory = _inventory()
|
|
1483
|
+
artifact = _artifact(inventory, "fixture.us-consent")
|
|
1484
|
+
if mutation == "missing_file":
|
|
1485
|
+
(packet / artifact["relative_path"]).unlink()
|
|
1486
|
+
elif mutation == "digest":
|
|
1487
|
+
artifact["declared_sha256"] = "0" * 64
|
|
1488
|
+
elif mutation == "size":
|
|
1489
|
+
artifact["declared_size_bytes"] += 1
|
|
1490
|
+
elif mutation == "type":
|
|
1491
|
+
artifact["artifact_type"] = "protocol"
|
|
1492
|
+
elif mutation == "holder":
|
|
1493
|
+
artifact["declared_holder_role_id"] = "principal_investigator"
|
|
1494
|
+
manifest = _build(inventory, packet)
|
|
1495
|
+
row = _entry(
|
|
1496
|
+
manifest,
|
|
1497
|
+
"us.45cfr46.116.informed-consent",
|
|
1498
|
+
"consent.participant-materials",
|
|
1499
|
+
)
|
|
1500
|
+
assert row["status"] == "CONFLICTING"
|
|
1501
|
+
assert row["readiness_effect"] == "gap"
|
|
1502
|
+
assert reason in row["reason_codes"]
|
|
1503
|
+
assert manifest["administrative_status"]["submission_readiness"] == "gaps_located"
|
|
1504
|
+
|
|
1505
|
+
|
|
1506
|
+
@pytest.mark.parametrize("signature_state", ["not_located", "unknown"])
|
|
1507
|
+
def test_declared_signature_state_does_not_invent_a_requirement(
|
|
1508
|
+
signature_state: str,
|
|
1509
|
+
) -> None:
|
|
1510
|
+
inventory = _inventory()
|
|
1511
|
+
artifact = _artifact(inventory, "fixture.us-consent")
|
|
1512
|
+
artifact["declared_structure"]["signature_blocks"][0]["state"] = signature_state
|
|
1513
|
+
artifact["declared_structure"]["certificate"] = None
|
|
1514
|
+
row = _entry(
|
|
1515
|
+
_build(inventory),
|
|
1516
|
+
"us.45cfr46.116.informed-consent",
|
|
1517
|
+
"consent.participant-materials",
|
|
1518
|
+
)
|
|
1519
|
+
assert row["status"] == "DOCUMENTED"
|
|
1520
|
+
assert row["reason_codes"] == ["STRUCTURE_DOCUMENTED"]
|
|
1521
|
+
|
|
1522
|
+
|
|
1523
|
+
@pytest.mark.parametrize(
|
|
1524
|
+
("issued_on", "expires_on"),
|
|
1525
|
+
[("2000-01-01", "2001-01-01"), ("2099-01-01", "2100-01-01")],
|
|
1526
|
+
)
|
|
1527
|
+
def test_certificate_dates_do_not_invent_freshness_requirements(
|
|
1528
|
+
issued_on: str, expires_on: str
|
|
1529
|
+
) -> None:
|
|
1530
|
+
context, registry, resolved, _overlay = _synthetic_overlay_authority()
|
|
1531
|
+
inventory = _waiver_inventory()
|
|
1532
|
+
certificate = _artifact(inventory, "fixture.training-certificate")[
|
|
1533
|
+
"declared_structure"
|
|
1534
|
+
]["certificate"]
|
|
1535
|
+
assert certificate is not None
|
|
1536
|
+
certificate["issued_on"] = issued_on
|
|
1537
|
+
certificate["expires_on"] = expires_on
|
|
1538
|
+
row = _entry(
|
|
1539
|
+
_build(inventory, PACKET_ROOT, context, registry, resolved),
|
|
1540
|
+
"synthetic.packet.waiver-route",
|
|
1541
|
+
"synthetic.waiver-decision",
|
|
1542
|
+
)
|
|
1543
|
+
assert row["status"] == "DOCUMENTED"
|
|
1544
|
+
assert row["reason_codes"] == ["STRUCTURE_DOCUMENTED"]
|
|
1545
|
+
|
|
1546
|
+
|
|
1547
|
+
def test_schema_valid_reversed_certificate_interval_is_a_manifest_conflict() -> None:
|
|
1548
|
+
context, registry, resolved, _overlay = _synthetic_overlay_authority()
|
|
1549
|
+
inventory = _waiver_inventory()
|
|
1550
|
+
certificate = _artifact(inventory, "fixture.training-certificate")[
|
|
1551
|
+
"declared_structure"
|
|
1552
|
+
]["certificate"]
|
|
1553
|
+
assert certificate is not None
|
|
1554
|
+
certificate["issued_on"] = "2026-01-02"
|
|
1555
|
+
certificate["expires_on"] = "2026-01-01"
|
|
1556
|
+
_validator(INVENTORY_SCHEMA).validate(inventory)
|
|
1557
|
+
validate_submission_packet_inventory(inventory)
|
|
1558
|
+
|
|
1559
|
+
row = _entry(
|
|
1560
|
+
_build(inventory, PACKET_ROOT, context, registry, resolved),
|
|
1561
|
+
"synthetic.packet.waiver-route",
|
|
1562
|
+
"synthetic.waiver-decision",
|
|
1563
|
+
)
|
|
1564
|
+
assert row["status"] == "CONFLICTING"
|
|
1565
|
+
assert row["readiness_effect"] == "gap"
|
|
1566
|
+
assert row["reason_codes"] == ["DECLARED_STRUCTURE_CONFLICT"]
|
|
1567
|
+
|
|
1568
|
+
|
|
1569
|
+
def test_certificate_internal_holder_conflict_uses_only_synthetic_overlay() -> None:
|
|
1570
|
+
context, registry, resolved, _overlay = _synthetic_overlay_authority()
|
|
1571
|
+
inventory = _waiver_inventory()
|
|
1572
|
+
certificate = _artifact(inventory, "fixture.training-certificate")[
|
|
1573
|
+
"declared_structure"
|
|
1574
|
+
]["certificate"]
|
|
1575
|
+
assert certificate is not None
|
|
1576
|
+
certificate["holder_role_id"] = "principal_investigator"
|
|
1577
|
+
manifest = _build(inventory, PACKET_ROOT, context, registry, resolved)
|
|
1578
|
+
row = _entry(
|
|
1579
|
+
manifest,
|
|
1580
|
+
"synthetic.packet.waiver-route",
|
|
1581
|
+
"synthetic.waiver-decision",
|
|
1582
|
+
)
|
|
1583
|
+
assert row["status"] == "CONFLICTING"
|
|
1584
|
+
assert "CERTIFICATE_HOLDER_MISMATCH" in row["reason_codes"]
|
|
1585
|
+
|
|
1586
|
+
|
|
1587
|
+
def test_status_vocabulary_is_covered_without_inventing_a_verdict() -> None:
|
|
1588
|
+
documented = _build()
|
|
1589
|
+
missing_inventory = _inventory()
|
|
1590
|
+
_artifact(missing_inventory, "fixture.us-consent")["evidence_bindings"] = []
|
|
1591
|
+
not_located = _build(missing_inventory)
|
|
1592
|
+
conflict_inventory = _inventory()
|
|
1593
|
+
_artifact(conflict_inventory, "fixture.us-consent")["declared_sha256"] = "0" * 64
|
|
1594
|
+
conflicting = _build(conflict_inventory)
|
|
1595
|
+
unresolved_context = _context()
|
|
1596
|
+
unresolved_context["declared_facts"] = [
|
|
1597
|
+
row
|
|
1598
|
+
for row in unresolved_context["declared_facts"]
|
|
1599
|
+
if row["fact_id"] != "packet_v1.non_clinical"
|
|
1600
|
+
]
|
|
1601
|
+
registry = _registry()
|
|
1602
|
+
applicability = _build(
|
|
1603
|
+
_inventory(),
|
|
1604
|
+
PACKET_ROOT,
|
|
1605
|
+
unresolved_context,
|
|
1606
|
+
registry,
|
|
1607
|
+
resolve(unresolved_context, registry),
|
|
1608
|
+
)
|
|
1609
|
+
observed_statuses = {
|
|
1610
|
+
row["status"]
|
|
1611
|
+
for manifest in (documented, not_located, conflicting, applicability)
|
|
1612
|
+
for key in ("entries", "unresolved_reasons")
|
|
1613
|
+
for row in manifest[key]
|
|
1614
|
+
}
|
|
1615
|
+
assert observed_statuses == {
|
|
1616
|
+
"DOCUMENTED",
|
|
1617
|
+
"NOT_LOCATED",
|
|
1618
|
+
"CONFLICTING",
|
|
1619
|
+
"APPLICABILITY_UNRESOLVED",
|
|
1620
|
+
"ACCEPTANCE_UNVERIFIED",
|
|
1621
|
+
}
|
|
1622
|
+
|
|
1623
|
+
|
|
1624
|
+
def test_exact_profiled_waiver_route_avoids_false_gap_but_never_claims_grant() -> None:
|
|
1625
|
+
context, registry, resolved, _overlay = _synthetic_overlay_authority()
|
|
1626
|
+
inventory = _waiver_inventory()
|
|
1627
|
+
manifest = _build(inventory, PACKET_ROOT, context, registry, resolved)
|
|
1628
|
+
route = _entry(
|
|
1629
|
+
manifest,
|
|
1630
|
+
"synthetic.packet.waiver-route",
|
|
1631
|
+
"synthetic.waiver-decision",
|
|
1632
|
+
)
|
|
1633
|
+
base = _entry(
|
|
1634
|
+
manifest,
|
|
1635
|
+
"synthetic.packet.base-consent",
|
|
1636
|
+
"synthetic.base-consent",
|
|
1637
|
+
)
|
|
1638
|
+
assert route["status"] == "DOCUMENTED"
|
|
1639
|
+
assert route["matched_artifact_ids"] == ["fixture.training-certificate"]
|
|
1640
|
+
assert base["responsibility"] == "packet_owned"
|
|
1641
|
+
assert base["status"] == "ACCEPTANCE_UNVERIFIED"
|
|
1642
|
+
assert base["readiness_effect"] == "unresolved"
|
|
1643
|
+
assert base["reason_codes"] == ["WAIVER_OR_EXCEPTION_CLAIM_UNVERIFIED"]
|
|
1644
|
+
assert "NOT_LOCATED" not in base["status"]
|
|
1645
|
+
assert manifest["administrative_status"]["submission_readiness"] == "unresolved"
|
|
1646
|
+
encoded = json.dumps(manifest, sort_keys=True).casefold()
|
|
1647
|
+
assert "waiver_granted" not in encoded
|
|
1648
|
+
assert '"approved"' not in encoded
|
|
1649
|
+
|
|
1650
|
+
|
|
1651
|
+
def test_profiled_route_without_author_claim_does_not_suppress_base_gap() -> None:
|
|
1652
|
+
context, registry, resolved, _overlay = _synthetic_overlay_authority()
|
|
1653
|
+
manifest = _build(_inventory(), PACKET_ROOT, context, registry, resolved)
|
|
1654
|
+
base = _entry(
|
|
1655
|
+
manifest,
|
|
1656
|
+
"synthetic.packet.base-consent",
|
|
1657
|
+
"synthetic.base-consent",
|
|
1658
|
+
)
|
|
1659
|
+
assert base["status"] == "NOT_LOCATED"
|
|
1660
|
+
assert base["reason_codes"] == ["EXPECTED_PACKET_ARTIFACT_NOT_LOCATED"]
|
|
1661
|
+
assert manifest["administrative_status"]["submission_readiness"] == "gaps_located"
|
|
1662
|
+
|
|
1663
|
+
|
|
1664
|
+
@pytest.mark.parametrize(
|
|
1665
|
+
"mutation",
|
|
1666
|
+
["wrong_route", "wrong_decision_artifact", "unbound_decision", "holder_conflict"],
|
|
1667
|
+
)
|
|
1668
|
+
def test_inexact_or_conflicting_profiled_route_cannot_suppress_missing_base(
|
|
1669
|
+
mutation: str,
|
|
1670
|
+
) -> None:
|
|
1671
|
+
context, registry, resolved, _overlay = _synthetic_overlay_authority()
|
|
1672
|
+
inventory = _waiver_inventory()
|
|
1673
|
+
claim = inventory["waiver_or_exception_claims"][0]
|
|
1674
|
+
certificate = _artifact(inventory, "fixture.training-certificate")
|
|
1675
|
+
if mutation == "wrong_route":
|
|
1676
|
+
claim["route_requirement_ids"] = ["us.45cfr46.116.informed-consent"]
|
|
1677
|
+
elif mutation == "wrong_decision_artifact":
|
|
1678
|
+
claim["decision_artifact_id"] = "fixture.us-consent"
|
|
1679
|
+
elif mutation == "unbound_decision":
|
|
1680
|
+
certificate["evidence_bindings"] = []
|
|
1681
|
+
else:
|
|
1682
|
+
certificate["declared_holder_role_id"] = "principal_investigator"
|
|
1683
|
+
manifest = _build(inventory, PACKET_ROOT, context, registry, resolved)
|
|
1684
|
+
base = _entry(
|
|
1685
|
+
manifest,
|
|
1686
|
+
"synthetic.packet.base-consent",
|
|
1687
|
+
"synthetic.base-consent",
|
|
1688
|
+
)
|
|
1689
|
+
assert base["status"] == "NOT_LOCATED"
|
|
1690
|
+
assert base["readiness_effect"] == "gap"
|
|
1691
|
+
|
|
1692
|
+
|
|
1693
|
+
def test_unprofiled_or_external_route_state_cannot_suppress_missing_base() -> None:
|
|
1694
|
+
for state in (
|
|
1695
|
+
"external_authority_required",
|
|
1696
|
+
"not_profiled_in_bounded_profile",
|
|
1697
|
+
"not_applicable",
|
|
1698
|
+
):
|
|
1699
|
+
context, registry, _resolved, overlay = _synthetic_overlay_authority()
|
|
1700
|
+
base = next(
|
|
1701
|
+
row
|
|
1702
|
+
for row in overlay["requirements"]
|
|
1703
|
+
if row["requirement_id"] == "synthetic.packet.base-consent"
|
|
1704
|
+
)
|
|
1705
|
+
base["waiver_or_exception_route"] = {
|
|
1706
|
+
"state": state,
|
|
1707
|
+
"requirement_ids": [],
|
|
1708
|
+
"decision_maker_role": (
|
|
1709
|
+
"institutional_review_office"
|
|
1710
|
+
if state == "external_authority_required"
|
|
1711
|
+
else None
|
|
1712
|
+
),
|
|
1713
|
+
}
|
|
1714
|
+
_repin_overlay(context, overlay)
|
|
1715
|
+
resolved = resolve(context, registry)
|
|
1716
|
+
manifest = _build(
|
|
1717
|
+
_waiver_inventory(), PACKET_ROOT, context, registry, resolved
|
|
1718
|
+
)
|
|
1719
|
+
row = _entry(
|
|
1720
|
+
manifest,
|
|
1721
|
+
"synthetic.packet.base-consent",
|
|
1722
|
+
"synthetic.base-consent",
|
|
1723
|
+
)
|
|
1724
|
+
assert row["status"] == "NOT_LOCATED", state
|
|
1725
|
+
|
|
1726
|
+
|
|
1727
|
+
@pytest.mark.parametrize("mutation", ["scope", "actor"])
|
|
1728
|
+
def test_route_scope_or_actor_mismatch_cannot_suppress_missing_base(
|
|
1729
|
+
mutation: str,
|
|
1730
|
+
) -> None:
|
|
1731
|
+
context, registry, _resolved, overlay = _synthetic_overlay_authority()
|
|
1732
|
+
route = next(
|
|
1733
|
+
row
|
|
1734
|
+
for row in overlay["requirements"]
|
|
1735
|
+
if row["requirement_id"] == "synthetic.packet.waiver-route"
|
|
1736
|
+
)
|
|
1737
|
+
if mutation == "scope":
|
|
1738
|
+
route["consumer_scopes"] = ["participant_information"]
|
|
1739
|
+
else:
|
|
1740
|
+
route["obligated_actor"] = "institutional_review_office"
|
|
1741
|
+
_repin_overlay(context, overlay)
|
|
1742
|
+
resolved = resolve(context, registry)
|
|
1743
|
+
manifest = _build(
|
|
1744
|
+
_waiver_inventory(), PACKET_ROOT, context, registry, resolved
|
|
1745
|
+
)
|
|
1746
|
+
base = _entry(
|
|
1747
|
+
manifest,
|
|
1748
|
+
"synthetic.packet.base-consent",
|
|
1749
|
+
"synthetic.base-consent",
|
|
1750
|
+
)
|
|
1751
|
+
assert base["status"] == "NOT_LOCATED"
|
|
1752
|
+
|
|
1753
|
+
|
|
1754
|
+
def test_profiled_route_does_not_recursively_self_satisfy() -> None:
|
|
1755
|
+
context, registry, _resolved, overlay = _synthetic_overlay_authority()
|
|
1756
|
+
route = next(
|
|
1757
|
+
row
|
|
1758
|
+
for row in overlay["requirements"]
|
|
1759
|
+
if row["requirement_id"] == "synthetic.packet.waiver-route"
|
|
1760
|
+
)
|
|
1761
|
+
route["waiver_or_exception_route"] = {
|
|
1762
|
+
"state": "profiled",
|
|
1763
|
+
"requirement_ids": ["synthetic.packet.waiver-route"],
|
|
1764
|
+
"decision_maker_role": "institutional_review_office",
|
|
1765
|
+
}
|
|
1766
|
+
_repin_overlay(context, overlay)
|
|
1767
|
+
resolved = resolve(context, registry)
|
|
1768
|
+
inventory = _waiver_inventory()
|
|
1769
|
+
_artifact(inventory, "fixture.training-certificate")["evidence_bindings"] = []
|
|
1770
|
+
manifest = _build(inventory, PACKET_ROOT, context, registry, resolved)
|
|
1771
|
+
route_entry = _entry(
|
|
1772
|
+
manifest,
|
|
1773
|
+
"synthetic.packet.waiver-route",
|
|
1774
|
+
"synthetic.waiver-decision",
|
|
1775
|
+
)
|
|
1776
|
+
base_entry = _entry(
|
|
1777
|
+
manifest,
|
|
1778
|
+
"synthetic.packet.base-consent",
|
|
1779
|
+
"synthetic.base-consent",
|
|
1780
|
+
)
|
|
1781
|
+
assert route_entry["status"] == "NOT_LOCATED"
|
|
1782
|
+
assert base_entry["status"] == "NOT_LOCATED"
|
|
1783
|
+
|
|
1784
|
+
|
|
1785
|
+
@pytest.mark.parametrize(
|
|
1786
|
+
("value", "source_reference"),
|
|
1787
|
+
[
|
|
1788
|
+
("documented", "caller.authorization-record"),
|
|
1789
|
+
("not_provided", None),
|
|
1790
|
+
("cannot_verify", None),
|
|
1791
|
+
],
|
|
1792
|
+
)
|
|
1793
|
+
def test_authorization_status_is_exact_copy_through_only(
|
|
1794
|
+
value: str, source_reference: str | None
|
|
1795
|
+
) -> None:
|
|
1796
|
+
inventory = _inventory()
|
|
1797
|
+
inventory["authorization_status_input"] = {
|
|
1798
|
+
"value": value,
|
|
1799
|
+
"source_reference": source_reference,
|
|
1800
|
+
"provenance": "caller_supplied_no_derivation",
|
|
1801
|
+
}
|
|
1802
|
+
manifest = _build(inventory)
|
|
1803
|
+
assert manifest["administrative_status"]["authorization_status"] == inventory[
|
|
1804
|
+
"authorization_status_input"
|
|
1805
|
+
]
|
|
1806
|
+
|
|
1807
|
+
|
|
1808
|
+
def test_documented_packet_structure_never_promotes_authorization() -> None:
|
|
1809
|
+
inventory = _inventory()
|
|
1810
|
+
inventory["authorization_status_input"] = {
|
|
1811
|
+
"value": "not_provided",
|
|
1812
|
+
"source_reference": None,
|
|
1813
|
+
"provenance": "caller_supplied_no_derivation",
|
|
1814
|
+
}
|
|
1815
|
+
manifest = _build(inventory)
|
|
1816
|
+
assert any(row["status"] == "DOCUMENTED" for row in manifest["entries"])
|
|
1817
|
+
assert manifest["administrative_status"]["submission_readiness"] == (
|
|
1818
|
+
"no_listed_gaps_located"
|
|
1819
|
+
)
|
|
1820
|
+
assert manifest["administrative_status"]["authorization_status"]["value"] == (
|
|
1821
|
+
"not_provided"
|
|
1822
|
+
)
|
|
1823
|
+
|
|
1824
|
+
|
|
1825
|
+
def test_readiness_changes_do_not_change_authorization_input() -> None:
|
|
1826
|
+
inventory = _inventory()
|
|
1827
|
+
complete = _build(inventory)
|
|
1828
|
+
missing = copy.deepcopy(inventory)
|
|
1829
|
+
_artifact(missing, "fixture.us-consent")["evidence_bindings"] = []
|
|
1830
|
+
gaps = _build(missing)
|
|
1831
|
+
unresolved_context = _context()
|
|
1832
|
+
unresolved_context["overlay_selection_state"]["institutional"] = "not_provided"
|
|
1833
|
+
registry = _registry()
|
|
1834
|
+
unresolved = _build(
|
|
1835
|
+
inventory,
|
|
1836
|
+
PACKET_ROOT,
|
|
1837
|
+
unresolved_context,
|
|
1838
|
+
registry,
|
|
1839
|
+
resolve(unresolved_context, registry),
|
|
1840
|
+
)
|
|
1841
|
+
assert {
|
|
1842
|
+
complete["administrative_status"]["submission_readiness"],
|
|
1843
|
+
gaps["administrative_status"]["submission_readiness"],
|
|
1844
|
+
unresolved["administrative_status"]["submission_readiness"],
|
|
1845
|
+
} == {"no_listed_gaps_located", "gaps_located", "unresolved"}
|
|
1846
|
+
assert complete["administrative_status"]["authorization_status"] == gaps[
|
|
1847
|
+
"administrative_status"
|
|
1848
|
+
]["authorization_status"] == unresolved["administrative_status"][
|
|
1849
|
+
"authorization_status"
|
|
1850
|
+
]
|
|
1851
|
+
|
|
1852
|
+
|
|
1853
|
+
def test_fixed_administrative_and_acceptance_boundaries_are_exact() -> None:
|
|
1854
|
+
manifest = _build()
|
|
1855
|
+
assert manifest["administrative_status"]["review_pathway"] == (
|
|
1856
|
+
"institutional determination required"
|
|
1857
|
+
)
|
|
1858
|
+
assert manifest["administrative_status"]["review_timeline"] == (
|
|
1859
|
+
"unknown — obtain current institutional estimate"
|
|
1860
|
+
)
|
|
1861
|
+
assert manifest["acceptance_boundary"] == {
|
|
1862
|
+
"status": "ACCEPTANCE_UNVERIFIED",
|
|
1863
|
+
"reason_code": "INSTITUTIONAL_DETERMINATION_REQUIRED",
|
|
1864
|
+
"affects_submission_readiness": False,
|
|
1865
|
+
}
|
|
1866
|
+
assert manifest["boundary_footer"] == BOUNDARY_FOOTER
|
|
1867
|
+
|
|
1868
|
+
|
|
1869
|
+
def test_recursive_output_has_no_verdict_adequacy_prose_or_excerpt() -> None:
|
|
1870
|
+
manifest = _build()
|
|
1871
|
+
forbidden_keys = {
|
|
1872
|
+
"verdict",
|
|
1873
|
+
"review_level",
|
|
1874
|
+
"approval",
|
|
1875
|
+
"approval_status",
|
|
1876
|
+
"clearance",
|
|
1877
|
+
"compliance",
|
|
1878
|
+
"conformance",
|
|
1879
|
+
"adequacy",
|
|
1880
|
+
"content_coverage",
|
|
1881
|
+
"quality_score",
|
|
1882
|
+
"language_quality",
|
|
1883
|
+
"authorization_decision",
|
|
1884
|
+
"excerpt",
|
|
1885
|
+
"quote",
|
|
1886
|
+
"description",
|
|
1887
|
+
"summary",
|
|
1888
|
+
"structured_expectations",
|
|
1889
|
+
}
|
|
1890
|
+
assert _all_keys(manifest).isdisjoint(forbidden_keys)
|
|
1891
|
+
encoded = json.dumps(manifest, ensure_ascii=False, sort_keys=True)
|
|
1892
|
+
for path in PACKET_ROOT.iterdir():
|
|
1893
|
+
if path.is_file():
|
|
1894
|
+
assert path.read_text(encoding="utf-8").strip() not in encoded
|
|
1895
|
+
assert "Test-only structural attachment row" not in encoded
|
|
1896
|
+
assert "Participant-facing consent materials" not in encoded
|
|
1897
|
+
|
|
1898
|
+
|
|
1899
|
+
def test_681_handoff_is_json_round_trip_pointer_only_without_parallel_verdict() -> None:
|
|
1900
|
+
manifest = _build()
|
|
1901
|
+
transported = json.loads(json.dumps(manifest, ensure_ascii=False, sort_keys=True))
|
|
1902
|
+
assert transported == manifest
|
|
1903
|
+
_validator(MANIFEST_SCHEMA).validate(transported)
|
|
1904
|
+
assert all(
|
|
1905
|
+
row["requirement_ref"]["requirement_pointer"].startswith(
|
|
1906
|
+
("/profiles/", "/overlays/")
|
|
1907
|
+
)
|
|
1908
|
+
and row["evidence_ref"]["evidence_pointer"].startswith(
|
|
1909
|
+
("/profiles/", "/overlays/")
|
|
1910
|
+
)
|
|
1911
|
+
for row in transported["entries"]
|
|
1912
|
+
)
|
|
1913
|
+
assert "verdict" not in _all_keys(transported)
|
|
1914
|
+
|
|
1915
|
+
|
|
1916
|
+
def test_live_structured_expectations_and_descriptions_do_not_affect_status() -> None:
|
|
1917
|
+
context, registry, _resolved = _authority()
|
|
1918
|
+
baseline = _build(
|
|
1919
|
+
_inventory(), PACKET_ROOT, context, registry, resolve(context, registry)
|
|
1920
|
+
)
|
|
1921
|
+
profile = next(
|
|
1922
|
+
row
|
|
1923
|
+
for row in registry["profiles"]
|
|
1924
|
+
if row["profile_id"] == "us.hhs.45-cfr-46.subpart-a"
|
|
1925
|
+
)
|
|
1926
|
+
requirement = next(
|
|
1927
|
+
row
|
|
1928
|
+
for row in profile["requirements"]
|
|
1929
|
+
if row["requirement_id"] == "us.45cfr46.116.informed-consent"
|
|
1930
|
+
)
|
|
1931
|
+
requirement["structured_expectations"] = [
|
|
1932
|
+
{
|
|
1933
|
+
"field_id": "synthetic.impossible-prose-test",
|
|
1934
|
+
"operator": "equals",
|
|
1935
|
+
"value": False,
|
|
1936
|
+
}
|
|
1937
|
+
]
|
|
1938
|
+
for evidence in requirement["evidence_expected"]:
|
|
1939
|
+
evidence["description"] = "This prose must never influence #667."
|
|
1940
|
+
_repin_profile(context, profile)
|
|
1941
|
+
changed = _build(
|
|
1942
|
+
_inventory(), PACKET_ROOT, context, registry, resolve(context, registry)
|
|
1943
|
+
)
|
|
1944
|
+
for evidence_id in ("consent.participant-materials", "consent.irb-determination"):
|
|
1945
|
+
before = _entry(baseline, requirement["requirement_id"], evidence_id)
|
|
1946
|
+
after = _entry(changed, requirement["requirement_id"], evidence_id)
|
|
1947
|
+
assert (
|
|
1948
|
+
after["status"],
|
|
1949
|
+
after["responsibility"],
|
|
1950
|
+
after["reason_codes"],
|
|
1951
|
+
after["matched_artifact_ids"],
|
|
1952
|
+
) == (
|
|
1953
|
+
before["status"],
|
|
1954
|
+
before["responsibility"],
|
|
1955
|
+
before["reason_codes"],
|
|
1956
|
+
before["matched_artifact_ids"],
|
|
1957
|
+
)
|
|
1958
|
+
|
|
1959
|
+
|
|
1960
|
+
def test_packet_prose_polarity_is_not_interpreted_when_mechanical_binding_matches(
|
|
1961
|
+
tmp_path: Path,
|
|
1962
|
+
) -> None:
|
|
1963
|
+
packet = _packet_copy(tmp_path)
|
|
1964
|
+
inventory = _inventory()
|
|
1965
|
+
before = _build(inventory, packet)
|
|
1966
|
+
artifact = _artifact(inventory, "fixture.us-consent")
|
|
1967
|
+
path = packet / artifact["relative_path"]
|
|
1968
|
+
path.write_text(
|
|
1969
|
+
"I refuse every substantive proposition; this is adversarial prose.\n",
|
|
1970
|
+
encoding="utf-8",
|
|
1971
|
+
)
|
|
1972
|
+
raw = path.read_bytes()
|
|
1973
|
+
artifact["declared_sha256"] = hashlib.sha256(raw).hexdigest()
|
|
1974
|
+
artifact["declared_size_bytes"] = len(raw)
|
|
1975
|
+
after = _build(inventory, packet)
|
|
1976
|
+
before_row = _entry(
|
|
1977
|
+
before,
|
|
1978
|
+
"us.45cfr46.116.informed-consent",
|
|
1979
|
+
"consent.participant-materials",
|
|
1980
|
+
)
|
|
1981
|
+
after_row = _entry(
|
|
1982
|
+
after,
|
|
1983
|
+
"us.45cfr46.116.informed-consent",
|
|
1984
|
+
"consent.participant-materials",
|
|
1985
|
+
)
|
|
1986
|
+
assert before_row["status"] == after_row["status"] == "DOCUMENTED"
|
|
1987
|
+
assert before_row["reason_codes"] == after_row["reason_codes"]
|
|
1988
|
+
assert before["manifest_digest"] != after["manifest_digest"]
|
|
1989
|
+
|
|
1990
|
+
|
|
1991
|
+
def test_manifest_self_digest_is_exact() -> None:
|
|
1992
|
+
manifest = _build()
|
|
1993
|
+
unsigned = copy.deepcopy(manifest)
|
|
1994
|
+
claimed = unsigned.pop("manifest_digest")
|
|
1995
|
+
assert claimed == digest(unsigned)
|
|
1996
|
+
|
|
1997
|
+
|
|
1998
|
+
@pytest.mark.parametrize(
|
|
1999
|
+
"mutate",
|
|
2000
|
+
[
|
|
2001
|
+
lambda value: value["entries"][0]["requirement_ref"].__setitem__(
|
|
2002
|
+
"requirement_pointer", "/profiles/999/requirements/0"
|
|
2003
|
+
),
|
|
2004
|
+
lambda value: value["entries"][0]["evidence_ref"].__setitem__(
|
|
2005
|
+
"evidence_digest", "0" * 64
|
|
2006
|
+
),
|
|
2007
|
+
lambda value: value["packet_observations"][0].__setitem__(
|
|
2008
|
+
"observed_sha256", "0" * 64
|
|
2009
|
+
),
|
|
2010
|
+
lambda value: value["administrative_status"].__setitem__(
|
|
2011
|
+
"submission_readiness", "gaps_located"
|
|
2012
|
+
),
|
|
2013
|
+
lambda value: value["administrative_status"]["authorization_status"].update(
|
|
2014
|
+
{
|
|
2015
|
+
"value": "documented",
|
|
2016
|
+
"source_reference": "forged.authorization",
|
|
2017
|
+
}
|
|
2018
|
+
),
|
|
2019
|
+
lambda value: value["entries"][0].update(
|
|
2020
|
+
{
|
|
2021
|
+
"status": "ACCEPTANCE_UNVERIFIED",
|
|
2022
|
+
"readiness_effect": "unresolved",
|
|
2023
|
+
"reason_codes": ["WAIVER_OR_EXCEPTION_CLAIM_UNVERIFIED"],
|
|
2024
|
+
}
|
|
2025
|
+
),
|
|
2026
|
+
],
|
|
2027
|
+
)
|
|
2028
|
+
def test_resigned_manifest_mutations_fail_exact_replay(
|
|
2029
|
+
mutate: Callable[[dict[str, Any]], None]
|
|
2030
|
+
) -> None:
|
|
2031
|
+
inventory = _inventory()
|
|
2032
|
+
context, registry, resolved = _authority()
|
|
2033
|
+
manifest = _build(inventory, PACKET_ROOT, context, registry, resolved)
|
|
2034
|
+
mutate(manifest)
|
|
2035
|
+
_repin_manifest(manifest)
|
|
2036
|
+
with pytest.raises(ContractError):
|
|
2037
|
+
validate_submission_packet_manifest(
|
|
2038
|
+
manifest,
|
|
2039
|
+
inventory,
|
|
2040
|
+
PACKET_ROOT,
|
|
2041
|
+
context=context,
|
|
2042
|
+
registry=registry,
|
|
2043
|
+
resolved=resolved,
|
|
2044
|
+
)
|
|
2045
|
+
|
|
2046
|
+
|
|
2047
|
+
def test_resigned_context_free_overlay_state_fails_shape_and_direct_render() -> None:
|
|
2048
|
+
manifest = build_submission_packet_manifest(_inventory(), PACKET_ROOT)
|
|
2049
|
+
manifest["overlay_selection_state"] = {
|
|
2050
|
+
"institutional": "selected",
|
|
2051
|
+
"funder": "none_declared_by_author",
|
|
2052
|
+
}
|
|
2053
|
+
_repin_manifest(manifest)
|
|
2054
|
+
assert list(_validator(MANIFEST_SCHEMA).iter_errors(manifest))
|
|
2055
|
+
with pytest.raises(ContractError, match="overlay_selection_state"):
|
|
2056
|
+
render_submission_packet_manifest(manifest)
|
|
2057
|
+
|
|
2058
|
+
|
|
2059
|
+
def test_resigned_replay_validated_manifest_requires_overlay_state() -> None:
|
|
2060
|
+
manifest = _build()
|
|
2061
|
+
manifest["overlay_selection_state"] = None
|
|
2062
|
+
_repin_manifest(manifest)
|
|
2063
|
+
assert list(_validator(MANIFEST_SCHEMA).iter_errors(manifest))
|
|
2064
|
+
with pytest.raises(ContractError, match="overlay_selection_state"):
|
|
2065
|
+
render_submission_packet_manifest(manifest)
|
|
2066
|
+
|
|
2067
|
+
|
|
2068
|
+
def test_resigned_resolved_authority_with_partly_closed_gate_fails_shape() -> None:
|
|
2069
|
+
manifest = _build()
|
|
2070
|
+
manifest["authority_binding"]["downstream_gate"][
|
|
2071
|
+
"all_applicability_resolved"
|
|
2072
|
+
] = False
|
|
2073
|
+
_repin_manifest(manifest)
|
|
2074
|
+
assert list(_validator(MANIFEST_SCHEMA).iter_errors(manifest))
|
|
2075
|
+
with pytest.raises(ContractError, match="fully open"):
|
|
2076
|
+
render_submission_packet_manifest(manifest)
|
|
2077
|
+
|
|
2078
|
+
|
|
2079
|
+
def test_resigned_unresolved_authority_with_open_profile_gate_fails_shape() -> None:
|
|
2080
|
+
context = _context("no-profile.json")
|
|
2081
|
+
registry = _registry()
|
|
2082
|
+
resolved = resolve(context, registry)
|
|
2083
|
+
manifest = _build(_inventory(), PACKET_ROOT, context, registry, resolved)
|
|
2084
|
+
manifest["authority_binding"]["downstream_gate"][
|
|
2085
|
+
"profile_dependent_result_allowed"
|
|
2086
|
+
] = True
|
|
2087
|
+
_repin_manifest(manifest)
|
|
2088
|
+
assert list(_validator(MANIFEST_SCHEMA).iter_errors(manifest))
|
|
2089
|
+
with pytest.raises(ContractError, match="must be false"):
|
|
2090
|
+
render_submission_packet_manifest(manifest)
|
|
2091
|
+
|
|
2092
|
+
|
|
2093
|
+
def test_resigned_closed_gate_with_entries_fails_shape_and_direct_render() -> None:
|
|
2094
|
+
unresolved = build_submission_packet_manifest(_inventory(), PACKET_ROOT)
|
|
2095
|
+
unresolved["entries"] = [copy.deepcopy(_build()["entries"][0])]
|
|
2096
|
+
_repin_manifest(unresolved)
|
|
2097
|
+
assert list(_validator(MANIFEST_SCHEMA).iter_errors(unresolved))
|
|
2098
|
+
with pytest.raises(ContractError, match="closed authority or capability gate"):
|
|
2099
|
+
render_submission_packet_manifest(unresolved)
|
|
2100
|
+
|
|
2101
|
+
|
|
2102
|
+
def test_resigned_closed_gate_with_packet_observation_fails_shape() -> None:
|
|
2103
|
+
unresolved = build_submission_packet_manifest(_inventory(), PACKET_ROOT)
|
|
2104
|
+
unresolved["packet_observations"] = [
|
|
2105
|
+
copy.deepcopy(_build()["packet_observations"][0])
|
|
2106
|
+
]
|
|
2107
|
+
unresolved["packet_pointer"]["observation_digest"] = digest(
|
|
2108
|
+
unresolved["packet_observations"]
|
|
2109
|
+
)
|
|
2110
|
+
_repin_manifest(unresolved)
|
|
2111
|
+
assert list(_validator(MANIFEST_SCHEMA).iter_errors(unresolved))
|
|
2112
|
+
with pytest.raises(ContractError, match="closed authority or capability gate"):
|
|
2113
|
+
render_submission_packet_manifest(unresolved)
|
|
2114
|
+
|
|
2115
|
+
|
|
2116
|
+
def test_resigned_located_observation_cannot_claim_attachment_absence() -> None:
|
|
2117
|
+
manifest = _build()
|
|
2118
|
+
observation = manifest["packet_observations"][0]
|
|
2119
|
+
assert observation["state"] == "located"
|
|
2120
|
+
observation["status"] = "CONFLICTING"
|
|
2121
|
+
observation["reason_codes"] = ["DECLARED_ATTACHMENT_NOT_LOCATED"]
|
|
2122
|
+
manifest["packet_pointer"]["observation_digest"] = digest(
|
|
2123
|
+
manifest["packet_observations"]
|
|
2124
|
+
)
|
|
2125
|
+
_repin_manifest(manifest)
|
|
2126
|
+
assert list(_validator(MANIFEST_SCHEMA).iter_errors(manifest))
|
|
2127
|
+
with pytest.raises(ContractError, match="located conflict"):
|
|
2128
|
+
render_submission_packet_manifest(manifest)
|
|
2129
|
+
|
|
2130
|
+
|
|
2131
|
+
def test_resigned_overlay_not_provided_without_reason_fails_shape() -> None:
|
|
2132
|
+
manifest = _build()
|
|
2133
|
+
manifest["overlay_selection_state"]["institutional"] = "not_provided"
|
|
2134
|
+
manifest["administrative_status"]["submission_readiness"] = "unresolved"
|
|
2135
|
+
_repin_manifest(manifest)
|
|
2136
|
+
assert list(_validator(MANIFEST_SCHEMA).iter_errors(manifest))
|
|
2137
|
+
with pytest.raises(ContractError, match="unresolved_reasons"):
|
|
2138
|
+
render_submission_packet_manifest(manifest)
|
|
2139
|
+
|
|
2140
|
+
|
|
2141
|
+
@pytest.mark.parametrize(
|
|
2142
|
+
"mutate",
|
|
2143
|
+
[
|
|
2144
|
+
lambda value: value["inventory_pointer"].__setitem__(
|
|
2145
|
+
"inventory_id", value["inventory_pointer"]["inventory_id"] + "\n"
|
|
2146
|
+
),
|
|
2147
|
+
lambda value: value["authority_binding"]["registry_pointer"].__setitem__(
|
|
2148
|
+
"registry_version",
|
|
2149
|
+
value["authority_binding"]["registry_pointer"]["registry_version"]
|
|
2150
|
+
+ "\n",
|
|
2151
|
+
),
|
|
2152
|
+
lambda value: value["entries"][0]["evidence_ref"].__setitem__(
|
|
2153
|
+
"evidence_digest",
|
|
2154
|
+
value["entries"][0]["evidence_ref"]["evidence_digest"] + "\n",
|
|
2155
|
+
),
|
|
2156
|
+
lambda value: value["packet_observations"][0].__setitem__(
|
|
2157
|
+
"relative_path",
|
|
2158
|
+
value["packet_observations"][0]["relative_path"] + "\n",
|
|
2159
|
+
),
|
|
2160
|
+
lambda value: value["entries"][0]["requirement_ref"].__setitem__(
|
|
2161
|
+
"requirement_pointer",
|
|
2162
|
+
value["entries"][0]["requirement_ref"]["requirement_pointer"] + "\n",
|
|
2163
|
+
),
|
|
2164
|
+
lambda value: value["entries"][0]["requirement_ref"].__setitem__(
|
|
2165
|
+
"authority_anchor_pointer",
|
|
2166
|
+
value["entries"][0]["requirement_ref"]["authority_anchor_pointer"]
|
|
2167
|
+
+ "\n",
|
|
2168
|
+
),
|
|
2169
|
+
lambda value: value["entries"][0]["evidence_ref"].__setitem__(
|
|
2170
|
+
"evidence_pointer",
|
|
2171
|
+
value["entries"][0]["evidence_ref"]["evidence_pointer"] + "\n",
|
|
2172
|
+
),
|
|
2173
|
+
lambda value: value["authority_binding"]["registry_pointer"].__setitem__(
|
|
2174
|
+
"as_of", "2026-W01-1"
|
|
2175
|
+
),
|
|
2176
|
+
],
|
|
2177
|
+
)
|
|
2178
|
+
def test_manifest_schema_runtime_absolute_end_parity(
|
|
2179
|
+
mutate: Callable[[dict[str, Any]], None]
|
|
2180
|
+
) -> None:
|
|
2181
|
+
inventory = _inventory()
|
|
2182
|
+
context, registry, resolved = _authority()
|
|
2183
|
+
manifest = _build(inventory, PACKET_ROOT, context, registry, resolved)
|
|
2184
|
+
mutate(manifest)
|
|
2185
|
+
_repin_manifest(manifest)
|
|
2186
|
+
assert list(_validator(MANIFEST_SCHEMA).iter_errors(manifest))
|
|
2187
|
+
with pytest.raises(ContractError):
|
|
2188
|
+
validate_submission_packet_manifest(
|
|
2189
|
+
manifest,
|
|
2190
|
+
inventory,
|
|
2191
|
+
PACKET_ROOT,
|
|
2192
|
+
context=context,
|
|
2193
|
+
registry=registry,
|
|
2194
|
+
resolved=resolved,
|
|
2195
|
+
)
|
|
2196
|
+
|
|
2197
|
+
|
|
2198
|
+
def test_inventory_key_and_unordered_list_order_do_not_change_manifest() -> None:
|
|
2199
|
+
inventory = _inventory()
|
|
2200
|
+
us_artifact = _artifact(inventory, "fixture.us-consent")
|
|
2201
|
+
us_artifact["evidence_bindings"].append(
|
|
2202
|
+
{"requirement_id": "unused.requirement", "evidence_id": "unused.evidence"}
|
|
2203
|
+
)
|
|
2204
|
+
us_artifact["declared_structure"]["signature_blocks"].append(
|
|
2205
|
+
{"role_id": "sponsor", "state": "present"}
|
|
2206
|
+
)
|
|
2207
|
+
inventory["waiver_or_exception_claims"] = [
|
|
2208
|
+
{
|
|
2209
|
+
"requirement_id": "unused.base-a",
|
|
2210
|
+
"route_requirement_ids": ["unused.route-b", "unused.route-a"],
|
|
2211
|
+
"decision_artifact_id": None,
|
|
2212
|
+
"declared_by": "author",
|
|
2213
|
+
},
|
|
2214
|
+
{
|
|
2215
|
+
"requirement_id": "unused.base-b",
|
|
2216
|
+
"route_requirement_ids": [],
|
|
2217
|
+
"decision_artifact_id": None,
|
|
2218
|
+
"declared_by": "author",
|
|
2219
|
+
},
|
|
2220
|
+
]
|
|
2221
|
+
baseline = _build(inventory)
|
|
2222
|
+
reordered = json.loads(json.dumps(inventory, ensure_ascii=False, sort_keys=True))
|
|
2223
|
+
reordered["artifacts"].reverse()
|
|
2224
|
+
reordered["packet_responsibility_role_ids"].reverse()
|
|
2225
|
+
reordered["waiver_or_exception_claims"].reverse()
|
|
2226
|
+
for claim in reordered["waiver_or_exception_claims"]:
|
|
2227
|
+
claim["route_requirement_ids"].reverse()
|
|
2228
|
+
for artifact in reordered["artifacts"]:
|
|
2229
|
+
artifact["evidence_bindings"].reverse()
|
|
2230
|
+
artifact["declared_structure"]["signature_blocks"].reverse()
|
|
2231
|
+
after = _build(reordered)
|
|
2232
|
+
assert after == baseline
|
|
2233
|
+
|
|
2234
|
+
|
|
2235
|
+
def test_context_fact_order_and_reconfirmation_do_not_change_manifest() -> None:
|
|
2236
|
+
inventory = _inventory()
|
|
2237
|
+
context, registry, resolved = _authority()
|
|
2238
|
+
baseline = _build(inventory, PACKET_ROOT, context, registry, resolved)
|
|
2239
|
+
reordered = json.loads(json.dumps(context, ensure_ascii=False, sort_keys=True))
|
|
2240
|
+
reordered["declared_facts"].reverse()
|
|
2241
|
+
reordered["confirmed_at"] = "2026-08-09T15:00:00+08:00"
|
|
2242
|
+
replayed = resolve(reordered, registry)
|
|
2243
|
+
after = _build(inventory, PACKET_ROOT, reordered, registry, replayed)
|
|
2244
|
+
assert after == baseline
|
|
2245
|
+
|
|
2246
|
+
|
|
2247
|
+
def test_output_order_is_canonical() -> None:
|
|
2248
|
+
manifest = _build()
|
|
2249
|
+
observations = [row["artifact_id"] for row in manifest["packet_observations"]]
|
|
2250
|
+
assert observations == sorted(observations)
|
|
2251
|
+
entry_keys = [
|
|
2252
|
+
(
|
|
2253
|
+
row["requirement_ref"]["axis"],
|
|
2254
|
+
row["requirement_ref"]["authority_kind"],
|
|
2255
|
+
row["requirement_ref"]["authority_id"],
|
|
2256
|
+
row["requirement_ref"]["requirement_id"],
|
|
2257
|
+
row["evidence_ref"]["evidence_pointer"],
|
|
2258
|
+
)
|
|
2259
|
+
for row in manifest["entries"]
|
|
2260
|
+
]
|
|
2261
|
+
assert entry_keys == sorted(entry_keys)
|
|
2262
|
+
assert all(row["reason_codes"] == sorted(row["reason_codes"]) for row in manifest["entries"])
|
|
2263
|
+
|
|
2264
|
+
|
|
2265
|
+
def test_identical_packet_re_root_does_not_change_manifest(tmp_path: Path) -> None:
|
|
2266
|
+
copied = _packet_copy(tmp_path)
|
|
2267
|
+
assert _build(packet_root=copied) == _build(packet_root=PACKET_ROOT)
|
|
2268
|
+
|
|
2269
|
+
|
|
2270
|
+
def test_locale_timezone_and_cwd_do_not_change_manifest(
|
|
2271
|
+
tmp_path: Path, monkeypatch: pytest.MonkeyPatch
|
|
2272
|
+
) -> None:
|
|
2273
|
+
baseline = _build()
|
|
2274
|
+
monkeypatch.setenv("LANG", "tr_TR.UTF-8")
|
|
2275
|
+
monkeypatch.setenv("LC_ALL", "C")
|
|
2276
|
+
monkeypatch.setenv("TZ", "Pacific/Honolulu")
|
|
2277
|
+
monkeypatch.chdir(tmp_path)
|
|
2278
|
+
assert _build() == baseline
|
|
2279
|
+
|
|
2280
|
+
|
|
2281
|
+
def test_authorization_copy_through_is_digest_load_bearing_but_row_statuses_are_not() -> None:
|
|
2282
|
+
original_inventory = _inventory()
|
|
2283
|
+
original = _build(original_inventory)
|
|
2284
|
+
documented_inventory = copy.deepcopy(original_inventory)
|
|
2285
|
+
documented_inventory["authorization_status_input"] = {
|
|
2286
|
+
"value": "documented",
|
|
2287
|
+
"source_reference": "caller.authorization-record",
|
|
2288
|
+
"provenance": "caller_supplied_no_derivation",
|
|
2289
|
+
}
|
|
2290
|
+
documented = _build(documented_inventory)
|
|
2291
|
+
assert documented["manifest_digest"] != original["manifest_digest"]
|
|
2292
|
+
assert [
|
|
2293
|
+
(row["status"], row["reason_codes"], row["matched_artifact_ids"])
|
|
2294
|
+
for row in documented["entries"]
|
|
2295
|
+
] == [
|
|
2296
|
+
(row["status"], row["reason_codes"], row["matched_artifact_ids"])
|
|
2297
|
+
for row in original["entries"]
|
|
2298
|
+
]
|
|
2299
|
+
|
|
2300
|
+
|
|
2301
|
+
def test_renderer_is_deterministic_and_never_includes_packet_prose() -> None:
|
|
2302
|
+
manifest = _build()
|
|
2303
|
+
first = render_submission_packet_manifest(manifest)
|
|
2304
|
+
second = render_submission_packet_manifest(
|
|
2305
|
+
json.loads(json.dumps(manifest, sort_keys=True))
|
|
2306
|
+
)
|
|
2307
|
+
assert first == second
|
|
2308
|
+
assert "Review pathway: institutional determination required" in first
|
|
2309
|
+
assert "Submission readiness: no_listed_gaps_located" in first
|
|
2310
|
+
assert "Authorization status: not_provided" in first
|
|
2311
|
+
assert "Review timeline: unknown — obtain current institutional estimate" in first
|
|
2312
|
+
assert "## Packet Observations" in first
|
|
2313
|
+
assert RENDERED_BOUNDARY in first
|
|
2314
|
+
assert "STRUCTURAL-FIXTURE-667" not in first
|
|
2315
|
+
assert "Test-only structural attachment row" not in first
|
|
2316
|
+
|
|
2317
|
+
|
|
2318
|
+
def test_resolved_empty_renderer_does_not_invent_unresolved_entry_status() -> None:
|
|
2319
|
+
context, registry, _resolved = _authority()
|
|
2320
|
+
profile = next(
|
|
2321
|
+
row
|
|
2322
|
+
for row in registry["profiles"]
|
|
2323
|
+
if row["profile_id"] == "us.hhs.45-cfr-46.subpart-a"
|
|
2324
|
+
)
|
|
2325
|
+
for requirement in profile["requirements"]:
|
|
2326
|
+
requirement["consumer_scopes"] = [
|
|
2327
|
+
scope
|
|
2328
|
+
for scope in requirement["consumer_scopes"]
|
|
2329
|
+
if scope != "submission_packet"
|
|
2330
|
+
]
|
|
2331
|
+
_repin_profile(context, profile)
|
|
2332
|
+
resolved = resolve(context, registry)
|
|
2333
|
+
manifest = _build(_inventory(), PACKET_ROOT, context, registry, resolved)
|
|
2334
|
+
assert manifest["entries"] == []
|
|
2335
|
+
assert manifest["excluded_requirements"] == []
|
|
2336
|
+
assert manifest["unresolved_reasons"] == []
|
|
2337
|
+
assert manifest["administrative_status"]["submission_readiness"] == (
|
|
2338
|
+
"no_listed_gaps_located"
|
|
2339
|
+
)
|
|
2340
|
+
rendered = render_submission_packet_manifest(manifest)
|
|
2341
|
+
assert "| none | none | none | none | none | none | none |" in rendered
|
|
2342
|
+
assert packet_runtime._md("APPLICABILITY_UNRESOLVED") not in rendered
|
|
2343
|
+
|
|
2344
|
+
|
|
2345
|
+
def test_context_free_empty_renderer_carries_unresolved_only_in_reason_table() -> None:
|
|
2346
|
+
manifest = build_submission_packet_manifest(_inventory(), PACKET_ROOT)
|
|
2347
|
+
rendered = render_submission_packet_manifest(manifest)
|
|
2348
|
+
assert "| none | none | none | none | none | none | none |" in rendered
|
|
2349
|
+
assert (
|
|
2350
|
+
f"| {packet_runtime._md('APPLICABILITY_UNRESOLVED')} | "
|
|
2351
|
+
f"{packet_runtime._md('AUTHORITY_INPUT_NOT_PROVIDED')} | "
|
|
2352
|
+
"not provided | not provided |"
|
|
2353
|
+
) in rendered
|
|
2354
|
+
|
|
2355
|
+
|
|
2356
|
+
def test_renderer_preserves_false_applicability_accounting() -> None:
|
|
2357
|
+
context, registry, _resolved, overlay = _synthetic_overlay_authority()
|
|
2358
|
+
base = next(
|
|
2359
|
+
row
|
|
2360
|
+
for row in overlay["requirements"]
|
|
2361
|
+
if row["requirement_id"] == "synthetic.packet.base-consent"
|
|
2362
|
+
)
|
|
2363
|
+
base["applies_if"] = {
|
|
2364
|
+
"op": "fact_equals",
|
|
2365
|
+
"fact_id": "data.special_category",
|
|
2366
|
+
"value": True,
|
|
2367
|
+
}
|
|
2368
|
+
_repin_overlay(context, overlay)
|
|
2369
|
+
special = next(
|
|
2370
|
+
row
|
|
2371
|
+
for row in context["declared_facts"]
|
|
2372
|
+
if row["fact_id"] == "data.special_category"
|
|
2373
|
+
)
|
|
2374
|
+
special["state"], special["value"] = "declared", False
|
|
2375
|
+
resolved = resolve(context, registry)
|
|
2376
|
+
manifest = _build(_inventory(), PACKET_ROOT, context, registry, resolved)
|
|
2377
|
+
excluded = next(
|
|
2378
|
+
row
|
|
2379
|
+
for row in manifest["excluded_requirements"]
|
|
2380
|
+
if row["requirement_ref"]["requirement_id"]
|
|
2381
|
+
== "synthetic.packet.base-consent"
|
|
2382
|
+
)
|
|
2383
|
+
rendered = render_submission_packet_manifest(manifest)
|
|
2384
|
+
assert "## Excluded Requirements" in rendered
|
|
2385
|
+
assert (
|
|
2386
|
+
f"| {packet_runtime._md('synthetic.packet.base-consent')} | "
|
|
2387
|
+
f"{packet_runtime._md(excluded['requirement_ref']['requirement_pointer'])} | "
|
|
2388
|
+
f"{packet_runtime._md('resolved_predicate_false')} |"
|
|
2389
|
+
) in rendered
|
|
2390
|
+
|
|
2391
|
+
|
|
2392
|
+
def test_renderer_neutralizes_markdown_active_inventory_path(
|
|
2393
|
+
tmp_path: Path,
|
|
2394
|
+
) -> None:
|
|
2395
|
+
packet = _packet_copy(tmp_path)
|
|
2396
|
+
inventory = _inventory()
|
|
2397
|
+
artifact = _artifact(inventory, "fixture.us-consent")
|
|
2398
|
+
original = packet / artifact["relative_path"]
|
|
2399
|
+
malicious = (
|
|
2400
|
+
"<img src=x>-)-`code`-pipe|cell-"
|
|
2401
|
+
"line\u2028# heading.txt"
|
|
2402
|
+
)
|
|
2403
|
+
original.rename(packet / malicious)
|
|
2404
|
+
artifact["relative_path"] = malicious
|
|
2405
|
+
manifest = _build(inventory, packet)
|
|
2406
|
+
rendered = render_submission_packet_manifest(manifest)
|
|
2407
|
+
assert malicious not in rendered
|
|
2408
|
+
assert "javascript:" not in rendered
|
|
2409
|
+
assert "<img" not in rendered
|
|
2410
|
+
assert "\u2028" not in rendered
|
|
2411
|
+
observation_lines = rendered.split("## Packet Observations", 1)[1].split(
|
|
2412
|
+
"## Mechanical Evidence Entries", 1
|
|
2413
|
+
)[0]
|
|
2414
|
+
assert sum(
|
|
2415
|
+
line.startswith(f"| {packet_runtime._md(artifact['artifact_id'])} |")
|
|
2416
|
+
for line in observation_lines.splitlines()
|
|
2417
|
+
) == 1
|
|
2418
|
+
|
|
2419
|
+
try:
|
|
2420
|
+
from markdown_it import MarkdownIt
|
|
2421
|
+
except ImportError:
|
|
2422
|
+
return
|
|
2423
|
+
tokens = MarkdownIt().parse(rendered)
|
|
2424
|
+
assert not any(
|
|
2425
|
+
token.type in {"link_open", "image", "html_inline", "html_block"}
|
|
2426
|
+
for token in tokens
|
|
2427
|
+
)
|
|
2428
|
+
|
|
2429
|
+
|
|
2430
|
+
def _cli_inputs(tmp_path: Path) -> dict[str, Path]:
|
|
2431
|
+
context, registry, resolved = _authority()
|
|
2432
|
+
paths = {
|
|
2433
|
+
"inventory": tmp_path / "inventory.json",
|
|
2434
|
+
"context": tmp_path / "context.json",
|
|
2435
|
+
"registry": tmp_path / "registry.json",
|
|
2436
|
+
"resolved": tmp_path / "resolved.json",
|
|
2437
|
+
"manifest": tmp_path / "manifest.json",
|
|
2438
|
+
"rendered": tmp_path / "manifest.md",
|
|
2439
|
+
}
|
|
2440
|
+
_write_json(paths["inventory"], _inventory())
|
|
2441
|
+
_write_json(paths["context"], context)
|
|
2442
|
+
_write_json(paths["registry"], registry)
|
|
2443
|
+
_write_json(paths["resolved"], resolved)
|
|
2444
|
+
return paths
|
|
2445
|
+
|
|
2446
|
+
|
|
2447
|
+
def _authority_cli_args(paths: dict[str, Path]) -> list[str]:
|
|
2448
|
+
return [
|
|
2449
|
+
"--context",
|
|
2450
|
+
str(paths["context"]),
|
|
2451
|
+
"--registry",
|
|
2452
|
+
str(paths["registry"]),
|
|
2453
|
+
"--resolved",
|
|
2454
|
+
str(paths["resolved"]),
|
|
2455
|
+
]
|
|
2456
|
+
|
|
2457
|
+
|
|
2458
|
+
def test_cli_build_validate_and_render_all_use_exact_replay(tmp_path: Path) -> None:
|
|
2459
|
+
paths = _cli_inputs(tmp_path)
|
|
2460
|
+
common = [
|
|
2461
|
+
"--inventory",
|
|
2462
|
+
str(paths["inventory"]),
|
|
2463
|
+
"--packet-root",
|
|
2464
|
+
str(PACKET_ROOT),
|
|
2465
|
+
*_authority_cli_args(paths),
|
|
2466
|
+
]
|
|
2467
|
+
built = subprocess.run(
|
|
2468
|
+
[
|
|
2469
|
+
sys.executable,
|
|
2470
|
+
str(RUNTIME),
|
|
2471
|
+
"build",
|
|
2472
|
+
*common,
|
|
2473
|
+
"--output",
|
|
2474
|
+
str(paths["manifest"]),
|
|
2475
|
+
],
|
|
2476
|
+
text=True,
|
|
2477
|
+
capture_output=True,
|
|
2478
|
+
check=False,
|
|
2479
|
+
)
|
|
2480
|
+
assert built.returncode == 0, built.stderr
|
|
2481
|
+
built_manifest = _json(paths["manifest"])
|
|
2482
|
+
_validator(MANIFEST_SCHEMA).validate(built_manifest)
|
|
2483
|
+
manifest_bytes = paths["manifest"].read_bytes()
|
|
2484
|
+
assert manifest_bytes == packet_runtime._canonical_bytes(built_manifest)
|
|
2485
|
+
assert len(manifest_bytes) <= packet_runtime.MAX_MANIFEST_BYTES
|
|
2486
|
+
|
|
2487
|
+
validated = subprocess.run(
|
|
2488
|
+
[
|
|
2489
|
+
sys.executable,
|
|
2490
|
+
str(RUNTIME),
|
|
2491
|
+
"validate",
|
|
2492
|
+
"--manifest",
|
|
2493
|
+
str(paths["manifest"]),
|
|
2494
|
+
*common,
|
|
2495
|
+
],
|
|
2496
|
+
text=True,
|
|
2497
|
+
capture_output=True,
|
|
2498
|
+
check=False,
|
|
2499
|
+
)
|
|
2500
|
+
assert validated.returncode == 0, validated.stderr
|
|
2501
|
+
|
|
2502
|
+
rendered = subprocess.run(
|
|
2503
|
+
[
|
|
2504
|
+
sys.executable,
|
|
2505
|
+
str(RUNTIME),
|
|
2506
|
+
"render",
|
|
2507
|
+
"--manifest",
|
|
2508
|
+
str(paths["manifest"]),
|
|
2509
|
+
*common,
|
|
2510
|
+
"--output",
|
|
2511
|
+
str(paths["rendered"]),
|
|
2512
|
+
],
|
|
2513
|
+
text=True,
|
|
2514
|
+
capture_output=True,
|
|
2515
|
+
check=False,
|
|
2516
|
+
)
|
|
2517
|
+
assert rendered.returncode == 0, rendered.stderr
|
|
2518
|
+
assert RENDERED_BOUNDARY in paths["rendered"].read_text(encoding="utf-8")
|
|
2519
|
+
|
|
2520
|
+
forged = _json(paths["manifest"])
|
|
2521
|
+
forged["entries"][0]["matched_artifact_ids"] = []
|
|
2522
|
+
_repin_manifest(forged)
|
|
2523
|
+
_write_json(paths["manifest"], forged)
|
|
2524
|
+
rejected = subprocess.run(
|
|
2525
|
+
[
|
|
2526
|
+
sys.executable,
|
|
2527
|
+
str(RUNTIME),
|
|
2528
|
+
"render",
|
|
2529
|
+
"--manifest",
|
|
2530
|
+
str(paths["manifest"]),
|
|
2531
|
+
*common,
|
|
2532
|
+
],
|
|
2533
|
+
text=True,
|
|
2534
|
+
capture_output=True,
|
|
2535
|
+
check=False,
|
|
2536
|
+
)
|
|
2537
|
+
assert rejected.returncode == 2
|
|
2538
|
+
assert "exactly match deterministic replay" in rejected.stderr
|
|
2539
|
+
|
|
2540
|
+
|
|
2541
|
+
@pytest.mark.parametrize(
|
|
2542
|
+
("target", "raw"),
|
|
2543
|
+
[
|
|
2544
|
+
("inventory", '{"schema_version":"a","schema_version":"b"}'),
|
|
2545
|
+
("inventory", '{"value":NaN}'),
|
|
2546
|
+
("context", '{"schema_version":"a","schema_version":"b"}'),
|
|
2547
|
+
("context", '{"value":Infinity}'),
|
|
2548
|
+
("registry", '{"schema_version":"a","schema_version":"b"}'),
|
|
2549
|
+
("registry", '{"value":-Infinity}'),
|
|
2550
|
+
("resolved", '{"schema_version":"a","schema_version":"b"}'),
|
|
2551
|
+
("resolved", '{"value":NaN}'),
|
|
2552
|
+
("manifest", '{"schema_version":"a","schema_version":"b"}'),
|
|
2553
|
+
("manifest", '{"value":Infinity}'),
|
|
2554
|
+
],
|
|
2555
|
+
)
|
|
2556
|
+
def test_cli_rejects_duplicate_keys_and_nonfinite_json(
|
|
2557
|
+
tmp_path: Path, target: str, raw: str
|
|
2558
|
+
) -> None:
|
|
2559
|
+
paths = _cli_inputs(tmp_path)
|
|
2560
|
+
manifest = _build()
|
|
2561
|
+
_write_json(paths["manifest"], manifest)
|
|
2562
|
+
paths[target].write_text(raw, encoding="utf-8")
|
|
2563
|
+
common = [
|
|
2564
|
+
"--inventory",
|
|
2565
|
+
str(paths["inventory"]),
|
|
2566
|
+
"--packet-root",
|
|
2567
|
+
str(PACKET_ROOT),
|
|
2568
|
+
*_authority_cli_args(paths),
|
|
2569
|
+
]
|
|
2570
|
+
command = "validate" if target == "manifest" else "build"
|
|
2571
|
+
argv = [sys.executable, str(RUNTIME), command]
|
|
2572
|
+
if command == "validate":
|
|
2573
|
+
argv.extend(["--manifest", str(paths["manifest"])])
|
|
2574
|
+
argv.extend(common)
|
|
2575
|
+
completed = subprocess.run(
|
|
2576
|
+
argv,
|
|
2577
|
+
text=True,
|
|
2578
|
+
capture_output=True,
|
|
2579
|
+
check=False,
|
|
2580
|
+
)
|
|
2581
|
+
assert completed.returncode == 2
|
|
2582
|
+
assert "duplicate JSON key" in completed.stderr or "non-finite" in completed.stderr
|
|
2583
|
+
|
|
2584
|
+
|
|
2585
|
+
@pytest.mark.parametrize(
|
|
2586
|
+
"raw",
|
|
2587
|
+
[
|
|
2588
|
+
'{"oversized_integer":' + "9" * 5000 + "}",
|
|
2589
|
+
'{"deep":' + "[" * 2000 + "0" + "]" * 2000 + "}",
|
|
2590
|
+
],
|
|
2591
|
+
)
|
|
2592
|
+
def test_cli_rejects_parser_resource_edges_with_rc2_and_no_traceback(
|
|
2593
|
+
tmp_path: Path, raw: str
|
|
2594
|
+
) -> None:
|
|
2595
|
+
paths = _cli_inputs(tmp_path)
|
|
2596
|
+
paths["inventory"].write_text(raw, encoding="utf-8")
|
|
2597
|
+
completed = subprocess.run(
|
|
2598
|
+
[
|
|
2599
|
+
sys.executable,
|
|
2600
|
+
str(RUNTIME),
|
|
2601
|
+
"build",
|
|
2602
|
+
"--inventory",
|
|
2603
|
+
str(paths["inventory"]),
|
|
2604
|
+
"--packet-root",
|
|
2605
|
+
str(PACKET_ROOT),
|
|
2606
|
+
*_authority_cli_args(paths),
|
|
2607
|
+
],
|
|
2608
|
+
text=True,
|
|
2609
|
+
capture_output=True,
|
|
2610
|
+
check=False,
|
|
2611
|
+
)
|
|
2612
|
+
assert completed.returncode == 2
|
|
2613
|
+
assert completed.stderr.startswith("ERROR:")
|
|
2614
|
+
assert "Traceback" not in completed.stderr
|
|
2615
|
+
|
|
2616
|
+
|
|
2617
|
+
def test_cli_rejects_escaped_lone_surrogate_with_rc2_and_no_traceback(
|
|
2618
|
+
tmp_path: Path,
|
|
2619
|
+
) -> None:
|
|
2620
|
+
paths = _cli_inputs(tmp_path)
|
|
2621
|
+
inventory = _inventory()
|
|
2622
|
+
inventory["artifacts"][0]["relative_path"] = "surrogate-\ud800.txt"
|
|
2623
|
+
paths["inventory"].write_text(
|
|
2624
|
+
json.dumps(inventory, ensure_ascii=True), encoding="utf-8"
|
|
2625
|
+
)
|
|
2626
|
+
completed = subprocess.run(
|
|
2627
|
+
[
|
|
2628
|
+
sys.executable,
|
|
2629
|
+
str(RUNTIME),
|
|
2630
|
+
"build",
|
|
2631
|
+
"--inventory",
|
|
2632
|
+
str(paths["inventory"]),
|
|
2633
|
+
"--packet-root",
|
|
2634
|
+
str(PACKET_ROOT),
|
|
2635
|
+
*_authority_cli_args(paths),
|
|
2636
|
+
],
|
|
2637
|
+
text=True,
|
|
2638
|
+
capture_output=True,
|
|
2639
|
+
check=False,
|
|
2640
|
+
)
|
|
2641
|
+
assert completed.returncode == 2
|
|
2642
|
+
assert completed.stderr.startswith("ERROR:")
|
|
2643
|
+
assert "surrogate" in completed.stderr
|
|
2644
|
+
assert "Traceback" not in completed.stderr
|