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,1889 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import argparse
|
|
4
|
+
import base64
|
|
5
|
+
import copy
|
|
6
|
+
from datetime import datetime, timedelta, timezone
|
|
7
|
+
import hashlib
|
|
8
|
+
import json
|
|
9
|
+
import os
|
|
10
|
+
from pathlib import Path
|
|
11
|
+
import shutil
|
|
12
|
+
import unicodedata
|
|
13
|
+
|
|
14
|
+
from jsonschema import Draft202012Validator
|
|
15
|
+
import pytest
|
|
16
|
+
|
|
17
|
+
from scripts import check_indirect_prompt_injection_no_call as ast_guard
|
|
18
|
+
from scripts import run_indirect_prompt_injection_no_call as runner
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
MODULE_PATH = Path(runner.__file__)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def _command_args(run_dir: Path, plan_sha: str, **kwargs):
|
|
25
|
+
return argparse.Namespace(
|
|
26
|
+
run_dir=run_dir,
|
|
27
|
+
plan_sha256=plan_sha,
|
|
28
|
+
transcript=kwargs.get("transcript"),
|
|
29
|
+
authorization_record=kwargs.get("authorization_record"),
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def _initialize(tmp_path: Path):
|
|
34
|
+
run_dir = tmp_path / "run"
|
|
35
|
+
args = argparse.Namespace(
|
|
36
|
+
run_dir=run_dir,
|
|
37
|
+
run_id="automated-contract-test-v1",
|
|
38
|
+
suite_commit=runner._repository_head_commit(),
|
|
39
|
+
order_seed="issue-675-phase2-test-seed-v1",
|
|
40
|
+
subject_provider="automated-fixture-provider",
|
|
41
|
+
subject_model="automated-fixture-model",
|
|
42
|
+
subject_runtime="automated-fixture-runtime",
|
|
43
|
+
subject_runtime_version="1.0",
|
|
44
|
+
auth_mode="automated-fixture-auth",
|
|
45
|
+
reasoning_effort="frozen",
|
|
46
|
+
input_token_cap=12000,
|
|
47
|
+
output_token_cap=3000,
|
|
48
|
+
)
|
|
49
|
+
result = runner.init_run(args)
|
|
50
|
+
plan = json.loads((run_dir / "run-plan.json").read_bytes())
|
|
51
|
+
return run_dir, result["run_plan_sha256"], plan
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def _authorization(plan: dict) -> dict:
|
|
55
|
+
return {
|
|
56
|
+
"schema_version": "indirect-prompt-injection-authorization-record/1.0",
|
|
57
|
+
"suite": runner.SUITE,
|
|
58
|
+
"record_id": "automated-contract-fixture-auth-v1",
|
|
59
|
+
"run_plan_sha256": hashlib.sha256(runner._json_bytes(plan)).hexdigest(),
|
|
60
|
+
"run_id": plan["run_id"],
|
|
61
|
+
"suite_commit": plan["suite_commit"],
|
|
62
|
+
"execution": plan["execution"],
|
|
63
|
+
"scope": {
|
|
64
|
+
"scope_type": "exact_run_plan_all_cells",
|
|
65
|
+
"subject_call_cells": 64,
|
|
66
|
+
"cell_ids": plan["order"]["cell_ids"],
|
|
67
|
+
"order_sha256": plan["order"]["order_sha256"],
|
|
68
|
+
},
|
|
69
|
+
"decision": {
|
|
70
|
+
"status": "authorized",
|
|
71
|
+
"decided_at": "2026-08-13T00:00:00Z",
|
|
72
|
+
"operator_reference": "automated-contract-fixture-reference",
|
|
73
|
+
"statement": (
|
|
74
|
+
"AUTOMATED CONTRACT FIXTURE ONLY; this is not real consent, identity, "
|
|
75
|
+
"human evidence, or permission to run a model."
|
|
76
|
+
),
|
|
77
|
+
},
|
|
78
|
+
"proof_boundary": {
|
|
79
|
+
"structural_and_byte_binding_only": True,
|
|
80
|
+
"operator_identity_verified_by_runner": False,
|
|
81
|
+
"fresh_external_authorization_is_procedural_responsibility": True,
|
|
82
|
+
"not_human_or_research_evidence": True,
|
|
83
|
+
},
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
def _authorization_file(tmp_path: Path, plan: dict) -> Path:
|
|
88
|
+
path = tmp_path / "authorization.json"
|
|
89
|
+
path.write_bytes(runner._json_bytes(_authorization(plan)))
|
|
90
|
+
return path
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
def _event(index: int, kind: str, payload: bytes, cell: dict) -> dict:
|
|
94
|
+
external_session_id = f"automated-fresh-session-{cell['cell_id']}"
|
|
95
|
+
native_type = next(
|
|
96
|
+
native for native, derived in runner.RAW_NATIVE_EVENT_TYPES.items()
|
|
97
|
+
if derived == kind
|
|
98
|
+
)
|
|
99
|
+
raw = runner._canonical(
|
|
100
|
+
{
|
|
101
|
+
"contract": "indirect-prompt-injection-canonical-event/2.0",
|
|
102
|
+
"native_event_type": native_type,
|
|
103
|
+
"external_session_id": external_session_id,
|
|
104
|
+
"cell_id": cell["cell_id"],
|
|
105
|
+
"sequence_index": cell["sequence_index"],
|
|
106
|
+
"event_index": index,
|
|
107
|
+
"event_id": f"{external_session_id}:event-{index:04d}",
|
|
108
|
+
"payload_utf8": payload.decode("utf-8"),
|
|
109
|
+
}
|
|
110
|
+
)
|
|
111
|
+
return {
|
|
112
|
+
"event_index": index,
|
|
113
|
+
"event_kind": kind,
|
|
114
|
+
"raw_event_base64": base64.b64encode(raw).decode("ascii"),
|
|
115
|
+
"raw_event_bytes": len(raw),
|
|
116
|
+
"raw_event_sha256": hashlib.sha256(raw).hexdigest(),
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
def _transcript(
|
|
121
|
+
plan: dict,
|
|
122
|
+
cell: dict,
|
|
123
|
+
*,
|
|
124
|
+
response_text: str | None = None,
|
|
125
|
+
partial: bool = False,
|
|
126
|
+
) -> dict:
|
|
127
|
+
response_text = response_text or json.dumps(
|
|
128
|
+
{
|
|
129
|
+
"artifact": {},
|
|
130
|
+
"external_action_requests": [],
|
|
131
|
+
"injection_marker": None,
|
|
132
|
+
},
|
|
133
|
+
sort_keys=True,
|
|
134
|
+
separators=(",", ":"),
|
|
135
|
+
)
|
|
136
|
+
response_raw = response_text.encode("utf-8")
|
|
137
|
+
authorization_raw = runner._json_bytes(_authorization(plan))
|
|
138
|
+
started = datetime(2026, 8, 13, tzinfo=timezone.utc) + timedelta(
|
|
139
|
+
seconds=cell["sequence_index"] * 3
|
|
140
|
+
)
|
|
141
|
+
completed = started + timedelta(seconds=1)
|
|
142
|
+
recorded = completed + timedelta(seconds=1)
|
|
143
|
+
session_receipt = {
|
|
144
|
+
"receipt_id": f"automated-external-receipt-{cell['cell_id']}",
|
|
145
|
+
"external_session_id": f"automated-fresh-session-{cell['cell_id']}",
|
|
146
|
+
"cell_id": cell["cell_id"],
|
|
147
|
+
"sequence_index": cell["sequence_index"],
|
|
148
|
+
"started_at": started.isoformat().replace("+00:00", "Z"),
|
|
149
|
+
"completed_at": completed.isoformat().replace("+00:00", "Z"),
|
|
150
|
+
"fresh_context": True,
|
|
151
|
+
}
|
|
152
|
+
session_receipt_raw = runner._canonical(session_receipt)
|
|
153
|
+
events = [
|
|
154
|
+
_event(1, "call_started", b"AUTOMATED CONTRACT EVENT: call started", cell),
|
|
155
|
+
_event(2, "subject_output", response_raw, cell),
|
|
156
|
+
_event(
|
|
157
|
+
3,
|
|
158
|
+
"partial_output" if partial else "call_completed",
|
|
159
|
+
b"AUTOMATED CONTRACT EVENT: call ended",
|
|
160
|
+
cell,
|
|
161
|
+
),
|
|
162
|
+
]
|
|
163
|
+
return {
|
|
164
|
+
"schema_version": "indirect-prompt-injection-transcript/1.0",
|
|
165
|
+
"suite": runner.SUITE,
|
|
166
|
+
"run_plan_sha256": hashlib.sha256(runner._json_bytes(plan)).hexdigest(),
|
|
167
|
+
"cell_id": cell["cell_id"],
|
|
168
|
+
"sequence_index": cell["sequence_index"],
|
|
169
|
+
"source": {
|
|
170
|
+
"source_kind": "externally_recorded_subject_call",
|
|
171
|
+
"source_artifact_id": f"automated-contract-fixture-{cell['cell_id']}",
|
|
172
|
+
"recorded_at": recorded.isoformat().replace("+00:00", "Z"),
|
|
173
|
+
"authorization_record_ref": "automated-contract-fixture-auth-v1",
|
|
174
|
+
"authorization_record_sha256": hashlib.sha256(authorization_raw).hexdigest(),
|
|
175
|
+
"event_normalizer": {
|
|
176
|
+
"contract": "runner-decoded-canonical-event/2.0",
|
|
177
|
+
"normalizer_id": "ars-675-canonical-event-decoder",
|
|
178
|
+
"normalizer_version": "2.0",
|
|
179
|
+
"external_provenance_only": False,
|
|
180
|
+
"runner_authenticates_normalizer_identity": True,
|
|
181
|
+
},
|
|
182
|
+
"external_session_receipt_utf8": session_receipt_raw.decode("utf-8"),
|
|
183
|
+
"external_session_receipt_sha256": hashlib.sha256(session_receipt_raw).hexdigest(),
|
|
184
|
+
},
|
|
185
|
+
"bindings": {
|
|
186
|
+
"prompt_sha256": cell["prompt_sha256"],
|
|
187
|
+
"scenario_sha256": cell["scenario_sha256"],
|
|
188
|
+
"call_envelope_sha256": cell["call_envelope_sha256"],
|
|
189
|
+
},
|
|
190
|
+
"observed_execution": runner._observed_execution(plan["execution"]),
|
|
191
|
+
"observed_usage": {
|
|
192
|
+
"input_tokens": 100,
|
|
193
|
+
"output_tokens": max(1, len(response_raw) // 4),
|
|
194
|
+
"source": "automated-fixture-usage",
|
|
195
|
+
},
|
|
196
|
+
"call_status": {
|
|
197
|
+
"complete": not partial,
|
|
198
|
+
"blocked": False,
|
|
199
|
+
"partial": partial,
|
|
200
|
+
"status_detail": "automated complete fixture" if not partial else "automated partial fixture",
|
|
201
|
+
},
|
|
202
|
+
"response": {
|
|
203
|
+
"raw_response_utf8": response_text,
|
|
204
|
+
"raw_response_bytes": len(response_raw),
|
|
205
|
+
"raw_response_sha256": hashlib.sha256(response_raw).hexdigest(),
|
|
206
|
+
"parse_diagnostics": runner._response_diagnostics(response_text),
|
|
207
|
+
},
|
|
208
|
+
"events": events,
|
|
209
|
+
"observations": {
|
|
210
|
+
"prompt_hash_match": True,
|
|
211
|
+
"execution_match": True,
|
|
212
|
+
"unplanned_tool_actions": [],
|
|
213
|
+
"unplanned_network_actions": [],
|
|
214
|
+
"evidence_write_failure": False,
|
|
215
|
+
},
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
def _materialized(tmp_path: Path):
|
|
220
|
+
run_dir, plan_sha, plan = _initialize(tmp_path)
|
|
221
|
+
runner.materialize(_command_args(run_dir, plan_sha))
|
|
222
|
+
return run_dir, plan_sha, plan
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
def _replace_external_session_receipt(transcript: dict, **changes) -> None:
|
|
226
|
+
receipt = runner._strict_loads(
|
|
227
|
+
transcript["source"]["external_session_receipt_utf8"].encode("utf-8")
|
|
228
|
+
)
|
|
229
|
+
receipt.update(changes)
|
|
230
|
+
raw = runner._canonical(receipt)
|
|
231
|
+
transcript["source"]["external_session_receipt_utf8"] = raw.decode("utf-8")
|
|
232
|
+
transcript["source"]["external_session_receipt_sha256"] = hashlib.sha256(raw).hexdigest()
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
def _replace_response(transcript: dict, text: str) -> None:
|
|
236
|
+
raw = text.encode("utf-8")
|
|
237
|
+
transcript["response"] = {
|
|
238
|
+
"raw_response_utf8": text,
|
|
239
|
+
"raw_response_bytes": len(raw),
|
|
240
|
+
"raw_response_sha256": hashlib.sha256(raw).hexdigest(),
|
|
241
|
+
"parse_diagnostics": runner._response_diagnostics(text),
|
|
242
|
+
}
|
|
243
|
+
cell = {
|
|
244
|
+
"cell_id": transcript["cell_id"],
|
|
245
|
+
"sequence_index": transcript["sequence_index"],
|
|
246
|
+
}
|
|
247
|
+
transcript["events"][1] = _event(2, "subject_output", raw, cell)
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
def _mutate_raw_event(transcript: dict, event_offset: int, **changes) -> None:
|
|
251
|
+
event = transcript["events"][event_offset]
|
|
252
|
+
raw = base64.b64decode(event["raw_event_base64"], validate=True)
|
|
253
|
+
value = runner._strict_loads(raw)
|
|
254
|
+
value.update(changes)
|
|
255
|
+
mutated = runner._canonical(value)
|
|
256
|
+
event["raw_event_base64"] = base64.b64encode(mutated).decode("ascii")
|
|
257
|
+
event["raw_event_bytes"] = len(mutated)
|
|
258
|
+
event["raw_event_sha256"] = hashlib.sha256(mutated).hexdigest()
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
def _ingest_one(
|
|
262
|
+
tmp_path: Path,
|
|
263
|
+
run_dir: Path,
|
|
264
|
+
plan_sha: str,
|
|
265
|
+
plan: dict,
|
|
266
|
+
cell: dict,
|
|
267
|
+
*,
|
|
268
|
+
response_text: str | None = None,
|
|
269
|
+
) -> dict:
|
|
270
|
+
transcript = tmp_path / "external-transcript.json"
|
|
271
|
+
transcript.write_bytes(
|
|
272
|
+
runner._json_bytes(_transcript(plan, cell, response_text=response_text))
|
|
273
|
+
)
|
|
274
|
+
return runner.ingest(
|
|
275
|
+
_command_args(
|
|
276
|
+
run_dir,
|
|
277
|
+
plan_sha,
|
|
278
|
+
transcript=transcript,
|
|
279
|
+
authorization_record=_authorization_file(tmp_path, plan),
|
|
280
|
+
)
|
|
281
|
+
)
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
def _ingest_all(tmp_path: Path, run_dir: Path, plan_sha: str, plan: dict) -> None:
|
|
285
|
+
authorization = _authorization_file(tmp_path, plan)
|
|
286
|
+
transcript = tmp_path / "external-transcript.json"
|
|
287
|
+
for cell in plan["cells"]:
|
|
288
|
+
transcript.write_bytes(runner._json_bytes(_transcript(plan, cell)))
|
|
289
|
+
runner.ingest(
|
|
290
|
+
_command_args(
|
|
291
|
+
run_dir,
|
|
292
|
+
plan_sha,
|
|
293
|
+
transcript=transcript,
|
|
294
|
+
authorization_record=authorization,
|
|
295
|
+
)
|
|
296
|
+
)
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
def test_plan_is_exact_64_cell_counterbalanced_no_call_cross_product(tmp_path):
|
|
300
|
+
run_dir, plan_sha, plan = _initialize(tmp_path)
|
|
301
|
+
assert len(plan["cells"]) == 8 * 2 * 2 * 2 == 64
|
|
302
|
+
assert plan["order"]["cell_ids"] == [f"cell-{index:03d}" for index in range(1, 65)]
|
|
303
|
+
observed = {
|
|
304
|
+
(
|
|
305
|
+
cell["scenario_id"],
|
|
306
|
+
cell["content_condition"],
|
|
307
|
+
cell["guidance_condition"],
|
|
308
|
+
cell["replicate"],
|
|
309
|
+
)
|
|
310
|
+
for cell in plan["cells"]
|
|
311
|
+
}
|
|
312
|
+
assert len(observed) == 64
|
|
313
|
+
for scenario_id in {cell["scenario_id"] for cell in plan["cells"]}:
|
|
314
|
+
rows = [cell for cell in plan["cells"] if cell["scenario_id"] == scenario_id]
|
|
315
|
+
first = [
|
|
316
|
+
(cell["content_condition"], cell["guidance_condition"])
|
|
317
|
+
for cell in rows
|
|
318
|
+
if cell["replicate"] == 1
|
|
319
|
+
]
|
|
320
|
+
second = [
|
|
321
|
+
(cell["content_condition"], cell["guidance_condition"])
|
|
322
|
+
for cell in rows
|
|
323
|
+
if cell["replicate"] == 2
|
|
324
|
+
]
|
|
325
|
+
assert set(first) == set(runner.FACTORIAL_CELLS)
|
|
326
|
+
assert second == list(reversed(first))
|
|
327
|
+
alternate = runner._config_from_plan(plan)
|
|
328
|
+
alternate["order_seed"] = "issue-675-phase2-alternate-seed-v1"
|
|
329
|
+
assert runner._build_plan(alternate)["order"]["order_sha256"] != plan["order"]["order_sha256"]
|
|
330
|
+
assert len(plan["asset_bindings"]) == 21
|
|
331
|
+
assert plan["suite_commit"] == runner._repository_head_commit()
|
|
332
|
+
assert plan["suite_commit_boundary"]["matches_local_head_at_freeze"] is True
|
|
333
|
+
assert plan["suite_commit_boundary"]["clean_worktree_or_git_object_replay_proven"] is False
|
|
334
|
+
execution = plan["execution"]
|
|
335
|
+
assert execution["tools"] == [] and execution["web_enabled"] is False
|
|
336
|
+
assert execution["runner_transport"] == "none"
|
|
337
|
+
assert execution["dispatch_available"] is False
|
|
338
|
+
assert execution["api_spend_ceiling_usd"] == 0
|
|
339
|
+
assert execution["api_fallback"] is False
|
|
340
|
+
assert execution["envelope_grants_consent"] is False
|
|
341
|
+
assert execution["token_caps_enforced_by_runner"] is True
|
|
342
|
+
assert execution["observed_token_usage_required"] is True
|
|
343
|
+
assert runner.validate_run(_command_args(run_dir, plan_sha))["status"] == "initialized"
|
|
344
|
+
|
|
345
|
+
|
|
346
|
+
def test_init_rejects_operator_declared_non_head_suite_commit(tmp_path):
|
|
347
|
+
args = argparse.Namespace(
|
|
348
|
+
run_dir=tmp_path / "wrong-head",
|
|
349
|
+
run_id="automated-wrong-head-v1",
|
|
350
|
+
suite_commit="f" * 40,
|
|
351
|
+
order_seed="issue-675-wrong-head-seed-v1",
|
|
352
|
+
subject_provider="fixture",
|
|
353
|
+
subject_model="fixture",
|
|
354
|
+
subject_runtime="fixture",
|
|
355
|
+
subject_runtime_version="1",
|
|
356
|
+
auth_mode="fixture",
|
|
357
|
+
reasoning_effort="fixture",
|
|
358
|
+
input_token_cap=12000,
|
|
359
|
+
output_token_cap=3000,
|
|
360
|
+
)
|
|
361
|
+
with pytest.raises(runner.EnvelopeError, match="local checkout HEAD"):
|
|
362
|
+
runner.init_run(args)
|
|
363
|
+
|
|
364
|
+
|
|
365
|
+
def test_materializer_is_exclusive_hash_bound_and_non_dispatching(tmp_path):
|
|
366
|
+
run_dir, plan_sha, plan = _initialize(tmp_path)
|
|
367
|
+
result = runner.materialize(_command_args(run_dir, plan_sha))
|
|
368
|
+
assert result == {"materialized_files": 128, "cells": 64, "dispatch_available": False}
|
|
369
|
+
assert len([path for path in (run_dir / "materials").rglob("*") if path.is_file()]) == 128
|
|
370
|
+
first = plan["cells"][0]
|
|
371
|
+
assert hashlib.sha256((run_dir / first["prompt_path"]).read_bytes()).hexdigest() == first["prompt_sha256"]
|
|
372
|
+
envelope = json.loads((run_dir / first["call_envelope_path"]).read_bytes())
|
|
373
|
+
assert envelope["runner_transport"] == "none"
|
|
374
|
+
assert envelope["dispatch_available"] is False
|
|
375
|
+
assert envelope["envelope_grants_consent"] is False
|
|
376
|
+
assert envelope["execution"]["tools"] == []
|
|
377
|
+
assert envelope["execution"]["web_enabled"] is False
|
|
378
|
+
assert "command" not in envelope and "subject_output" not in envelope
|
|
379
|
+
armed = run_dir / runner._journal_ref("armed", "cell-001")
|
|
380
|
+
blind_armed = run_dir / runner._journal_ref(
|
|
381
|
+
"armed", runner.BLIND_TRANSACTION_ID
|
|
382
|
+
)
|
|
383
|
+
preload_armed = run_dir / runner._journal_ref(
|
|
384
|
+
"armed", runner.PRELOAD_TRANSACTION_ID
|
|
385
|
+
)
|
|
386
|
+
assert armed.is_file() and blind_armed.is_file() and preload_armed.is_file()
|
|
387
|
+
assert (run_dir / runner.JOURNAL_ROOT / "completed").is_dir()
|
|
388
|
+
assert not (run_dir / runner._journal_ref("claimed", "cell-001")).exists()
|
|
389
|
+
assert not (run_dir / runner._journal_ref("completed", "cell-001")).exists()
|
|
390
|
+
assert not (
|
|
391
|
+
run_dir / runner._journal_ref("claimed", runner.PRELOAD_TRANSACTION_ID)
|
|
392
|
+
).exists()
|
|
393
|
+
with pytest.raises(runner.EnvelopeError, match="exactly once"):
|
|
394
|
+
runner.materialize(_command_args(run_dir, plan_sha))
|
|
395
|
+
|
|
396
|
+
|
|
397
|
+
def test_ast_guard_rejects_transport_process_and_extra_command_surfaces():
|
|
398
|
+
source = MODULE_PATH.read_text(encoding="utf-8")
|
|
399
|
+
assert ast_guard.check_source(source) == []
|
|
400
|
+
assert any("forbidden transport" in error for error in ast_guard.check_source("import subprocess\n" + source))
|
|
401
|
+
assert any("forbidden transport" in error for error in ast_guard.check_source("import httpx\n" + source))
|
|
402
|
+
assert any("exact allowlist" in error for error in ast_guard.check_source("exec('pass')\n" + source))
|
|
403
|
+
mutated = source.replace(
|
|
404
|
+
'sub = parser.add_subparsers(dest="command", required=True)',
|
|
405
|
+
'sub = parser.add_subparsers(dest="command", required=True)\n sub.add_parser("dispatch")',
|
|
406
|
+
)
|
|
407
|
+
assert any("CLI commands" in error for error in ast_guard.check_source(mutated))
|
|
408
|
+
mutated = source.replace("def _parser()", "def dispatch_model_call()")
|
|
409
|
+
assert any("function definitions" in error for error in ast_guard.check_source(mutated))
|
|
410
|
+
|
|
411
|
+
|
|
412
|
+
@pytest.mark.parametrize(
|
|
413
|
+
"payload",
|
|
414
|
+
(
|
|
415
|
+
'from sys import modules as registry\nregistry["os"].spawnl(0, "x")\n',
|
|
416
|
+
'from sys import _getframe\n_getframe().f_globals["os"].system("x")\n',
|
|
417
|
+
'from builtins import open as hidden_open\nhidden_open("x")\n',
|
|
418
|
+
'system = os\nsystem.open("x", 0)\n',
|
|
419
|
+
'escape = json.loads.__globals__\n',
|
|
420
|
+
'import os as system\nsystem.spawnl(0, "x")\n',
|
|
421
|
+
),
|
|
422
|
+
)
|
|
423
|
+
def test_ast_guard_rejects_import_symbol_builtin_alias_and_module_escapes(payload):
|
|
424
|
+
source = MODULE_PATH.read_text(encoding="utf-8")
|
|
425
|
+
assert ast_guard.check_source(payload + source)
|
|
426
|
+
|
|
427
|
+
|
|
428
|
+
def test_plan_material_and_symlink_drift_fail_closed(tmp_path):
|
|
429
|
+
run_dir, plan_sha, plan = _materialized(tmp_path)
|
|
430
|
+
material = run_dir / plan["cells"][0]["prompt_path"]
|
|
431
|
+
material.write_bytes(material.read_bytes() + b"\n")
|
|
432
|
+
with pytest.raises(runner.EnvelopeError, match="material bytes drifted"):
|
|
433
|
+
runner.validate_run(_command_args(run_dir, plan_sha))
|
|
434
|
+
|
|
435
|
+
other_dir, other_sha, _ = _initialize(tmp_path / "other")
|
|
436
|
+
(other_dir / "escape").symlink_to(tmp_path)
|
|
437
|
+
with pytest.raises(runner.EnvelopeError, match="must not contain symlinks"):
|
|
438
|
+
runner.validate_run(_command_args(other_dir, other_sha))
|
|
439
|
+
|
|
440
|
+
containment_root = tmp_path / "containment-root"
|
|
441
|
+
containment_root.mkdir()
|
|
442
|
+
(containment_root / "real").mkdir()
|
|
443
|
+
(containment_root / "alias").symlink_to(containment_root / "real")
|
|
444
|
+
with pytest.raises(runner.EnvelopeError, match="symlink ancestor"):
|
|
445
|
+
runner._write_new(
|
|
446
|
+
containment_root / "alias/evidence.json",
|
|
447
|
+
b"AUTOMATED TEST EVIDENCE\n",
|
|
448
|
+
root=containment_root,
|
|
449
|
+
)
|
|
450
|
+
|
|
451
|
+
|
|
452
|
+
def test_preload_plan_drift_is_durably_quarantined_and_restore_cannot_retry(tmp_path):
|
|
453
|
+
run_dir, plan_sha, plan = _materialized(tmp_path)
|
|
454
|
+
source = tmp_path / "transcript.json"
|
|
455
|
+
source.write_bytes(runner._json_bytes(_transcript(plan, plan["cells"][0])))
|
|
456
|
+
plan_path = run_dir / "run-plan.json"
|
|
457
|
+
pristine = plan_path.read_bytes()
|
|
458
|
+
plan_path.write_bytes(pristine + b"\n")
|
|
459
|
+
args = _command_args(
|
|
460
|
+
run_dir,
|
|
461
|
+
plan_sha,
|
|
462
|
+
transcript=source,
|
|
463
|
+
authorization_record=_authorization_file(tmp_path, plan),
|
|
464
|
+
)
|
|
465
|
+
with pytest.raises(runner.EnvelopeError, match="permanently quarantined"):
|
|
466
|
+
runner.ingest(args)
|
|
467
|
+
marker = json.loads((run_dir / runner.PRELOAD_QUARANTINE_REF).read_bytes())
|
|
468
|
+
assert marker["retry_forbidden"] is True
|
|
469
|
+
assert marker["expected_run_plan_sha256"] == plan_sha
|
|
470
|
+
plan_path.write_bytes(pristine)
|
|
471
|
+
with pytest.raises(runner.EnvelopeError, match="permanently quarantined"):
|
|
472
|
+
runner.ingest(args)
|
|
473
|
+
|
|
474
|
+
|
|
475
|
+
def test_preload_quarantine_write_failure_claims_before_transcript_and_restore(
|
|
476
|
+
tmp_path, monkeypatch
|
|
477
|
+
):
|
|
478
|
+
run_dir, plan_sha, plan = _materialized(tmp_path)
|
|
479
|
+
source = tmp_path / "transcript.json"
|
|
480
|
+
source.write_bytes(runner._json_bytes(_transcript(plan, plan["cells"][0])))
|
|
481
|
+
plan_path = run_dir / "run-plan.json"
|
|
482
|
+
pristine = plan_path.read_bytes()
|
|
483
|
+
plan_path.write_bytes(pristine + b"\n")
|
|
484
|
+
args = _command_args(
|
|
485
|
+
run_dir,
|
|
486
|
+
plan_sha,
|
|
487
|
+
transcript=source,
|
|
488
|
+
authorization_record=_authorization_file(tmp_path, plan),
|
|
489
|
+
)
|
|
490
|
+
original_read = runner._read_file
|
|
491
|
+
original_ensure = runner._ensure_exact_new
|
|
492
|
+
transcript_reads = 0
|
|
493
|
+
|
|
494
|
+
def observe_read(path, **kwargs):
|
|
495
|
+
nonlocal transcript_reads
|
|
496
|
+
if path == source:
|
|
497
|
+
transcript_reads += 1
|
|
498
|
+
armed = run_dir / runner._journal_ref(
|
|
499
|
+
"armed", runner.PRELOAD_TRANSACTION_ID
|
|
500
|
+
)
|
|
501
|
+
claimed = run_dir / runner._journal_ref(
|
|
502
|
+
"claimed", runner.PRELOAD_TRANSACTION_ID
|
|
503
|
+
)
|
|
504
|
+
assert claimed.is_file()
|
|
505
|
+
assert (armed.stat().st_dev, armed.stat().st_ino) == (
|
|
506
|
+
claimed.stat().st_dev,
|
|
507
|
+
claimed.stat().st_ino,
|
|
508
|
+
)
|
|
509
|
+
return original_read(path, **kwargs)
|
|
510
|
+
|
|
511
|
+
def fail_quarantine(path, raw, **kwargs):
|
|
512
|
+
if path.name == runner.PRELOAD_QUARANTINE_REF:
|
|
513
|
+
raise runner.EnvelopeError("AUTOMATED QUARANTINE WRITE FAILURE")
|
|
514
|
+
return original_ensure(path, raw, **kwargs)
|
|
515
|
+
|
|
516
|
+
monkeypatch.setattr(runner, "_read_file", observe_read)
|
|
517
|
+
monkeypatch.setattr(runner, "_ensure_exact_new", fail_quarantine)
|
|
518
|
+
with pytest.raises(runner.EnvelopeError, match="could not be committed"):
|
|
519
|
+
runner.ingest(args)
|
|
520
|
+
assert transcript_reads == 1
|
|
521
|
+
assert not (run_dir / runner.PRELOAD_QUARANTINE_REF).exists()
|
|
522
|
+
assert not (run_dir / runner._journal_ref("claimed", "cell-001")).exists()
|
|
523
|
+
|
|
524
|
+
plan_path.write_bytes(pristine)
|
|
525
|
+
monkeypatch.setattr(runner, "_ensure_exact_new", original_ensure)
|
|
526
|
+
with pytest.raises(runner.EnvelopeError, match="pre-load terminal transaction"):
|
|
527
|
+
runner.ingest(args)
|
|
528
|
+
assert transcript_reads == 1
|
|
529
|
+
|
|
530
|
+
|
|
531
|
+
def test_preload_claim_failure_never_reads_submitted_transcript(tmp_path, monkeypatch):
|
|
532
|
+
run_dir, plan_sha, plan = _materialized(tmp_path)
|
|
533
|
+
source = tmp_path / "transcript.json"
|
|
534
|
+
source.write_bytes(runner._json_bytes(_transcript(plan, plan["cells"][0])))
|
|
535
|
+
(run_dir / "run-plan.json").write_bytes(
|
|
536
|
+
(run_dir / "run-plan.json").read_bytes() + b"\n"
|
|
537
|
+
)
|
|
538
|
+
original_read = runner._read_file
|
|
539
|
+
transcript_reads = 0
|
|
540
|
+
|
|
541
|
+
def observe_read(path, **kwargs):
|
|
542
|
+
nonlocal transcript_reads
|
|
543
|
+
if path == source:
|
|
544
|
+
transcript_reads += 1
|
|
545
|
+
return original_read(path, **kwargs)
|
|
546
|
+
|
|
547
|
+
def fail_preload_claim(run_root, supplied_sha, transaction_id, sequence_index):
|
|
548
|
+
assert transaction_id == runner.PRELOAD_TRANSACTION_ID
|
|
549
|
+
raise runner.EnvelopeError("AUTOMATED PRELOAD CLAIM FAILURE")
|
|
550
|
+
|
|
551
|
+
monkeypatch.setattr(runner, "_read_file", observe_read)
|
|
552
|
+
monkeypatch.setattr(runner, "_claim_journal_token", fail_preload_claim)
|
|
553
|
+
with pytest.raises(runner.EnvelopeError, match="transcript was not acquired"):
|
|
554
|
+
runner.ingest(
|
|
555
|
+
_command_args(
|
|
556
|
+
run_dir,
|
|
557
|
+
plan_sha,
|
|
558
|
+
transcript=source,
|
|
559
|
+
authorization_record=_authorization_file(tmp_path, plan),
|
|
560
|
+
)
|
|
561
|
+
)
|
|
562
|
+
assert transcript_reads == 0
|
|
563
|
+
|
|
564
|
+
|
|
565
|
+
def test_material_drift_at_ingest_commits_irreversible_stop(tmp_path):
|
|
566
|
+
run_dir, plan_sha, plan = _materialized(tmp_path)
|
|
567
|
+
material = run_dir / plan["cells"][0]["prompt_path"]
|
|
568
|
+
material.write_bytes(material.read_bytes() + b"DRIFT")
|
|
569
|
+
source = tmp_path / "transcript.json"
|
|
570
|
+
source.write_bytes(runner._json_bytes(_transcript(plan, plan["cells"][0])))
|
|
571
|
+
with pytest.raises(runner.StopViolation) as caught:
|
|
572
|
+
runner.ingest(
|
|
573
|
+
_command_args(
|
|
574
|
+
run_dir,
|
|
575
|
+
plan_sha,
|
|
576
|
+
transcript=source,
|
|
577
|
+
authorization_record=_authorization_file(tmp_path, plan),
|
|
578
|
+
)
|
|
579
|
+
)
|
|
580
|
+
assert caught.value.code == "prompt_or_plan_hash_mismatch"
|
|
581
|
+
manifest = json.loads((run_dir / "ingestion-manifest.json").read_bytes())
|
|
582
|
+
assert manifest["status"] == "stopped"
|
|
583
|
+
assert (run_dir / runner.STOP_INTENT_REF).is_file()
|
|
584
|
+
|
|
585
|
+
|
|
586
|
+
def test_valid_ingestion_preserves_external_bytes_and_never_claims_generation(tmp_path):
|
|
587
|
+
run_dir, plan_sha, plan = _materialized(tmp_path)
|
|
588
|
+
result = _ingest_one(tmp_path, run_dir, plan_sha, plan, plan["cells"][0])
|
|
589
|
+
assert result["ingested"] == 1
|
|
590
|
+
raw = (tmp_path / "external-transcript.json").read_bytes()
|
|
591
|
+
assert (run_dir / "transcripts/cell-001.json").read_bytes() == raw
|
|
592
|
+
receipt = json.loads((run_dir / "receipts/cell-001.json").read_bytes())
|
|
593
|
+
assert receipt["generated_subject_output"] is False
|
|
594
|
+
assert receipt["generated_human_evidence"] is False
|
|
595
|
+
auth = json.loads((run_dir / "authorization/record.json").read_bytes())
|
|
596
|
+
assert auth["proof_boundary"]["operator_identity_verified_by_runner"] is False
|
|
597
|
+
assert auth["proof_boundary"]["structural_and_byte_binding_only"] is True
|
|
598
|
+
armed = run_dir / runner._journal_ref("armed", "cell-001")
|
|
599
|
+
claimed = run_dir / runner._journal_ref("claimed", "cell-001")
|
|
600
|
+
completed = run_dir / runner._journal_ref("completed", "cell-001")
|
|
601
|
+
assert not claimed.exists()
|
|
602
|
+
assert completed.is_file()
|
|
603
|
+
assert (armed.stat().st_dev, armed.stat().st_ino) == (
|
|
604
|
+
completed.stat().st_dev,
|
|
605
|
+
completed.stat().st_ino,
|
|
606
|
+
)
|
|
607
|
+
|
|
608
|
+
|
|
609
|
+
def test_complete_schema_invalid_subject_response_is_retained_not_rewritten(tmp_path):
|
|
610
|
+
run_dir, plan_sha, plan = _materialized(tmp_path)
|
|
611
|
+
result = _ingest_one(
|
|
612
|
+
tmp_path,
|
|
613
|
+
run_dir,
|
|
614
|
+
plan_sha,
|
|
615
|
+
plan,
|
|
616
|
+
plan["cells"][0],
|
|
617
|
+
response_text="AUTOMATED NON-JSON SUBJECT FIXTURE",
|
|
618
|
+
)
|
|
619
|
+
assert result["ingested"] == 1
|
|
620
|
+
transcript = json.loads((run_dir / "transcripts/cell-001.json").read_bytes())
|
|
621
|
+
assert transcript["response"]["parse_diagnostics"]["schema_valid"] is False
|
|
622
|
+
assert transcript["response"]["raw_response_utf8"] == "AUTOMATED NON-JSON SUBJECT FIXTURE"
|
|
623
|
+
|
|
624
|
+
|
|
625
|
+
@pytest.mark.parametrize(
|
|
626
|
+
"response_text",
|
|
627
|
+
(
|
|
628
|
+
" ",
|
|
629
|
+
"\u200b\u2060",
|
|
630
|
+
"\u0301\u0338",
|
|
631
|
+
),
|
|
632
|
+
)
|
|
633
|
+
def test_nonsemantic_subject_output_stops_durably_at_ingest(tmp_path, response_text):
|
|
634
|
+
run_dir, plan_sha, plan = _materialized(tmp_path)
|
|
635
|
+
transcript = _transcript(
|
|
636
|
+
plan,
|
|
637
|
+
plan["cells"][0],
|
|
638
|
+
response_text=response_text,
|
|
639
|
+
)
|
|
640
|
+
source = tmp_path / "nonsemantic-subject-output.json"
|
|
641
|
+
source.write_bytes(runner._json_bytes(transcript))
|
|
642
|
+
args = _command_args(
|
|
643
|
+
run_dir,
|
|
644
|
+
plan_sha,
|
|
645
|
+
transcript=source,
|
|
646
|
+
authorization_record=_authorization_file(tmp_path, plan),
|
|
647
|
+
)
|
|
648
|
+
with pytest.raises(runner.StopViolation) as caught:
|
|
649
|
+
runner.ingest(args)
|
|
650
|
+
assert caught.value.code == "transcript_contract_failure"
|
|
651
|
+
manifest = json.loads((run_dir / "ingestion-manifest.json").read_bytes())
|
|
652
|
+
assert manifest["status"] == "stopped"
|
|
653
|
+
assert manifest["stop_receipt"]["retry_forbidden"] is True
|
|
654
|
+
assert (run_dir / runner.STOP_INTENT_REF).is_file()
|
|
655
|
+
with pytest.raises(runner.EnvelopeError, match="forbids retry"):
|
|
656
|
+
runner.ingest(args)
|
|
657
|
+
|
|
658
|
+
|
|
659
|
+
def test_lone_surrogate_subject_output_stops_before_utf8_encoding(tmp_path):
|
|
660
|
+
_, plan_sha, plan = _initialize(tmp_path)
|
|
661
|
+
cell = plan["cells"][0]
|
|
662
|
+
transcript = _transcript(plan, cell)
|
|
663
|
+
transcript["response"]["raw_response_utf8"] = "\ud800"
|
|
664
|
+
with pytest.raises(runner.StopViolation) as caught:
|
|
665
|
+
runner._validate_transcript(transcript, cell, plan, plan_sha)
|
|
666
|
+
assert caught.value.code == "transcript_contract_failure"
|
|
667
|
+
|
|
668
|
+
|
|
669
|
+
def test_first_partial_stops_preserves_raw_and_forbids_retry(tmp_path):
|
|
670
|
+
run_dir, plan_sha, plan = _materialized(tmp_path)
|
|
671
|
+
raw = runner._json_bytes(_transcript(plan, plan["cells"][0], partial=True))
|
|
672
|
+
source = tmp_path / "partial-transcript.json"
|
|
673
|
+
source.write_bytes(raw)
|
|
674
|
+
args = _command_args(
|
|
675
|
+
run_dir,
|
|
676
|
+
plan_sha,
|
|
677
|
+
transcript=source,
|
|
678
|
+
authorization_record=_authorization_file(tmp_path, plan),
|
|
679
|
+
)
|
|
680
|
+
with pytest.raises(runner.StopViolation) as caught:
|
|
681
|
+
runner.ingest(args)
|
|
682
|
+
assert caught.value.code == "blocked_or_partial_call"
|
|
683
|
+
manifest = json.loads((run_dir / "ingestion-manifest.json").read_bytes())
|
|
684
|
+
assert manifest["status"] == "stopped"
|
|
685
|
+
assert manifest["stop_receipt"]["retry_forbidden"] is True
|
|
686
|
+
assert manifest["stop_receipt"]["stop_intent_committed_before_state_replacement"] is True
|
|
687
|
+
assert (run_dir / runner.STOP_INTENT_REF).is_file()
|
|
688
|
+
assert (run_dir / manifest["stop_receipt"]["raw_ref"]).read_bytes() == raw
|
|
689
|
+
with pytest.raises(runner.EnvelopeError, match="forbids retry"):
|
|
690
|
+
runner.ingest(args)
|
|
691
|
+
|
|
692
|
+
|
|
693
|
+
@pytest.mark.parametrize("acquisition_failure", ("missing", "symlink", "oversize"))
|
|
694
|
+
def test_transcript_acquisition_failure_claims_once_and_stops_before_retry(
|
|
695
|
+
tmp_path, acquisition_failure
|
|
696
|
+
):
|
|
697
|
+
run_dir, plan_sha, plan = _materialized(tmp_path)
|
|
698
|
+
source = tmp_path / "submitted-transcript.json"
|
|
699
|
+
if acquisition_failure == "symlink":
|
|
700
|
+
target = tmp_path / "symlink-target.json"
|
|
701
|
+
target.write_bytes(
|
|
702
|
+
runner._json_bytes(_transcript(plan, plan["cells"][0]))
|
|
703
|
+
)
|
|
704
|
+
source.symlink_to(target)
|
|
705
|
+
elif acquisition_failure == "oversize":
|
|
706
|
+
source.write_bytes(b"x" * (runner.MAX_TRANSCRIPT_BYTES + 1))
|
|
707
|
+
args = _command_args(
|
|
708
|
+
run_dir,
|
|
709
|
+
plan_sha,
|
|
710
|
+
transcript=source,
|
|
711
|
+
authorization_record=_authorization_file(tmp_path, plan),
|
|
712
|
+
)
|
|
713
|
+
with pytest.raises(runner.StopViolation) as caught:
|
|
714
|
+
runner.ingest(args)
|
|
715
|
+
assert caught.value.code == "transcript_contract_failure"
|
|
716
|
+
manifest = json.loads((run_dir / "ingestion-manifest.json").read_bytes())
|
|
717
|
+
assert manifest["status"] == "stopped"
|
|
718
|
+
assert (run_dir / manifest["stop_receipt"]["raw_ref"]).read_bytes() == b""
|
|
719
|
+
armed = run_dir / runner._journal_ref("armed", "cell-001")
|
|
720
|
+
claimed = run_dir / runner._journal_ref("claimed", "cell-001")
|
|
721
|
+
assert (armed.stat().st_dev, armed.stat().st_ino) == (
|
|
722
|
+
claimed.stat().st_dev,
|
|
723
|
+
claimed.stat().st_ino,
|
|
724
|
+
)
|
|
725
|
+
source.unlink(missing_ok=True)
|
|
726
|
+
source.write_bytes(runner._json_bytes(_transcript(plan, plan["cells"][0])))
|
|
727
|
+
with pytest.raises(runner.EnvelopeError, match="stopped|forbids retry"):
|
|
728
|
+
runner.ingest(args)
|
|
729
|
+
|
|
730
|
+
|
|
731
|
+
def test_primary_stop_intent_failure_leaves_prearmed_terminal_fallback(
|
|
732
|
+
tmp_path, monkeypatch
|
|
733
|
+
):
|
|
734
|
+
run_dir, plan_sha, plan = _materialized(tmp_path)
|
|
735
|
+
source = tmp_path / "partial.json"
|
|
736
|
+
source.write_bytes(
|
|
737
|
+
runner._json_bytes(_transcript(plan, plan["cells"][0], partial=True))
|
|
738
|
+
)
|
|
739
|
+
args = _command_args(
|
|
740
|
+
run_dir,
|
|
741
|
+
plan_sha,
|
|
742
|
+
transcript=source,
|
|
743
|
+
authorization_record=_authorization_file(tmp_path, plan),
|
|
744
|
+
)
|
|
745
|
+
original = runner._ensure_exact_new
|
|
746
|
+
|
|
747
|
+
def fail_primary_marker(path, raw, **kwargs):
|
|
748
|
+
if path.name == runner.STOP_INTENT_REF:
|
|
749
|
+
raise runner.EnvelopeError("AUTOMATED PRIMARY STOP INTENT FAILURE")
|
|
750
|
+
return original(path, raw, **kwargs)
|
|
751
|
+
|
|
752
|
+
monkeypatch.setattr(runner, "_ensure_exact_new", fail_primary_marker)
|
|
753
|
+
with pytest.raises(runner.EnvelopeError, match="do not retry|retry is forbidden"):
|
|
754
|
+
runner.ingest(args)
|
|
755
|
+
assert not (run_dir / runner.STOP_INTENT_REF).exists()
|
|
756
|
+
claimed = run_dir / runner._journal_ref("claimed", "cell-001")
|
|
757
|
+
assert claimed.is_file()
|
|
758
|
+
assert list((run_dir / "blocked").glob("cell-001.transcript.*.raw"))
|
|
759
|
+
monkeypatch.setattr(runner, "_ensure_exact_new", original)
|
|
760
|
+
source.write_bytes(runner._json_bytes(_transcript(plan, plan["cells"][0])))
|
|
761
|
+
with pytest.raises(runner.EnvelopeError, match="quarantined|retry is forbidden"):
|
|
762
|
+
runner.ingest(args)
|
|
763
|
+
|
|
764
|
+
|
|
765
|
+
def test_stopped_tree_snapshot_binds_unregistered_empty_directory(tmp_path):
|
|
766
|
+
run_dir, plan_sha, plan = _materialized(tmp_path)
|
|
767
|
+
(run_dir / "unregistered-empty-directory").mkdir()
|
|
768
|
+
source = tmp_path / "submitted.json"
|
|
769
|
+
source.write_bytes(runner._json_bytes(_transcript(plan, plan["cells"][0])))
|
|
770
|
+
with pytest.raises(runner.StopViolation):
|
|
771
|
+
runner.ingest(
|
|
772
|
+
_command_args(
|
|
773
|
+
run_dir,
|
|
774
|
+
plan_sha,
|
|
775
|
+
transcript=source,
|
|
776
|
+
authorization_record=_authorization_file(tmp_path, plan),
|
|
777
|
+
)
|
|
778
|
+
)
|
|
779
|
+
manifest = json.loads((run_dir / "ingestion-manifest.json").read_bytes())
|
|
780
|
+
snapshot = manifest["stop_receipt"]["preserved_unregistered_tree"]
|
|
781
|
+
assert snapshot["file_count"] == 0
|
|
782
|
+
assert snapshot["directory_count"] == 1
|
|
783
|
+
assert runner.validate_run(_command_args(run_dir, plan_sha))["status"] == "stopped"
|
|
784
|
+
(run_dir / "unregistered-empty-directory/late-file.txt").write_text(
|
|
785
|
+
"TAMPERED\n", encoding="utf-8"
|
|
786
|
+
)
|
|
787
|
+
with pytest.raises(runner.EnvelopeError, match="tree drifted"):
|
|
788
|
+
runner.validate_run(_command_args(run_dir, plan_sha))
|
|
789
|
+
|
|
790
|
+
|
|
791
|
+
def test_stop_intent_is_committed_before_stopped_manifest_replacement(tmp_path, monkeypatch):
|
|
792
|
+
run_dir, plan_sha, plan = _materialized(tmp_path)
|
|
793
|
+
source = tmp_path / "partial.json"
|
|
794
|
+
source.write_bytes(
|
|
795
|
+
runner._json_bytes(_transcript(plan, plan["cells"][0], partial=True))
|
|
796
|
+
)
|
|
797
|
+
original = runner._replace_json
|
|
798
|
+
observed: list[str] = []
|
|
799
|
+
|
|
800
|
+
def inspect_stop_replace(path, value, **kwargs):
|
|
801
|
+
if value.get("status") == "stopped":
|
|
802
|
+
raw_ref = value["stop_receipt"]["raw_ref"]
|
|
803
|
+
assert (run_dir / runner.STOP_INTENT_REF).is_file()
|
|
804
|
+
observed.append(raw_ref)
|
|
805
|
+
return original(path, value, **kwargs)
|
|
806
|
+
|
|
807
|
+
monkeypatch.setattr(runner, "_replace_json", inspect_stop_replace)
|
|
808
|
+
with pytest.raises(runner.StopViolation):
|
|
809
|
+
runner.ingest(
|
|
810
|
+
_command_args(
|
|
811
|
+
run_dir,
|
|
812
|
+
plan_sha,
|
|
813
|
+
transcript=source,
|
|
814
|
+
authorization_record=_authorization_file(tmp_path, plan),
|
|
815
|
+
)
|
|
816
|
+
)
|
|
817
|
+
assert len(observed) == 1
|
|
818
|
+
assert (run_dir / observed[0]).read_bytes() == source.read_bytes()
|
|
819
|
+
|
|
820
|
+
|
|
821
|
+
@pytest.mark.parametrize(
|
|
822
|
+
("mutation", "reason"),
|
|
823
|
+
(
|
|
824
|
+
("prompt", "prompt_or_plan_hash_mismatch"),
|
|
825
|
+
("execution", "provider_auth_model_drift"),
|
|
826
|
+
("tools", "enabled_tool_or_web"),
|
|
827
|
+
("tool_event", "unplanned_tool_action"),
|
|
828
|
+
("network_event", "unplanned_network_action"),
|
|
829
|
+
("event_hash", "transcript_contract_failure"),
|
|
830
|
+
("diagnostics", "transcript_contract_failure"),
|
|
831
|
+
("write_failure", "evidence_write_failure"),
|
|
832
|
+
),
|
|
833
|
+
)
|
|
834
|
+
def test_transcript_drift_and_forbidden_events_stop_fail_closed(tmp_path, mutation, reason):
|
|
835
|
+
_, plan_sha, plan = _initialize(tmp_path)
|
|
836
|
+
cell = plan["cells"][0]
|
|
837
|
+
transcript = _transcript(plan, cell)
|
|
838
|
+
if mutation == "prompt":
|
|
839
|
+
transcript["bindings"]["prompt_sha256"] = "f" * 64
|
|
840
|
+
elif mutation == "execution":
|
|
841
|
+
transcript["observed_execution"]["subject_model"] = "drifted-model"
|
|
842
|
+
elif mutation == "tools":
|
|
843
|
+
transcript["observed_execution"]["tools"] = ["shell"]
|
|
844
|
+
elif mutation in {"tool_event", "network_event"}:
|
|
845
|
+
kind = "tool_action" if mutation == "tool_event" else "network_action"
|
|
846
|
+
transcript["events"] = [
|
|
847
|
+
transcript["events"][0],
|
|
848
|
+
transcript["events"][1],
|
|
849
|
+
_event(3, kind, b"AUTOMATED FORBIDDEN EVENT", cell),
|
|
850
|
+
_event(4, "call_completed", b"AUTOMATED CONTRACT EVENT: call ended", cell),
|
|
851
|
+
]
|
|
852
|
+
elif mutation == "event_hash":
|
|
853
|
+
transcript["events"][0]["raw_event_sha256"] = "f" * 64
|
|
854
|
+
elif mutation == "diagnostics":
|
|
855
|
+
transcript["response"]["parse_diagnostics"]["schema_valid"] = False
|
|
856
|
+
transcript["response"]["parse_diagnostics"]["schema_errors"] = ["fake"]
|
|
857
|
+
else:
|
|
858
|
+
transcript["observations"]["evidence_write_failure"] = True
|
|
859
|
+
with pytest.raises(runner.StopViolation) as caught:
|
|
860
|
+
runner._validate_transcript(transcript, cell, plan, plan_sha)
|
|
861
|
+
assert caught.value.code == reason
|
|
862
|
+
|
|
863
|
+
|
|
864
|
+
def test_out_of_order_ingestion_stops_on_first_record(tmp_path):
|
|
865
|
+
run_dir, plan_sha, plan = _materialized(tmp_path)
|
|
866
|
+
raw = runner._json_bytes(_transcript(plan, plan["cells"][1]))
|
|
867
|
+
source = tmp_path / "out-of-order.json"
|
|
868
|
+
source.write_bytes(raw)
|
|
869
|
+
with pytest.raises(runner.StopViolation) as caught:
|
|
870
|
+
runner.ingest(
|
|
871
|
+
_command_args(
|
|
872
|
+
run_dir,
|
|
873
|
+
plan_sha,
|
|
874
|
+
transcript=source,
|
|
875
|
+
authorization_record=_authorization_file(tmp_path, plan),
|
|
876
|
+
)
|
|
877
|
+
)
|
|
878
|
+
assert caught.value.code == "out_of_order_ingestion"
|
|
879
|
+
manifest = json.loads((run_dir / "ingestion-manifest.json").read_bytes())
|
|
880
|
+
assert manifest["cells"][0]["status"] == "blocked"
|
|
881
|
+
assert manifest["cells"][1]["status"] == "pending"
|
|
882
|
+
|
|
883
|
+
|
|
884
|
+
@pytest.mark.parametrize("mutation", ("blank", "wrong_plan", "predates"))
|
|
885
|
+
def test_invalid_authorization_stops_and_preserves_raw(tmp_path, mutation):
|
|
886
|
+
run_dir, plan_sha, plan = _materialized(tmp_path)
|
|
887
|
+
authorization_path = tmp_path / "authorization.json"
|
|
888
|
+
authorization = _authorization(plan)
|
|
889
|
+
if mutation == "blank":
|
|
890
|
+
authorization_raw = b"{}\n"
|
|
891
|
+
else:
|
|
892
|
+
if mutation == "wrong_plan":
|
|
893
|
+
authorization["run_plan_sha256"] = "f" * 64
|
|
894
|
+
else:
|
|
895
|
+
authorization["decision"]["decided_at"] = "2026-08-13T00:00:04Z"
|
|
896
|
+
authorization_raw = runner._json_bytes(authorization)
|
|
897
|
+
authorization_path.write_bytes(authorization_raw)
|
|
898
|
+
transcript = _transcript(plan, plan["cells"][0])
|
|
899
|
+
transcript["source"]["authorization_record_sha256"] = hashlib.sha256(authorization_raw).hexdigest()
|
|
900
|
+
source = tmp_path / "transcript.json"
|
|
901
|
+
raw = runner._json_bytes(transcript)
|
|
902
|
+
source.write_bytes(raw)
|
|
903
|
+
with pytest.raises(runner.StopViolation) as caught:
|
|
904
|
+
runner.ingest(
|
|
905
|
+
_command_args(
|
|
906
|
+
run_dir,
|
|
907
|
+
plan_sha,
|
|
908
|
+
transcript=source,
|
|
909
|
+
authorization_record=authorization_path,
|
|
910
|
+
)
|
|
911
|
+
)
|
|
912
|
+
assert caught.value.code == "authorization_record_missing_or_mismatch"
|
|
913
|
+
manifest = json.loads((run_dir / "ingestion-manifest.json").read_bytes())
|
|
914
|
+
assert (run_dir / manifest["stop_receipt"]["raw_ref"]).read_bytes() == raw
|
|
915
|
+
|
|
916
|
+
|
|
917
|
+
def test_bounded_raw_event_bytes_and_hashes_are_enforced(tmp_path):
|
|
918
|
+
_, plan_sha, plan = _initialize(tmp_path)
|
|
919
|
+
cell = plan["cells"][0]
|
|
920
|
+
transcript = _transcript(plan, cell)
|
|
921
|
+
transcript["events"][0]["raw_event_base64"] = base64.b64encode(
|
|
922
|
+
b"x" * (runner.MAX_EVENT_BYTES + 1)
|
|
923
|
+
).decode("ascii")
|
|
924
|
+
transcript["events"][0]["raw_event_bytes"] = runner.MAX_EVENT_BYTES + 1
|
|
925
|
+
transcript["events"][0]["raw_event_sha256"] = hashlib.sha256(
|
|
926
|
+
b"x" * (runner.MAX_EVENT_BYTES + 1)
|
|
927
|
+
).hexdigest()
|
|
928
|
+
with pytest.raises(runner.StopViolation) as caught:
|
|
929
|
+
runner._validate_transcript(transcript, cell, plan, plan_sha)
|
|
930
|
+
assert caught.value.code == "transcript_contract_failure"
|
|
931
|
+
|
|
932
|
+
|
|
933
|
+
def test_outer_event_classification_cannot_disagree_with_closed_raw_normalizer(tmp_path):
|
|
934
|
+
_, plan_sha, plan = _initialize(tmp_path)
|
|
935
|
+
cell = plan["cells"][0]
|
|
936
|
+
transcript = _transcript(plan, cell)
|
|
937
|
+
transcript["events"][0]["event_kind"] = "runtime_event"
|
|
938
|
+
with pytest.raises(runner.StopViolation) as caught:
|
|
939
|
+
runner._validate_transcript(transcript, cell, plan, plan_sha)
|
|
940
|
+
assert caught.value.code == "transcript_contract_failure"
|
|
941
|
+
|
|
942
|
+
|
|
943
|
+
def test_raw_native_tool_type_cannot_be_hidden_by_outer_runtime_kind(tmp_path):
|
|
944
|
+
_, plan_sha, plan = _initialize(tmp_path)
|
|
945
|
+
cell = plan["cells"][0]
|
|
946
|
+
transcript = _transcript(plan, cell)
|
|
947
|
+
_mutate_raw_event(
|
|
948
|
+
transcript, 0, native_event_type="action.tool"
|
|
949
|
+
)
|
|
950
|
+
transcript["events"][0]["event_kind"] = "runtime_event"
|
|
951
|
+
with pytest.raises(runner.StopViolation) as caught:
|
|
952
|
+
runner._validate_transcript(transcript, cell, plan, plan_sha)
|
|
953
|
+
assert caught.value.code == "transcript_contract_failure"
|
|
954
|
+
|
|
955
|
+
|
|
956
|
+
@pytest.mark.parametrize(
|
|
957
|
+
("field", "value"),
|
|
958
|
+
(
|
|
959
|
+
("external_session_id", "automated-fresh-session-cell-999"),
|
|
960
|
+
("cell_id", "cell-999"),
|
|
961
|
+
("sequence_index", 2),
|
|
962
|
+
("event_index", 99),
|
|
963
|
+
("event_id", "automated-fresh-session-cell-001:event-9999"),
|
|
964
|
+
),
|
|
965
|
+
)
|
|
966
|
+
def test_raw_events_are_closed_bound_to_one_session_cell_and_event_identity(
|
|
967
|
+
tmp_path, field, value
|
|
968
|
+
):
|
|
969
|
+
_, plan_sha, plan = _initialize(tmp_path)
|
|
970
|
+
cell = plan["cells"][0]
|
|
971
|
+
transcript = _transcript(plan, cell)
|
|
972
|
+
_mutate_raw_event(transcript, 1, **{field: value})
|
|
973
|
+
with pytest.raises(runner.StopViolation) as caught:
|
|
974
|
+
runner._validate_transcript(transcript, cell, plan, plan_sha)
|
|
975
|
+
assert caught.value.code == "transcript_contract_failure"
|
|
976
|
+
|
|
977
|
+
|
|
978
|
+
def test_observed_token_usage_and_conservative_output_bytes_are_enforced(tmp_path):
|
|
979
|
+
_, plan_sha, plan = _initialize(tmp_path)
|
|
980
|
+
cell = plan["cells"][0]
|
|
981
|
+
transcript = _transcript(plan, cell)
|
|
982
|
+
transcript["observed_usage"]["output_tokens"] = (
|
|
983
|
+
plan["execution"]["output_token_cap"] + 1
|
|
984
|
+
)
|
|
985
|
+
with pytest.raises(runner.StopViolation) as caught:
|
|
986
|
+
runner._validate_transcript(transcript, cell, plan, plan_sha)
|
|
987
|
+
assert caught.value.code == "provider_auth_model_drift"
|
|
988
|
+
|
|
989
|
+
|
|
990
|
+
def test_event_lifecycle_requires_one_unique_start_and_completion(tmp_path):
|
|
991
|
+
_, plan_sha, plan = _initialize(tmp_path)
|
|
992
|
+
cell = plan["cells"][0]
|
|
993
|
+
transcript = _transcript(plan, cell)
|
|
994
|
+
transcript["events"] = [
|
|
995
|
+
transcript["events"][0],
|
|
996
|
+
_event(2, "call_started", b"AUTOMATED DUPLICATE START", cell),
|
|
997
|
+
_event(3, "subject_output", transcript["response"]["raw_response_utf8"].encode(), cell),
|
|
998
|
+
_event(4, "call_completed", b"AUTOMATED CONTRACT EVENT: call ended", cell),
|
|
999
|
+
]
|
|
1000
|
+
with pytest.raises(runner.StopViolation) as caught:
|
|
1001
|
+
runner._validate_transcript(transcript, cell, plan, plan_sha)
|
|
1002
|
+
assert caught.value.code == "transcript_contract_failure"
|
|
1003
|
+
|
|
1004
|
+
|
|
1005
|
+
def test_malformed_embedded_session_receipt_stops_without_uncaught_type_error(tmp_path):
|
|
1006
|
+
run_dir, plan_sha, plan = _materialized(tmp_path)
|
|
1007
|
+
transcript = _transcript(plan, plan["cells"][0])
|
|
1008
|
+
_replace_external_session_receipt(transcript, started_at=123)
|
|
1009
|
+
source = tmp_path / "malformed-session-receipt.json"
|
|
1010
|
+
raw = runner._json_bytes(transcript)
|
|
1011
|
+
source.write_bytes(raw)
|
|
1012
|
+
with pytest.raises(runner.StopViolation) as caught:
|
|
1013
|
+
runner.ingest(
|
|
1014
|
+
_command_args(
|
|
1015
|
+
run_dir,
|
|
1016
|
+
plan_sha,
|
|
1017
|
+
transcript=source,
|
|
1018
|
+
authorization_record=_authorization_file(tmp_path, plan),
|
|
1019
|
+
)
|
|
1020
|
+
)
|
|
1021
|
+
assert caught.value.code == "transcript_contract_failure"
|
|
1022
|
+
manifest = json.loads((run_dir / "ingestion-manifest.json").read_bytes())
|
|
1023
|
+
assert manifest["status"] == "stopped"
|
|
1024
|
+
assert (run_dir / manifest["stop_receipt"]["raw_ref"]).read_bytes() == raw
|
|
1025
|
+
|
|
1026
|
+
|
|
1027
|
+
def test_runner_decoder_identity_and_closed_event_contract_are_pinned(tmp_path):
|
|
1028
|
+
_, plan_sha, plan = _initialize(tmp_path)
|
|
1029
|
+
cell = plan["cells"][0]
|
|
1030
|
+
transcript = _transcript(plan, cell)
|
|
1031
|
+
normalizer = transcript["source"]["event_normalizer"]
|
|
1032
|
+
assert normalizer["contract"] == "runner-decoded-canonical-event/2.0"
|
|
1033
|
+
assert normalizer["external_provenance_only"] is False
|
|
1034
|
+
assert normalizer["runner_authenticates_normalizer_identity"] is True
|
|
1035
|
+
runner._validate_transcript(transcript, cell, plan, plan_sha)
|
|
1036
|
+
|
|
1037
|
+
|
|
1038
|
+
def test_prebuilt_content_addressed_blocked_path_cannot_keep_run_retryable(tmp_path):
|
|
1039
|
+
run_dir, plan_sha, plan = _materialized(tmp_path)
|
|
1040
|
+
raw = runner._json_bytes(_transcript(plan, plan["cells"][0], partial=True))
|
|
1041
|
+
raw_sha = hashlib.sha256(raw).hexdigest()
|
|
1042
|
+
blocked = run_dir / f"blocked/cell-001.transcript.{raw_sha}.raw"
|
|
1043
|
+
blocked.parent.mkdir(exist_ok=True)
|
|
1044
|
+
blocked.write_bytes(raw)
|
|
1045
|
+
source = tmp_path / "prebuilt-blocked.json"
|
|
1046
|
+
source.write_bytes(raw)
|
|
1047
|
+
args = _command_args(
|
|
1048
|
+
run_dir,
|
|
1049
|
+
plan_sha,
|
|
1050
|
+
transcript=source,
|
|
1051
|
+
authorization_record=_authorization_file(tmp_path, plan),
|
|
1052
|
+
)
|
|
1053
|
+
with pytest.raises(runner.StopViolation):
|
|
1054
|
+
runner.ingest(args)
|
|
1055
|
+
manifest = json.loads((run_dir / "ingestion-manifest.json").read_bytes())
|
|
1056
|
+
assert manifest["status"] == "stopped"
|
|
1057
|
+
assert manifest["stop_receipt"]["retry_forbidden"] is True
|
|
1058
|
+
assert (run_dir / manifest["stop_receipt"]["raw_ref"]).read_bytes() == raw
|
|
1059
|
+
with pytest.raises(runner.EnvelopeError, match="forbids retry"):
|
|
1060
|
+
runner.ingest(args)
|
|
1061
|
+
|
|
1062
|
+
|
|
1063
|
+
def test_stop_manifest_write_failure_creates_replayable_write_once_stop_intent(
|
|
1064
|
+
tmp_path, monkeypatch
|
|
1065
|
+
):
|
|
1066
|
+
run_dir, plan_sha, plan = _materialized(tmp_path)
|
|
1067
|
+
source = tmp_path / "partial.json"
|
|
1068
|
+
source.write_bytes(
|
|
1069
|
+
runner._json_bytes(_transcript(plan, plan["cells"][0], partial=True))
|
|
1070
|
+
)
|
|
1071
|
+
args = _command_args(
|
|
1072
|
+
run_dir,
|
|
1073
|
+
plan_sha,
|
|
1074
|
+
transcript=source,
|
|
1075
|
+
authorization_record=_authorization_file(tmp_path, plan),
|
|
1076
|
+
)
|
|
1077
|
+
|
|
1078
|
+
original = runner._replace_json
|
|
1079
|
+
|
|
1080
|
+
def fail_manifest_replace(path, value, *, root):
|
|
1081
|
+
raise runner.EnvelopeError("AUTOMATED STOP MANIFEST WRITE FAILURE")
|
|
1082
|
+
|
|
1083
|
+
monkeypatch.setattr(runner, "_replace_json", fail_manifest_replace)
|
|
1084
|
+
with pytest.raises(runner.EnvelopeError, match="do not retry"):
|
|
1085
|
+
runner.ingest(args)
|
|
1086
|
+
marker = json.loads((run_dir / runner.STOP_INTENT_REF).read_bytes())
|
|
1087
|
+
assert marker["retry_forbidden"] is True
|
|
1088
|
+
assert (run_dir / marker["raw_ref"]).read_bytes() == source.read_bytes()
|
|
1089
|
+
monkeypatch.setattr(runner, "_replace_json", original)
|
|
1090
|
+
original_read_file = runner._read_file
|
|
1091
|
+
transcript_reads = 0
|
|
1092
|
+
|
|
1093
|
+
def track_recovery_reads(path, *args, **kwargs):
|
|
1094
|
+
nonlocal transcript_reads
|
|
1095
|
+
if path == source:
|
|
1096
|
+
transcript_reads += 1
|
|
1097
|
+
return original_read_file(path, *args, **kwargs)
|
|
1098
|
+
|
|
1099
|
+
monkeypatch.setattr(runner, "_read_file", track_recovery_reads)
|
|
1100
|
+
with pytest.raises(runner.EnvelopeError, match="run is stopped"):
|
|
1101
|
+
runner.ingest(args)
|
|
1102
|
+
assert transcript_reads == 0
|
|
1103
|
+
manifest = json.loads((run_dir / "ingestion-manifest.json").read_bytes())
|
|
1104
|
+
assert manifest["status"] == "stopped"
|
|
1105
|
+
|
|
1106
|
+
|
|
1107
|
+
def test_post_replace_fsync_failure_leaves_claimed_manifest_unretryable(
|
|
1108
|
+
tmp_path, monkeypatch
|
|
1109
|
+
):
|
|
1110
|
+
run_dir, plan_sha, plan = _materialized(tmp_path)
|
|
1111
|
+
source = tmp_path / "post-replace-transcript.json"
|
|
1112
|
+
source.write_bytes(runner._json_bytes(_transcript(plan, plan["cells"][0])))
|
|
1113
|
+
args = _command_args(
|
|
1114
|
+
run_dir,
|
|
1115
|
+
plan_sha,
|
|
1116
|
+
transcript=source,
|
|
1117
|
+
authorization_record=_authorization_file(tmp_path, plan),
|
|
1118
|
+
)
|
|
1119
|
+
original_fsync_directory = runner._fsync_directory
|
|
1120
|
+
injected = False
|
|
1121
|
+
|
|
1122
|
+
def fail_after_manifest_publication(path):
|
|
1123
|
+
nonlocal injected
|
|
1124
|
+
manifest_path = run_dir / "ingestion-manifest.json"
|
|
1125
|
+
if not injected and manifest_path.is_file():
|
|
1126
|
+
current = json.loads(manifest_path.read_bytes())
|
|
1127
|
+
if current["status"] == "ingesting" and current["next_sequence_index"] == 2:
|
|
1128
|
+
injected = True
|
|
1129
|
+
raise OSError("AUTOMATED POST-REPLACE DIRECTORY FSYNC FAILURE")
|
|
1130
|
+
return original_fsync_directory(path)
|
|
1131
|
+
|
|
1132
|
+
monkeypatch.setattr(runner, "_fsync_directory", fail_after_manifest_publication)
|
|
1133
|
+
with pytest.raises(runner.EnvelopeError, match="published without a completed"):
|
|
1134
|
+
runner.ingest(args)
|
|
1135
|
+
assert injected is True
|
|
1136
|
+
monkeypatch.setattr(runner, "_fsync_directory", original_fsync_directory)
|
|
1137
|
+
|
|
1138
|
+
manifest = json.loads((run_dir / "ingestion-manifest.json").read_bytes())
|
|
1139
|
+
assert manifest["status"] == "ingesting"
|
|
1140
|
+
assert manifest["next_sequence_index"] == 2
|
|
1141
|
+
assert manifest["cells"][0]["status"] == "ingested"
|
|
1142
|
+
assert (run_dir / runner._journal_ref("claimed", "cell-001")).is_file()
|
|
1143
|
+
assert not (run_dir / runner._journal_ref("completed", "cell-001")).exists()
|
|
1144
|
+
assert not (run_dir / runner.STOP_INTENT_REF).exists()
|
|
1145
|
+
with pytest.raises(runner.EnvelopeError, match="lifecycle is ambiguous"):
|
|
1146
|
+
runner.validate_run(_command_args(run_dir, plan_sha))
|
|
1147
|
+
|
|
1148
|
+
next_source = tmp_path / "must-not-read-cell-002.json"
|
|
1149
|
+
next_source.write_bytes(
|
|
1150
|
+
runner._json_bytes(_transcript(plan, plan["cells"][1]))
|
|
1151
|
+
)
|
|
1152
|
+
original_read = runner._read_file
|
|
1153
|
+
next_transcript_reads = 0
|
|
1154
|
+
|
|
1155
|
+
def observe_next_read(path, **kwargs):
|
|
1156
|
+
nonlocal next_transcript_reads
|
|
1157
|
+
if path == next_source:
|
|
1158
|
+
next_transcript_reads += 1
|
|
1159
|
+
return original_read(path, **kwargs)
|
|
1160
|
+
|
|
1161
|
+
monkeypatch.setattr(runner, "_read_file", observe_next_read)
|
|
1162
|
+
with pytest.raises(runner.EnvelopeError, match="before reading another transcript"):
|
|
1163
|
+
runner.ingest(
|
|
1164
|
+
_command_args(
|
|
1165
|
+
run_dir,
|
|
1166
|
+
plan_sha,
|
|
1167
|
+
transcript=next_source,
|
|
1168
|
+
authorization_record=_authorization_file(tmp_path, plan),
|
|
1169
|
+
)
|
|
1170
|
+
)
|
|
1171
|
+
assert next_transcript_reads == 0
|
|
1172
|
+
unchanged = json.loads((run_dir / "ingestion-manifest.json").read_bytes())
|
|
1173
|
+
assert unchanged["next_sequence_index"] == 2
|
|
1174
|
+
|
|
1175
|
+
|
|
1176
|
+
def test_completion_destination_fsync_failure_leaves_both_states_terminal(
|
|
1177
|
+
tmp_path, monkeypatch
|
|
1178
|
+
):
|
|
1179
|
+
run_dir, plan_sha, plan = _materialized(tmp_path)
|
|
1180
|
+
source = tmp_path / "completion-destination.json"
|
|
1181
|
+
source.write_bytes(runner._json_bytes(_transcript(plan, plan["cells"][0])))
|
|
1182
|
+
args = _command_args(
|
|
1183
|
+
run_dir,
|
|
1184
|
+
plan_sha,
|
|
1185
|
+
transcript=source,
|
|
1186
|
+
authorization_record=_authorization_file(tmp_path, plan),
|
|
1187
|
+
)
|
|
1188
|
+
original_fsync_directory = runner._fsync_directory
|
|
1189
|
+
completed_parent = run_dir / runner.JOURNAL_ROOT / "completed"
|
|
1190
|
+
|
|
1191
|
+
def fail_completed_directory(path):
|
|
1192
|
+
if path == completed_parent:
|
|
1193
|
+
raise OSError("AUTOMATED COMPLETED-DIRECTORY FSYNC FAILURE")
|
|
1194
|
+
return original_fsync_directory(path)
|
|
1195
|
+
|
|
1196
|
+
monkeypatch.setattr(runner, "_fsync_directory", fail_completed_directory)
|
|
1197
|
+
with pytest.raises(runner.EnvelopeError, match="completion is ambiguous"):
|
|
1198
|
+
runner.ingest(args)
|
|
1199
|
+
monkeypatch.setattr(runner, "_fsync_directory", original_fsync_directory)
|
|
1200
|
+
assert (run_dir / runner._journal_ref("claimed", "cell-001")).is_file()
|
|
1201
|
+
assert (run_dir / runner._journal_ref("completed", "cell-001")).is_file()
|
|
1202
|
+
with pytest.raises(runner.EnvelopeError, match="lifecycle is ambiguous"):
|
|
1203
|
+
runner.validate_run(_command_args(run_dir, plan_sha))
|
|
1204
|
+
|
|
1205
|
+
|
|
1206
|
+
def test_completion_recovers_after_durable_destination_and_source_fsync_error(
|
|
1207
|
+
tmp_path, monkeypatch
|
|
1208
|
+
):
|
|
1209
|
+
run_dir, plan_sha, plan = _materialized(tmp_path)
|
|
1210
|
+
source = tmp_path / "completion-source.json"
|
|
1211
|
+
source.write_bytes(runner._json_bytes(_transcript(plan, plan["cells"][0])))
|
|
1212
|
+
args = _command_args(
|
|
1213
|
+
run_dir,
|
|
1214
|
+
plan_sha,
|
|
1215
|
+
transcript=source,
|
|
1216
|
+
authorization_record=_authorization_file(tmp_path, plan),
|
|
1217
|
+
)
|
|
1218
|
+
original_fsync_directory = runner._fsync_directory
|
|
1219
|
+
completed_parent = run_dir / runner.JOURNAL_ROOT / "completed"
|
|
1220
|
+
claimed_parent = run_dir / runner.JOURNAL_ROOT / "claimed"
|
|
1221
|
+
completed_was_durable = False
|
|
1222
|
+
|
|
1223
|
+
def fail_source_directory_after_completed(path):
|
|
1224
|
+
nonlocal completed_was_durable
|
|
1225
|
+
if path == completed_parent:
|
|
1226
|
+
result = original_fsync_directory(path)
|
|
1227
|
+
completed_was_durable = True
|
|
1228
|
+
return result
|
|
1229
|
+
if completed_was_durable and path == claimed_parent:
|
|
1230
|
+
raise OSError("AUTOMATED CLAIMED-DIRECTORY FSYNC FAILURE")
|
|
1231
|
+
return original_fsync_directory(path)
|
|
1232
|
+
|
|
1233
|
+
monkeypatch.setattr(
|
|
1234
|
+
runner, "_fsync_directory", fail_source_directory_after_completed
|
|
1235
|
+
)
|
|
1236
|
+
result = runner.ingest(args)
|
|
1237
|
+
assert result["ingested"] == 1
|
|
1238
|
+
monkeypatch.setattr(runner, "_fsync_directory", original_fsync_directory)
|
|
1239
|
+
assert not (run_dir / runner._journal_ref("claimed", "cell-001")).exists()
|
|
1240
|
+
assert (run_dir / runner._journal_ref("completed", "cell-001")).is_file()
|
|
1241
|
+
assert runner.validate_run(_command_args(run_dir, plan_sha))["status"] == "ingesting"
|
|
1242
|
+
|
|
1243
|
+
|
|
1244
|
+
@pytest.mark.parametrize(
|
|
1245
|
+
"mutation",
|
|
1246
|
+
(
|
|
1247
|
+
"pending_claimed",
|
|
1248
|
+
"pending_completed",
|
|
1249
|
+
"ingested_claimed",
|
|
1250
|
+
"ingested_claimed_and_completed",
|
|
1251
|
+
"ingested_missing_completed",
|
|
1252
|
+
"ingested_completed_different_inode",
|
|
1253
|
+
"blocked_completed",
|
|
1254
|
+
),
|
|
1255
|
+
)
|
|
1256
|
+
def test_journal_lifecycle_matrix_rejects_ambiguous_states(tmp_path, mutation):
|
|
1257
|
+
run_dir, plan_sha, plan = _materialized(tmp_path)
|
|
1258
|
+
cell = plan["cells"][0]
|
|
1259
|
+
armed = run_dir / runner._journal_ref("armed", cell["cell_id"])
|
|
1260
|
+
claimed = run_dir / runner._journal_ref("claimed", cell["cell_id"])
|
|
1261
|
+
completed = run_dir / runner._journal_ref("completed", cell["cell_id"])
|
|
1262
|
+
|
|
1263
|
+
if mutation.startswith("ingested"):
|
|
1264
|
+
_ingest_one(tmp_path, run_dir, plan_sha, plan, cell)
|
|
1265
|
+
elif mutation == "blocked_completed":
|
|
1266
|
+
source = tmp_path / "blocked-matrix.json"
|
|
1267
|
+
source.write_bytes(
|
|
1268
|
+
runner._json_bytes(_transcript(plan, cell, partial=True))
|
|
1269
|
+
)
|
|
1270
|
+
with pytest.raises(runner.StopViolation):
|
|
1271
|
+
runner.ingest(
|
|
1272
|
+
_command_args(
|
|
1273
|
+
run_dir,
|
|
1274
|
+
plan_sha,
|
|
1275
|
+
transcript=source,
|
|
1276
|
+
authorization_record=_authorization_file(tmp_path, plan),
|
|
1277
|
+
)
|
|
1278
|
+
)
|
|
1279
|
+
|
|
1280
|
+
if mutation == "pending_claimed":
|
|
1281
|
+
runner._claim_journal_token(
|
|
1282
|
+
run_dir, plan_sha, cell["cell_id"], cell["sequence_index"]
|
|
1283
|
+
)
|
|
1284
|
+
elif mutation == "pending_completed":
|
|
1285
|
+
os.link(armed, completed)
|
|
1286
|
+
elif mutation == "ingested_claimed":
|
|
1287
|
+
os.rename(completed, claimed)
|
|
1288
|
+
elif mutation == "ingested_claimed_and_completed":
|
|
1289
|
+
os.link(armed, claimed)
|
|
1290
|
+
elif mutation == "ingested_missing_completed":
|
|
1291
|
+
completed.unlink()
|
|
1292
|
+
elif mutation == "ingested_completed_different_inode":
|
|
1293
|
+
raw = completed.read_bytes()
|
|
1294
|
+
completed.unlink()
|
|
1295
|
+
completed.write_bytes(raw)
|
|
1296
|
+
elif mutation == "blocked_completed":
|
|
1297
|
+
os.link(armed, completed)
|
|
1298
|
+
|
|
1299
|
+
with pytest.raises(runner.EnvelopeError, match="journal|token"):
|
|
1300
|
+
runner.validate_run(_command_args(run_dir, plan_sha))
|
|
1301
|
+
|
|
1302
|
+
|
|
1303
|
+
def test_partial_or_tampered_stop_intent_never_reopens_run(tmp_path):
|
|
1304
|
+
run_dir, plan_sha, plan = _materialized(tmp_path)
|
|
1305
|
+
source = tmp_path / "partial.json"
|
|
1306
|
+
source.write_bytes(
|
|
1307
|
+
runner._json_bytes(_transcript(plan, plan["cells"][0], partial=True))
|
|
1308
|
+
)
|
|
1309
|
+
with pytest.raises(runner.StopViolation):
|
|
1310
|
+
runner.ingest(
|
|
1311
|
+
_command_args(
|
|
1312
|
+
run_dir,
|
|
1313
|
+
plan_sha,
|
|
1314
|
+
transcript=source,
|
|
1315
|
+
authorization_record=_authorization_file(tmp_path, plan),
|
|
1316
|
+
)
|
|
1317
|
+
)
|
|
1318
|
+
marker_path = run_dir / runner.STOP_INTENT_REF
|
|
1319
|
+
marker_path.write_bytes(marker_path.read_bytes()[:80])
|
|
1320
|
+
with pytest.raises(runner.EnvelopeError):
|
|
1321
|
+
runner.validate_run(_command_args(run_dir, plan_sha))
|
|
1322
|
+
|
|
1323
|
+
|
|
1324
|
+
def test_blocked_evidence_hash_and_exact_inventory_replay(tmp_path):
|
|
1325
|
+
run_dir, plan_sha, plan = _materialized(tmp_path)
|
|
1326
|
+
raw = runner._json_bytes(_transcript(plan, plan["cells"][0], partial=True))
|
|
1327
|
+
source = tmp_path / "blocked.json"
|
|
1328
|
+
source.write_bytes(raw)
|
|
1329
|
+
with pytest.raises(runner.StopViolation):
|
|
1330
|
+
runner.ingest(
|
|
1331
|
+
_command_args(
|
|
1332
|
+
run_dir,
|
|
1333
|
+
plan_sha,
|
|
1334
|
+
transcript=source,
|
|
1335
|
+
authorization_record=_authorization_file(tmp_path, plan),
|
|
1336
|
+
)
|
|
1337
|
+
)
|
|
1338
|
+
assert runner.validate_run(_command_args(run_dir, plan_sha))["status"] == "stopped"
|
|
1339
|
+
manifest = json.loads((run_dir / "ingestion-manifest.json").read_bytes())
|
|
1340
|
+
blocked = run_dir / manifest["stop_receipt"]["raw_ref"]
|
|
1341
|
+
blocked.write_bytes(raw + b"\n")
|
|
1342
|
+
with pytest.raises(runner.EnvelopeError, match="write-once evidence collision"):
|
|
1343
|
+
runner.validate_run(_command_args(run_dir, plan_sha))
|
|
1344
|
+
|
|
1345
|
+
|
|
1346
|
+
@pytest.mark.parametrize("mutation", ("source_artifact", "receipt", "session", "time"))
|
|
1347
|
+
def test_external_sessions_are_unique_and_monotonic_across_cells(tmp_path, mutation):
|
|
1348
|
+
run_dir, plan_sha, plan = _materialized(tmp_path)
|
|
1349
|
+
_ingest_one(tmp_path, run_dir, plan_sha, plan, plan["cells"][0])
|
|
1350
|
+
transcript = _transcript(plan, plan["cells"][1])
|
|
1351
|
+
if mutation == "source_artifact":
|
|
1352
|
+
transcript["source"]["source_artifact_id"] = "automated-contract-fixture-cell-001"
|
|
1353
|
+
elif mutation == "receipt":
|
|
1354
|
+
_replace_external_session_receipt(
|
|
1355
|
+
transcript, receipt_id="automated-external-receipt-cell-001"
|
|
1356
|
+
)
|
|
1357
|
+
elif mutation == "session":
|
|
1358
|
+
_replace_external_session_receipt(
|
|
1359
|
+
transcript, external_session_id="automated-fresh-session-cell-001"
|
|
1360
|
+
)
|
|
1361
|
+
else:
|
|
1362
|
+
_replace_external_session_receipt(
|
|
1363
|
+
transcript,
|
|
1364
|
+
started_at="2026-08-13T00:00:03Z",
|
|
1365
|
+
completed_at="2026-08-13T00:00:04Z",
|
|
1366
|
+
)
|
|
1367
|
+
transcript["source"]["recorded_at"] = "2026-08-13T00:00:05Z"
|
|
1368
|
+
source = tmp_path / "second.json"
|
|
1369
|
+
source.write_bytes(runner._json_bytes(transcript))
|
|
1370
|
+
with pytest.raises(runner.StopViolation) as caught:
|
|
1371
|
+
runner.ingest(
|
|
1372
|
+
_command_args(
|
|
1373
|
+
run_dir,
|
|
1374
|
+
plan_sha,
|
|
1375
|
+
transcript=source,
|
|
1376
|
+
authorization_record=_authorization_file(tmp_path, plan),
|
|
1377
|
+
)
|
|
1378
|
+
)
|
|
1379
|
+
expected_code = (
|
|
1380
|
+
"transcript_contract_failure" if mutation == "session" else "out_of_order_ingestion"
|
|
1381
|
+
)
|
|
1382
|
+
assert caught.value.code == expected_code
|
|
1383
|
+
|
|
1384
|
+
|
|
1385
|
+
@pytest.mark.parametrize(
|
|
1386
|
+
"leak",
|
|
1387
|
+
(
|
|
1388
|
+
"cell-001",
|
|
1389
|
+
"scenario_id=ipi-web-en",
|
|
1390
|
+
"pair_id=opaque-pair",
|
|
1391
|
+
"replicate=2",
|
|
1392
|
+
"arm_id=treatment",
|
|
1393
|
+
"C1: yes; prior human label and adjudication complete",
|
|
1394
|
+
"gold-standard coder marked it positive; tie-breaker approved",
|
|
1395
|
+
"前輪標註者已評分,裁決者確認",
|
|
1396
|
+
"c\u0338e\u0338l\u0338l\u0338-0\u03380\u03381",
|
|
1397
|
+
"The frozen id is c\u0345ell-001.",
|
|
1398
|
+
"p\u0338r\u0338i\u0338o\u0338r label assigned yes",
|
|
1399
|
+
"Observed prior l\u0338abel assigned yes.",
|
|
1400
|
+
"This is the treat.ment arm.",
|
|
1401
|
+
"An adjudi\u200bcator decided.",
|
|
1402
|
+
"c\u200be\u200bl\u200bl-001",
|
|
1403
|
+
"p\u200br\u200bi\u200bo\u200br label assigned yes",
|
|
1404
|
+
"c♥ell-001",
|
|
1405
|
+
"Observed prior lab♥el assigned yes.",
|
|
1406
|
+
"This is the treat♥ment arm.",
|
|
1407
|
+
"This is the treat\u00a0ment condition.",
|
|
1408
|
+
"Observed prior deci\u00a0sion.",
|
|
1409
|
+
"Observed review\u00a0er evidence.",
|
|
1410
|
+
"The preced\u00a0ing response was reviewed.",
|
|
1411
|
+
"前\u00a0輪標註已完成",
|
|
1412
|
+
"前♥輪標註已完成",
|
|
1413
|
+
"真♥人專家已評分",
|
|
1414
|
+
"處♥置組",
|
|
1415
|
+
"先♥前回應",
|
|
1416
|
+
),
|
|
1417
|
+
)
|
|
1418
|
+
def test_blind_packet_rejects_mapping_or_prior_human_evidence_free_text(tmp_path, leak):
|
|
1419
|
+
_, _plan_sha, plan = _initialize(tmp_path)
|
|
1420
|
+
transcript = _transcript(plan, plan["cells"][0])
|
|
1421
|
+
_replace_response(transcript, leak)
|
|
1422
|
+
receipt = runner._external_session_receipt(transcript, plan["cells"][0])
|
|
1423
|
+
with pytest.raises(runner.EnvelopeError, match="leaks|prior label"):
|
|
1424
|
+
runner._assert_blindable_transcript(
|
|
1425
|
+
plan, transcript, plan["cells"][0], receipt
|
|
1426
|
+
)
|
|
1427
|
+
|
|
1428
|
+
|
|
1429
|
+
@pytest.mark.parametrize(
|
|
1430
|
+
"ordinary_text",
|
|
1431
|
+
(
|
|
1432
|
+
"The scell-001x placeholder is ordinary prose.",
|
|
1433
|
+
"The scell-001 placeholder is ordinary prose.",
|
|
1434
|
+
"The cell-001x placeholder is ordinary prose.",
|
|
1435
|
+
"The éCell-001 placeholder is ordinary prose.",
|
|
1436
|
+
"The Cell-001é placeholder is ordinary prose.",
|
|
1437
|
+
"The ĿCell-001 placeholder is ordinary prose.",
|
|
1438
|
+
"The Cell-001Ŀ placeholder is ordinary prose.",
|
|
1439
|
+
"The ͺCell-001 placeholder is ordinary prose.",
|
|
1440
|
+
"The Cell-001ͺ placeholder is ordinary prose.",
|
|
1441
|
+
"The ⑴Cell-001 placeholder is ordinary prose.",
|
|
1442
|
+
"The Cell-001⑴ placeholder is ordinary prose.",
|
|
1443
|
+
"The priorlabelled workflow is ordinary prose.",
|
|
1444
|
+
"The readjudicationx token is ordinary prose.",
|
|
1445
|
+
),
|
|
1446
|
+
)
|
|
1447
|
+
def test_blind_identifier_and_phrase_compaction_keeps_boundaries(
|
|
1448
|
+
tmp_path, ordinary_text
|
|
1449
|
+
):
|
|
1450
|
+
_, _plan_sha, plan = _initialize(tmp_path)
|
|
1451
|
+
transcript = _transcript(plan, plan["cells"][0])
|
|
1452
|
+
_replace_response(transcript, ordinary_text)
|
|
1453
|
+
receipt = runner._external_session_receipt(transcript, plan["cells"][0])
|
|
1454
|
+
runner._assert_blindable_transcript(
|
|
1455
|
+
plan, transcript, plan["cells"][0], receipt
|
|
1456
|
+
)
|
|
1457
|
+
|
|
1458
|
+
|
|
1459
|
+
def test_all_frozen_compact_phrases_resist_symbol_and_separator_insertion():
|
|
1460
|
+
phrases = (
|
|
1461
|
+
runner.MAPPING_LEAK_COMPACT_PHRASES
|
|
1462
|
+
+ runner.HUMAN_EVIDENCE_COMPACT_PHRASES
|
|
1463
|
+
)
|
|
1464
|
+
assert len(phrases) == len(set(phrases))
|
|
1465
|
+
for phrase in phrases:
|
|
1466
|
+
split_at = next(
|
|
1467
|
+
index
|
|
1468
|
+
for index in range(1, len(phrase))
|
|
1469
|
+
if phrase[index - 1].isalnum() and phrase[index].isalnum()
|
|
1470
|
+
)
|
|
1471
|
+
for separator in ("\u00a0", "♥"):
|
|
1472
|
+
obfuscated = phrase[:split_at] + separator + phrase[split_at:]
|
|
1473
|
+
assert runner._contains_compact_phrase(obfuscated, phrase), (
|
|
1474
|
+
phrase,
|
|
1475
|
+
obfuscated,
|
|
1476
|
+
)
|
|
1477
|
+
|
|
1478
|
+
|
|
1479
|
+
def test_unicode_screen_rejects_all_assigned_separator_class_identifier_splits():
|
|
1480
|
+
failures = []
|
|
1481
|
+
tested = 0
|
|
1482
|
+
for codepoint in range(0x110000):
|
|
1483
|
+
character = chr(codepoint)
|
|
1484
|
+
category = unicodedata.category(character)
|
|
1485
|
+
if category[0] not in {"M", "P", "S", "Z"} and category not in {
|
|
1486
|
+
"Cc",
|
|
1487
|
+
"Cf",
|
|
1488
|
+
}:
|
|
1489
|
+
continue
|
|
1490
|
+
tested += 1
|
|
1491
|
+
if not runner._contains_complete_compact_identifier(
|
|
1492
|
+
f"c{character}ell-001", "cell-001"
|
|
1493
|
+
):
|
|
1494
|
+
failures.append((codepoint, category))
|
|
1495
|
+
assert tested > 11000
|
|
1496
|
+
assert failures == []
|
|
1497
|
+
|
|
1498
|
+
|
|
1499
|
+
def test_unicode_screen_keeps_compatibility_letter_number_adjacency_atomic():
|
|
1500
|
+
failures = []
|
|
1501
|
+
tested = 0
|
|
1502
|
+
for codepoint in range(0x110000):
|
|
1503
|
+
character = chr(codepoint)
|
|
1504
|
+
if unicodedata.category(character)[0] not in {"L", "N"}:
|
|
1505
|
+
continue
|
|
1506
|
+
decomposition = unicodedata.normalize("NFKD", character)
|
|
1507
|
+
if not any(
|
|
1508
|
+
unicodedata.category(item)[0] in {"M", "C", "P", "S", "Z"}
|
|
1509
|
+
for item in decomposition
|
|
1510
|
+
):
|
|
1511
|
+
continue
|
|
1512
|
+
tested += 1
|
|
1513
|
+
if runner._contains_complete_compact_identifier(
|
|
1514
|
+
f"{character}Cell-001", "cell-001"
|
|
1515
|
+
) or runner._contains_complete_compact_identifier(
|
|
1516
|
+
f"Cell-001{character}", "cell-001"
|
|
1517
|
+
):
|
|
1518
|
+
failures.append(codepoint)
|
|
1519
|
+
assert tested > 1000
|
|
1520
|
+
assert failures == []
|
|
1521
|
+
|
|
1522
|
+
|
|
1523
|
+
@pytest.mark.parametrize(
|
|
1524
|
+
"leak",
|
|
1525
|
+
(
|
|
1526
|
+
"cell\u200b-001",
|
|
1527
|
+
"prior\u2060-label assigned yes",
|
|
1528
|
+
"content・condition:injected",
|
|
1529
|
+
"c\u0338e\u0338l\u0338l\u0338-0\u03380\u03381",
|
|
1530
|
+
"The frozen id is c\u0345ell-001.",
|
|
1531
|
+
"p\u0338r\u0338i\u0338o\u0338r label assigned yes",
|
|
1532
|
+
"Observed prior l\u0338abel assigned yes.",
|
|
1533
|
+
"This is the treat.ment arm.",
|
|
1534
|
+
"An adjudi\u200bcator decided.",
|
|
1535
|
+
"c\u200be\u200bl\u200bl-001",
|
|
1536
|
+
"p\u200br\u200bi\u200bo\u200br label assigned yes",
|
|
1537
|
+
"c♥ell-001",
|
|
1538
|
+
"Observed prior lab♥el assigned yes.",
|
|
1539
|
+
"This is the treat♥ment arm.",
|
|
1540
|
+
"This is the treat\u00a0ment condition.",
|
|
1541
|
+
"Observed prior deci\u00a0sion.",
|
|
1542
|
+
"Observed review\u00a0er evidence.",
|
|
1543
|
+
"The preced\u00a0ing response was reviewed.",
|
|
1544
|
+
"前\u00a0輪標註已完成",
|
|
1545
|
+
"前♥輪標註已完成",
|
|
1546
|
+
"真♥人專家已評分",
|
|
1547
|
+
"處♥置組",
|
|
1548
|
+
"先♥前回應",
|
|
1549
|
+
),
|
|
1550
|
+
)
|
|
1551
|
+
def test_nfkc_format_and_punctuation_obfuscated_mapping_leak_stops_at_ingest(
|
|
1552
|
+
tmp_path, leak
|
|
1553
|
+
):
|
|
1554
|
+
run_dir, plan_sha, plan = _materialized(tmp_path)
|
|
1555
|
+
transcript = _transcript(plan, plan["cells"][0])
|
|
1556
|
+
_replace_response(transcript, leak)
|
|
1557
|
+
source = tmp_path / "unicode-leak.json"
|
|
1558
|
+
source.write_bytes(runner._json_bytes(transcript))
|
|
1559
|
+
with pytest.raises(runner.StopViolation) as caught:
|
|
1560
|
+
runner.ingest(
|
|
1561
|
+
_command_args(
|
|
1562
|
+
run_dir,
|
|
1563
|
+
plan_sha,
|
|
1564
|
+
transcript=source,
|
|
1565
|
+
authorization_record=_authorization_file(tmp_path, plan),
|
|
1566
|
+
)
|
|
1567
|
+
)
|
|
1568
|
+
assert caught.value.code == "blind_mapping_or_prior_label_leak"
|
|
1569
|
+
manifest = json.loads((run_dir / "ingestion-manifest.json").read_bytes())
|
|
1570
|
+
assert manifest["status"] == "stopped"
|
|
1571
|
+
assert manifest["stop_receipt"]["retry_forbidden"] is True
|
|
1572
|
+
|
|
1573
|
+
|
|
1574
|
+
def test_evidence_write_failure_stops_and_preserves_blocked_raw(tmp_path, monkeypatch):
|
|
1575
|
+
run_dir, plan_sha, plan = _materialized(tmp_path)
|
|
1576
|
+
source = tmp_path / "transcript.json"
|
|
1577
|
+
raw = runner._json_bytes(_transcript(plan, plan["cells"][0]))
|
|
1578
|
+
source.write_bytes(raw)
|
|
1579
|
+
original = runner._write_new
|
|
1580
|
+
failed = False
|
|
1581
|
+
|
|
1582
|
+
def fail_first_transcript(path, value, *, root):
|
|
1583
|
+
nonlocal failed
|
|
1584
|
+
if not failed and "/transcripts/" in path.as_posix():
|
|
1585
|
+
failed = True
|
|
1586
|
+
raise runner.EnvelopeError("AUTOMATED WRITE FAILURE")
|
|
1587
|
+
return original(path, value, root=root)
|
|
1588
|
+
|
|
1589
|
+
monkeypatch.setattr(runner, "_write_new", fail_first_transcript)
|
|
1590
|
+
with pytest.raises(runner.StopViolation) as caught:
|
|
1591
|
+
runner.ingest(
|
|
1592
|
+
_command_args(
|
|
1593
|
+
run_dir,
|
|
1594
|
+
plan_sha,
|
|
1595
|
+
transcript=source,
|
|
1596
|
+
authorization_record=_authorization_file(tmp_path, plan),
|
|
1597
|
+
)
|
|
1598
|
+
)
|
|
1599
|
+
assert caught.value.code == "evidence_write_failure"
|
|
1600
|
+
manifest = json.loads((run_dir / "ingestion-manifest.json").read_bytes())
|
|
1601
|
+
assert manifest["status"] == "stopped"
|
|
1602
|
+
assert (run_dir / manifest["stop_receipt"]["raw_ref"]).read_bytes() == raw
|
|
1603
|
+
|
|
1604
|
+
|
|
1605
|
+
def test_partial_success_path_bytes_are_registered_and_replayed_exactly(
|
|
1606
|
+
tmp_path, monkeypatch
|
|
1607
|
+
):
|
|
1608
|
+
run_dir, plan_sha, plan = _materialized(tmp_path)
|
|
1609
|
+
source = tmp_path / "transcript.json"
|
|
1610
|
+
raw = runner._json_bytes(_transcript(plan, plan["cells"][0]))
|
|
1611
|
+
source.write_bytes(raw)
|
|
1612
|
+
original = runner._write_new
|
|
1613
|
+
|
|
1614
|
+
def fail_receipt(path, value, **kwargs):
|
|
1615
|
+
if path.as_posix().endswith("receipts/cell-001.json"):
|
|
1616
|
+
raise runner.EnvelopeError("AUTOMATED RECEIPT WRITE FAILURE")
|
|
1617
|
+
return original(path, value, **kwargs)
|
|
1618
|
+
|
|
1619
|
+
monkeypatch.setattr(runner, "_write_new", fail_receipt)
|
|
1620
|
+
with pytest.raises(runner.StopViolation) as caught:
|
|
1621
|
+
runner.ingest(
|
|
1622
|
+
_command_args(
|
|
1623
|
+
run_dir,
|
|
1624
|
+
plan_sha,
|
|
1625
|
+
transcript=source,
|
|
1626
|
+
authorization_record=_authorization_file(tmp_path, plan),
|
|
1627
|
+
)
|
|
1628
|
+
)
|
|
1629
|
+
assert caught.value.code == "evidence_write_failure"
|
|
1630
|
+
manifest = json.loads((run_dir / "ingestion-manifest.json").read_bytes())
|
|
1631
|
+
retained = manifest["stop_receipt"]["preserved_auxiliary_artifacts"]
|
|
1632
|
+
assert [(row["role"], row["ref"]) for row in retained] == [
|
|
1633
|
+
("authorization_record", "authorization/record.json"),
|
|
1634
|
+
("accepted_transcript_before_state_commit", "transcripts/cell-001.json"),
|
|
1635
|
+
]
|
|
1636
|
+
transcript_row = retained[1]
|
|
1637
|
+
assert transcript_row["sha256"] == hashlib.sha256(raw).hexdigest()
|
|
1638
|
+
assert runner.validate_run(_command_args(run_dir, plan_sha))["status"] == "stopped"
|
|
1639
|
+
(run_dir / transcript_row["ref"]).write_bytes(b"TAMPERED\n")
|
|
1640
|
+
with pytest.raises(runner.EnvelopeError, match="preserved auxiliary evidence drift"):
|
|
1641
|
+
runner.validate_run(_command_args(run_dir, plan_sha))
|
|
1642
|
+
|
|
1643
|
+
|
|
1644
|
+
def test_preexisting_current_transcript_path_is_inventoried_before_stop(tmp_path):
|
|
1645
|
+
run_dir, plan_sha, plan = _materialized(tmp_path)
|
|
1646
|
+
collision = run_dir / "transcripts/cell-001.json"
|
|
1647
|
+
collision.write_bytes(b"PREEXISTING AUTOMATED COLLISION\n")
|
|
1648
|
+
source = tmp_path / "submitted.json"
|
|
1649
|
+
source.write_bytes(runner._json_bytes(_transcript(plan, plan["cells"][0])))
|
|
1650
|
+
with pytest.raises(runner.StopViolation):
|
|
1651
|
+
runner.ingest(
|
|
1652
|
+
_command_args(
|
|
1653
|
+
run_dir,
|
|
1654
|
+
plan_sha,
|
|
1655
|
+
transcript=source,
|
|
1656
|
+
authorization_record=_authorization_file(tmp_path, plan),
|
|
1657
|
+
)
|
|
1658
|
+
)
|
|
1659
|
+
manifest = json.loads((run_dir / "ingestion-manifest.json").read_bytes())
|
|
1660
|
+
assert manifest["status"] == "stopped"
|
|
1661
|
+
assert manifest["stop_receipt"]["preserved_auxiliary_artifacts"] == []
|
|
1662
|
+
assert manifest["stop_receipt"]["preserved_unregistered_tree"] == (
|
|
1663
|
+
runner._unregistered_tree_snapshot(
|
|
1664
|
+
run_dir, {"transcripts/cell-001.json"}, set()
|
|
1665
|
+
)
|
|
1666
|
+
)
|
|
1667
|
+
assert runner.validate_run(_command_args(run_dir, plan_sha))["status"] == "stopped"
|
|
1668
|
+
|
|
1669
|
+
|
|
1670
|
+
def test_prior_receipt_drift_stops_next_ingestion_and_preserves_submitted_raw(tmp_path):
|
|
1671
|
+
run_dir, plan_sha, plan = _materialized(tmp_path)
|
|
1672
|
+
_ingest_one(tmp_path, run_dir, plan_sha, plan, plan["cells"][0])
|
|
1673
|
+
receipt = run_dir / "receipts/cell-001.json"
|
|
1674
|
+
receipt.write_bytes(receipt.read_bytes() + b"\n")
|
|
1675
|
+
source = tmp_path / "next-transcript.json"
|
|
1676
|
+
raw = runner._json_bytes(_transcript(plan, plan["cells"][1]))
|
|
1677
|
+
source.write_bytes(raw)
|
|
1678
|
+
with pytest.raises(runner.StopViolation) as caught:
|
|
1679
|
+
runner.ingest(
|
|
1680
|
+
_command_args(
|
|
1681
|
+
run_dir,
|
|
1682
|
+
plan_sha,
|
|
1683
|
+
transcript=source,
|
|
1684
|
+
authorization_record=_authorization_file(tmp_path, plan),
|
|
1685
|
+
)
|
|
1686
|
+
)
|
|
1687
|
+
assert caught.value.code == "transcript_contract_failure"
|
|
1688
|
+
manifest = json.loads((run_dir / "ingestion-manifest.json").read_bytes())
|
|
1689
|
+
assert manifest["status"] == "stopped"
|
|
1690
|
+
assert manifest["cells"][0]["status"] == "ingested"
|
|
1691
|
+
assert manifest["cells"][1]["status"] == "blocked"
|
|
1692
|
+
assert (run_dir / manifest["stop_receipt"]["raw_ref"]).read_bytes() == raw
|
|
1693
|
+
|
|
1694
|
+
|
|
1695
|
+
def _walk_keys(value):
|
|
1696
|
+
if isinstance(value, dict):
|
|
1697
|
+
for key, item in value.items():
|
|
1698
|
+
yield key
|
|
1699
|
+
yield from _walk_keys(item)
|
|
1700
|
+
elif isinstance(value, list):
|
|
1701
|
+
for item in value:
|
|
1702
|
+
yield from _walk_keys(item)
|
|
1703
|
+
|
|
1704
|
+
|
|
1705
|
+
def test_full_ingestion_creates_64_isolated_write_once_label_free_packets(
|
|
1706
|
+
tmp_path, monkeypatch
|
|
1707
|
+
):
|
|
1708
|
+
run_dir, plan_sha, plan = _materialized(tmp_path)
|
|
1709
|
+
_ingest_all(tmp_path, run_dir, plan_sha, plan)
|
|
1710
|
+
assert runner.validate_run(_command_args(run_dir, plan_sha))["status"] == "complete"
|
|
1711
|
+
quarantined_run = tmp_path / "quarantined-run"
|
|
1712
|
+
shutil.copytree(run_dir, quarantined_run)
|
|
1713
|
+
# copytree copies hard-linked journal names as distinct files. Recreate the
|
|
1714
|
+
# production same-inode completion invariant before testing blind staging.
|
|
1715
|
+
for cell in plan["cells"]:
|
|
1716
|
+
completed = quarantined_run / runner._journal_ref(
|
|
1717
|
+
"completed", cell["cell_id"]
|
|
1718
|
+
)
|
|
1719
|
+
completed.unlink()
|
|
1720
|
+
os.link(
|
|
1721
|
+
quarantined_run / runner._journal_ref("armed", cell["cell_id"]),
|
|
1722
|
+
completed,
|
|
1723
|
+
)
|
|
1724
|
+
incomplete_staging = (
|
|
1725
|
+
quarantined_run.parent / f".{quarantined_run.name}.blind-next"
|
|
1726
|
+
)
|
|
1727
|
+
(incomplete_staging / "private").mkdir(parents=True, mode=0o700)
|
|
1728
|
+
residue = incomplete_staging / "private/map.json"
|
|
1729
|
+
residue.write_bytes(b"AUTOMATED INCOMPLETE PRIVATE MAP RESIDUE\n")
|
|
1730
|
+
residue.chmod(0o600)
|
|
1731
|
+
with pytest.raises(runner.EnvelopeError, match="forbids regeneration"):
|
|
1732
|
+
runner.prepare_blind_packet(_command_args(quarantined_run, plan_sha))
|
|
1733
|
+
assert (
|
|
1734
|
+
quarantined_run
|
|
1735
|
+
/ runner._journal_ref("claimed", runner.BLIND_TRANSACTION_ID)
|
|
1736
|
+
).is_file()
|
|
1737
|
+
preserved_residue = residue.read_bytes()
|
|
1738
|
+
with pytest.raises(runner.EnvelopeError, match="forbids regeneration"):
|
|
1739
|
+
runner.prepare_blind_packet(_command_args(quarantined_run, plan_sha))
|
|
1740
|
+
assert residue.read_bytes() == preserved_residue
|
|
1741
|
+
assert not (quarantined_run / "blind").exists()
|
|
1742
|
+
|
|
1743
|
+
original_rename = runner.os.rename
|
|
1744
|
+
failed = False
|
|
1745
|
+
|
|
1746
|
+
def fail_bundle_rename_once(source, target):
|
|
1747
|
+
nonlocal failed
|
|
1748
|
+
if not failed and source.name == f".{run_dir.name}.blind-next":
|
|
1749
|
+
failed = True
|
|
1750
|
+
raise OSError("AUTOMATED POST-STAGING RENAME FAILURE")
|
|
1751
|
+
return original_rename(source, target)
|
|
1752
|
+
|
|
1753
|
+
monkeypatch.setattr(runner.os, "rename", fail_bundle_rename_once)
|
|
1754
|
+
with pytest.raises(runner.EnvelopeError, match="evidence is preserved"):
|
|
1755
|
+
runner.prepare_blind_packet(_command_args(run_dir, plan_sha))
|
|
1756
|
+
staging = run_dir.parent / f".{run_dir.name}.blind-next"
|
|
1757
|
+
assert staging.is_dir()
|
|
1758
|
+
staged_manifest = (staging / "manifest.json").read_bytes()
|
|
1759
|
+
assert not (run_dir / "blind").exists()
|
|
1760
|
+
monkeypatch.setattr(runner.os, "rename", original_rename)
|
|
1761
|
+
result = runner.prepare_blind_packet(_command_args(run_dir, plan_sha))
|
|
1762
|
+
assert result["packets"] == 64
|
|
1763
|
+
assert result["labels_present"] is False
|
|
1764
|
+
assert result["human_evidence_present"] is False
|
|
1765
|
+
assert result["state"] == "blind_finalized"
|
|
1766
|
+
assert result["recovered_existing_atomic_bundle"] is True
|
|
1767
|
+
assert (run_dir / "blind/manifest.json").read_bytes() == staged_manifest
|
|
1768
|
+
assert runner.validate_run(_command_args(run_dir, plan_sha))["status"] == "blind_finalized"
|
|
1769
|
+
inventory = json.loads((run_dir / "blind/inventory.json").read_bytes())
|
|
1770
|
+
private_map_path = run_dir / "blind/private/map.json"
|
|
1771
|
+
private_map = json.loads(private_map_path.read_bytes())
|
|
1772
|
+
assert private_map["protection"]["encrypted"] is False
|
|
1773
|
+
assert private_map["protection"]["mode_bits_are_not_identity_or_access_control_proof"] is True
|
|
1774
|
+
assert private_map_path.parent.stat().st_mode & 0o777 == 0o700
|
|
1775
|
+
assert private_map_path.stat().st_mode & 0o777 == 0o600
|
|
1776
|
+
assert len(inventory["packets"]) == len(private_map["mappings"]) == 64
|
|
1777
|
+
public_text = json.dumps(inventory, sort_keys=True)
|
|
1778
|
+
for forbidden in (
|
|
1779
|
+
"scenario_id",
|
|
1780
|
+
"pair_id",
|
|
1781
|
+
"content_condition",
|
|
1782
|
+
"guidance_condition",
|
|
1783
|
+
"replicate",
|
|
1784
|
+
"expected_artifact",
|
|
1785
|
+
"canary",
|
|
1786
|
+
"other_transcript",
|
|
1787
|
+
"ipi-web-en",
|
|
1788
|
+
"ars_guided",
|
|
1789
|
+
"platform_only",
|
|
1790
|
+
"benign",
|
|
1791
|
+
"injected",
|
|
1792
|
+
):
|
|
1793
|
+
assert forbidden not in public_text
|
|
1794
|
+
packet_refs = {row["packet_ref"] for row in inventory["packets"]}
|
|
1795
|
+
assert len(packet_refs) == 64
|
|
1796
|
+
for row in inventory["packets"]:
|
|
1797
|
+
packet_raw = (run_dir / "blind" / row["packet_ref"]).read_bytes()
|
|
1798
|
+
assert hashlib.sha256(packet_raw).hexdigest() == row["packet_sha256"]
|
|
1799
|
+
packet = json.loads(packet_raw)
|
|
1800
|
+
assert packet["delivery"] == {
|
|
1801
|
+
"isolated_single_session": True,
|
|
1802
|
+
"deliver_other_sessions_together": False,
|
|
1803
|
+
"assignment_ledger_gate_required_before_delivery": True,
|
|
1804
|
+
}
|
|
1805
|
+
assert packet["assignment_boundary"] == runner._assignment_boundary()
|
|
1806
|
+
assert packet["assignment_boundary"]["bundle_alone_proves_arm_blindness"] is False
|
|
1807
|
+
assert "injected_canary_key" not in packet["blinded_to"]
|
|
1808
|
+
assert "content_condition_label" not in packet["blinded_to"]
|
|
1809
|
+
assert packet["labels_present"] is False
|
|
1810
|
+
assert packet["adjudication_present"] is False
|
|
1811
|
+
assert packet["human_evidence_present"] is False
|
|
1812
|
+
assert {
|
|
1813
|
+
"scenario_id",
|
|
1814
|
+
"pair_id",
|
|
1815
|
+
"content_condition",
|
|
1816
|
+
"guidance_condition",
|
|
1817
|
+
"replicate",
|
|
1818
|
+
"expected_artifact",
|
|
1819
|
+
"canary",
|
|
1820
|
+
}.isdisjoint(set(_walk_keys(packet)))
|
|
1821
|
+
manifest_path = run_dir / "ingestion-manifest.json"
|
|
1822
|
+
finalized_manifest = json.loads(manifest_path.read_bytes())
|
|
1823
|
+
manifest_path.write_bytes(
|
|
1824
|
+
runner._json_bytes(runner._source_ingestion_manifest(finalized_manifest))
|
|
1825
|
+
)
|
|
1826
|
+
recovered = runner.prepare_blind_packet(_command_args(run_dir, plan_sha))
|
|
1827
|
+
assert recovered["recovered_existing_atomic_bundle"] is True
|
|
1828
|
+
assert runner.validate_run(_command_args(run_dir, plan_sha))["status"] == (
|
|
1829
|
+
"blind_finalized"
|
|
1830
|
+
)
|
|
1831
|
+
private_map_path.chmod(0o644)
|
|
1832
|
+
with pytest.raises(runner.EnvelopeError, match="private map file mode"):
|
|
1833
|
+
runner.validate_run(_command_args(run_dir, plan_sha))
|
|
1834
|
+
private_map_path.chmod(0o600)
|
|
1835
|
+
private_pristine = private_map_path.read_bytes()
|
|
1836
|
+
private_map_path.write_bytes(private_pristine + b"\n")
|
|
1837
|
+
with pytest.raises(runner.EnvelopeError, match="private map hash drift"):
|
|
1838
|
+
runner.validate_run(_command_args(run_dir, plan_sha))
|
|
1839
|
+
private_map_path.write_bytes(private_pristine)
|
|
1840
|
+
private_map_path.chmod(0o600)
|
|
1841
|
+
with pytest.raises(runner.EnvelopeError, match="already finalized"):
|
|
1842
|
+
runner.prepare_blind_packet(_command_args(run_dir, plan_sha))
|
|
1843
|
+
first_packet = run_dir / "blind" / inventory["packets"][0]["packet_ref"]
|
|
1844
|
+
pristine = first_packet.read_bytes()
|
|
1845
|
+
first_packet.write_bytes(pristine + b"\n")
|
|
1846
|
+
with pytest.raises(runner.EnvelopeError, match="replay|hash|byte"):
|
|
1847
|
+
runner.validate_run(_command_args(run_dir, plan_sha))
|
|
1848
|
+
first_packet.write_bytes(pristine)
|
|
1849
|
+
(run_dir / "blind/rogue-labels.json").write_text(
|
|
1850
|
+
'{"fabricated_human_label":true}\n', encoding="utf-8"
|
|
1851
|
+
)
|
|
1852
|
+
with pytest.raises(runner.EnvelopeError, match="inventory"):
|
|
1853
|
+
runner.validate_run(_command_args(run_dir, plan_sha))
|
|
1854
|
+
|
|
1855
|
+
|
|
1856
|
+
def test_blind_preparation_refuses_incomplete_or_stopped_run(tmp_path):
|
|
1857
|
+
run_dir, plan_sha, _plan = _materialized(tmp_path)
|
|
1858
|
+
with pytest.raises(runner.EnvelopeError, match="requires 64 complete"):
|
|
1859
|
+
runner.prepare_blind_packet(_command_args(run_dir, plan_sha))
|
|
1860
|
+
|
|
1861
|
+
|
|
1862
|
+
@pytest.mark.parametrize("forbidden_key", ("arm_id", "human_label", "adjudication"))
|
|
1863
|
+
def test_blind_packet_structure_rejects_nested_assignment_or_human_keys(
|
|
1864
|
+
forbidden_key,
|
|
1865
|
+
):
|
|
1866
|
+
with pytest.raises(runner.EnvelopeError, match="forbidden assignment"):
|
|
1867
|
+
runner._assert_blind_packet_structure(
|
|
1868
|
+
{"safe": {"nested": [{forbidden_key: "AUTOMATED HIDDEN VALUE"}]}}
|
|
1869
|
+
)
|
|
1870
|
+
|
|
1871
|
+
|
|
1872
|
+
def test_all_new_schemas_are_closed_draft_2020_12_contracts():
|
|
1873
|
+
for path in (
|
|
1874
|
+
runner.RUN_PLAN_SCHEMA,
|
|
1875
|
+
runner.AUTHORIZATION_SCHEMA,
|
|
1876
|
+
runner.TRANSCRIPT_SCHEMA,
|
|
1877
|
+
runner.INGESTION_SCHEMA,
|
|
1878
|
+
runner.BLIND_PACKET_SCHEMA,
|
|
1879
|
+
runner.BLIND_INVENTORY_SCHEMA,
|
|
1880
|
+
runner.BLIND_MAP_SCHEMA,
|
|
1881
|
+
runner.BLIND_MANIFEST_SCHEMA,
|
|
1882
|
+
runner.STOP_INTENT_SCHEMA,
|
|
1883
|
+
runner.ASSIGNMENT_LEDGER_SCHEMA,
|
|
1884
|
+
runner.JOURNAL_TOKEN_SCHEMA,
|
|
1885
|
+
):
|
|
1886
|
+
schema = json.loads(path.read_bytes())
|
|
1887
|
+
assert schema["$schema"] == "https://json-schema.org/draft/2020-12/schema"
|
|
1888
|
+
assert schema["additionalProperties"] is False
|
|
1889
|
+
Draft202012Validator.check_schema(schema)
|