psyclaw 0.27.22 → 0.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -5
- package/dist/apps/panel/index.html +2 -2
- package/dist/src/adapters/pi/extension.js +225 -92
- package/dist/src/adapters/pi/extension.js.map +1 -1
- package/dist/src/agents/import.js +44 -32
- package/dist/src/agents/import.js.map +1 -1
- package/dist/src/analysis/hooks.d.ts +1 -0
- package/dist/src/analysis/hooks.js +20 -1
- package/dist/src/analysis/hooks.js.map +1 -1
- package/dist/src/ars/bridge.d.ts +20 -0
- package/dist/src/ars/bridge.js +132 -0
- package/dist/src/ars/bridge.js.map +1 -0
- package/dist/src/ars/contracts.d.ts +55 -0
- package/dist/src/ars/contracts.js +2 -0
- package/dist/src/ars/contracts.js.map +1 -0
- package/dist/src/ars/panel-plan.d.ts +4 -0
- package/dist/src/ars/panel-plan.js +11 -0
- package/dist/src/ars/panel-plan.js.map +1 -0
- package/dist/src/ars/pi-panel-executor.d.ts +30 -0
- package/dist/src/ars/pi-panel-executor.js +140 -0
- package/dist/src/ars/pi-panel-executor.js.map +1 -0
- package/dist/src/ars/profile.d.ts +36 -0
- package/dist/src/ars/profile.js +119 -0
- package/dist/src/ars/profile.js.map +1 -0
- package/dist/src/ars/re-review.d.ts +22 -0
- package/dist/src/ars/re-review.js +172 -0
- package/dist/src/ars/re-review.js.map +1 -0
- package/dist/src/branding.d.ts +2 -4
- package/dist/src/branding.js +3 -5
- package/dist/src/branding.js.map +1 -1
- package/dist/src/bundled-tools.d.ts +3 -0
- package/dist/src/bundled-tools.js +21 -0
- package/dist/src/bundled-tools.js.map +1 -0
- package/dist/src/chat.js +6 -5
- package/dist/src/chat.js.map +1 -1
- package/dist/src/creation/contracts.d.ts +38 -0
- package/dist/src/creation/contracts.js +2 -0
- package/dist/src/creation/contracts.js.map +1 -0
- package/dist/src/creation/service.d.ts +7 -0
- package/dist/src/creation/service.js +196 -0
- package/dist/src/creation/service.js.map +1 -0
- package/dist/src/index.d.ts +10 -0
- package/dist/src/index.js +10 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/install/installer.js +32 -10
- package/dist/src/install/installer.js.map +1 -1
- package/dist/src/orchestration/personas.d.ts +15 -0
- package/dist/src/orchestration/personas.js +51 -0
- package/dist/src/orchestration/personas.js.map +1 -0
- package/dist/src/orchestration/pi-executor.d.ts +1 -0
- package/dist/src/orchestration/pi-executor.js +1 -1
- package/dist/src/orchestration/pi-executor.js.map +1 -1
- package/dist/src/panel/extension.js +29 -8
- package/dist/src/panel/extension.js.map +1 -1
- package/dist/src/panel/server.js +14 -5
- package/dist/src/panel/server.js.map +1 -1
- package/dist/src/project/paths.d.ts +3 -0
- package/dist/src/project/paths.js +7 -0
- package/dist/src/project/paths.js.map +1 -1
- package/dist/src/rules/user-rules.d.ts +8 -0
- package/dist/src/rules/user-rules.js +36 -0
- package/dist/src/rules/user-rules.js.map +1 -0
- package/dist/src/skills/contracts.d.ts +4 -4
- package/dist/src/skills/recommended.js +1 -1
- package/dist/src/skills/registry.js +49 -28
- package/dist/src/skills/registry.js.map +1 -1
- package/dist/src/style/cli-ui.js +0 -1
- package/dist/src/style/cli-ui.js.map +1 -1
- package/package.json +14 -3
- package/scripts/rebrand-pi.mjs +6 -0
- package/skills/recommended/catalog.json +2 -11
- package/vendor/ars/.claude/CLAUDE.md +371 -0
- package/vendor/ars/.command-invariants.toml +24 -0
- package/vendor/ars/CITATION.cff +35 -0
- package/vendor/ars/LICENSE +417 -0
- package/vendor/ars/MODE_REGISTRY.md +76 -0
- package/vendor/ars/NOTICE.md +26 -0
- package/vendor/ars/POSITIONING.md +99 -0
- package/vendor/ars/PSYCLAW_SOURCE.json +10 -0
- package/vendor/ars/README.md +751 -0
- package/vendor/ars/SECURITY.md +52 -0
- package/vendor/ars/THIRD_PARTY.md +70 -0
- package/vendor/ars/academic-paper/SKILL.md +542 -0
- package/vendor/ars/academic-paper/agents/abstract_bilingual_agent.md +171 -0
- package/vendor/ars/academic-paper/agents/argument_builder_agent.md +276 -0
- package/vendor/ars/academic-paper/agents/citation_compliance_agent.md +422 -0
- package/vendor/ars/academic-paper/agents/draft_writer_agent.md +656 -0
- package/vendor/ars/academic-paper/agents/formatter_agent.md +999 -0
- package/vendor/ars/academic-paper/agents/intake_agent.md +393 -0
- package/vendor/ars/academic-paper/agents/literature_strategist_agent.md +626 -0
- package/vendor/ars/academic-paper/agents/peer_reviewer_agent.md +516 -0
- package/vendor/ars/academic-paper/agents/revision_coach_agent.md +334 -0
- package/vendor/ars/academic-paper/agents/socratic_mentor_agent.md +527 -0
- package/vendor/ars/academic-paper/agents/structure_architect_agent.md +401 -0
- package/vendor/ars/academic-paper/agents/visualization_agent.md +441 -0
- package/vendor/ars/academic-paper/examples/chinese_paper_example.md +278 -0
- package/vendor/ars/academic-paper/examples/clinical_citation_verification_checklist.md +95 -0
- package/vendor/ars/academic-paper/examples/clinical_epistemic_status_example.md +100 -0
- package/vendor/ars/academic-paper/examples/commitment_ledger_example.md +147 -0
- package/vendor/ars/academic-paper/examples/imrad_hei_example.md +234 -0
- package/vendor/ars/academic-paper/examples/literature_review_example.md +260 -0
- package/vendor/ars/academic-paper/examples/plan_mode_guided_writing.md +600 -0
- package/vendor/ars/academic-paper/examples/revision_mode_example.md +344 -0
- package/vendor/ars/academic-paper/examples/revision_recovery_example.md +506 -0
- package/vendor/ars/academic-paper/examples/version_family_reconciliation_example.md +89 -0
- package/vendor/ars/academic-paper/references/abstract_writing_guide.md +169 -0
- package/vendor/ars/academic-paper/references/academic_writing_style.md +188 -0
- package/vendor/ars/academic-paper/references/anti_leakage_protocol.md +83 -0
- package/vendor/ars/academic-paper/references/apa7_chinese_citation_guide.md +364 -0
- package/vendor/ars/academic-paper/references/apa7_extended_guide.md +198 -0
- package/vendor/ars/academic-paper/references/changelog.md +11 -0
- package/vendor/ars/academic-paper/references/citation_format_switcher.md +228 -0
- package/vendor/ars/academic-paper/references/committee_correspondence_protocol.md +158 -0
- package/vendor/ars/academic-paper/references/credit_authorship_guide.md +308 -0
- package/vendor/ars/academic-paper/references/disclosure_mode_protocol.md +478 -0
- package/vendor/ars/academic-paper/references/domain_evidence_profiles.md +38 -0
- package/vendor/ars/academic-paper/references/failure_paths.md +349 -0
- package/vendor/ars/academic-paper/references/funding_statement_guide.md +319 -0
- package/vendor/ars/academic-paper/references/hei_domain_glossary.md +169 -0
- package/vendor/ars/academic-paper/references/intro_title_rhetoric_guide.md +114 -0
- package/vendor/ars/academic-paper/references/journal_submission_guide.md +249 -0
- package/vendor/ars/academic-paper/references/latex_template_reference.md +378 -0
- package/vendor/ars/academic-paper/references/mode_selection_guide.md +378 -0
- package/vendor/ars/academic-paper/references/paper_structure_patterns.md +330 -0
- package/vendor/ars/academic-paper/references/plan_mode_protocol.md +112 -0
- package/vendor/ars/academic-paper/references/policy_anchor_disclosure_protocol.md +200 -0
- package/vendor/ars/academic-paper/references/policy_anchor_table.md +157 -0
- package/vendor/ars/academic-paper/references/revision_patch_protocol.md +173 -0
- package/vendor/ars/academic-paper/references/statistical_visualization_standards.md +750 -0
- package/vendor/ars/academic-paper/references/venue_disclosure_policies.md +259 -0
- package/vendor/ars/academic-paper/references/vlm_figure_verification.md +126 -0
- package/vendor/ars/academic-paper/references/workflow_phase_details.md +135 -0
- package/vendor/ars/academic-paper/references/writing_judgment_framework.md +59 -0
- package/vendor/ars/academic-paper/references/writing_quality_check.md +173 -0
- package/vendor/ars/academic-paper/templates/bilingual_abstract_template.md +78 -0
- package/vendor/ars/academic-paper/templates/case_study_template.md +129 -0
- package/vendor/ars/academic-paper/templates/conference_paper_template.md +108 -0
- package/vendor/ars/academic-paper/templates/credit_statement_template.md +132 -0
- package/vendor/ars/academic-paper/templates/funding_statement_template.md +290 -0
- package/vendor/ars/academic-paper/templates/imrad_template.md +183 -0
- package/vendor/ars/academic-paper/templates/latex_article_template.tex +199 -0
- package/vendor/ars/academic-paper/templates/literature_review_template.md +135 -0
- package/vendor/ars/academic-paper/templates/policy_brief_template.md +139 -0
- package/vendor/ars/academic-paper/templates/revision_tracking_template.md +199 -0
- package/vendor/ars/academic-paper/templates/theoretical_paper_template.md +119 -0
- package/vendor/ars/academic-paper-reviewer/SKILL.md +491 -0
- package/vendor/ars/academic-paper-reviewer/agents/devils_advocate_reviewer_agent.md +443 -0
- package/vendor/ars/academic-paper-reviewer/agents/domain_reviewer_agent.md +412 -0
- package/vendor/ars/academic-paper-reviewer/agents/editorial_synthesizer_agent.md +478 -0
- package/vendor/ars/academic-paper-reviewer/agents/eic_agent.md +339 -0
- package/vendor/ars/academic-paper-reviewer/agents/field_analyst_agent.md +221 -0
- package/vendor/ars/academic-paper-reviewer/agents/methodology_reviewer_agent.md +449 -0
- package/vendor/ars/academic-paper-reviewer/agents/perspective_reviewer_agent.md +427 -0
- package/vendor/ars/academic-paper-reviewer/examples/hei_paper_review_example.md +391 -0
- package/vendor/ars/academic-paper-reviewer/examples/interdisciplinary_review_example.md +299 -0
- package/vendor/ars/academic-paper-reviewer/examples/subclaim_decomposition_example.md +80 -0
- package/vendor/ars/academic-paper-reviewer/references/calibration_mode_protocol.md +256 -0
- package/vendor/ars/academic-paper-reviewer/references/changelog.md +10 -0
- package/vendor/ars/academic-paper-reviewer/references/editorial_decision_standards.md +236 -0
- package/vendor/ars/academic-paper-reviewer/references/guided_mode_protocol.md +34 -0
- package/vendor/ars/academic-paper-reviewer/references/integration_guide.md +15 -0
- package/vendor/ars/academic-paper-reviewer/references/quality_rubrics.md +84 -0
- package/vendor/ars/academic-paper-reviewer/references/re_review_mode_protocol.md +340 -0
- package/vendor/ars/academic-paper-reviewer/references/review_criteria_framework.md +98 -0
- package/vendor/ars/academic-paper-reviewer/references/review_panel_provenance_protocol.md +197 -0
- package/vendor/ars/academic-paper-reviewer/references/review_quality_thinking.md +58 -0
- package/vendor/ars/academic-paper-reviewer/references/reviewer_sprint_prompt_source.md +324 -0
- package/vendor/ars/academic-paper-reviewer/references/sprint_contract_protocol.md +296 -0
- package/vendor/ars/academic-paper-reviewer/references/statistical_reporting_standards.md +505 -0
- package/vendor/ars/academic-paper-reviewer/references/top_journals_by_field.md +206 -0
- package/vendor/ars/academic-paper-reviewer/templates/editorial_decision_template.md +235 -0
- package/vendor/ars/academic-paper-reviewer/templates/peer_review_report_template.md +305 -0
- package/vendor/ars/academic-paper-reviewer/templates/revision_response_template.md +248 -0
- package/vendor/ars/academic-pipeline/SKILL.md +736 -0
- package/vendor/ars/academic-pipeline/agents/claim_ref_alignment_audit_agent.md +382 -0
- package/vendor/ars/academic-pipeline/agents/collaboration_depth_agent.md +164 -0
- package/vendor/ars/academic-pipeline/agents/integrity_verification_agent.md +870 -0
- package/vendor/ars/academic-pipeline/agents/pipeline_orchestrator_agent.md +1379 -0
- package/vendor/ars/academic-pipeline/agents/state_tracker_agent.md +622 -0
- package/vendor/ars/academic-pipeline/examples/full_pipeline_example.md +482 -0
- package/vendor/ars/academic-pipeline/examples/integrity_failure_recovery.md +389 -0
- package/vendor/ars/academic-pipeline/examples/mid_entry_example.md +414 -0
- package/vendor/ars/academic-pipeline/references/adapters/.gitkeep +0 -0
- package/vendor/ars/academic-pipeline/references/adapters/overview.md +153 -0
- package/vendor/ars/academic-pipeline/references/ai_research_failure_modes.md +185 -0
- package/vendor/ars/academic-pipeline/references/changelog.md +14 -0
- package/vendor/ars/academic-pipeline/references/claim_audit_calibration_protocol.md +175 -0
- package/vendor/ars/academic-pipeline/references/claim_verification_protocol.md +282 -0
- package/vendor/ars/academic-pipeline/references/external_review_protocol.md +131 -0
- package/vendor/ars/academic-pipeline/references/integrity_review_protocol.md +110 -0
- package/vendor/ars/academic-pipeline/references/literature_corpus_consumers.md +193 -0
- package/vendor/ars/academic-pipeline/references/mode_advisor.md +135 -0
- package/vendor/ars/academic-pipeline/references/passport_as_reset_boundary.md +132 -0
- package/vendor/ars/academic-pipeline/references/pipeline_state_machine.md +405 -0
- package/vendor/ars/academic-pipeline/references/plagiarism_detection_protocol.md +239 -0
- package/vendor/ars/academic-pipeline/references/process_summary_protocol.md +209 -0
- package/vendor/ars/academic-pipeline/references/progress_dashboard_template.md +38 -0
- package/vendor/ars/academic-pipeline/references/reinforcement_content.md +15 -0
- package/vendor/ars/academic-pipeline/references/reproducibility_audit.md +55 -0
- package/vendor/ars/academic-pipeline/references/score_trajectory_protocol.md +78 -0
- package/vendor/ars/academic-pipeline/references/team_collaboration_protocol.md +261 -0
- package/vendor/ars/academic-pipeline/references/two_stage_review_protocol.md +27 -0
- package/vendor/ars/academic-pipeline/templates/pipeline_status_template.md +146 -0
- package/vendor/ars/agents/report_compiler_agent.md +341 -0
- package/vendor/ars/agents/research_architect_agent.md +298 -0
- package/vendor/ars/agents/synthesis_agent.md +356 -0
- package/vendor/ars/commands/ars-3w.md +10 -0
- package/vendor/ars/commands/ars-abstract.md +10 -0
- package/vendor/ars/commands/ars-cache-invalidate.md +20 -0
- package/vendor/ars/commands/ars-citation-check.md +10 -0
- package/vendor/ars/commands/ars-disclosure.md +10 -0
- package/vendor/ars/commands/ars-format-convert.md +10 -0
- package/vendor/ars/commands/ars-full.md +9 -0
- package/vendor/ars/commands/ars-lit-review.md +12 -0
- package/vendor/ars/commands/ars-mark-read.md +18 -0
- package/vendor/ars/commands/ars-outline.md +10 -0
- package/vendor/ars/commands/ars-plan.md +10 -0
- package/vendor/ars/commands/ars-rebuttal-audit.md +12 -0
- package/vendor/ars/commands/ars-reviewer.md +9 -0
- package/vendor/ars/commands/ars-revision-coach.md +9 -0
- package/vendor/ars/commands/ars-revision.md +10 -0
- package/vendor/ars/commands/ars-unmark-read.md +16 -0
- package/vendor/ars/deep-research/SKILL.md +600 -0
- package/vendor/ars/deep-research/agents/bibliography_agent.md +473 -0
- package/vendor/ars/deep-research/agents/devils_advocate_agent.md +192 -0
- package/vendor/ars/deep-research/agents/editor_in_chief_agent.md +167 -0
- package/vendor/ars/deep-research/agents/ethics_review_agent.md +267 -0
- package/vendor/ars/deep-research/agents/meta_analysis_agent.md +325 -0
- package/vendor/ars/deep-research/agents/monitoring_agent.md +209 -0
- package/vendor/ars/deep-research/agents/report_compiler_agent.md +341 -0
- package/vendor/ars/deep-research/agents/research_architect_agent.md +298 -0
- package/vendor/ars/deep-research/agents/research_question_agent.md +216 -0
- package/vendor/ars/deep-research/agents/risk_of_bias_agent.md +231 -0
- package/vendor/ars/deep-research/agents/socratic_mentor_agent.md +764 -0
- package/vendor/ars/deep-research/agents/source_verification_agent.md +219 -0
- package/vendor/ars/deep-research/agents/synthesis_agent.md +356 -0
- package/vendor/ars/deep-research/agents/timeline_extraction_agent.md +99 -0
- package/vendor/ars/deep-research/examples/exploratory_research.md +157 -0
- package/vendor/ars/deep-research/examples/fact_check_mode.md +173 -0
- package/vendor/ars/deep-research/examples/handoff_to_paper.md +318 -0
- package/vendor/ars/deep-research/examples/idea_diversity_coverage_gap_advisory.md +64 -0
- package/vendor/ars/deep-research/examples/policy_analysis.md +161 -0
- package/vendor/ars/deep-research/examples/review_mode.md +253 -0
- package/vendor/ars/deep-research/examples/socratic_guided_research.md +331 -0
- package/vendor/ars/deep-research/examples/systematic_review.md +133 -0
- package/vendor/ars/deep-research/references/apa7_style_guide.md +162 -0
- package/vendor/ars/deep-research/references/argumentation_reasoning_framework.md +68 -0
- package/vendor/ars/deep-research/references/arxiv_api_protocol.md +76 -0
- package/vendor/ars/deep-research/references/changelog.md +22 -0
- package/vendor/ars/deep-research/references/chinese_literature_api_protocol.md +317 -0
- package/vendor/ars/deep-research/references/cross_agent_quality_definitions.md +14 -0
- package/vendor/ars/deep-research/references/crossref_api_protocol.md +84 -0
- package/vendor/ars/deep-research/references/equator_reporting_guidelines.md +482 -0
- package/vendor/ars/deep-research/references/ethics_checklist.md +282 -0
- package/vendor/ars/deep-research/references/failure_paths.md +355 -0
- package/vendor/ars/deep-research/references/interdisciplinary_bridges.md +292 -0
- package/vendor/ars/deep-research/references/irb_decision_tree.md +315 -0
- package/vendor/ars/deep-research/references/literature_monitoring_strategies.md +263 -0
- package/vendor/ars/deep-research/references/logical_fallacies.md +192 -0
- package/vendor/ars/deep-research/references/methodology_patterns.md +462 -0
- package/vendor/ars/deep-research/references/mode_selection_guide.md +331 -0
- package/vendor/ars/deep-research/references/openalex_api_protocol.md +82 -0
- package/vendor/ars/deep-research/references/preregistration_guide.md +324 -0
- package/vendor/ars/deep-research/references/semantic_scholar_api_protocol.md +107 -0
- package/vendor/ars/deep-research/references/socratic_mode_protocol.md +99 -0
- package/vendor/ars/deep-research/references/socratic_questioning_framework.md +232 -0
- package/vendor/ars/deep-research/references/source_quality_hierarchy.md +188 -0
- package/vendor/ars/deep-research/references/systematic_review_protocol.md +95 -0
- package/vendor/ars/deep-research/references/systematic_review_toolkit.md +353 -0
- package/vendor/ars/deep-research/templates/evidence_assessment_template.md +127 -0
- package/vendor/ars/deep-research/templates/literature_matrix_template.md +85 -0
- package/vendor/ars/deep-research/templates/preregistration_template.md +318 -0
- package/vendor/ars/deep-research/templates/prisma_protocol_template.md +248 -0
- package/vendor/ars/deep-research/templates/prisma_report_template.md +415 -0
- package/vendor/ars/deep-research/templates/research_brief_template.md +93 -0
- package/vendor/ars/package.json +24 -0
- package/vendor/ars/pi/README.md +161 -0
- package/vendor/ars/pi/package.json +26 -0
- package/vendor/ars/pi/wrapper.js +193 -0
- package/vendor/ars/pi/wrapper.test.mjs +201 -0
- package/vendor/ars/pyproject.toml +2 -0
- package/vendor/ars/requirements-pdf-content-classifier.txt +5 -0
- package/vendor/ars/scripts/_block_parser.py +396 -0
- package/vendor/ars/scripts/_ci_pytest_manifest.toml +661 -0
- package/vendor/ars/scripts/_claim_audit_constants.py +268 -0
- package/vendor/ars/scripts/_e4_evidence.py +110 -0
- package/vendor/ars/scripts/_eval_threshold_gate.py +73 -0
- package/vendor/ars/scripts/_markdown_lint_util.py +224 -0
- package/vendor/ars/scripts/_next_verified_at_ms.py +176 -0
- package/vendor/ars/scripts/_passport_yaml.py +53 -0
- package/vendor/ars/scripts/_skill_lint.py +254 -0
- package/vendor/ars/scripts/_text_similarity.py +141 -0
- package/vendor/ars/scripts/adapters/README.md +89 -0
- package/vendor/ars/scripts/adapters/_common.py +209 -0
- package/vendor/ars/scripts/adapters/examples/folder_scan/expected_passport.yaml +25 -0
- package/vendor/ars/scripts/adapters/examples/folder_scan/expected_rejection_log.yaml +18 -0
- package/vendor/ars/scripts/adapters/examples/folder_scan/input_fixture/Chen2024_AIAssessment.pdf +0 -0
- package/vendor/ars/scripts/adapters/examples/folder_scan/input_fixture/Wang_2023_formative_feedback.pdf +0 -0
- package/vendor/ars/scripts/adapters/examples/folder_scan/input_fixture/paper1.pdf +0 -0
- package/vendor/ars/scripts/adapters/examples/folder_scan/input_fixture//344/270/255/346/226/207/346/252/224/345/220/215_2024.pdf +0 -0
- package/vendor/ars/scripts/adapters/examples/obsidian/expected_passport.yaml +40 -0
- package/vendor/ars/scripts/adapters/examples/obsidian/expected_rejection_log.yaml +13 -0
- package/vendor/ars/scripts/adapters/examples/obsidian/input_fixture/vault/.gitkeep +0 -0
- package/vendor/ars/scripts/adapters/examples/obsidian/input_fixture/vault/.obsidian/app.json +1 -0
- package/vendor/ars/scripts/adapters/examples/obsidian/input_fixture/vault/_templates/tmpl.md +7 -0
- package/vendor/ars/scripts/adapters/examples/obsidian/input_fixture/vault/chen2024ai.md +13 -0
- package/vendor/ars/scripts/adapters/examples/obsidian/input_fixture/vault/invalid.md +1 -0
- package/vendor/ars/scripts/adapters/examples/obsidian/input_fixture/vault/wang2023formative.md +10 -0
- package/vendor/ars/scripts/adapters/examples/zotero/expected_passport.yaml +34 -0
- package/vendor/ars/scripts/adapters/examples/zotero/expected_rejection_log.yaml +34 -0
- package/vendor/ars/scripts/adapters/examples/zotero/input_fixture/.gitkeep +0 -0
- package/vendor/ars/scripts/adapters/examples/zotero/input_fixture/export.json +43 -0
- package/vendor/ars/scripts/adapters/folder_scan.py +214 -0
- package/vendor/ars/scripts/adapters/obsidian.py +336 -0
- package/vendor/ars/scripts/adapters/tests/.gitkeep +0 -0
- package/vendor/ars/scripts/adapters/tests/conftest.py +77 -0
- package/vendor/ars/scripts/adapters/tests/test_check_corpus_consumer_protocol.py +632 -0
- package/vendor/ars/scripts/adapters/tests/test_check_literature_corpus_schema.py +631 -0
- package/vendor/ars/scripts/adapters/tests/test_common.py +365 -0
- package/vendor/ars/scripts/adapters/tests/test_conftest.py +96 -0
- package/vendor/ars/scripts/adapters/tests/test_folder_scan.py +260 -0
- package/vendor/ars/scripts/adapters/tests/test_literature_corpus_entry_schema.py +745 -0
- package/vendor/ars/scripts/adapters/tests/test_obsidian.py +357 -0
- package/vendor/ars/scripts/adapters/tests/test_rejection_log_schema.py +271 -0
- package/vendor/ars/scripts/adapters/tests/test_sync_adapter_docs.py +88 -0
- package/vendor/ars/scripts/adapters/tests/test_zotero.py +454 -0
- package/vendor/ars/scripts/adapters/zotero.py +318 -0
- package/vendor/ars/scripts/adjudication_activity.py +1592 -0
- package/vendor/ars/scripts/announce-ars-loaded.sh +144 -0
- package/vendor/ars/scripts/ars_anchorize_draft.py +170 -0
- package/vendor/ars/scripts/ars_apply_revision_patch.py +912 -0
- package/vendor/ars/scripts/ars_cache_invalidate.py +40 -0
- package/vendor/ars/scripts/ars_mark_read.py +521 -0
- package/vendor/ars/scripts/ars_phase_scope_manifest.json +33 -0
- package/vendor/ars/scripts/ars_update_check.sh +215 -0
- package/vendor/ars/scripts/ars_write_scope_guard.py +506 -0
- package/vendor/ars/scripts/arxiv_client.py +222 -0
- package/vendor/ars/scripts/audit_snapshot.py +572 -0
- package/vendor/ars/scripts/bibliographic_integrity_signals.py +800 -0
- package/vendor/ars/scripts/bootstrap_timeline_yaml.py +146 -0
- package/vendor/ars/scripts/build_claim_standing_candidate_ledger.py +1238 -0
- package/vendor/ars/scripts/build_claim_standing_query_plan.py +643 -0
- package/vendor/ars/scripts/build_content_coverage_advisory.py +1205 -0
- package/vendor/ars/scripts/build_cross_document_consistency_advisory.py +2332 -0
- package/vendor/ars/scripts/build_review_pathway_rule_trace.py +830 -0
- package/vendor/ars/scripts/build_submission_packet_manifest.py +2310 -0
- package/vendor/ars/scripts/check_215_field_norm.py +173 -0
- package/vendor/ars/scripts/check_216_surface_form.py +250 -0
- package/vendor/ars/scripts/check_268_nested_commitment_ledger.py +180 -0
- package/vendor/ars/scripts/check_390_revision_patch_discipline.py +296 -0
- package/vendor/ars/scripts/check_392_citation_verification_intake.py +126 -0
- package/vendor/ars/scripts/check_394_submission_policy.py +178 -0
- package/vendor/ars/scripts/check_439_format_profile.py +307 -0
- package/vendor/ars/scripts/check_619_disclosure_closeout.py +237 -0
- package/vendor/ars/scripts/check_630_codex_subscription_transport.py +456 -0
- package/vendor/ars/scripts/check_669_review_pathway_rule_trace.py +662 -0
- package/vendor/ars/scripts/check_670_revision_roadmap_integration.py +518 -0
- package/vendor/ars/scripts/check_673_adjudication_activity.py +684 -0
- package/vendor/ars/scripts/check_684_review_criteria_binding.py +557 -0
- package/vendor/ars/scripts/check_agents_mirror_sync.py +115 -0
- package/vendor/ars/scripts/check_audit_artifact_consistency.py +2313 -0
- package/vendor/ars/scripts/check_benchmark_report.py +79 -0
- package/vendor/ars/scripts/check_bibliographic_integrity_signals.py +831 -0
- package/vendor/ars/scripts/check_calibration_tiers.py +235 -0
- package/vendor/ars/scripts/check_changelog_covers_merges.py +289 -0
- package/vendor/ars/scripts/check_ci_pytest_manifest.py +204 -0
- package/vendor/ars/scripts/check_claim_audit_consistency.py +1664 -0
- package/vendor/ars/scripts/check_claim_standing_candidate_ledger_integration.py +500 -0
- package/vendor/ars/scripts/check_claim_standing_freshness.py +253 -0
- package/vendor/ars/scripts/check_claim_standing_transmissions.py +449 -0
- package/vendor/ars/scripts/check_collaboration_depth_rubric.py +180 -0
- package/vendor/ars/scripts/check_command_frontmatter_name.py +116 -0
- package/vendor/ars/scripts/check_committee_correspondence.py +333 -0
- package/vendor/ars/scripts/check_compliance_report.py +108 -0
- package/vendor/ars/scripts/check_content_coverage_advisory_integration.py +796 -0
- package/vendor/ars/scripts/check_control_availability.py +172 -0
- package/vendor/ars/scripts/check_corpus_consumer_protocol.py +404 -0
- package/vendor/ars/scripts/check_cross_document_consistency_advisory_integration.py +1191 -0
- package/vendor/ars/scripts/check_cross_model_handoff_contract.py +234 -0
- package/vendor/ars/scripts/check_cross_model_verification_sync.py +261 -0
- package/vendor/ars/scripts/check_data_access_level.py +131 -0
- package/vendor/ars/scripts/check_data_flows.py +252 -0
- package/vendor/ars/scripts/check_decision_contract.py +464 -0
- package/vendor/ars/scripts/check_degradation_registry.py +326 -0
- package/vendor/ars/scripts/check_distribution_surface_claims.py +226 -0
- package/vendor/ars/scripts/check_domain_evidence_profile.py +538 -0
- package/vendor/ars/scripts/check_e4_promotion.py +195 -0
- package/vendor/ars/scripts/check_evals_gold_set.py +279 -0
- package/vendor/ars/scripts/check_evidence_row_integration.py +396 -0
- package/vendor/ars/scripts/check_experiment_provenance.py +117 -0
- package/vendor/ars/scripts/check_field_norm_severity.py +144 -0
- package/vendor/ars/scripts/check_firm_rules_sync.py +375 -0
- package/vendor/ars/scripts/check_heldout_measurement_report.py +1179 -0
- package/vendor/ars/scripts/check_human_subjects_output_contract.py +139 -0
- package/vendor/ars/scripts/check_human_subjects_reference_migration.py +844 -0
- package/vendor/ars/scripts/check_indirect_prompt_injection_no_call.py +328 -0
- package/vendor/ars/scripts/check_instruction_data_boundary.py +236 -0
- package/vendor/ars/scripts/check_judge_prompt_version.py +125 -0
- package/vendor/ars/scripts/check_literature_corpus_schema.py +402 -0
- package/vendor/ars/scripts/check_model_tiering.py +223 -0
- package/vendor/ars/scripts/check_panel_synthesis.py +1331 -0
- package/vendor/ars/scripts/check_passport_reset_contract.py +214 -0
- package/vendor/ars/scripts/check_pattern_eval_manifest.py +422 -0
- package/vendor/ars/scripts/check_persuasion_invariance_fixtures.py +637 -0
- package/vendor/ars/scripts/check_phase_conformance.py +2180 -0
- package/vendor/ars/scripts/check_pipeline_boundary_semantics.py +600 -0
- package/vendor/ars/scripts/check_pipeline_integrity.py +340 -0
- package/vendor/ars/scripts/check_policy_anchor_protocol.py +159 -0
- package/vendor/ars/scripts/check_policy_anchor_table.py +286 -0
- package/vendor/ars/scripts/check_preprint_venues_consistency.py +123 -0
- package/vendor/ars/scripts/check_prisma_trAIce_freshness.py +84 -0
- package/vendor/ars/scripts/check_promotion_bakeoff_preregistration.py +1303 -0
- package/vendor/ars/scripts/check_ranking_lift.py +323 -0
- package/vendor/ars/scripts/check_re_review_synthesis.py +2719 -0
- package/vendor/ars/scripts/check_receipt_enum_sync.py +203 -0
- package/vendor/ars/scripts/check_repro_lock.py +85 -0
- package/vendor/ars/scripts/check_review_pathway_output.py +276 -0
- package/vendor/ars/scripts/check_reviewer_data_fences.py +224 -0
- package/vendor/ars/scripts/check_reviewer_finding_contract.py +783 -0
- package/vendor/ars/scripts/check_reviewer_role_label.py +447 -0
- package/vendor/ars/scripts/check_reviewer_scoring_honesty.py +292 -0
- package/vendor/ars/scripts/check_reviewer_sprint_prompt_sync.py +409 -0
- package/vendor/ars/scripts/check_revision_claim_drift_suite_v2.py +1622 -0
- package/vendor/ars/scripts/check_revision_token_conservation.py +263 -0
- package/vendor/ars/scripts/check_risk_register.py +280 -0
- package/vendor/ars/scripts/check_role_scoped_contract.py +702 -0
- package/vendor/ars/scripts/check_rq_framing_patterns.py +184 -0
- package/vendor/ars/scripts/check_rubric_weight_consistency.py +32 -0
- package/vendor/ars/scripts/check_seeded_defect_fixtures.py +425 -0
- package/vendor/ars/scripts/check_setup_cross_model_parity.py +139 -0
- package/vendor/ars/scripts/check_spec_consistency.py +1249 -0
- package/vendor/ars/scripts/check_sprint_contract.py +371 -0
- package/vendor/ars/scripts/check_stage_capability_matrix.py +784 -0
- package/vendor/ars/scripts/check_submission_packet_manifest_integration.py +358 -0
- package/vendor/ars/scripts/check_surface_form_parity.py +445 -0
- package/vendor/ars/scripts/check_task_type.py +22 -0
- package/vendor/ars/scripts/check_tools_allowlist.py +538 -0
- package/vendor/ars/scripts/check_tortured_phrase_screening_integration.py +1974 -0
- package/vendor/ars/scripts/check_v3_10_134_write_scope.py +286 -0
- package/vendor/ars/scripts/check_v3_10_policy.py +656 -0
- package/vendor/ars/scripts/check_v3_6_6_ab_manifest.py +364 -0
- package/vendor/ars/scripts/check_v3_6_7_pattern_protection.py +1366 -0
- package/vendor/ars/scripts/check_v3_6_8_audit_scope_block.py +464 -0
- package/vendor/ars/scripts/check_v3_6_8_cite_provenance_pipeline.py +231 -0
- package/vendor/ars/scripts/check_v3_6_8_frontmatter_trust_schema.py +248 -0
- package/vendor/ars/scripts/check_v3_6_8_mark_read_commands.py +79 -0
- package/vendor/ars/scripts/check_v3_6_8_pattern_protection.py +941 -0
- package/vendor/ars/scripts/check_v3_7_3_three_layer_citation.py +318 -0
- package/vendor/ars/scripts/check_v3_8_annotation_literal_sync.py +228 -0
- package/vendor/ars/scripts/check_v3_9_0_triangulation.py +366 -0
- package/vendor/ars/scripts/check_v3_9_2_phase_boundary.py +270 -0
- package/vendor/ars/scripts/check_v3_9_4_temporal_verification.py +139 -0
- package/vendor/ars/scripts/check_venue_disclosure_policies.py +63 -0
- package/vendor/ars/scripts/check_version_consistency.py +826 -0
- package/vendor/ars/scripts/check_workflow_classification.py +223 -0
- package/vendor/ars/scripts/chinese_literature_client.py +1938 -0
- package/vendor/ars/scripts/citation_verification_summary.py +85 -0
- package/vendor/ars/scripts/claim_audit_calibration.py +517 -0
- package/vendor/ars/scripts/claim_audit_finalizer.py +456 -0
- package/vendor/ars/scripts/claim_audit_pipeline.py +1594 -0
- package/vendor/ars/scripts/claim_registry_coverage.py +493 -0
- package/vendor/ars/scripts/claim_standing_discovery.py +784 -0
- package/vendor/ars/scripts/claim_standing_stance_runner.py +758 -0
- package/vendor/ars/scripts/claim_standing_stance_scorer.py +239 -0
- package/vendor/ars/scripts/claim_strength_drift_disposition.py +666 -0
- package/vendor/ars/scripts/contamination_signals.py +689 -0
- package/vendor/ars/scripts/corpus_consumer_manifest.json +19 -0
- package/vendor/ars/scripts/cross_model_codex_transport.py +1374 -0
- package/vendor/ars/scripts/cross_model_codex_verify.sh +6 -0
- package/vendor/ars/scripts/cross_model_handoff.py +359 -0
- package/vendor/ars/scripts/cross_model_smoke_test.sh +183 -0
- package/vendor/ars/scripts/cross_model_smoke_test_codex.sh +35 -0
- package/vendor/ars/scripts/cross_model_verification/gemini_is_grounded.jq +45 -0
- package/vendor/ars/scripts/cross_model_verification/gemini_sources.jq +45 -0
- package/vendor/ars/scripts/cross_model_verification/normalize_compat_verdict.py +57 -0
- package/vendor/ars/scripts/cross_model_verification/openai_has_completed_web_search.jq +15 -0
- package/vendor/ars/scripts/cross_model_verification/openai_sources.jq +17 -0
- package/vendor/ars/scripts/cross_model_verification/openai_text.jq +11 -0
- package/vendor/ars/scripts/crossref_client.py +225 -0
- package/vendor/ars/scripts/dispatch_e4_panel.py +2731 -0
- package/vendor/ars/scripts/evidence_rows.py +2043 -0
- package/vendor/ars/scripts/fixtures/adjudication_activity/author_stage3.json +32 -0
- package/vendor/ars/scripts/fixtures/adjudication_activity/author_stage3_input.json +27 -0
- package/vendor/ars/scripts/fixtures/adjudication_activity/author_stage3_prime.json +32 -0
- package/vendor/ars/scripts/fixtures/adjudication_activity/author_stage3_prime_input.json +27 -0
- package/vendor/ars/scripts/fixtures/adjudication_activity/compliance_override.json +50 -0
- package/vendor/ars/scripts/fixtures/adjudication_activity/compliance_override_action.json +14 -0
- package/vendor/ars/scripts/fixtures/adjudication_activity/compliance_pass.json +44 -0
- package/vendor/ars/scripts/fixtures/adjudication_activity/explicit_user_request_log.json +26 -0
- package/vendor/ars/scripts/fixtures/adjudication_activity/mandatory_checkpoint_log.json +116 -0
- package/vendor/ars/scripts/fixtures/audit_artifact_consistency/README.md +56 -0
- package/vendor/ars/scripts/fixtures/audit_artifact_consistency/negative/a1_pass_with_p1/2026-04-30T15-22-04Z-d8f3.audit_artifact_entry.json +24 -0
- package/vendor/ars/scripts/fixtures/audit_artifact_consistency/negative/a1_pass_with_p1/2026-04-30T15-22-04Z-d8f3.jsonl +4 -0
- package/vendor/ars/scripts/fixtures/audit_artifact_consistency/negative/a1_pass_with_p1/2026-04-30T15-22-04Z-d8f3.meta.json +43 -0
- package/vendor/ars/scripts/fixtures/audit_artifact_consistency/negative/a1_pass_with_p1/2026-04-30T15-22-04Z-d8f3.verdict.yaml +19 -0
- package/vendor/ars/scripts/fixtures/audit_artifact_consistency/negative/a7_orphan_completion/2026-04-30T15-22-04Z-d8f3.jsonl +3 -0
- package/vendor/ars/scripts/fixtures/audit_artifact_consistency/positive/persisted_minor/2026-04-30T15-22-04Z-d8f3.audit_artifact_entry.json +26 -0
- package/vendor/ars/scripts/fixtures/audit_artifact_consistency/positive/persisted_minor/2026-04-30T15-22-04Z-d8f3.jsonl +4 -0
- package/vendor/ars/scripts/fixtures/audit_artifact_consistency/positive/persisted_minor/2026-04-30T15-22-04Z-d8f3.meta.json +43 -0
- package/vendor/ars/scripts/fixtures/audit_artifact_consistency/positive/persisted_minor/2026-04-30T15-22-04Z-d8f3.verdict.yaml +19 -0
- package/vendor/ars/scripts/fixtures/audit_artifact_consistency/positive/proposal_pass/2026-04-30T15-22-04Z-d8f3.audit_artifact_entry.json +24 -0
- package/vendor/ars/scripts/fixtures/audit_artifact_consistency/positive/proposal_pass/2026-04-30T15-22-04Z-d8f3.jsonl +4 -0
- package/vendor/ars/scripts/fixtures/audit_artifact_consistency/positive/proposal_pass/2026-04-30T15-22-04Z-d8f3.meta.json +43 -0
- package/vendor/ars/scripts/fixtures/audit_artifact_consistency/positive/proposal_pass/2026-04-30T15-22-04Z-d8f3.verdict.yaml +12 -0
- package/vendor/ars/scripts/fixtures/bibliographic_integrity_signals/retraction.json +46 -0
- package/vendor/ars/scripts/fixtures/bibliographic_integrity_signals/retraction_check_attestation.json +44 -0
- package/vendor/ars/scripts/fixtures/bibliographic_integrity_signals/tortured_phrase.json +44 -0
- package/vendor/ars/scripts/fixtures/bibliographic_integrity_signals/tortured_phrase_v1_2_abstract_missing.json +107 -0
- package/vendor/ars/scripts/fixtures/bibliographic_integrity_signals/tortured_phrase_v1_2_detected.json +124 -0
- package/vendor/ars/scripts/fixtures/check_evals_gold_set/clean/expected_outcomes.json +77 -0
- package/vendor/ars/scripts/fixtures/check_evals_gold_set/clean/manifest.yaml +37 -0
- package/vendor/ars/scripts/fixtures/check_evals_gold_set/clean/tuples/001-valid-doi-test.json +20 -0
- package/vendor/ars/scripts/fixtures/check_evals_gold_set/clean/tuples/002-valid-arxiv-test.json +19 -0
- package/vendor/ars/scripts/fixtures/check_evals_gold_set/clean/tuples/003-fabricated-test.json +20 -0
- package/vendor/ars/scripts/fixtures/claim_audit_calibration/gold_set.json +344 -0
- package/vendor/ars/scripts/fixtures/claim_standing_candidate_ledger/query_plan.json +108 -0
- package/vendor/ars/scripts/fixtures/claim_standing_candidate_ledger/retrieval_input.json +179 -0
- package/vendor/ars/scripts/fixtures/committee_correspondence/16fd83f6aec7/concern_tracker.json +129 -0
- package/vendor/ars/scripts/fixtures/committee_correspondence/16fd83f6aec7/response_skeleton.md +19 -0
- package/vendor/ars/scripts/fixtures/committee_correspondence/16fd83f6aec7/source_letter.txt +9 -0
- package/vendor/ars/scripts/fixtures/content_coverage_advisory/base_draft.json +48 -0
- package/vendor/ars/scripts/fixtures/content_coverage_advisory/base_inventory.json +38 -0
- package/vendor/ars/scripts/fixtures/content_coverage_advisory/packet/consent.txt +1 -0
- package/vendor/ars/scripts/fixtures/content_coverage_advisory/session_sources.json +3 -0
- package/vendor/ars/scripts/fixtures/cross_document_consistency/README.md +6 -0
- package/vendor/ars/scripts/fixtures/cross_document_consistency/accepted_draft.md +35 -0
- package/vendor/ars/scripts/fixtures/cross_document_consistency/cases.json +75 -0
- package/vendor/ars/scripts/fixtures/cross_document_consistency/preregistration.md +5 -0
- package/vendor/ars/scripts/fixtures/cross_model_codex_transport/forbidden_event.jsonl +4 -0
- package/vendor/ars/scripts/fixtures/cross_model_codex_transport/grounded_verified.jsonl +3 -0
- package/vendor/ars/scripts/fixtures/cross_model_codex_transport/malformed.jsonl +3 -0
- package/vendor/ars/scripts/fixtures/cross_model_codex_transport/missing_search.jsonl +2 -0
- package/vendor/ars/scripts/fixtures/cross_model_codex_transport/multiple_finals.jsonl +4 -0
- package/vendor/ars/scripts/fixtures/cross_model_codex_transport/not_found.jsonl +3 -0
- package/vendor/ars/scripts/fixtures/cross_model_codex_transport/unbound_source.jsonl +3 -0
- package/vendor/ars/scripts/fixtures/cross_model_codex_transport/wrong_search_shape.jsonl +3 -0
- package/vendor/ars/scripts/fixtures/evidence_rows/phase_e_inputs.json +114 -0
- package/vendor/ars/scripts/fixtures/evidence_rows/session_sources.json +5 -0
- package/vendor/ars/scripts/fixtures/human_subjects_authority/cross-border-us-tw-gdpr.json +71 -0
- package/vendor/ars/scripts/fixtures/human_subjects_authority/gdpr-member-state-unresolved.json +62 -0
- package/vendor/ars/scripts/fixtures/human_subjects_authority/missing-data-axis.json +45 -0
- package/vendor/ars/scripts/fixtures/human_subjects_authority/no-profile.json +33 -0
- package/vendor/ars/scripts/fixtures/human_subjects_authority/tw-gdpr-two-axis.json +74 -0
- package/vendor/ars/scripts/fixtures/human_subjects_authority/us-gdpr-two-axis.json +74 -0
- package/vendor/ars/scripts/fixtures/review_pathway_rule_trace/lint-near-misses.json +72 -0
- package/vendor/ars/scripts/fixtures/review_pathway_rule_trace/no-profile-request.json +18 -0
- package/vendor/ars/scripts/fixtures/review_pathway_rule_trace/tw-candidates-request.json +63 -0
- package/vendor/ars/scripts/fixtures/review_pathway_rule_trace/us-candidates-request.json +77 -0
- package/vendor/ars/scripts/fixtures/review_target_context/exact-declaration.json +24 -0
- package/vendor/ars/scripts/fixtures/review_target_context/field-general-declaration.json +24 -0
- package/vendor/ars/scripts/fixtures/review_target_context/msr-2027-technical-full-declaration.json +24 -0
- package/vendor/ars/scripts/fixtures/review_target_context/synthetic-registry.json +92 -0
- package/vendor/ars/scripts/fixtures/revision_claim_drift_v2/README.md +21 -0
- package/vendor/ars/scripts/fixtures/revision_claim_drift_v2/subject_context_attested_only.json +55 -0
- package/vendor/ars/scripts/fixtures/revision_claim_drift_v2/subject_context_machine_supported.json +49 -0
- package/vendor/ars/scripts/fixtures/revision_claim_drift_v2/subject_context_not_isolated.json +56 -0
- package/vendor/ars/scripts/fixtures/revision_claim_drift_v2/subject_context_unknown.json +49 -0
- package/vendor/ars/scripts/fixtures/submission_package/clean/paper.md +16 -0
- package/vendor/ars/scripts/fixtures/submission_package/clean/references.bib +13 -0
- package/vendor/ars/scripts/fixtures/submission_package/fallback_authoryear/paper.md +11 -0
- package/vendor/ars/scripts/fixtures/submission_package/fallback_authoryear/references.bib +13 -0
- package/vendor/ars/scripts/fixtures/submission_package/fallback_latex/paper.tex +9 -0
- package/vendor/ars/scripts/fixtures/submission_package/fallback_latex/references.bib +13 -0
- package/vendor/ars/scripts/fixtures/submission_package/marker_no_join/paper.md +7 -0
- package/vendor/ars/scripts/fixtures/submission_package/orphan_intext/paper.md +8 -0
- package/vendor/ars/scripts/fixtures/submission_package/orphan_intext/references.bib +6 -0
- package/vendor/ars/scripts/fixtures/submission_package/passports/corpus_only.yaml +9 -0
- package/vendor/ars/scripts/fixtures/submission_package/passports/summary_join.yaml +16 -0
- package/vendor/ars/scripts/fixtures/submission_package/profiles/full.yaml +15 -0
- package/vendor/ars/scripts/fixtures/submission_package/profiles/tight.yaml +15 -0
- package/vendor/ars/scripts/fixtures/submission_package/summary_join/paper.md +7 -0
- package/vendor/ars/scripts/fixtures/submission_package/uncited_reference/paper.md +9 -0
- package/vendor/ars/scripts/fixtures/submission_package/uncited_reference/references.bib +13 -0
- package/vendor/ars/scripts/fixtures/submission_package/venue_clean/paper.md +26 -0
- package/vendor/ars/scripts/fixtures/submission_package/venue_clean/references.bib +13 -0
- package/vendor/ars/scripts/fixtures/submission_package/venue_violations/paper.md +20 -0
- package/vendor/ars/scripts/fixtures/submission_package/venue_violations/references.bib +13 -0
- package/vendor/ars/scripts/fixtures/submission_packet_manifest/base_inventory.json +101 -0
- package/vendor/ars/scripts/fixtures/submission_packet_manifest/packet/consent-materials.txt +3 -0
- package/vendor/ars/scripts/fixtures/submission_packet_manifest/packet/training-certificate.txt +2 -0
- package/vendor/ars/scripts/fixtures/submission_packet_manifest/packet/tw-consent-materials.txt +3 -0
- package/vendor/ars/scripts/fixtures/tortured_phrase_screening/corpus_input.yaml +30 -0
- package/vendor/ars/scripts/fixtures/tortured_phrase_screening/own_draft.md +36 -0
- package/vendor/ars/scripts/fixtures/tortured_phrase_screening/own_draft.tex +21 -0
- package/vendor/ars/scripts/fixtures/tortured_phrase_screening/seed_expectations.json +218 -0
- package/vendor/ars/scripts/fixtures/tortured_phrase_screening/snapshot.json +164 -0
- package/vendor/ars/scripts/fixtures/tortured_phrase_screening/snapshot_manifest.json +29 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/README.md +55 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/arxiv/empty_feed.xml +10 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/arxiv/error_5xx.html +7 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/arxiv/id_hit.xml +26 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/chinese_literature/README.md +69 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/chinese_literature/cnki_landing_page.html +13 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/chinese_literature/error_5xx.html +2 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/chinese_literature/esearch_coordinate_ambiguous.json +16 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/chinese_literature/esearch_coordinate_hit.json +16 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/chinese_literature/esearch_coordinate_zero.json +14 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/chinese_literature/esearch_coverage_hit.json +15 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/chinese_literature/esearch_coverage_zero.json +13 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/chinese_literature/esummary_hit.json +43 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/chinese_literature/esummary_issn_mismatch.json +31 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/chinese_literature/esummary_no_doi.json +31 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/chinese_literature/esummary_unknown_ra.json +34 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/chinese_literature/esummary_year_mismatch.json +31 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/chinese_literature/handle_absent.json +4 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/chinese_literature/handle_exists.json +16 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/chinese_literature/handle_internal_error.json +4 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/chinese_literature/istic_csl_hit.json +25 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/chinese_literature/istic_csl_other_title.json +18 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/chinese_literature/ra_cnki.json +6 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/chinese_literature/ra_crossref.json +6 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/chinese_literature/ra_istic.json +6 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/chinese_literature/ra_unknown_prefix.json +6 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/crossref/doi_hit.json +24 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/crossref/error_5xx.html +7 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/crossref/title_search_miss.json +15 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/openalex/doi_hit.json +29 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/openalex/error_5xx.json +4 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/openalex/title_search_miss.json +11 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/semantic_scholar/doi_hit.json +14 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/semantic_scholar/error_5xx.json +3 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/semantic_scholar/title_search_miss.json +5 -0
- package/vendor/ars/scripts/human_read_attestation_resolver.py +467 -0
- package/vendor/ars/scripts/ideation_diversity_assignment_gate.py +430 -0
- package/vendor/ars/scripts/inquiry_branch_ledger.py +2540 -0
- package/vendor/ars/scripts/legacy/ars_apply_revision_patch_v1_0.py +715 -0
- package/vendor/ars/scripts/legacy/check_re_review_synthesis_v1_0.py +2215 -0
- package/vendor/ars/scripts/migrate_literature_corpus_to_v3_10.py +223 -0
- package/vendor/ars/scripts/migrate_literature_corpus_to_v3_7_3.py +277 -0
- package/vendor/ars/scripts/migrate_literature_corpus_to_v3_9_0.py +304 -0
- package/vendor/ars/scripts/model_tiering_manifest.json +46 -0
- package/vendor/ars/scripts/openalex_client.py +232 -0
- package/vendor/ars/scripts/parse_audit_verdict.py +802 -0
- package/vendor/ars/scripts/pdf_content_classifier_worker.py +176 -0
- package/vendor/ars/scripts/pdf_read_preflight.py +1455 -0
- package/vendor/ars/scripts/policy_anchor_disclosure_referee.py +354 -0
- package/vendor/ars/scripts/recompute_receipts.py +1414 -0
- package/vendor/ars/scripts/render_claim_standing_view.py +374 -0
- package/vendor/ars/scripts/render_eval_comment.py +130 -0
- package/vendor/ars/scripts/render_harness_retirement_issue.py +167 -0
- package/vendor/ars/scripts/repro_lock_validation.py +90 -0
- package/vendor/ars/scripts/research_workflow_profile.py +1079 -0
- package/vendor/ars/scripts/resolve_human_subjects_authority.py +1158 -0
- package/vendor/ars/scripts/resolve_review_target_context.py +683 -0
- package/vendor/ars/scripts/resume_e4_record.py +509 -0
- package/vendor/ars/scripts/retraction_status.py +484 -0
- package/vendor/ars/scripts/review_criteria_binding.py +889 -0
- package/vendor/ars/scripts/review_panel_provenance.py +744 -0
- package/vendor/ars/scripts/revision_roadmap.py +1967 -0
- package/vendor/ars/scripts/run_ci_pytest_manifest.py +116 -0
- package/vendor/ars/scripts/run_codex_audit.sh +1191 -0
- package/vendor/ars/scripts/run_evals.py +513 -0
- package/vendor/ars/scripts/run_ideation_diversity_no_call.py +3505 -0
- package/vendor/ars/scripts/run_indirect_prompt_injection_no_call.py +3330 -0
- package/vendor/ars/scripts/run_indirect_prompt_injection_probe.py +399 -0
- package/vendor/ars/scripts/run_review_criteria_constructive_value.py +1895 -0
- package/vendor/ars/scripts/run_role_topology_utility_dry_run.py +606 -0
- package/vendor/ars/scripts/score_review_criteria_constructive_value.py +617 -0
- package/vendor/ars/scripts/semantic_scholar_client.py +291 -0
- package/vendor/ars/scripts/slr_lineage.py +59 -0
- package/vendor/ars/scripts/sync_adapter_docs.py +118 -0
- package/vendor/ars/scripts/temporal_integrity_audit.py +840 -0
- package/vendor/ars/scripts/test_431_exact_or_bust.py +253 -0
- package/vendor/ars/scripts/test__eval_threshold_gate.py +125 -0
- package/vendor/ars/scripts/test__markdown_lint_util.py +129 -0
- package/vendor/ars/scripts/test__next_verified_at_ms.py +256 -0
- package/vendor/ars/scripts/test_adjacent_framing_probe_lint.py +171 -0
- package/vendor/ars/scripts/test_adjudication_activity.py +1515 -0
- package/vendor/ars/scripts/test_ars_anchorize_draft.py +178 -0
- package/vendor/ars/scripts/test_ars_apply_revision_patch.py +1335 -0
- package/vendor/ars/scripts/test_ars_cache_invalidate.py +51 -0
- package/vendor/ars/scripts/test_ars_mark_read.py +910 -0
- package/vendor/ars/scripts/test_ars_update_check.py +816 -0
- package/vendor/ars/scripts/test_ars_write_scope_guard.py +790 -0
- package/vendor/ars/scripts/test_arxiv_client.py +374 -0
- package/vendor/ars/scripts/test_audit_schemas.py +560 -0
- package/vendor/ars/scripts/test_audit_snapshot_render_section_0.py +105 -0
- package/vendor/ars/scripts/test_block_parser.py +259 -0
- package/vendor/ars/scripts/test_bootstrap_timeline_yaml.py +148 -0
- package/vendor/ars/scripts/test_build_claim_standing_candidate_ledger.py +1203 -0
- package/vendor/ars/scripts/test_build_claim_standing_query_plan.py +791 -0
- package/vendor/ars/scripts/test_build_submission_packet_manifest.py +2644 -0
- package/vendor/ars/scripts/test_check_215_field_norm.py +238 -0
- package/vendor/ars/scripts/test_check_216_surface_form.py +341 -0
- package/vendor/ars/scripts/test_check_268_nested_commitment_ledger.py +194 -0
- package/vendor/ars/scripts/test_check_390_revision_patch_discipline.py +279 -0
- package/vendor/ars/scripts/test_check_392_citation_verification_intake.py +144 -0
- package/vendor/ars/scripts/test_check_394_submission_policy.py +200 -0
- package/vendor/ars/scripts/test_check_439_format_profile.py +252 -0
- package/vendor/ars/scripts/test_check_619_disclosure_closeout.py +158 -0
- package/vendor/ars/scripts/test_check_630_codex_subscription_transport.py +245 -0
- package/vendor/ars/scripts/test_check_669_review_pathway_rule_trace.py +304 -0
- package/vendor/ars/scripts/test_check_670_revision_roadmap_integration.py +260 -0
- package/vendor/ars/scripts/test_check_673_adjudication_activity.py +367 -0
- package/vendor/ars/scripts/test_check_684_review_criteria_binding.py +274 -0
- package/vendor/ars/scripts/test_check_agents_mirror_sync.py +137 -0
- package/vendor/ars/scripts/test_check_audit_artifact_consistency.py +2133 -0
- package/vendor/ars/scripts/test_check_benchmark_report.py +117 -0
- package/vendor/ars/scripts/test_check_bibliographic_integrity_signals.py +609 -0
- package/vendor/ars/scripts/test_check_calibration_tiers.py +376 -0
- package/vendor/ars/scripts/test_check_changelog_covers_merges.py +509 -0
- package/vendor/ars/scripts/test_check_ci_pytest_manifest.py +425 -0
- package/vendor/ars/scripts/test_check_claim_standing_candidate_ledger_integration.py +256 -0
- package/vendor/ars/scripts/test_check_claim_standing_freshness.py +277 -0
- package/vendor/ars/scripts/test_check_collaboration_depth_rubric.py +239 -0
- package/vendor/ars/scripts/test_check_command_frontmatter_name.py +178 -0
- package/vendor/ars/scripts/test_check_committee_correspondence.py +298 -0
- package/vendor/ars/scripts/test_check_compliance_report.py +381 -0
- package/vendor/ars/scripts/test_check_content_coverage_advisory_integration.py +308 -0
- package/vendor/ars/scripts/test_check_control_availability.py +361 -0
- package/vendor/ars/scripts/test_check_cross_document_consistency_advisory_integration.py +698 -0
- package/vendor/ars/scripts/test_check_cross_model_handoff_contract.py +301 -0
- package/vendor/ars/scripts/test_check_cross_model_verification_sync.py +203 -0
- package/vendor/ars/scripts/test_check_data_access_level.py +227 -0
- package/vendor/ars/scripts/test_check_data_flows.py +382 -0
- package/vendor/ars/scripts/test_check_decision_contract.py +387 -0
- package/vendor/ars/scripts/test_check_degradation_registry.py +270 -0
- package/vendor/ars/scripts/test_check_distribution_surface_claims.py +225 -0
- package/vendor/ars/scripts/test_check_domain_evidence_profile.py +439 -0
- package/vendor/ars/scripts/test_check_e4_promotion.py +163 -0
- package/vendor/ars/scripts/test_check_evals_gold_set.py +312 -0
- package/vendor/ars/scripts/test_check_evidence_row_integration.py +187 -0
- package/vendor/ars/scripts/test_check_field_norm_severity.py +173 -0
- package/vendor/ars/scripts/test_check_firm_rules_sync.py +342 -0
- package/vendor/ars/scripts/test_check_heldout_measurement_report.py +1508 -0
- package/vendor/ars/scripts/test_check_human_subjects_output_contract.py +129 -0
- package/vendor/ars/scripts/test_check_human_subjects_reference_migration.py +756 -0
- package/vendor/ars/scripts/test_check_instruction_data_boundary.py +204 -0
- package/vendor/ars/scripts/test_check_judge_prompt_version.py +90 -0
- package/vendor/ars/scripts/test_check_model_tiering.py +236 -0
- package/vendor/ars/scripts/test_check_panel_synthesis.py +1658 -0
- package/vendor/ars/scripts/test_check_passport_reset_contract.py +249 -0
- package/vendor/ars/scripts/test_check_pattern_eval_manifest.py +381 -0
- package/vendor/ars/scripts/test_check_persuasion_invariance_fixtures.py +591 -0
- package/vendor/ars/scripts/test_check_phase_conformance.py +4366 -0
- package/vendor/ars/scripts/test_check_pipeline_boundary_semantics.py +931 -0
- package/vendor/ars/scripts/test_check_pipeline_integrity.py +243 -0
- package/vendor/ars/scripts/test_check_policy_anchor_protocol.py +236 -0
- package/vendor/ars/scripts/test_check_policy_anchor_table.py +295 -0
- package/vendor/ars/scripts/test_check_prisma_trAIce_freshness.py +68 -0
- package/vendor/ars/scripts/test_check_promotion_bakeoff_preregistration.py +799 -0
- package/vendor/ars/scripts/test_check_ranking_lift.py +377 -0
- package/vendor/ars/scripts/test_check_re_review_synthesis.py +3398 -0
- package/vendor/ars/scripts/test_check_receipt_enum_sync.py +176 -0
- package/vendor/ars/scripts/test_check_repro_lock.py +107 -0
- package/vendor/ars/scripts/test_check_reviewer_data_fences.py +334 -0
- package/vendor/ars/scripts/test_check_reviewer_finding_contract.py +1107 -0
- package/vendor/ars/scripts/test_check_reviewer_role_label.py +491 -0
- package/vendor/ars/scripts/test_check_reviewer_scoring_honesty.py +222 -0
- package/vendor/ars/scripts/test_check_reviewer_sprint_prompt_sync.py +373 -0
- package/vendor/ars/scripts/test_check_revision_claim_drift_suite_v2.py +1925 -0
- package/vendor/ars/scripts/test_check_revision_token_conservation.py +398 -0
- package/vendor/ars/scripts/test_check_risk_register.py +336 -0
- package/vendor/ars/scripts/test_check_role_scoped_contract.py +1104 -0
- package/vendor/ars/scripts/test_check_rq_framing_patterns.py +110 -0
- package/vendor/ars/scripts/test_check_rubric_weight_consistency.py +32 -0
- package/vendor/ars/scripts/test_check_seeded_defect_fixtures.py +392 -0
- package/vendor/ars/scripts/test_check_setup_cross_model_parity.py +121 -0
- package/vendor/ars/scripts/test_check_spec_consistency.py +1081 -0
- package/vendor/ars/scripts/test_check_sprint_contract.py +458 -0
- package/vendor/ars/scripts/test_check_stage_capability_matrix.py +698 -0
- package/vendor/ars/scripts/test_check_submission_packet_manifest_integration.py +177 -0
- package/vendor/ars/scripts/test_check_surface_form_parity.py +417 -0
- package/vendor/ars/scripts/test_check_task_type.py +116 -0
- package/vendor/ars/scripts/test_check_tools_allowlist.py +835 -0
- package/vendor/ars/scripts/test_check_tortured_phrase_screening_integration.py +1306 -0
- package/vendor/ars/scripts/test_check_v3_10_134_write_scope.py +251 -0
- package/vendor/ars/scripts/test_check_v3_10_policy.py +547 -0
- package/vendor/ars/scripts/test_check_v3_6_7_pattern_protection.py +960 -0
- package/vendor/ars/scripts/test_check_v3_6_8_audit_scope_block.py +1000 -0
- package/vendor/ars/scripts/test_check_v3_6_8_cite_provenance_pipeline.py +454 -0
- package/vendor/ars/scripts/test_check_v3_6_8_frontmatter_trust_schema.py +581 -0
- package/vendor/ars/scripts/test_check_v3_6_8_mark_read_commands.py +120 -0
- package/vendor/ars/scripts/test_check_v3_6_8_pattern_protection.py +1138 -0
- package/vendor/ars/scripts/test_check_v3_7_3_three_layer_citation.py +566 -0
- package/vendor/ars/scripts/test_check_v3_8_annotation_literal_sync.py +262 -0
- package/vendor/ars/scripts/test_check_v3_9_0_triangulation.py +321 -0
- package/vendor/ars/scripts/test_check_v3_9_2_phase_boundary.py +190 -0
- package/vendor/ars/scripts/test_check_v3_9_4_temporal_verification.py +471 -0
- package/vendor/ars/scripts/test_check_version_consistency.py +1462 -0
- package/vendor/ars/scripts/test_check_workflow_classification.py +225 -0
- package/vendor/ars/scripts/test_chinese_literature_client.py +1889 -0
- package/vendor/ars/scripts/test_citation_existence_policy.py +480 -0
- package/vendor/ars/scripts/test_citation_verification_summary.py +342 -0
- package/vendor/ars/scripts/test_claim_audit_calibration.py +882 -0
- package/vendor/ars/scripts/test_claim_audit_finalizer.py +979 -0
- package/vendor/ars/scripts/test_claim_audit_pipeline.py +2398 -0
- package/vendor/ars/scripts/test_claim_audit_schema.py +1778 -0
- package/vendor/ars/scripts/test_claim_intent_manifest.py +666 -0
- package/vendor/ars/scripts/test_claim_registry_coverage.py +246 -0
- package/vendor/ars/scripts/test_claim_standing_discovery.py +579 -0
- package/vendor/ars/scripts/test_claim_standing_pipeline_wiring.py +290 -0
- package/vendor/ars/scripts/test_claim_standing_stance_assets.py +399 -0
- package/vendor/ars/scripts/test_claim_standing_stance_contracts.py +383 -0
- package/vendor/ars/scripts/test_claim_standing_stance_runner.py +349 -0
- package/vendor/ars/scripts/test_claim_standing_transmissions.py +605 -0
- package/vendor/ars/scripts/test_claim_strength_drift_disposition.py +517 -0
- package/vendor/ars/scripts/test_claim_verification_coverage_contract.py +104 -0
- package/vendor/ars/scripts/test_contamination_signals.py +1086 -0
- package/vendor/ars/scripts/test_content_coverage_advisory.py +1767 -0
- package/vendor/ars/scripts/test_cross_document_consistency_advisory.py +1270 -0
- package/vendor/ars/scripts/test_cross_model_codex_transport.py +1152 -0
- package/vendor/ars/scripts/test_cross_model_handoff.py +571 -0
- package/vendor/ars/scripts/test_cross_model_verification_guards.py +792 -0
- package/vendor/ars/scripts/test_crossref_client.py +393 -0
- package/vendor/ars/scripts/test_dispatch_e4_panel.py +4235 -0
- package/vendor/ars/scripts/test_e2e_claim_audit.py +540 -0
- package/vendor/ars/scripts/test_eval_harness_workflow.py +140 -0
- package/vendor/ars/scripts/test_evals_citation_extraction.py +150 -0
- package/vendor/ars/scripts/test_evals_lift_report_schema.py +108 -0
- package/vendor/ars/scripts/test_evidence_rows.py +2593 -0
- package/vendor/ars/scripts/test_experiment_provenance.py +915 -0
- package/vendor/ars/scripts/test_human_read_attestation_resolver.py +477 -0
- package/vendor/ars/scripts/test_ideation_diversity_assignment_gate.py +615 -0
- package/vendor/ars/scripts/test_indirect_prompt_injection_behavior_probe.py +250 -0
- package/vendor/ars/scripts/test_inquiry_branch_ledger.py +2296 -0
- package/vendor/ars/scripts/test_migrate_literature_corpus_to_v3_10.py +248 -0
- package/vendor/ars/scripts/test_migrate_literature_corpus_to_v3_7_3.py +545 -0
- package/vendor/ars/scripts/test_migrate_literature_corpus_to_v3_9_0.py +497 -0
- package/vendor/ars/scripts/test_normalize_compat_verdict.py +149 -0
- package/vendor/ars/scripts/test_openalex_client.py +490 -0
- package/vendor/ars/scripts/test_passport_yaml.py +104 -0
- package/vendor/ars/scripts/test_pattern_eval_runtime.py +1295 -0
- package/vendor/ars/scripts/test_pdf_read_preflight.py +1943 -0
- package/vendor/ars/scripts/test_policy_anchor_disclosure.py +666 -0
- package/vendor/ars/scripts/test_reading_probe_lint.py +218 -0
- package/vendor/ars/scripts/test_recompute_receipts.py +778 -0
- package/vendor/ars/scripts/test_render_claim_standing_view.py +192 -0
- package/vendor/ars/scripts/test_render_eval_comment.py +162 -0
- package/vendor/ars/scripts/test_render_harness_retirement_issue.py +110 -0
- package/vendor/ars/scripts/test_repro_lock_validation_drift.py +100 -0
- package/vendor/ars/scripts/test_research_workflow_profile.py +734 -0
- package/vendor/ars/scripts/test_resolve_human_subjects_authority.py +1219 -0
- package/vendor/ars/scripts/test_resolve_review_target_context.py +703 -0
- package/vendor/ars/scripts/test_resume_e4_record.py +315 -0
- package/vendor/ars/scripts/test_retraction_status.py +456 -0
- package/vendor/ars/scripts/test_review_criteria_binding.py +629 -0
- package/vendor/ars/scripts/test_review_panel_provenance.py +565 -0
- package/vendor/ars/scripts/test_review_pathway_rule_trace.py +821 -0
- package/vendor/ars/scripts/test_revision_roadmap.py +1255 -0
- package/vendor/ars/scripts/test_run_ci_pytest_manifest.py +186 -0
- package/vendor/ars/scripts/test_run_codex_audit_e2e.py +369 -0
- package/vendor/ars/scripts/test_run_evals.py +430 -0
- package/vendor/ars/scripts/test_run_guard_launcher.py +500 -0
- package/vendor/ars/scripts/test_run_ideation_diversity_no_call.py +1833 -0
- package/vendor/ars/scripts/test_run_indirect_prompt_injection_no_call.py +1889 -0
- package/vendor/ars/scripts/test_run_review_criteria_constructive_value.py +586 -0
- package/vendor/ars/scripts/test_run_role_topology_utility_dry_run.py +428 -0
- package/vendor/ars/scripts/test_score_review_criteria_constructive_value.py +340 -0
- package/vendor/ars/scripts/test_semantic_scholar_client.py +554 -0
- package/vendor/ars/scripts/test_slr_lineage_emission.py +230 -0
- package/vendor/ars/scripts/test_socratic_rq_non_generation_contract.py +173 -0
- package/vendor/ars/scripts/test_temporal_integrity_audit.py +438 -0
- package/vendor/ars/scripts/test_text_similarity.py +95 -0
- package/vendor/ars/scripts/test_title_fuzzy_false_positive.py +111 -0
- package/vendor/ars/scripts/test_tortured_phrase_screening.py +2959 -0
- package/vendor/ars/scripts/test_transport_fixture_citation_gate.py +338 -0
- package/vendor/ars/scripts/test_uncited_assertion.py +558 -0
- package/vendor/ars/scripts/test_v3_6_7_phase_6_6.py +1279 -0
- package/vendor/ars/scripts/test_validate_compliance_fixtures.py +36 -0
- package/vendor/ars/scripts/test_validate_ideation_diversity_assets.py +230 -0
- package/vendor/ars/scripts/test_venue_disclosure_contract.py +755 -0
- package/vendor/ars/scripts/test_verification_cache.py +280 -0
- package/vendor/ars/scripts/test_verification_gate.py +461 -0
- package/vendor/ars/scripts/test_verify_passport_cli.py +123 -0
- package/vendor/ars/scripts/test_verify_submission_package.py +1407 -0
- package/vendor/ars/scripts/test_version_records_schema.py +211 -0
- package/vendor/ars/scripts/tortured_phrase_screening.py +3502 -0
- package/vendor/ars/scripts/uncited_assertion_detector.py +254 -0
- package/vendor/ars/scripts/v3_6_7_inversion_manifest.json +9 -0
- package/vendor/ars/scripts/v3_6_8_inversion_manifest.json +10 -0
- package/vendor/ars/scripts/validate_claim_standing_stance_assets.py +249 -0
- package/vendor/ars/scripts/validate_compliance_fixtures.py +56 -0
- package/vendor/ars/scripts/validate_ideation_diversity_assets.py +303 -0
- package/vendor/ars/scripts/venue_disclosure_contract_harness.py +837 -0
- package/vendor/ars/scripts/verification_cache.py +276 -0
- package/vendor/ars/scripts/verification_gate/__init__.py +345 -0
- package/vendor/ars/scripts/verify_passport.py +133 -0
- package/vendor/ars/scripts/verify_submission_package.py +1657 -0
- package/vendor/ars/shared/agents/compliance_agent.md +136 -0
- package/vendor/ars/shared/artifact_reproducibility_pattern.md +173 -0
- package/vendor/ars/shared/benchmark_report.schema.json +81 -0
- package/vendor/ars/shared/benchmark_report_pattern.md +180 -0
- package/vendor/ars/shared/bibliographic_integrity_signals.md +142 -0
- package/vendor/ars/shared/collaboration_depth_rubric.md +154 -0
- package/vendor/ars/shared/compliance_checkpoint_protocol.md +162 -0
- package/vendor/ars/shared/compliance_report.schema.json +187 -0
- package/vendor/ars/shared/contracts/README.md +938 -0
- package/vendor/ars/shared/contracts/activity/adjudication_activity_input.schema.json +555 -0
- package/vendor/ars/shared/contracts/activity/adjudication_activity_store.schema.json +560 -0
- package/vendor/ars/shared/contracts/audit/audit_jsonl.schema.json +128 -0
- package/vendor/ars/shared/contracts/audit/audit_sidecar.schema.json +169 -0
- package/vendor/ars/shared/contracts/audit/audit_verdict.schema.json +133 -0
- package/vendor/ars/shared/contracts/audit/cross_document_consistency_advisory.schema.json +480 -0
- package/vendor/ars/shared/contracts/audit/cross_document_consistency_advisory_draft.schema.json +564 -0
- package/vendor/ars/shared/contracts/audit/cross_document_source_manifest.schema.json +202 -0
- package/vendor/ars/shared/contracts/audit/tortured_phrase_advisory.schema.json +1362 -0
- package/vendor/ars/shared/contracts/audit/tortured_phrase_snapshot.schema.json +208 -0
- package/vendor/ars/shared/contracts/audit/tortured_phrase_snapshot_manifest.schema.json +335 -0
- package/vendor/ars/shared/contracts/capability/stage_capability_matrix.json +434 -0
- package/vendor/ars/shared/contracts/claim_standing/candidate_ledger.schema.json +705 -0
- package/vendor/ars/shared/contracts/claim_standing/query_plan.schema.json +389 -0
- package/vendor/ars/shared/contracts/claim_standing/query_plan_v1_1.schema.json +782 -0
- package/vendor/ars/shared/contracts/claim_standing/retrieval_input.schema.json +440 -0
- package/vendor/ars/shared/contracts/claim_standing/stance_record.schema.json +460 -0
- package/vendor/ars/shared/contracts/claim_standing/transmission_ledger.schema.json +282 -0
- package/vendor/ars/shared/contracts/cross_model/codex_citation_receipt.schema.json +157 -0
- package/vendor/ars/shared/contracts/cross_model/codex_citation_request.schema.json +23 -0
- package/vendor/ars/shared/contracts/cross_model/promotion_bakeoff_sealed_commitment.schema.json +55 -0
- package/vendor/ars/shared/contracts/cross_model/promotion_bakeoff_sealed_reveal.schema.json +50 -0
- package/vendor/ars/shared/contracts/degradation_registry.json +428 -0
- package/vendor/ars/shared/contracts/evaluator/full.json +126 -0
- package/vendor/ars/shared/contracts/evidence/claim_registry.schema.json +50 -0
- package/vendor/ars/shared/contracts/evidence/claim_registry_coverage_report.schema.json +79 -0
- package/vendor/ars/shared/contracts/evidence/evidence_row.schema.json +504 -0
- package/vendor/ars/shared/contracts/evidence/evidence_row_v1_1.schema.json +364 -0
- package/vendor/ars/shared/contracts/evidence/evidence_row_v1_2.schema.json +714 -0
- package/vendor/ars/shared/contracts/evidence/evidence_row_v1_3.schema.json +524 -0
- package/vendor/ars/shared/contracts/human_subjects/authority_profile_registry.schema.json +497 -0
- package/vendor/ars/shared/contracts/human_subjects/committee_correspondence.schema.json +253 -0
- package/vendor/ars/shared/contracts/human_subjects/content_coverage_advisory.schema.json +620 -0
- package/vendor/ars/shared/contracts/human_subjects/irb_context_record.schema.json +329 -0
- package/vendor/ars/shared/contracts/human_subjects/resolved_authority_context.schema.json +347 -0
- package/vendor/ars/shared/contracts/human_subjects/review_pathway_rule_trace.schema.json +265 -0
- package/vendor/ars/shared/contracts/human_subjects/review_pathway_trace_request.schema.json +127 -0
- package/vendor/ars/shared/contracts/human_subjects/submission_packet_inventory.schema.json +240 -0
- package/vendor/ars/shared/contracts/human_subjects/submission_packet_manifest.schema.json +999 -0
- package/vendor/ars/shared/contracts/passport/audit_artifact_entry.schema.json +266 -0
- package/vendor/ars/shared/contracts/passport/bibliographic_integrity_signal.schema.json +1676 -0
- package/vendor/ars/shared/contracts/passport/citation_provenance.schema.json +107 -0
- package/vendor/ars/shared/contracts/passport/citation_verification_summary.schema.json +164 -0
- package/vendor/ars/shared/contracts/passport/claim_audit_result.schema.json +124 -0
- package/vendor/ars/shared/contracts/passport/claim_drift.schema.json +58 -0
- package/vendor/ars/shared/contracts/passport/claim_intent_manifest.schema.json +107 -0
- package/vendor/ars/shared/contracts/passport/constraint_violation.schema.json +65 -0
- package/vendor/ars/shared/contracts/passport/experiment_alignment_result.schema.json +69 -0
- package/vendor/ars/shared/contracts/passport/experiment_provenance_entry.schema.json +169 -0
- package/vendor/ars/shared/contracts/passport/human_read_log.schema.json +86 -0
- package/vendor/ars/shared/contracts/passport/inquiry_ledger_ref.schema.json +22 -0
- package/vendor/ars/shared/contracts/passport/literature_corpus_entry.schema.json +650 -0
- package/vendor/ars/shared/contracts/passport/preregistration_artifact.schema.json +132 -0
- package/vendor/ars/shared/contracts/passport/rejection_log.schema.json +89 -0
- package/vendor/ars/shared/contracts/passport/reset_ledger_entry.schema.json +158 -0
- package/vendor/ars/shared/contracts/passport/temporal_audit_results.schema.json +208 -0
- package/vendor/ars/shared/contracts/passport/terminal_policies.schema.json +50 -0
- package/vendor/ars/shared/contracts/passport/timeline.schema.json +102 -0
- package/vendor/ars/shared/contracts/passport/uncited_assertion.schema.json +56 -0
- package/vendor/ars/shared/contracts/passport/uncited_audit_failure.schema.json +72 -0
- package/vendor/ars/shared/contracts/passport/user_attested_read_resolution.schema.json +87 -0
- package/vendor/ars/shared/contracts/passport/version_records.schema.json +138 -0
- package/vendor/ars/shared/contracts/patch/block_manifest.schema.json +45 -0
- package/vendor/ars/shared/contracts/patch/legacy/v1_0/revision_patch.schema.json +110 -0
- package/vendor/ars/shared/contracts/patch/revision_patch.schema.json +250 -0
- package/vendor/ars/shared/contracts/pdf/pdf_content_classifier_diagnostic.schema.json +39 -0
- package/vendor/ars/shared/contracts/pdf/pdf_content_classifier_worker.schema.json +88 -0
- package/vendor/ars/shared/contracts/pdf/pdf_read_preflight.schema.json +227 -0
- package/vendor/ars/shared/contracts/re_review/input_manifest.schema.json +161 -0
- package/vendor/ars/shared/contracts/re_review/legacy/v1_0/input_manifest.schema.json +134 -0
- package/vendor/ars/shared/contracts/re_review/legacy/v1_0/precommitment.schema.json +193 -0
- package/vendor/ars/shared/contracts/re_review/legacy/v1_0/traceability.schema.json +841 -0
- package/vendor/ars/shared/contracts/re_review/legacy/v1_0/verdict_record.schema.json +244 -0
- package/vendor/ars/shared/contracts/re_review/precommitment.schema.json +193 -0
- package/vendor/ars/shared/contracts/re_review/traceability.schema.json +916 -0
- package/vendor/ars/shared/contracts/re_review/verdict_record.schema.json +245 -0
- package/vendor/ars/shared/contracts/research_workflow/inquiry_branch_ledger.schema.json +449 -0
- package/vendor/ars/shared/contracts/research_workflow/research_workflow_profile.schema.json +222 -0
- package/vendor/ars/shared/contracts/research_workflow/research_workflow_profile_selection_receipt.schema.json +111 -0
- package/vendor/ars/shared/contracts/review_target/constructive_review_findings.schema.json +172 -0
- package/vendor/ars/shared/contracts/review_target/criteria_registry.schema.json +97 -0
- package/vendor/ars/shared/contracts/review_target/review_criteria_binding_manifest.schema.json +235 -0
- package/vendor/ars/shared/contracts/review_target/review_criteria_source_receipt.schema.json +158 -0
- package/vendor/ars/shared/contracts/review_target/review_target_context.schema.json +106 -0
- package/vendor/ars/shared/contracts/review_target/review_target_declaration.schema.json +118 -0
- package/vendor/ars/shared/contracts/reviewer/full.json +114 -0
- package/vendor/ars/shared/contracts/reviewer/methodology_focus.json +75 -0
- package/vendor/ars/shared/contracts/reviewer/review_panel_provenance.schema.json +263 -0
- package/vendor/ars/shared/contracts/reviewer/review_panel_provenance_carrier.schema.json +122 -0
- package/vendor/ars/shared/contracts/reviewer/review_panel_provenance_input.schema.json +120 -0
- package/vendor/ars/shared/contracts/revision/author_adjudication.schema.json +251 -0
- package/vendor/ars/shared/contracts/revision/author_adjudication_input.schema.json +25 -0
- package/vendor/ars/shared/contracts/revision/claim_strength_drift_disposition.schema.json +97 -0
- package/vendor/ars/shared/contracts/revision/claim_strength_drift_disposition_input.schema.json +80 -0
- package/vendor/ars/shared/contracts/revision/claim_strength_drift_findings.schema.json +139 -0
- package/vendor/ars/shared/contracts/revision/claim_surface_manifest.schema.json +99 -0
- package/vendor/ars/shared/contracts/revision/integrity_correction_authorization.schema.json +140 -0
- package/vendor/ars/shared/contracts/revision/integrity_correction_authorization_input.schema.json +28 -0
- package/vendor/ars/shared/contracts/revision/integrity_correction_list.schema.json +48 -0
- package/vendor/ars/shared/contracts/revision/integrity_pass_receipt.schema.json +16 -0
- package/vendor/ars/shared/contracts/revision/revision_evidence_bundle.schema.json +134 -0
- package/vendor/ars/shared/contracts/revision/revision_roadmap.schema.json +334 -0
- package/vendor/ars/shared/contracts/submission/format_profile.example.yaml +33 -0
- package/vendor/ars/shared/contracts/submission/format_profile.schema.json +102 -0
- package/vendor/ars/shared/contracts/submission/submission_verification_report.schema.json +233 -0
- package/vendor/ars/shared/contracts/submission/venue_profile.schema.json +114 -0
- package/vendor/ars/shared/contracts/writer/full.json +87 -0
- package/vendor/ars/shared/cross_model_verification.md +714 -0
- package/vendor/ars/shared/evals_lift_report.schema.json +141 -0
- package/vendor/ars/shared/ground_truth_isolation_pattern.md +275 -0
- package/vendor/ars/shared/handoff_schemas.md +1209 -0
- package/vendor/ars/shared/human_subjects_authority_registry.json +1278 -0
- package/vendor/ars/shared/mode_spectrum.md +57 -0
- package/vendor/ars/shared/model_tiering.md +83 -0
- package/vendor/ars/shared/policy_data/nature_policy.md +56 -0
- package/vendor/ars/shared/prisma_trAIce_protocol.md +157 -0
- package/vendor/ars/shared/raise_framework.md +129 -0
- package/vendor/ars/shared/references/authority_content_coverage_advisory_protocol.md +275 -0
- package/vendor/ars/shared/references/claim_standing_candidate_ledger_protocol.md +66 -0
- package/vendor/ars/shared/references/claim_strength_ladder.md +93 -0
- package/vendor/ars/shared/references/cross_document_consistency_advisory_protocol.md +263 -0
- package/vendor/ars/shared/references/evidence_row_protocol.md +260 -0
- package/vendor/ars/shared/references/firm_rules.md +90 -0
- package/vendor/ars/shared/references/human_subjects_authority_protocol.md +274 -0
- package/vendor/ars/shared/references/intent_clarification_protocol.md +168 -0
- package/vendor/ars/shared/references/irb_terminology_glossary.md +229 -0
- package/vendor/ars/shared/references/protected_hedging_phrases.md +118 -0
- package/vendor/ars/shared/references/psychometric_terminology_glossary.md +109 -0
- package/vendor/ars/shared/references/review_criteria_consumer_protocol.md +238 -0
- package/vendor/ars/shared/references/review_pathway_rule_trace_protocol.md +166 -0
- package/vendor/ars/shared/references/submission_packet_manifest_protocol.md +292 -0
- package/vendor/ars/shared/references/word_count_conventions.md +124 -0
- package/vendor/ars/shared/research_workflow_profiles/field_general.json +1 -0
- package/vendor/ars/shared/review_criteria_registry.json +207 -0
- package/vendor/ars/shared/review_criteria_sources/msr-2027-technical-papers.2026-08-24.json +46 -0
- package/vendor/ars/shared/review_criteria_sources/sigsoft-empirical-standards.2026-08-24.json +31 -0
- package/vendor/ars/shared/sprint_contract.schema.json +482 -0
- package/vendor/ars/shared/style_calibration_protocol.md +151 -0
- package/vendor/ars/shared/templates/codex_audit_multifile_template.md +263 -0
- package/vendor/ars/tools/release-discipline/.toolkit-version +1 -0
- package/vendor/ars/tools/release-discipline/README.md +4 -0
- package/vendor/ars/tools/release-discipline/scripts/_release_doc_alignment_schema.py +1011 -0
- package/vendor/ars/tools/release-discipline/scripts/check_command_invariants.py +497 -0
- package/vendor/ars/tools/release-discipline/scripts/check_release_doc_alignment.py +263 -0
- package/vendor/ars/tools/release-discipline/scripts/sync-toolkit.sh +147 -0
- package/vendor/windows/NOTICE.md +12 -0
- package/vendor/windows/arm64/fd.exe +0 -0
- package/vendor/windows/arm64/licenses/fd/LICENSE-APACHE +201 -0
- package/vendor/windows/arm64/licenses/fd/LICENSE-MIT +21 -0
- package/vendor/windows/arm64/licenses/ripgrep/COPYING +3 -0
- package/vendor/windows/arm64/licenses/ripgrep/LICENSE-MIT +21 -0
- package/vendor/windows/arm64/licenses/ripgrep/UNLICENSE +24 -0
- package/vendor/windows/arm64/rg.exe +0 -0
- package/vendor/windows/x64/fd.exe +0 -0
- package/vendor/windows/x64/licenses/fd/LICENSE-APACHE +201 -0
- package/vendor/windows/x64/licenses/fd/LICENSE-MIT +21 -0
- package/vendor/windows/x64/licenses/ripgrep/COPYING +3 -0
- package/vendor/windows/x64/licenses/ripgrep/LICENSE-MIT +21 -0
- package/vendor/windows/x64/licenses/ripgrep/UNLICENSE +24 -0
- package/vendor/windows/x64/rg.exe +0 -0
|
@@ -0,0 +1,1158 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Resolve explicit human-subjects authority profiles without inferring jurisdiction.
|
|
3
|
+
|
|
4
|
+
The runtime is standard-library-only. It reads only the paths named on the
|
|
5
|
+
command line, performs closed-contract and cross-row validation, and emits a
|
|
6
|
+
pointer-only applicability trace. It is not a legal, compliance, pathway,
|
|
7
|
+
readiness, exemption, or authorization engine.
|
|
8
|
+
"""
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
|
|
11
|
+
import argparse
|
|
12
|
+
import copy
|
|
13
|
+
import hashlib
|
|
14
|
+
import json
|
|
15
|
+
import math
|
|
16
|
+
import re
|
|
17
|
+
import sys
|
|
18
|
+
from datetime import date, datetime
|
|
19
|
+
from pathlib import Path
|
|
20
|
+
from typing import Any, NoReturn
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
AXES = ("review_ethics", "data_protection")
|
|
24
|
+
TRI = ("true", "false", "unknown")
|
|
25
|
+
OPS = ("fact_equals", "fact_in", "fact_contains", "all", "any", "not")
|
|
26
|
+
ID_RE = re.compile(r"^[a-z0-9][a-z0-9._-]*$")
|
|
27
|
+
VERSION_RE = re.compile(r"^[A-Za-z0-9][A-Za-z0-9._-]*$")
|
|
28
|
+
SHA_RE = re.compile(r"^[0-9a-f]{64}$")
|
|
29
|
+
HTTPS_RE = re.compile(r"^https://[^\s\x00-\x1f\x7f]+$")
|
|
30
|
+
MAX_JSON_BYTES = 8 * 1024 * 1024
|
|
31
|
+
MAX_ITEMS = 4096
|
|
32
|
+
MAX_AST_DEPTH = 16
|
|
33
|
+
MAX_AST_NODES = 512
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
class ContractError(ValueError):
|
|
37
|
+
"""An input violates the closed V1 contract."""
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def _fail(path: str, message: str) -> NoReturn:
|
|
41
|
+
raise ContractError(f"{path}: {message}")
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def _reject_constant(value: str) -> NoReturn:
|
|
45
|
+
raise ContractError(f"non-finite JSON number is not allowed: {value}")
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def _reject_duplicate_pairs(pairs: list[tuple[str, Any]]) -> dict[str, Any]:
|
|
49
|
+
result: dict[str, Any] = {}
|
|
50
|
+
for key, value in pairs:
|
|
51
|
+
if key in result:
|
|
52
|
+
raise ContractError(f"duplicate JSON key is not allowed: {key}")
|
|
53
|
+
result[key] = value
|
|
54
|
+
return result
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def load_json(path: Path | str) -> dict[str, Any]:
|
|
58
|
+
source = Path(path)
|
|
59
|
+
try:
|
|
60
|
+
if source.stat().st_size > MAX_JSON_BYTES:
|
|
61
|
+
raise ContractError(f"JSON input exceeds {MAX_JSON_BYTES} bytes: {source}")
|
|
62
|
+
with source.open("r", encoding="utf-8") as handle:
|
|
63
|
+
value = json.load(
|
|
64
|
+
handle,
|
|
65
|
+
object_pairs_hook=_reject_duplicate_pairs,
|
|
66
|
+
parse_constant=_reject_constant,
|
|
67
|
+
)
|
|
68
|
+
except ContractError:
|
|
69
|
+
raise
|
|
70
|
+
except (OSError, UnicodeError, json.JSONDecodeError) as exc:
|
|
71
|
+
raise ContractError(f"cannot read JSON input {source}: {exc}") from exc
|
|
72
|
+
if not isinstance(value, dict):
|
|
73
|
+
raise ContractError(f"top-level JSON value must be an object: {source}")
|
|
74
|
+
return value
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def _canonical_bytes(value: Any) -> bytes:
|
|
78
|
+
return json.dumps(
|
|
79
|
+
value,
|
|
80
|
+
ensure_ascii=False,
|
|
81
|
+
sort_keys=True,
|
|
82
|
+
separators=(",", ":"),
|
|
83
|
+
allow_nan=False,
|
|
84
|
+
).encode("utf-8")
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
def digest(value: Any) -> str:
|
|
88
|
+
return hashlib.sha256(_canonical_bytes(value)).hexdigest()
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
def _closed(value: Any, path: str, fields: set[str]) -> dict[str, Any]:
|
|
92
|
+
if not isinstance(value, dict):
|
|
93
|
+
_fail(path, "must be an object")
|
|
94
|
+
missing = fields - set(value)
|
|
95
|
+
extra = set(value) - fields
|
|
96
|
+
if missing:
|
|
97
|
+
_fail(path, f"missing field(s): {', '.join(sorted(missing))}")
|
|
98
|
+
if extra:
|
|
99
|
+
_fail(path, f"undeclared field(s): {', '.join(sorted(extra))}")
|
|
100
|
+
return value
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
def _array(value: Any, path: str, *, maximum: int = MAX_ITEMS) -> list[Any]:
|
|
104
|
+
if not isinstance(value, list):
|
|
105
|
+
_fail(path, "must be an array")
|
|
106
|
+
if len(value) > maximum:
|
|
107
|
+
_fail(path, f"exceeds {maximum} items")
|
|
108
|
+
return value
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
def _text(
|
|
112
|
+
value: Any,
|
|
113
|
+
path: str,
|
|
114
|
+
*,
|
|
115
|
+
nullable: bool = False,
|
|
116
|
+
maximum: int | None = None,
|
|
117
|
+
) -> str | None:
|
|
118
|
+
if nullable and value is None:
|
|
119
|
+
return None
|
|
120
|
+
if not isinstance(value, str) or not value.strip():
|
|
121
|
+
_fail(path, "must be a non-empty string" + (" or null" if nullable else ""))
|
|
122
|
+
if any(ord(ch) < 32 or ord(ch) == 127 for ch in value):
|
|
123
|
+
_fail(path, "must not contain control characters")
|
|
124
|
+
if maximum is not None and len(value) > maximum:
|
|
125
|
+
_fail(path, f"must not exceed {maximum} characters")
|
|
126
|
+
return value
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
def _identifier(value: Any, path: str) -> str:
|
|
130
|
+
text = _text(value, path)
|
|
131
|
+
assert text is not None
|
|
132
|
+
if ID_RE.fullmatch(text) is None:
|
|
133
|
+
_fail(path, "must use lowercase letters, digits, dot, underscore, or hyphen")
|
|
134
|
+
return text
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
def _version(value: Any, path: str) -> str:
|
|
138
|
+
text = _text(value, path)
|
|
139
|
+
assert text is not None
|
|
140
|
+
if VERSION_RE.fullmatch(text) is None:
|
|
141
|
+
_fail(path, "has an invalid version token")
|
|
142
|
+
return text
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
def _sha(value: Any, path: str, *, nullable: bool = False) -> str | None:
|
|
146
|
+
if nullable and value is None:
|
|
147
|
+
return None
|
|
148
|
+
text = _text(value, path)
|
|
149
|
+
assert text is not None
|
|
150
|
+
if SHA_RE.fullmatch(text) is None:
|
|
151
|
+
_fail(path, "must be 64 lowercase hexadecimal characters")
|
|
152
|
+
return text
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
def _date(value: Any, path: str, *, nullable: bool = False) -> date | None:
|
|
156
|
+
if nullable and value is None:
|
|
157
|
+
return None
|
|
158
|
+
text = _text(value, path)
|
|
159
|
+
assert text is not None
|
|
160
|
+
try:
|
|
161
|
+
if len(text) != 10:
|
|
162
|
+
raise ValueError
|
|
163
|
+
return date.fromisoformat(text)
|
|
164
|
+
except ValueError as exc:
|
|
165
|
+
raise ContractError(f"{path}: must be a real ISO 8601 date") from exc
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
def _datetime(value: Any, path: str) -> datetime:
|
|
169
|
+
text = _text(value, path)
|
|
170
|
+
assert text is not None
|
|
171
|
+
try:
|
|
172
|
+
parsed = datetime.fromisoformat(text.replace("Z", "+00:00"))
|
|
173
|
+
if "T" not in text or parsed.tzinfo is None:
|
|
174
|
+
raise ValueError
|
|
175
|
+
return parsed
|
|
176
|
+
except ValueError as exc:
|
|
177
|
+
raise ContractError(f"{path}: must be an ISO 8601 date-time with offset") from exc
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
def _https(value: Any, path: str, *, nullable: bool = False) -> str | None:
|
|
181
|
+
if nullable and value is None:
|
|
182
|
+
return None
|
|
183
|
+
text = _text(value, path)
|
|
184
|
+
assert text is not None
|
|
185
|
+
if HTTPS_RE.fullmatch(text) is None:
|
|
186
|
+
_fail(path, "must be a control-free HTTPS URL")
|
|
187
|
+
return text
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
def _enum(value: Any, path: str, choices: tuple[str, ...] | set[str]) -> str:
|
|
191
|
+
if value not in choices:
|
|
192
|
+
_fail(path, f"must be one of: {', '.join(sorted(choices))}")
|
|
193
|
+
return value
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
def _unique_texts(
|
|
197
|
+
value: Any,
|
|
198
|
+
path: str,
|
|
199
|
+
*,
|
|
200
|
+
identifiers: bool = False,
|
|
201
|
+
minimum: int = 0,
|
|
202
|
+
maximum: int = MAX_ITEMS,
|
|
203
|
+
) -> list[str]:
|
|
204
|
+
rows = _array(value, path, maximum=maximum)
|
|
205
|
+
if len(rows) < minimum:
|
|
206
|
+
_fail(path, f"must contain at least {minimum} item(s)")
|
|
207
|
+
result: list[str] = []
|
|
208
|
+
for index, item in enumerate(rows):
|
|
209
|
+
result.append(
|
|
210
|
+
_identifier(item, f"{path}[{index}]")
|
|
211
|
+
if identifiers
|
|
212
|
+
else (_text(item, f"{path}[{index}]") or "")
|
|
213
|
+
)
|
|
214
|
+
if len(result) != len(set(result)):
|
|
215
|
+
_fail(path, "must not contain duplicate values")
|
|
216
|
+
return result
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
def _unique(values: list[Any], path: str) -> None:
|
|
220
|
+
seen: set[Any] = set()
|
|
221
|
+
for value in values:
|
|
222
|
+
if value in seen:
|
|
223
|
+
_fail(path, f"duplicate value: {value}")
|
|
224
|
+
seen.add(value)
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
def _validate_fact_value(value_type: str, value: Any, path: str) -> None:
|
|
228
|
+
if value_type == "boolean":
|
|
229
|
+
if not isinstance(value, bool):
|
|
230
|
+
_fail(path, "must be a boolean")
|
|
231
|
+
return
|
|
232
|
+
if value_type in {"string", "string_enum"}:
|
|
233
|
+
_text(value, path, maximum=512)
|
|
234
|
+
return
|
|
235
|
+
if value_type == "date":
|
|
236
|
+
_date(value, path)
|
|
237
|
+
return
|
|
238
|
+
if value_type == "string_set":
|
|
239
|
+
rows = _array(value, path, maximum=128)
|
|
240
|
+
normalized = [
|
|
241
|
+
_text(item, f"{path}[{index}]", maximum=256)
|
|
242
|
+
for index, item in enumerate(rows)
|
|
243
|
+
]
|
|
244
|
+
if len(normalized) != len(set(normalized)):
|
|
245
|
+
_fail(path, "must not contain duplicate values")
|
|
246
|
+
return
|
|
247
|
+
_fail(path, f"unknown fact value type: {value_type}")
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
def _validate_predicate(
|
|
251
|
+
value: Any,
|
|
252
|
+
definitions: dict[str, dict[str, Any]],
|
|
253
|
+
path: str,
|
|
254
|
+
*,
|
|
255
|
+
depth: int = 0,
|
|
256
|
+
counter: list[int] | None = None,
|
|
257
|
+
) -> None:
|
|
258
|
+
if counter is None:
|
|
259
|
+
counter = [0]
|
|
260
|
+
counter[0] += 1
|
|
261
|
+
if counter[0] > MAX_AST_NODES:
|
|
262
|
+
_fail(path, f"predicate exceeds {MAX_AST_NODES} nodes")
|
|
263
|
+
if depth > MAX_AST_DEPTH:
|
|
264
|
+
_fail(path, f"predicate exceeds depth {MAX_AST_DEPTH}")
|
|
265
|
+
if not isinstance(value, dict):
|
|
266
|
+
_fail(path, "predicate must be an object")
|
|
267
|
+
op = _enum(value.get("op"), f"{path}.op", set(OPS))
|
|
268
|
+
if op in {"fact_equals", "fact_contains"}:
|
|
269
|
+
row = _closed(value, path, {"op", "fact_id", "value"})
|
|
270
|
+
fact_id = _identifier(row["fact_id"], f"{path}.fact_id")
|
|
271
|
+
if fact_id not in definitions:
|
|
272
|
+
_fail(f"{path}.fact_id", f"unknown fact definition: {fact_id}")
|
|
273
|
+
fact_type = definitions[fact_id]["value_type"]
|
|
274
|
+
if op == "fact_contains":
|
|
275
|
+
if fact_type != "string_set":
|
|
276
|
+
_fail(path, "fact_contains requires a string_set fact")
|
|
277
|
+
_text(row["value"], f"{path}.value", maximum=256)
|
|
278
|
+
else:
|
|
279
|
+
if fact_type == "string_set":
|
|
280
|
+
_fail(path, "fact_equals is for scalar facts; use fact_contains for string_set")
|
|
281
|
+
_validate_fact_value(fact_type, row["value"], f"{path}.value")
|
|
282
|
+
allowed = definitions[fact_id]["allowed_values"]
|
|
283
|
+
if allowed is not None and row["value"] not in allowed:
|
|
284
|
+
_fail(f"{path}.value", "is outside the fact allowlist")
|
|
285
|
+
return
|
|
286
|
+
if op == "fact_in":
|
|
287
|
+
row = _closed(value, path, {"op", "fact_id", "values"})
|
|
288
|
+
fact_id = _identifier(row["fact_id"], f"{path}.fact_id")
|
|
289
|
+
if fact_id not in definitions:
|
|
290
|
+
_fail(f"{path}.fact_id", f"unknown fact definition: {fact_id}")
|
|
291
|
+
fact_type = definitions[fact_id]["value_type"]
|
|
292
|
+
if fact_type == "string_set":
|
|
293
|
+
_fail(path, "fact_in is for scalar facts; use fact_contains for string_set")
|
|
294
|
+
values = _array(row["values"], f"{path}.values", maximum=64)
|
|
295
|
+
if not values:
|
|
296
|
+
_fail(f"{path}.values", "must not be empty")
|
|
297
|
+
for index, item in enumerate(values):
|
|
298
|
+
_validate_fact_value(fact_type, item, f"{path}.values[{index}]")
|
|
299
|
+
if len({_canonical_bytes(item) for item in values}) != len(values):
|
|
300
|
+
_fail(f"{path}.values", "must not contain duplicate values")
|
|
301
|
+
allowed = definitions[fact_id]["allowed_values"]
|
|
302
|
+
if allowed is not None and any(item not in allowed for item in values):
|
|
303
|
+
_fail(f"{path}.values", "contains a value outside the fact allowlist")
|
|
304
|
+
return
|
|
305
|
+
if op in {"all", "any"}:
|
|
306
|
+
row = _closed(value, path, {"op", "operands"})
|
|
307
|
+
operands = _array(row["operands"], f"{path}.operands", maximum=64)
|
|
308
|
+
if not operands:
|
|
309
|
+
_fail(f"{path}.operands", "must not be empty")
|
|
310
|
+
for index, operand in enumerate(operands):
|
|
311
|
+
_validate_predicate(
|
|
312
|
+
operand,
|
|
313
|
+
definitions,
|
|
314
|
+
f"{path}.operands[{index}]",
|
|
315
|
+
depth=depth + 1,
|
|
316
|
+
counter=counter,
|
|
317
|
+
)
|
|
318
|
+
return
|
|
319
|
+
row = _closed(value, path, {"op", "operand"})
|
|
320
|
+
_validate_predicate(
|
|
321
|
+
row["operand"], definitions, f"{path}.operand", depth=depth + 1, counter=counter
|
|
322
|
+
)
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
def _fact_map(facts: Any) -> dict[str, Any]:
|
|
326
|
+
if isinstance(facts, list):
|
|
327
|
+
return {row["fact_id"]: row for row in facts}
|
|
328
|
+
if isinstance(facts, dict):
|
|
329
|
+
return facts
|
|
330
|
+
raise ContractError("facts: must be an object or declared-fact array")
|
|
331
|
+
|
|
332
|
+
|
|
333
|
+
def evaluate_predicate(
|
|
334
|
+
predicate: dict[str, Any],
|
|
335
|
+
facts: Any,
|
|
336
|
+
definitions: dict[str, dict[str, Any]] | None = None,
|
|
337
|
+
) -> tuple[str, list[dict[str, Any]]]:
|
|
338
|
+
"""Evaluate one closed predicate under Strong Kleene three-valued logic."""
|
|
339
|
+
fact_rows = _fact_map(facts)
|
|
340
|
+
if definitions is not None:
|
|
341
|
+
_validate_predicate(predicate, definitions, "predicate")
|
|
342
|
+
trace: list[dict[str, Any]] = []
|
|
343
|
+
visited = 0
|
|
344
|
+
|
|
345
|
+
def walk(node: dict[str, Any], pointer: str, depth: int) -> str:
|
|
346
|
+
nonlocal visited
|
|
347
|
+
visited += 1
|
|
348
|
+
if visited > MAX_AST_NODES:
|
|
349
|
+
_fail(pointer or "/", f"predicate exceeds {MAX_AST_NODES} nodes")
|
|
350
|
+
display_pointer = pointer or "/"
|
|
351
|
+
if not isinstance(node, dict):
|
|
352
|
+
_fail(display_pointer, "predicate node must be an object")
|
|
353
|
+
if depth > MAX_AST_DEPTH:
|
|
354
|
+
_fail(display_pointer, f"predicate exceeds depth {MAX_AST_DEPTH}")
|
|
355
|
+
op = node.get("op")
|
|
356
|
+
if op not in OPS:
|
|
357
|
+
_fail(f"{pointer}/op", "unknown predicate operator")
|
|
358
|
+
fact_id: str | None = None
|
|
359
|
+
declared_state = "compound"
|
|
360
|
+
if op in {"fact_equals", "fact_in", "fact_contains"}:
|
|
361
|
+
fact_id = node.get("fact_id")
|
|
362
|
+
row = fact_rows.get(fact_id)
|
|
363
|
+
if row is None:
|
|
364
|
+
result, declared_state = "unknown", "missing"
|
|
365
|
+
elif isinstance(row, dict) and "state" in row:
|
|
366
|
+
declared_state = row.get("state")
|
|
367
|
+
if declared_state != "declared" or row.get("value") is None:
|
|
368
|
+
result, declared_state = "unknown", "unknown"
|
|
369
|
+
else:
|
|
370
|
+
actual = row["value"]
|
|
371
|
+
if op == "fact_equals":
|
|
372
|
+
if isinstance(actual, list):
|
|
373
|
+
_fail(display_pointer, "fact_equals cannot compare a string_set")
|
|
374
|
+
result = "true" if type(actual) is type(node.get("value")) and actual == node.get("value") else "false"
|
|
375
|
+
elif op == "fact_in":
|
|
376
|
+
if isinstance(actual, list):
|
|
377
|
+
_fail(display_pointer, "fact_in cannot inspect a string_set")
|
|
378
|
+
result = "true" if any(type(actual) is type(v) and actual == v for v in node.get("values", [])) else "false"
|
|
379
|
+
elif isinstance(actual, list):
|
|
380
|
+
result = "true" if node.get("value") in actual else "false"
|
|
381
|
+
else:
|
|
382
|
+
_fail(display_pointer, "fact_contains requires a string_set value")
|
|
383
|
+
else:
|
|
384
|
+
declared_state = "declared"
|
|
385
|
+
actual = row
|
|
386
|
+
if op == "fact_equals":
|
|
387
|
+
if isinstance(actual, list):
|
|
388
|
+
_fail(display_pointer, "fact_equals cannot compare a string_set")
|
|
389
|
+
result = "true" if type(actual) is type(node.get("value")) and actual == node.get("value") else "false"
|
|
390
|
+
elif op == "fact_in":
|
|
391
|
+
if isinstance(actual, list):
|
|
392
|
+
_fail(display_pointer, "fact_in cannot inspect a string_set")
|
|
393
|
+
result = "true" if any(type(actual) is type(v) and actual == v for v in node.get("values", [])) else "false"
|
|
394
|
+
elif isinstance(actual, list):
|
|
395
|
+
result = "true" if node.get("value") in actual else "false"
|
|
396
|
+
else:
|
|
397
|
+
_fail(display_pointer, "fact_contains requires a string_set value")
|
|
398
|
+
elif op in {"all", "any"}:
|
|
399
|
+
children = [
|
|
400
|
+
walk(child, f"{pointer}/operands/{index}", depth + 1)
|
|
401
|
+
for index, child in enumerate(node.get("operands", []))
|
|
402
|
+
]
|
|
403
|
+
if op == "all":
|
|
404
|
+
result = "false" if "false" in children else ("unknown" if "unknown" in children else "true")
|
|
405
|
+
else:
|
|
406
|
+
result = "true" if "true" in children else ("unknown" if "unknown" in children else "false")
|
|
407
|
+
else:
|
|
408
|
+
child = walk(node.get("operand"), f"{pointer}/operand", depth + 1)
|
|
409
|
+
result = {"true": "false", "false": "true", "unknown": "unknown"}[child]
|
|
410
|
+
trace.append(
|
|
411
|
+
{
|
|
412
|
+
"expression_path": display_pointer,
|
|
413
|
+
"operator": op,
|
|
414
|
+
"result": result,
|
|
415
|
+
"fact_id": fact_id,
|
|
416
|
+
"declared_state": declared_state,
|
|
417
|
+
}
|
|
418
|
+
)
|
|
419
|
+
return result
|
|
420
|
+
|
|
421
|
+
result = walk(predicate, "", 0)
|
|
422
|
+
if len(trace) > MAX_AST_NODES:
|
|
423
|
+
_fail("predicate", f"exceeds {MAX_AST_NODES} nodes")
|
|
424
|
+
return result, trace
|
|
425
|
+
|
|
426
|
+
|
|
427
|
+
SOURCE_FIELDS = {
|
|
428
|
+
"source_id", "title", "publisher", "canonical_url", "snapshot_url",
|
|
429
|
+
"provision_locator", "allowed_provisions", "effective_from", "effective_until",
|
|
430
|
+
"source_amended_or_published_date", "retrieved_at", "verified_at",
|
|
431
|
+
"source_language", "controlling_language", "authenticity_status",
|
|
432
|
+
"content_digest", "digest_scope", "rights_status", "freshness",
|
|
433
|
+
}
|
|
434
|
+
ANCHOR_FIELDS = {
|
|
435
|
+
"source_id", "authority_url", "snapshot_url", "provision", "effective_date",
|
|
436
|
+
"effective_until", "source_amended_or_published_date", "retrieved_at",
|
|
437
|
+
"verified_at", "source_language", "controlling_language",
|
|
438
|
+
"authenticity_status", "content_digest", "digest_scope", "rights_status",
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
|
|
442
|
+
def _validate_source(row: Any, path: str, registry_as_of: date) -> None:
|
|
443
|
+
obj = _closed(row, path, SOURCE_FIELDS)
|
|
444
|
+
_identifier(obj["source_id"], f"{path}.source_id")
|
|
445
|
+
_text(obj["title"], f"{path}.title")
|
|
446
|
+
_text(obj["publisher"], f"{path}.publisher")
|
|
447
|
+
_https(obj["canonical_url"], f"{path}.canonical_url")
|
|
448
|
+
_https(obj["snapshot_url"], f"{path}.snapshot_url", nullable=True)
|
|
449
|
+
_text(obj["provision_locator"], f"{path}.provision_locator")
|
|
450
|
+
_unique_texts(obj["allowed_provisions"], f"{path}.allowed_provisions", minimum=1, maximum=128)
|
|
451
|
+
start = _date(obj["effective_from"], f"{path}.effective_from")
|
|
452
|
+
end = _date(obj["effective_until"], f"{path}.effective_until", nullable=True)
|
|
453
|
+
_date(obj["source_amended_or_published_date"], f"{path}.source_amended_or_published_date", nullable=True)
|
|
454
|
+
retrieved = _date(obj["retrieved_at"], f"{path}.retrieved_at")
|
|
455
|
+
verified = _date(obj["verified_at"], f"{path}.verified_at")
|
|
456
|
+
assert start is not None and retrieved is not None and verified is not None
|
|
457
|
+
if end is not None and end < start:
|
|
458
|
+
_fail(path, "effective_until precedes effective_from")
|
|
459
|
+
if retrieved > registry_as_of or verified > registry_as_of:
|
|
460
|
+
_fail(path, "retrieved_at/verified_at cannot be later than registry.as_of")
|
|
461
|
+
_text(obj["source_language"], f"{path}.source_language")
|
|
462
|
+
if not isinstance(obj["controlling_language"], bool):
|
|
463
|
+
_fail(f"{path}.controlling_language", "must be boolean")
|
|
464
|
+
authenticity = _enum(
|
|
465
|
+
obj["authenticity_status"],
|
|
466
|
+
f"{path}.authenticity_status",
|
|
467
|
+
{
|
|
468
|
+
"authentic_official", "official_controlling_language",
|
|
469
|
+
"authoritative_unofficial", "official_consolidated",
|
|
470
|
+
"official_reference_translation",
|
|
471
|
+
},
|
|
472
|
+
)
|
|
473
|
+
if authenticity == "official_reference_translation" and obj["controlling_language"]:
|
|
474
|
+
_fail(path, "a reference translation cannot be controlling")
|
|
475
|
+
_sha(obj["content_digest"], f"{path}.content_digest", nullable=True)
|
|
476
|
+
digest_scope = _enum(obj["digest_scope"], f"{path}.digest_scope", {"official_representation", "metadata_only", "not_recorded"})
|
|
477
|
+
if (obj["content_digest"] is None) != (digest_scope == "not_recorded"):
|
|
478
|
+
_fail(path, "content_digest and digest_scope are inconsistent")
|
|
479
|
+
_enum(obj["rights_status"], f"{path}.rights_status", {"link_only", "curator_summary_only", "redistribution_recorded"})
|
|
480
|
+
_enum(obj["freshness"], f"{path}.freshness", {"current", "stale", "unverified", "superseded"})
|
|
481
|
+
|
|
482
|
+
|
|
483
|
+
def _validate_anchor(anchor: Any, source: dict[str, Any], path: str) -> None:
|
|
484
|
+
obj = _closed(anchor, path, ANCHOR_FIELDS)
|
|
485
|
+
_identifier(obj["source_id"], f"{path}.source_id")
|
|
486
|
+
_https(obj["authority_url"], f"{path}.authority_url")
|
|
487
|
+
_https(obj["snapshot_url"], f"{path}.snapshot_url", nullable=True)
|
|
488
|
+
_text(obj["provision"], f"{path}.provision")
|
|
489
|
+
effective = _date(obj["effective_date"], f"{path}.effective_date")
|
|
490
|
+
end = _date(obj["effective_until"], f"{path}.effective_until", nullable=True)
|
|
491
|
+
_date(obj["source_amended_or_published_date"], f"{path}.source_amended_or_published_date", nullable=True)
|
|
492
|
+
_date(obj["retrieved_at"], f"{path}.retrieved_at")
|
|
493
|
+
_date(obj["verified_at"], f"{path}.verified_at")
|
|
494
|
+
_text(obj["source_language"], f"{path}.source_language")
|
|
495
|
+
if not isinstance(obj["controlling_language"], bool):
|
|
496
|
+
_fail(f"{path}.controlling_language", "must be boolean")
|
|
497
|
+
_text(obj["authenticity_status"], f"{path}.authenticity_status")
|
|
498
|
+
_sha(obj["content_digest"], f"{path}.content_digest", nullable=True)
|
|
499
|
+
_enum(obj["digest_scope"], f"{path}.digest_scope", {"official_representation", "metadata_only", "not_recorded"})
|
|
500
|
+
_enum(obj["rights_status"], f"{path}.rights_status", {"link_only", "curator_summary_only", "redistribution_recorded"})
|
|
501
|
+
joins = {
|
|
502
|
+
"source_id": "source_id", "authority_url": "canonical_url",
|
|
503
|
+
"snapshot_url": "snapshot_url", "effective_until": "effective_until",
|
|
504
|
+
"source_amended_or_published_date": "source_amended_or_published_date",
|
|
505
|
+
"retrieved_at": "retrieved_at", "verified_at": "verified_at",
|
|
506
|
+
"source_language": "source_language", "controlling_language": "controlling_language",
|
|
507
|
+
"authenticity_status": "authenticity_status", "content_digest": "content_digest",
|
|
508
|
+
"digest_scope": "digest_scope", "rights_status": "rights_status",
|
|
509
|
+
}
|
|
510
|
+
for anchor_key, source_key in joins.items():
|
|
511
|
+
if obj[anchor_key] != source[source_key]:
|
|
512
|
+
_fail(f"{path}.{anchor_key}", f"does not match source {source['source_id']}")
|
|
513
|
+
start = date.fromisoformat(source["effective_from"])
|
|
514
|
+
source_end = date.fromisoformat(source["effective_until"]) if source["effective_until"] else None
|
|
515
|
+
assert effective is not None
|
|
516
|
+
if effective != start:
|
|
517
|
+
_fail(f"{path}.effective_date", "must equal the provision source's verified effective_from date")
|
|
518
|
+
if obj["provision"] not in source["allowed_provisions"]:
|
|
519
|
+
_fail(f"{path}.provision", "is not an allowed provision locator for the selected source")
|
|
520
|
+
if end is not None and end < effective:
|
|
521
|
+
_fail(f"{path}.effective_until", "precedes effective_date")
|
|
522
|
+
|
|
523
|
+
|
|
524
|
+
def _validate_requirement(
|
|
525
|
+
row: Any,
|
|
526
|
+
path: str,
|
|
527
|
+
axis: str,
|
|
528
|
+
definitions: dict[str, dict[str, Any]],
|
|
529
|
+
sources: dict[str, dict[str, Any]],
|
|
530
|
+
authority_source_ids: set[str],
|
|
531
|
+
) -> str:
|
|
532
|
+
fields = {
|
|
533
|
+
"requirement_id", "axis", "title", "summary", "obligation_kind",
|
|
534
|
+
"obligated_actor", "consumer_scopes", "applies_if",
|
|
535
|
+
"structured_expectations", "evidence_expected", "waiver_or_exception_route",
|
|
536
|
+
"authoritative_decision_maker", "interaction", "authority_anchor",
|
|
537
|
+
}
|
|
538
|
+
obj = _closed(row, path, fields)
|
|
539
|
+
requirement_id = _identifier(obj["requirement_id"], f"{path}.requirement_id")
|
|
540
|
+
if obj["axis"] != axis:
|
|
541
|
+
_fail(f"{path}.axis", "must match its profile or overlay axis")
|
|
542
|
+
_text(obj["title"], f"{path}.title")
|
|
543
|
+
_text(obj["summary"], f"{path}.summary")
|
|
544
|
+
_enum(obj["obligation_kind"], f"{path}.obligation_kind", {"require", "prohibit", "condition", "information", "safeguard", "route"})
|
|
545
|
+
_identifier(obj["obligated_actor"], f"{path}.obligated_actor")
|
|
546
|
+
_unique_texts(obj["consumer_scopes"], f"{path}.consumer_scopes", identifiers=True, minimum=1)
|
|
547
|
+
_validate_predicate(obj["applies_if"], definitions, f"{path}.applies_if")
|
|
548
|
+
for index, expectation in enumerate(_array(obj["structured_expectations"], f"{path}.structured_expectations")):
|
|
549
|
+
exp = _closed(expectation, f"{path}.structured_expectations[{index}]", {"field_id", "operator", "value"})
|
|
550
|
+
_identifier(exp["field_id"], f"{path}.structured_expectations[{index}].field_id")
|
|
551
|
+
_enum(exp["operator"], f"{path}.structured_expectations[{index}].operator", {"equals", "includes", "gte", "lte", "present"})
|
|
552
|
+
value = exp["value"]
|
|
553
|
+
if isinstance(value, float) and not math.isfinite(value):
|
|
554
|
+
_fail(f"{path}.structured_expectations[{index}].value", "must be finite")
|
|
555
|
+
if isinstance(value, dict):
|
|
556
|
+
frac = _closed(value, f"{path}.structured_expectations[{index}].value", {"numerator", "denominator"})
|
|
557
|
+
if isinstance(frac["numerator"], bool) or not isinstance(frac["numerator"], int) or frac["numerator"] < 0:
|
|
558
|
+
_fail(path, "fraction numerator must be a non-negative integer")
|
|
559
|
+
if isinstance(frac["denominator"], bool) or not isinstance(frac["denominator"], int) or frac["denominator"] < 1:
|
|
560
|
+
_fail(path, "fraction denominator must be a positive integer")
|
|
561
|
+
elif not isinstance(value, (bool, int, float, str)):
|
|
562
|
+
_fail(path, "structured expectation has an unsupported value")
|
|
563
|
+
evidence_ids: list[str] = []
|
|
564
|
+
evidence = _array(obj["evidence_expected"], f"{path}.evidence_expected")
|
|
565
|
+
if not evidence:
|
|
566
|
+
_fail(f"{path}.evidence_expected", "must not be empty")
|
|
567
|
+
for index, item in enumerate(evidence):
|
|
568
|
+
ev = _closed(item, f"{path}.evidence_expected[{index}]", {"evidence_id", "held_by", "artifact_type", "description"})
|
|
569
|
+
evidence_ids.append(_identifier(ev["evidence_id"], f"{path}.evidence_expected[{index}].evidence_id"))
|
|
570
|
+
_identifier(ev["held_by"], f"{path}.evidence_expected[{index}].held_by")
|
|
571
|
+
_identifier(ev["artifact_type"], f"{path}.evidence_expected[{index}].artifact_type")
|
|
572
|
+
_text(ev["description"], f"{path}.evidence_expected[{index}].description")
|
|
573
|
+
_unique(evidence_ids, f"{path}.evidence_expected")
|
|
574
|
+
route = _closed(obj["waiver_or_exception_route"], f"{path}.waiver_or_exception_route", {"state", "requirement_ids", "decision_maker_role"})
|
|
575
|
+
state = _enum(route["state"], f"{path}.waiver_or_exception_route.state", {"profiled", "external_authority_required", "not_profiled_in_bounded_profile", "not_applicable"})
|
|
576
|
+
route_ids = _unique_texts(route["requirement_ids"], f"{path}.waiver_or_exception_route.requirement_ids", identifiers=True)
|
|
577
|
+
if state == "profiled" and not route_ids:
|
|
578
|
+
_fail(f"{path}.waiver_or_exception_route", "profiled routes require requirement_ids")
|
|
579
|
+
if state != "profiled" and route_ids:
|
|
580
|
+
_fail(f"{path}.waiver_or_exception_route", "only profiled routes may carry requirement_ids")
|
|
581
|
+
if route["decision_maker_role"] is not None:
|
|
582
|
+
_identifier(route["decision_maker_role"], f"{path}.waiver_or_exception_route.decision_maker_role")
|
|
583
|
+
decision = _closed(obj["authoritative_decision_maker"], f"{path}.authoritative_decision_maker", {"role_id", "description"})
|
|
584
|
+
_identifier(decision["role_id"], f"{path}.authoritative_decision_maker.role_id")
|
|
585
|
+
if decision["role_id"] in {"ars", "model", "user"}:
|
|
586
|
+
_fail(f"{path}.authoritative_decision_maker.role_id", "cannot assign authority to ARS, a model, or the user")
|
|
587
|
+
_text(decision["description"], f"{path}.authoritative_decision_maker.description")
|
|
588
|
+
interaction = _closed(obj["interaction"], f"{path}.interaction", {"collision_key", "policy"})
|
|
589
|
+
if interaction["collision_key"] is not None:
|
|
590
|
+
_identifier(interaction["collision_key"], f"{path}.interaction.collision_key")
|
|
591
|
+
if interaction["policy"] != "parallel_authorities":
|
|
592
|
+
_fail(f"{path}.interaction.policy", "must equal parallel_authorities")
|
|
593
|
+
anchor = obj["authority_anchor"]
|
|
594
|
+
if not isinstance(anchor, dict) or anchor.get("source_id") not in sources:
|
|
595
|
+
_fail(f"{path}.authority_anchor.source_id", "must resolve to a registry source")
|
|
596
|
+
if anchor["source_id"] not in authority_source_ids:
|
|
597
|
+
_fail(f"{path}.authority_anchor.source_id", "must be declared by its profile or overlay source_ids")
|
|
598
|
+
_validate_anchor(anchor, sources[anchor["source_id"]], f"{path}.authority_anchor")
|
|
599
|
+
return requirement_id
|
|
600
|
+
|
|
601
|
+
|
|
602
|
+
def validate_registry(registry: dict[str, Any]) -> None:
|
|
603
|
+
top = _closed(registry, "registry", {"schema_version", "registry_id", "registry_version", "as_of", "fact_definitions", "sources", "profiles", "overlays"})
|
|
604
|
+
if top["schema_version"] != "human-subjects-authority-registry/1.0":
|
|
605
|
+
_fail("registry.schema_version", "must equal human-subjects-authority-registry/1.0")
|
|
606
|
+
_identifier(top["registry_id"], "registry.registry_id")
|
|
607
|
+
_version(top["registry_version"], "registry.registry_version")
|
|
608
|
+
registry_as_of = _date(top["as_of"], "registry.as_of")
|
|
609
|
+
assert registry_as_of is not None
|
|
610
|
+
definitions: dict[str, dict[str, Any]] = {}
|
|
611
|
+
for index, row in enumerate(_array(top["fact_definitions"], "registry.fact_definitions", maximum=512)):
|
|
612
|
+
path = f"registry.fact_definitions[{index}]"
|
|
613
|
+
obj = _closed(row, path, {"fact_id", "value_type", "allowed_values", "description"})
|
|
614
|
+
fact_id = _identifier(obj["fact_id"], f"{path}.fact_id")
|
|
615
|
+
if fact_id in definitions:
|
|
616
|
+
_fail(f"{path}.fact_id", "duplicate fact id")
|
|
617
|
+
value_type = _enum(obj["value_type"], f"{path}.value_type", {"boolean", "string", "string_enum", "string_set", "date"})
|
|
618
|
+
allowed = obj["allowed_values"]
|
|
619
|
+
if allowed is not None:
|
|
620
|
+
allowed = _unique_texts(allowed, f"{path}.allowed_values", minimum=1, maximum=128)
|
|
621
|
+
if value_type == "string_enum" and allowed is None:
|
|
622
|
+
_fail(path, "string_enum requires allowed_values")
|
|
623
|
+
if value_type != "string_enum" and allowed is not None:
|
|
624
|
+
_fail(path, "allowed_values are only valid for string_enum")
|
|
625
|
+
_text(obj["description"], f"{path}.description")
|
|
626
|
+
definitions[fact_id] = obj
|
|
627
|
+
sources: dict[str, dict[str, Any]] = {}
|
|
628
|
+
for index, row in enumerate(_array(top["sources"], "registry.sources", maximum=256)):
|
|
629
|
+
_validate_source(row, f"registry.sources[{index}]", registry_as_of)
|
|
630
|
+
source_id = row["source_id"]
|
|
631
|
+
if source_id in sources:
|
|
632
|
+
_fail(f"registry.sources[{index}].source_id", "duplicate source id")
|
|
633
|
+
sources[source_id] = row
|
|
634
|
+
profile_index: dict[tuple[str, str], dict[str, Any]] = {}
|
|
635
|
+
profile_ids: set[str] = set()
|
|
636
|
+
requirement_ids: list[str] = []
|
|
637
|
+
profiles = _array(top["profiles"], "registry.profiles", maximum=128)
|
|
638
|
+
for index, row in enumerate(profiles):
|
|
639
|
+
path = f"registry.profiles[{index}]"
|
|
640
|
+
fields = {"profile_id", "profile_version", "profile_digest", "axis", "authority_scope_ids", "title", "authority_level", "coverage_status", "covered_provisions", "known_exclusions", "known_gaps", "no_completeness_claim", "source_ids", "applies_if", "requirements"}
|
|
641
|
+
obj = _closed(row, path, fields)
|
|
642
|
+
profile_id = _identifier(obj["profile_id"], f"{path}.profile_id")
|
|
643
|
+
profile_version = _version(obj["profile_version"], f"{path}.profile_version")
|
|
644
|
+
if profile_id in profile_ids or (profile_id, profile_version) in profile_index:
|
|
645
|
+
_fail(f"{path}.profile_id", "duplicate profile id/version")
|
|
646
|
+
profile_ids.add(profile_id)
|
|
647
|
+
axis = _enum(obj["axis"], f"{path}.axis", set(AXES))
|
|
648
|
+
_sha(obj["profile_digest"], f"{path}.profile_digest")
|
|
649
|
+
unsigned = copy.deepcopy(obj)
|
|
650
|
+
declared_digest = unsigned.pop("profile_digest")
|
|
651
|
+
if declared_digest != digest(unsigned):
|
|
652
|
+
_fail(f"{path}.profile_digest", "does not match the canonical profile digest")
|
|
653
|
+
_unique_texts(obj["authority_scope_ids"], f"{path}.authority_scope_ids", identifiers=True, minimum=1)
|
|
654
|
+
_text(obj["title"], f"{path}.title")
|
|
655
|
+
_enum(obj["authority_level"], f"{path}.authority_level", {"supranational", "national", "subnational", "tribal", "institutional"})
|
|
656
|
+
if obj["coverage_status"] != "bounded_subset" or obj["no_completeness_claim"] is not True:
|
|
657
|
+
_fail(path, "profiles must be bounded subsets with no_completeness_claim=true")
|
|
658
|
+
for name in ("covered_provisions", "known_exclusions", "known_gaps"):
|
|
659
|
+
_unique_texts(obj[name], f"{path}.{name}", minimum=1)
|
|
660
|
+
for source_id in _unique_texts(obj["source_ids"], f"{path}.source_ids", identifiers=True, minimum=1):
|
|
661
|
+
if source_id not in sources:
|
|
662
|
+
_fail(f"{path}.source_ids", f"unknown source id: {source_id}")
|
|
663
|
+
_validate_predicate(obj["applies_if"], definitions, f"{path}.applies_if")
|
|
664
|
+
requirements = _array(obj["requirements"], f"{path}.requirements", maximum=512)
|
|
665
|
+
if not requirements:
|
|
666
|
+
_fail(f"{path}.requirements", "must not be empty")
|
|
667
|
+
for req_index, requirement in enumerate(requirements):
|
|
668
|
+
requirement_ids.append(
|
|
669
|
+
_validate_requirement(
|
|
670
|
+
requirement,
|
|
671
|
+
f"{path}.requirements[{req_index}]",
|
|
672
|
+
axis,
|
|
673
|
+
definitions,
|
|
674
|
+
sources,
|
|
675
|
+
set(obj["source_ids"]),
|
|
676
|
+
)
|
|
677
|
+
)
|
|
678
|
+
profile_index[(profile_id, profile_version)] = obj
|
|
679
|
+
if {row["axis"] for row in profiles} != set(AXES):
|
|
680
|
+
_fail("registry.profiles", "must ship at least one profile on both V1 axes")
|
|
681
|
+
overlays = _array(top["overlays"], "registry.overlays", maximum=128)
|
|
682
|
+
overlay_ids: set[str] = set()
|
|
683
|
+
for index, row in enumerate(overlays):
|
|
684
|
+
path = f"registry.overlays[{index}]"
|
|
685
|
+
fields = {"overlay_id", "overlay_version", "overlay_digest", "overlay_kind", "axis", "issuer", "title", "authority_scope_ids", "target_profiles", "source_ids", "operation", "requirements_removed", "requirements"}
|
|
686
|
+
obj = _closed(row, path, fields)
|
|
687
|
+
overlay_id = _identifier(obj["overlay_id"], f"{path}.overlay_id")
|
|
688
|
+
if overlay_id in overlay_ids:
|
|
689
|
+
_fail(f"{path}.overlay_id", "duplicate overlay id")
|
|
690
|
+
overlay_ids.add(overlay_id)
|
|
691
|
+
_version(obj["overlay_version"], f"{path}.overlay_version")
|
|
692
|
+
_sha(obj["overlay_digest"], f"{path}.overlay_digest")
|
|
693
|
+
unsigned = copy.deepcopy(obj)
|
|
694
|
+
declared_digest = unsigned.pop("overlay_digest")
|
|
695
|
+
if declared_digest != digest(unsigned):
|
|
696
|
+
_fail(f"{path}.overlay_digest", "does not match the canonical overlay digest")
|
|
697
|
+
_enum(obj["overlay_kind"], f"{path}.overlay_kind", {"institutional", "funder"})
|
|
698
|
+
axis = _enum(obj["axis"], f"{path}.axis", set(AXES))
|
|
699
|
+
_text(obj["issuer"], f"{path}.issuer")
|
|
700
|
+
_text(obj["title"], f"{path}.title")
|
|
701
|
+
_unique_texts(obj["authority_scope_ids"], f"{path}.authority_scope_ids", identifiers=True, minimum=1)
|
|
702
|
+
targets = _array(obj["target_profiles"], f"{path}.target_profiles")
|
|
703
|
+
if not targets:
|
|
704
|
+
_fail(f"{path}.target_profiles", "must not be empty")
|
|
705
|
+
target_keys: list[tuple[str, str]] = []
|
|
706
|
+
for target_index, target in enumerate(targets):
|
|
707
|
+
target_path = f"{path}.target_profiles[{target_index}]"
|
|
708
|
+
target_obj = _closed(target, target_path, {"axis", "profile_id", "profile_version", "profile_digest"})
|
|
709
|
+
if target_obj["axis"] != axis:
|
|
710
|
+
_fail(f"{target_path}.axis", "must match overlay axis")
|
|
711
|
+
key = (_identifier(target_obj["profile_id"], f"{target_path}.profile_id"), _version(target_obj["profile_version"], f"{target_path}.profile_version"))
|
|
712
|
+
if key not in profile_index:
|
|
713
|
+
_fail(target_path, "target profile does not exist")
|
|
714
|
+
profile = profile_index[key]
|
|
715
|
+
if target_obj["profile_digest"] != profile["profile_digest"] or target_obj["axis"] != profile["axis"]:
|
|
716
|
+
_fail(target_path, "target profile pin does not match exactly")
|
|
717
|
+
target_keys.append(key)
|
|
718
|
+
_unique(target_keys, f"{path}.target_profiles")
|
|
719
|
+
for source_id in _unique_texts(obj["source_ids"], f"{path}.source_ids", identifiers=True, minimum=1):
|
|
720
|
+
if source_id not in sources:
|
|
721
|
+
_fail(f"{path}.source_ids", f"unknown source id: {source_id}")
|
|
722
|
+
_enum(obj["operation"], f"{path}.operation", {"add", "supplement", "conflict"})
|
|
723
|
+
if obj["requirements_removed"] is not False:
|
|
724
|
+
_fail(f"{path}.requirements_removed", "overlays may never remove requirements")
|
|
725
|
+
requirements = _array(obj["requirements"], f"{path}.requirements", maximum=512)
|
|
726
|
+
if not requirements:
|
|
727
|
+
_fail(f"{path}.requirements", "must not be empty")
|
|
728
|
+
for req_index, requirement in enumerate(requirements):
|
|
729
|
+
requirement_ids.append(
|
|
730
|
+
_validate_requirement(
|
|
731
|
+
requirement,
|
|
732
|
+
f"{path}.requirements[{req_index}]",
|
|
733
|
+
axis,
|
|
734
|
+
definitions,
|
|
735
|
+
sources,
|
|
736
|
+
set(obj["source_ids"]),
|
|
737
|
+
)
|
|
738
|
+
)
|
|
739
|
+
_unique(requirement_ids, "registry requirement ids")
|
|
740
|
+
known_requirements = set(requirement_ids)
|
|
741
|
+
for row in [*profiles, *overlays]:
|
|
742
|
+
for requirement in row["requirements"]:
|
|
743
|
+
route = requirement["waiver_or_exception_route"]
|
|
744
|
+
for target_id in route["requirement_ids"]:
|
|
745
|
+
if target_id not in known_requirements:
|
|
746
|
+
_fail(f"requirement {requirement['requirement_id']}", f"unknown profiled route requirement: {target_id}")
|
|
747
|
+
|
|
748
|
+
|
|
749
|
+
CONTEXT_FIELDS = {"schema_version", "context_record_id", "confirmed_by", "confirmed_at", "applicability_as_of", "scope_dimensions", "declared_facts", "profile_selection_state", "selected_profiles", "overlay_selection_state", "selected_overlays", "display_precedence"}
|
|
750
|
+
|
|
751
|
+
|
|
752
|
+
def validate_context(context: dict[str, Any], registry: dict[str, Any] | None = None) -> None:
|
|
753
|
+
obj = _closed(context, "context", CONTEXT_FIELDS)
|
|
754
|
+
if obj["schema_version"] != "irb-context-record/1.0":
|
|
755
|
+
_fail("context.schema_version", "must equal irb-context-record/1.0")
|
|
756
|
+
_identifier(obj["context_record_id"], "context.context_record_id")
|
|
757
|
+
if obj["confirmed_by"] != "author":
|
|
758
|
+
_fail("context.confirmed_by", "must equal author")
|
|
759
|
+
_datetime(obj["confirmed_at"], "context.confirmed_at")
|
|
760
|
+
_date(obj["applicability_as_of"], "context.applicability_as_of")
|
|
761
|
+
scope_names = {"review_jurisdictions", "institutions", "data_protection_regimes", "funders", "study_types", "populations", "data_locations", "cross_border_transfers"}
|
|
762
|
+
scopes = _closed(obj["scope_dimensions"], "context.scope_dimensions", scope_names)
|
|
763
|
+
scoped_fact_ids: set[str] = set()
|
|
764
|
+
for name in sorted(scope_names):
|
|
765
|
+
scoped_fact_ids.update(_unique_texts(scopes[name], f"context.scope_dimensions.{name}", identifiers=True, maximum=256))
|
|
766
|
+
definition_index = {row["fact_id"]: row for row in registry["fact_definitions"]} if registry is not None else None
|
|
767
|
+
declared_ids: list[str] = []
|
|
768
|
+
for index, row in enumerate(_array(obj["declared_facts"], "context.declared_facts", maximum=512)):
|
|
769
|
+
path = f"context.declared_facts[{index}]"
|
|
770
|
+
fact = _closed(row, path, {"fact_id", "value_type", "state", "value", "provenance"})
|
|
771
|
+
fact_id = _identifier(fact["fact_id"], f"{path}.fact_id")
|
|
772
|
+
declared_ids.append(fact_id)
|
|
773
|
+
value_type = _enum(fact["value_type"], f"{path}.value_type", {"boolean", "string", "string_enum", "string_set", "date"})
|
|
774
|
+
state = _enum(fact["state"], f"{path}.state", {"declared", "unknown"})
|
|
775
|
+
if fact["provenance"] != "author_declared":
|
|
776
|
+
_fail(f"{path}.provenance", "must equal author_declared")
|
|
777
|
+
if state == "unknown" and fact["value"] is not None:
|
|
778
|
+
_fail(f"{path}.value", "must be null when state is unknown")
|
|
779
|
+
if state == "declared":
|
|
780
|
+
if fact["value"] is None:
|
|
781
|
+
_fail(f"{path}.value", f"does not match declared value_type {value_type}")
|
|
782
|
+
_validate_fact_value(value_type, fact["value"], f"{path}.value")
|
|
783
|
+
if definition_index is not None:
|
|
784
|
+
if fact_id not in definition_index:
|
|
785
|
+
_fail(f"{path}.fact_id", "is not in the registry fact catalog")
|
|
786
|
+
definition = definition_index[fact_id]
|
|
787
|
+
if value_type != definition["value_type"]:
|
|
788
|
+
_fail(f"{path}.value_type", "does not match registry fact definition")
|
|
789
|
+
allowed = definition["allowed_values"]
|
|
790
|
+
if state == "declared" and allowed is not None and fact["value"] not in allowed:
|
|
791
|
+
_fail(f"{path}.value", "is outside the registry fact allowlist")
|
|
792
|
+
_unique(declared_ids, "context.declared_facts")
|
|
793
|
+
if registry is not None:
|
|
794
|
+
unknown_scoped = scoped_fact_ids - set(declared_ids)
|
|
795
|
+
if unknown_scoped:
|
|
796
|
+
_fail("context.scope_dimensions", f"references undeclared fact(s): {', '.join(sorted(unknown_scoped))}")
|
|
797
|
+
states = _closed(obj["profile_selection_state"], "context.profile_selection_state", set(AXES))
|
|
798
|
+
for axis in AXES:
|
|
799
|
+
_enum(states[axis], f"context.profile_selection_state.{axis}", {"selected", "unresolved"})
|
|
800
|
+
profile_keys: list[tuple[str, str, str]] = []
|
|
801
|
+
selections = _array(obj["selected_profiles"], "context.selected_profiles", maximum=64)
|
|
802
|
+
for index, row in enumerate(selections):
|
|
803
|
+
path = f"context.selected_profiles[{index}]"
|
|
804
|
+
selection = _closed(row, path, {"axis", "profile_id", "profile_version", "profile_digest", "authority_scope_ids"})
|
|
805
|
+
axis = _enum(selection["axis"], f"{path}.axis", set(AXES))
|
|
806
|
+
profile_id = _identifier(selection["profile_id"], f"{path}.profile_id")
|
|
807
|
+
version = _version(selection["profile_version"], f"{path}.profile_version")
|
|
808
|
+
_sha(selection["profile_digest"], f"{path}.profile_digest")
|
|
809
|
+
_unique_texts(selection["authority_scope_ids"], f"{path}.authority_scope_ids", identifiers=True, minimum=1)
|
|
810
|
+
profile_keys.append((axis, profile_id, version))
|
|
811
|
+
_unique(profile_keys, "context.selected_profiles")
|
|
812
|
+
for axis in AXES:
|
|
813
|
+
count = sum(row["axis"] == axis for row in selections)
|
|
814
|
+
if states[axis] == "selected" and count == 0:
|
|
815
|
+
_fail("context.profile_selection_state", f"{axis}=selected requires a selected profile")
|
|
816
|
+
if states[axis] == "unresolved" and count != 0:
|
|
817
|
+
_fail("context.profile_selection_state", f"{axis}=unresolved forbids selected profiles")
|
|
818
|
+
overlay_states = _closed(obj["overlay_selection_state"], "context.overlay_selection_state", {"institutional", "funder"})
|
|
819
|
+
for kind in ("institutional", "funder"):
|
|
820
|
+
_enum(overlay_states[kind], f"context.overlay_selection_state.{kind}", {"selected", "not_provided", "none_declared_by_author"})
|
|
821
|
+
overlay_keys: list[tuple[str, str, str]] = []
|
|
822
|
+
overlay_selections = _array(obj["selected_overlays"], "context.selected_overlays", maximum=64)
|
|
823
|
+
for index, row in enumerate(overlay_selections):
|
|
824
|
+
path = f"context.selected_overlays[{index}]"
|
|
825
|
+
selection = _closed(row, path, {"overlay_kind", "axis", "overlay_id", "overlay_version", "overlay_digest"})
|
|
826
|
+
kind = _enum(selection["overlay_kind"], f"{path}.overlay_kind", {"institutional", "funder"})
|
|
827
|
+
axis = _enum(selection["axis"], f"{path}.axis", set(AXES))
|
|
828
|
+
overlay_id = _identifier(selection["overlay_id"], f"{path}.overlay_id")
|
|
829
|
+
version = _version(selection["overlay_version"], f"{path}.overlay_version")
|
|
830
|
+
_sha(selection["overlay_digest"], f"{path}.overlay_digest")
|
|
831
|
+
overlay_keys.append((kind, overlay_id, version))
|
|
832
|
+
_unique(overlay_keys, "context.selected_overlays")
|
|
833
|
+
for kind in ("institutional", "funder"):
|
|
834
|
+
count = sum(row["overlay_kind"] == kind for row in overlay_selections)
|
|
835
|
+
if overlay_states[kind] == "selected" and count == 0:
|
|
836
|
+
_fail("context.overlay_selection_state", f"{kind}=selected requires an overlay")
|
|
837
|
+
if overlay_states[kind] != "selected" and count != 0:
|
|
838
|
+
_fail("context.overlay_selection_state", f"{kind} overlays require state=selected")
|
|
839
|
+
precedence = _array(obj["display_precedence"], "context.display_precedence", maximum=2)
|
|
840
|
+
if len(precedence) != 2:
|
|
841
|
+
_fail("context.display_precedence", "must contain both axes exactly once")
|
|
842
|
+
expected: dict[str, set[tuple[str, str, str, str, str]]] = {axis: set() for axis in AXES}
|
|
843
|
+
for row in selections:
|
|
844
|
+
expected[row["axis"]].add(("profile", row["axis"], row["profile_id"], row["profile_version"], row["profile_digest"]))
|
|
845
|
+
for row in overlay_selections:
|
|
846
|
+
expected[row["axis"]].add((f"{row['overlay_kind']}_overlay", row["axis"], row["overlay_id"], row["overlay_version"], row["overlay_digest"]))
|
|
847
|
+
seen_axes: set[str] = set()
|
|
848
|
+
for index, row in enumerate(precedence):
|
|
849
|
+
path = f"context.display_precedence[{index}]"
|
|
850
|
+
entry = _closed(row, path, {"axis", "purpose", "ordered_authorities"})
|
|
851
|
+
axis = _enum(entry["axis"], f"{path}.axis", set(AXES))
|
|
852
|
+
if axis in seen_axes:
|
|
853
|
+
_fail(f"{path}.axis", "duplicate axis")
|
|
854
|
+
seen_axes.add(axis)
|
|
855
|
+
if entry["purpose"] != "display_only_no_suppression":
|
|
856
|
+
_fail(f"{path}.purpose", "must equal display_only_no_suppression")
|
|
857
|
+
actual: list[tuple[str, str, str, str, str]] = []
|
|
858
|
+
for auth_index, authority in enumerate(_array(entry["ordered_authorities"], f"{path}.ordered_authorities", maximum=128)):
|
|
859
|
+
auth_path = f"{path}.ordered_authorities[{auth_index}]"
|
|
860
|
+
ref = _closed(authority, auth_path, {"authority_kind", "axis", "authority_id", "authority_version", "authority_digest"})
|
|
861
|
+
kind = _enum(ref["authority_kind"], f"{auth_path}.authority_kind", {"profile", "institutional_overlay", "funder_overlay"})
|
|
862
|
+
if ref["axis"] != axis:
|
|
863
|
+
_fail(f"{auth_path}.axis", "must match display axis")
|
|
864
|
+
_identifier(ref["authority_id"], f"{auth_path}.authority_id")
|
|
865
|
+
_version(ref["authority_version"], f"{auth_path}.authority_version")
|
|
866
|
+
_sha(ref["authority_digest"], f"{auth_path}.authority_digest")
|
|
867
|
+
actual.append((kind, axis, ref["authority_id"], ref["authority_version"], ref["authority_digest"]))
|
|
868
|
+
if len(actual) != len(set(actual)) or set(actual) != expected[axis]:
|
|
869
|
+
_fail(f"{path}.ordered_authorities", "must list every selected authority on this axis exactly once")
|
|
870
|
+
|
|
871
|
+
|
|
872
|
+
def _semantic_context(context: dict[str, Any]) -> dict[str, Any]:
|
|
873
|
+
value = copy.deepcopy(context)
|
|
874
|
+
value.pop("confirmed_at", None)
|
|
875
|
+
for row in value["declared_facts"]:
|
|
876
|
+
if row["value_type"] == "string_set" and isinstance(row["value"], list):
|
|
877
|
+
row["value"].sort()
|
|
878
|
+
value["declared_facts"] = sorted(value["declared_facts"], key=lambda row: row["fact_id"])
|
|
879
|
+
for rows in value["scope_dimensions"].values():
|
|
880
|
+
rows.sort()
|
|
881
|
+
for row in value["selected_profiles"]:
|
|
882
|
+
row["authority_scope_ids"].sort()
|
|
883
|
+
value["selected_profiles"].sort(key=lambda row: (row["axis"], row["profile_id"], row["profile_version"], row["profile_digest"]))
|
|
884
|
+
value["selected_overlays"].sort(key=lambda row: (row["axis"], row["overlay_kind"], row["overlay_id"], row["overlay_version"], row["overlay_digest"]))
|
|
885
|
+
return value
|
|
886
|
+
|
|
887
|
+
|
|
888
|
+
def _source_current(source: dict[str, Any], as_of: date) -> bool:
|
|
889
|
+
start = date.fromisoformat(source["effective_from"])
|
|
890
|
+
end = date.fromisoformat(source["effective_until"]) if source["effective_until"] else None
|
|
891
|
+
return (
|
|
892
|
+
start <= as_of
|
|
893
|
+
and (end is None or as_of <= end)
|
|
894
|
+
and source["freshness"] == "current"
|
|
895
|
+
and source["controlling_language"] is True
|
|
896
|
+
and source["authenticity_status"] != "official_reference_translation"
|
|
897
|
+
)
|
|
898
|
+
|
|
899
|
+
|
|
900
|
+
def _combine_all(left: str, right: str) -> str:
|
|
901
|
+
if "false" in {left, right}:
|
|
902
|
+
return "false"
|
|
903
|
+
if "unknown" in {left, right}:
|
|
904
|
+
return "unknown"
|
|
905
|
+
return "true"
|
|
906
|
+
|
|
907
|
+
|
|
908
|
+
def resolve(context: dict[str, Any], registry: dict[str, Any]) -> dict[str, Any]:
|
|
909
|
+
validate_registry(registry)
|
|
910
|
+
validate_context(context, registry)
|
|
911
|
+
context_as_of = _date(context["applicability_as_of"], "context.applicability_as_of")
|
|
912
|
+
registry_as_of = _date(registry["as_of"], "registry.as_of")
|
|
913
|
+
assert context_as_of is not None and registry_as_of is not None
|
|
914
|
+
if context_as_of > registry_as_of:
|
|
915
|
+
_fail("context.applicability_as_of", "cannot be later than registry.as_of")
|
|
916
|
+
facts = {row["fact_id"]: row for row in context["declared_facts"]}
|
|
917
|
+
definitions = {row["fact_id"]: row for row in registry["fact_definitions"]}
|
|
918
|
+
sources = {row["source_id"]: row for row in registry["sources"]}
|
|
919
|
+
profile_index = {(row["profile_id"], row["profile_version"]): (index, row) for index, row in enumerate(registry["profiles"])}
|
|
920
|
+
overlay_index = {(row["overlay_id"], row["overlay_version"]): (index, row) for index, row in enumerate(registry["overlays"])}
|
|
921
|
+
unresolved: list[dict[str, Any]] = []
|
|
922
|
+
selected_profiles: list[dict[str, Any]] = []
|
|
923
|
+
selected_profile_rows: list[tuple[int, dict[str, Any], str, list[dict[str, Any]], str]] = []
|
|
924
|
+
selected_profile_applicability: dict[tuple[str, str, str, str], str] = {}
|
|
925
|
+
for selection in sorted(context["selected_profiles"], key=lambda row: (row["axis"], row["profile_id"], row["profile_version"])):
|
|
926
|
+
key = (selection["profile_id"], selection["profile_version"])
|
|
927
|
+
if key not in profile_index:
|
|
928
|
+
_fail("context.selected_profiles", f"unknown exact profile pin: {key[0]}@{key[1]}")
|
|
929
|
+
index, profile = profile_index[key]
|
|
930
|
+
if selection["axis"] != profile["axis"] or selection["profile_digest"] != profile["profile_digest"] or set(selection["authority_scope_ids"]) != set(profile["authority_scope_ids"]):
|
|
931
|
+
_fail("context.selected_profiles", f"exact profile pin mismatch: {key[0]}@{key[1]}")
|
|
932
|
+
applicability, trace = evaluate_predicate(profile["applies_if"], facts, definitions)
|
|
933
|
+
anchored_sources = [sources[req["authority_anchor"]["source_id"]] for req in profile["requirements"]]
|
|
934
|
+
source_state = "current" if anchored_sources and all(_source_current(source, context_as_of) for source in anchored_sources) else "unresolved"
|
|
935
|
+
result = {
|
|
936
|
+
"axis": profile["axis"], "profile_id": profile["profile_id"],
|
|
937
|
+
"profile_version": profile["profile_version"], "profile_digest": profile["profile_digest"],
|
|
938
|
+
"authority_scope_ids": sorted(profile["authority_scope_ids"]),
|
|
939
|
+
"profile_pointer": f"/profiles/{index}", "applicability": applicability,
|
|
940
|
+
"predicate_trace": trace, "source_state": source_state,
|
|
941
|
+
}
|
|
942
|
+
selected_profiles.append(result)
|
|
943
|
+
selected_profile_rows.append((index, profile, applicability, trace, source_state))
|
|
944
|
+
selected_profile_applicability[
|
|
945
|
+
(
|
|
946
|
+
profile["profile_id"],
|
|
947
|
+
profile["profile_version"],
|
|
948
|
+
profile["profile_digest"],
|
|
949
|
+
profile["axis"],
|
|
950
|
+
)
|
|
951
|
+
] = applicability
|
|
952
|
+
if applicability == "unknown":
|
|
953
|
+
unresolved.append({"code": "APPLICABILITY_UNRESOLVED", "axis": profile["axis"], "authority_id": profile["profile_id"], "requirement_id": None})
|
|
954
|
+
elif applicability == "false":
|
|
955
|
+
unresolved.append({"code": "PROFILE_SCOPE_CONFLICT", "axis": profile["axis"], "authority_id": profile["profile_id"], "requirement_id": None})
|
|
956
|
+
if source_state != "current":
|
|
957
|
+
unresolved.append({"code": "AUTHORITY_SOURCE_NOT_CURRENT", "axis": profile["axis"], "authority_id": profile["profile_id"], "requirement_id": None})
|
|
958
|
+
both_axes = all(context["profile_selection_state"][axis] == "selected" and any(row["axis"] == axis for row in context["selected_profiles"]) for axis in AXES)
|
|
959
|
+
if not both_axes:
|
|
960
|
+
for axis in AXES:
|
|
961
|
+
if not any(row["axis"] == axis for row in context["selected_profiles"]):
|
|
962
|
+
unresolved.append({"code": "JURISDICTION_UNRESOLVED", "axis": axis, "authority_id": None, "requirement_id": None})
|
|
963
|
+
selected_profile_pins = {(row["profile_id"], row["profile_version"], row["profile_digest"], row["axis"]) for row in context["selected_profiles"]}
|
|
964
|
+
selected_overlays: list[dict[str, Any]] = []
|
|
965
|
+
selected_overlay_rows: list[tuple[int, dict[str, Any], str]] = []
|
|
966
|
+
for selection in sorted(context["selected_overlays"], key=lambda row: (row["axis"], row["overlay_kind"], row["overlay_id"], row["overlay_version"])):
|
|
967
|
+
key = (selection["overlay_id"], selection["overlay_version"])
|
|
968
|
+
if key not in overlay_index:
|
|
969
|
+
_fail("context.selected_overlays", f"unknown exact overlay pin: {key[0]}@{key[1]}")
|
|
970
|
+
index, overlay = overlay_index[key]
|
|
971
|
+
if selection["overlay_kind"] != overlay["overlay_kind"] or selection["axis"] != overlay["axis"] or selection["overlay_digest"] != overlay["overlay_digest"]:
|
|
972
|
+
_fail("context.selected_overlays", f"exact overlay pin mismatch: {key[0]}@{key[1]}")
|
|
973
|
+
targets = {(row["profile_id"], row["profile_version"], row["profile_digest"], row["axis"]) for row in overlay["target_profiles"]}
|
|
974
|
+
matched = targets & selected_profile_pins
|
|
975
|
+
if matched != targets:
|
|
976
|
+
_fail("context.selected_overlays", f"overlay does not have every exact base target selected: {overlay['overlay_id']}")
|
|
977
|
+
base_applicability = "true"
|
|
978
|
+
for target in sorted(targets):
|
|
979
|
+
base_applicability = _combine_all(
|
|
980
|
+
base_applicability, selected_profile_applicability[target]
|
|
981
|
+
)
|
|
982
|
+
if base_applicability != "true":
|
|
983
|
+
unresolved.append({"code": "OVERLAY_BASE_UNRESOLVED", "axis": overlay["axis"], "authority_id": overlay["overlay_id"], "requirement_id": None})
|
|
984
|
+
selected_overlays.append({
|
|
985
|
+
"overlay_kind": overlay["overlay_kind"], "axis": overlay["axis"],
|
|
986
|
+
"overlay_id": overlay["overlay_id"], "overlay_version": overlay["overlay_version"],
|
|
987
|
+
"overlay_digest": overlay["overlay_digest"], "overlay_pointer": f"/overlays/{index}",
|
|
988
|
+
"target_profile_ids": sorted({row[0] for row in matched}), "requirements_removed": False,
|
|
989
|
+
})
|
|
990
|
+
selected_overlay_rows.append((index, overlay, base_applicability))
|
|
991
|
+
requirement_results: list[dict[str, Any]] = []
|
|
992
|
+
collision_members: dict[str, list[str]] = {}
|
|
993
|
+
authority_requirements: dict[tuple[str, str], list[str]] = {}
|
|
994
|
+
|
|
995
|
+
def add_requirements(authority_kind: str, index: int, authority: dict[str, Any], parent_applicability: str = "true") -> None:
|
|
996
|
+
identity_key = "profile_id" if authority_kind == "profile" else "overlay_id"
|
|
997
|
+
version_key = "profile_version" if authority_kind == "profile" else "overlay_version"
|
|
998
|
+
digest_key = "profile_digest" if authority_kind == "profile" else "overlay_digest"
|
|
999
|
+
base_pointer = "profiles" if authority_kind == "profile" else "overlays"
|
|
1000
|
+
public_kind = authority_kind if authority_kind == "profile" else f"{authority['overlay_kind']}_overlay"
|
|
1001
|
+
authority_id = authority[identity_key]
|
|
1002
|
+
authority_requirements[(public_kind, authority_id)] = []
|
|
1003
|
+
for req_index, requirement in enumerate(authority["requirements"]):
|
|
1004
|
+
req_result, trace = evaluate_predicate(requirement["applies_if"], facts, definitions)
|
|
1005
|
+
applicability = _combine_all(parent_applicability, req_result)
|
|
1006
|
+
pointer = f"/{base_pointer}/{index}/requirements/{req_index}"
|
|
1007
|
+
result = {
|
|
1008
|
+
"requirement_id": requirement["requirement_id"], "authority_kind": public_kind,
|
|
1009
|
+
"authority_id": authority_id, "authority_version": authority[version_key],
|
|
1010
|
+
"authority_digest": authority[digest_key], "axis": authority["axis"],
|
|
1011
|
+
"obligated_actor": requirement["obligated_actor"],
|
|
1012
|
+
"consumer_scopes": sorted(requirement["consumer_scopes"]),
|
|
1013
|
+
"applicability": applicability, "predicate_trace": trace,
|
|
1014
|
+
"requirement_digest": digest(requirement), "requirement_pointer": pointer,
|
|
1015
|
+
"authority_anchor_pointer": f"{pointer}/authority_anchor",
|
|
1016
|
+
}
|
|
1017
|
+
requirement_results.append(result)
|
|
1018
|
+
authority_requirements[(public_kind, authority_id)].append(requirement["requirement_id"])
|
|
1019
|
+
collision_key = requirement["interaction"]["collision_key"]
|
|
1020
|
+
if collision_key is not None:
|
|
1021
|
+
collision_members.setdefault(collision_key, []).append(requirement["requirement_id"])
|
|
1022
|
+
if applicability == "unknown":
|
|
1023
|
+
unresolved.append({"code": "APPLICABILITY_UNRESOLVED", "axis": authority["axis"], "authority_id": authority_id, "requirement_id": requirement["requirement_id"]})
|
|
1024
|
+
anchor_source = sources[requirement["authority_anchor"]["source_id"]]
|
|
1025
|
+
if not _source_current(anchor_source, context_as_of):
|
|
1026
|
+
reason = {"code": "AUTHORITY_SOURCE_NOT_CURRENT", "axis": authority["axis"], "authority_id": authority_id, "requirement_id": requirement["requirement_id"]}
|
|
1027
|
+
if reason not in unresolved:
|
|
1028
|
+
unresolved.append(reason)
|
|
1029
|
+
|
|
1030
|
+
for index, profile, applicability, _trace, _state in selected_profile_rows:
|
|
1031
|
+
add_requirements("profile", index, profile, applicability)
|
|
1032
|
+
for index, overlay, base_applicability in selected_overlay_rows:
|
|
1033
|
+
add_requirements("overlay", index, overlay, base_applicability)
|
|
1034
|
+
requirement_results.sort(key=lambda row: (row["axis"], row["authority_kind"], row["authority_id"], row["requirement_id"]))
|
|
1035
|
+
collisions = [
|
|
1036
|
+
{"collision_key": key, "requirement_ids": sorted(ids), "resolution": "parallel_authorities_require_human_resolution", "requirements_removed": False}
|
|
1037
|
+
for key, ids in sorted(collision_members.items()) if len(set(ids)) >= 2
|
|
1038
|
+
]
|
|
1039
|
+
precedence_keys: list[tuple[str, str]] = []
|
|
1040
|
+
for axis_entry in context["display_precedence"]:
|
|
1041
|
+
for ref in axis_entry["ordered_authorities"]:
|
|
1042
|
+
precedence_keys.append((ref["authority_kind"], ref["authority_id"]))
|
|
1043
|
+
trace_ids: list[tuple[str, str]] = []
|
|
1044
|
+
for key in precedence_keys:
|
|
1045
|
+
trace_ids.extend((key[1], req_id) for req_id in authority_requirements.get(key, []))
|
|
1046
|
+
if {req_id for _, req_id in trace_ids} != {row["requirement_id"] for row in requirement_results} or len(trace_ids) != len(requirement_results):
|
|
1047
|
+
_fail("context.display_precedence", "did not preserve every requirement exactly once")
|
|
1048
|
+
trace_order = [
|
|
1049
|
+
{"position": index + 1, "requirement_id": req_id, "authority_id": authority_id, "purpose": "display_only_no_suppression"}
|
|
1050
|
+
for index, (authority_id, req_id) in enumerate(trace_ids)
|
|
1051
|
+
]
|
|
1052
|
+
unique_unresolved = {(row["code"], row["axis"], row["authority_id"], row["requirement_id"]): row for row in unresolved}
|
|
1053
|
+
unresolved_rows = [unique_unresolved[key] for key in sorted(unique_unresolved, key=lambda item: tuple("" if part is None else part for part in item))]
|
|
1054
|
+
applicability_resolved = both_axes and not any(row["code"] in {"APPLICABILITY_UNRESOLVED", "PROFILE_SCOPE_CONFLICT", "AUTHORITY_SOURCE_NOT_CURRENT", "OVERLAY_BASE_UNRESOLVED"} for row in unresolved_rows)
|
|
1055
|
+
allowed = both_axes and applicability_resolved
|
|
1056
|
+
resolution_state = "resolved" if allowed else ("jurisdiction_unresolved" if not both_axes else "applicability_unresolved")
|
|
1057
|
+
output: dict[str, Any] = {
|
|
1058
|
+
"schema_version": "resolved-human-subjects-authority-context/1.0",
|
|
1059
|
+
"context_pointer": {"context_record_id": context["context_record_id"], "schema_version": context["schema_version"], "context_digest": digest(_semantic_context(context))},
|
|
1060
|
+
"registry_pointer": {"registry_id": registry["registry_id"], "registry_version": registry["registry_version"], "as_of": registry["as_of"], "registry_digest": digest(registry)},
|
|
1061
|
+
"selected_profiles": selected_profiles,
|
|
1062
|
+
"selected_overlays": selected_overlays,
|
|
1063
|
+
"requirement_results": requirement_results,
|
|
1064
|
+
"collisions": collisions,
|
|
1065
|
+
"trace_order": trace_order,
|
|
1066
|
+
"resolution_state": resolution_state,
|
|
1067
|
+
"unresolved_reasons": unresolved_rows,
|
|
1068
|
+
"downstream_gate": {"both_axes_selected": both_axes, "exact_selection_resolved": True, "all_applicability_resolved": applicability_resolved, "profile_dependent_result_allowed": allowed},
|
|
1069
|
+
}
|
|
1070
|
+
output["resolved_digest"] = digest(output)
|
|
1071
|
+
return output
|
|
1072
|
+
|
|
1073
|
+
|
|
1074
|
+
def validate_resolved_context(
|
|
1075
|
+
output: dict[str, Any],
|
|
1076
|
+
context: dict[str, Any],
|
|
1077
|
+
registry: dict[str, Any],
|
|
1078
|
+
) -> None:
|
|
1079
|
+
"""Validate a serialized result by deterministic replay against named inputs."""
|
|
1080
|
+
if not isinstance(output, dict):
|
|
1081
|
+
_fail("resolved", "must be an object")
|
|
1082
|
+
if set(output) != {
|
|
1083
|
+
"schema_version",
|
|
1084
|
+
"context_pointer",
|
|
1085
|
+
"registry_pointer",
|
|
1086
|
+
"selected_profiles",
|
|
1087
|
+
"selected_overlays",
|
|
1088
|
+
"requirement_results",
|
|
1089
|
+
"collisions",
|
|
1090
|
+
"trace_order",
|
|
1091
|
+
"resolution_state",
|
|
1092
|
+
"unresolved_reasons",
|
|
1093
|
+
"downstream_gate",
|
|
1094
|
+
"resolved_digest",
|
|
1095
|
+
}:
|
|
1096
|
+
_fail("resolved", "does not have the closed resolved-context field set")
|
|
1097
|
+
claimed_digest = _sha(output["resolved_digest"], "resolved.resolved_digest")
|
|
1098
|
+
unsigned = copy.deepcopy(output)
|
|
1099
|
+
unsigned.pop("resolved_digest")
|
|
1100
|
+
if digest(unsigned) != claimed_digest:
|
|
1101
|
+
_fail("resolved.resolved_digest", "does not match the canonical artifact digest")
|
|
1102
|
+
expected = resolve(context, registry)
|
|
1103
|
+
if _canonical_bytes(output) != _canonical_bytes(expected):
|
|
1104
|
+
_fail(
|
|
1105
|
+
"resolved",
|
|
1106
|
+
"does not exactly match deterministic replay from the named context and registry",
|
|
1107
|
+
)
|
|
1108
|
+
|
|
1109
|
+
|
|
1110
|
+
def main(argv: list[str] | None = None) -> int:
|
|
1111
|
+
parser = argparse.ArgumentParser(description=__doc__)
|
|
1112
|
+
parser.add_argument("--context", type=Path)
|
|
1113
|
+
parser.add_argument("--registry", type=Path, required=True)
|
|
1114
|
+
parser.add_argument("--output", type=Path)
|
|
1115
|
+
parser.add_argument("--check-registry", action="store_true")
|
|
1116
|
+
parser.add_argument(
|
|
1117
|
+
"--check-resolved",
|
|
1118
|
+
type=Path,
|
|
1119
|
+
help="validate a serialized resolved artifact by replaying --context and --registry",
|
|
1120
|
+
)
|
|
1121
|
+
args = parser.parse_args(argv)
|
|
1122
|
+
try:
|
|
1123
|
+
registry = load_json(args.registry)
|
|
1124
|
+
validate_registry(registry)
|
|
1125
|
+
if args.check_registry:
|
|
1126
|
+
if (
|
|
1127
|
+
args.context is not None
|
|
1128
|
+
or args.output is not None
|
|
1129
|
+
or args.check_resolved is not None
|
|
1130
|
+
):
|
|
1131
|
+
raise ContractError(
|
|
1132
|
+
"--check-registry cannot be combined with --context, --output, or --check-resolved"
|
|
1133
|
+
)
|
|
1134
|
+
print("Human-subjects authority registry validation passed (#666).")
|
|
1135
|
+
return 0
|
|
1136
|
+
if args.context is None:
|
|
1137
|
+
raise ContractError("--context is required unless --check-registry is used")
|
|
1138
|
+
context = load_json(args.context)
|
|
1139
|
+
if args.check_resolved is not None:
|
|
1140
|
+
if args.output is not None:
|
|
1141
|
+
raise ContractError("--check-resolved cannot be combined with --output")
|
|
1142
|
+
validate_resolved_context(load_json(args.check_resolved), context, registry)
|
|
1143
|
+
print("Resolved human-subjects authority context validation passed (#666).")
|
|
1144
|
+
return 0
|
|
1145
|
+
result = resolve(context, registry)
|
|
1146
|
+
rendered = json.dumps(result, ensure_ascii=False, sort_keys=True, indent=2) + "\n"
|
|
1147
|
+
if args.output is None:
|
|
1148
|
+
sys.stdout.write(rendered)
|
|
1149
|
+
else:
|
|
1150
|
+
args.output.write_text(rendered, encoding="utf-8")
|
|
1151
|
+
return 0
|
|
1152
|
+
except (ContractError, OSError) as exc:
|
|
1153
|
+
print(f"ERROR: {exc}", file=sys.stderr)
|
|
1154
|
+
return 2
|
|
1155
|
+
|
|
1156
|
+
|
|
1157
|
+
if __name__ == "__main__":
|
|
1158
|
+
raise SystemExit(main())
|