psyclaw 0.27.23 → 0.28.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -5
- package/agents/recommended/catalog.json +99 -0
- package/dist/apps/panel/index.html +5 -5
- package/dist/src/adapters/pi/extension.js +339 -94
- package/dist/src/adapters/pi/extension.js.map +1 -1
- package/dist/src/adapters/pi/rpc.d.ts +2 -0
- package/dist/src/adapters/pi/rpc.js +9 -2
- package/dist/src/adapters/pi/rpc.js.map +1 -1
- package/dist/src/agents/import.js +44 -32
- package/dist/src/agents/import.js.map +1 -1
- package/dist/src/agents/recommended-personas.d.ts +42 -0
- package/dist/src/agents/recommended-personas.js +135 -0
- package/dist/src/agents/recommended-personas.js.map +1 -0
- package/dist/src/analysis/hooks.d.ts +1 -0
- package/dist/src/analysis/hooks.js +20 -1
- package/dist/src/analysis/hooks.js.map +1 -1
- package/dist/src/ars/bridge.d.ts +20 -0
- package/dist/src/ars/bridge.js +132 -0
- package/dist/src/ars/bridge.js.map +1 -0
- package/dist/src/ars/contracts.d.ts +55 -0
- package/dist/src/ars/contracts.js +2 -0
- package/dist/src/ars/contracts.js.map +1 -0
- package/dist/src/ars/panel-plan.d.ts +4 -0
- package/dist/src/ars/panel-plan.js +11 -0
- package/dist/src/ars/panel-plan.js.map +1 -0
- package/dist/src/ars/pi-panel-executor.d.ts +30 -0
- package/dist/src/ars/pi-panel-executor.js +140 -0
- package/dist/src/ars/pi-panel-executor.js.map +1 -0
- package/dist/src/ars/profile.d.ts +36 -0
- package/dist/src/ars/profile.js +119 -0
- package/dist/src/ars/profile.js.map +1 -0
- package/dist/src/ars/re-review.d.ts +22 -0
- package/dist/src/ars/re-review.js +172 -0
- package/dist/src/ars/re-review.js.map +1 -0
- package/dist/src/branding.d.ts +2 -4
- package/dist/src/branding.js +3 -5
- package/dist/src/branding.js.map +1 -1
- package/dist/src/bundled-tools.d.ts +3 -0
- package/dist/src/bundled-tools.js +21 -0
- package/dist/src/bundled-tools.js.map +1 -0
- package/dist/src/chat.js +6 -5
- package/dist/src/chat.js.map +1 -1
- package/dist/src/cli.js +6 -3
- package/dist/src/cli.js.map +1 -1
- package/dist/src/creation/contracts.d.ts +41 -0
- package/dist/src/creation/contracts.js +2 -0
- package/dist/src/creation/contracts.js.map +1 -0
- package/dist/src/creation/service.d.ts +7 -0
- package/dist/src/creation/service.js +208 -0
- package/dist/src/creation/service.js.map +1 -0
- package/dist/src/index.d.ts +11 -0
- package/dist/src/index.js +11 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/install/installer.js +32 -10
- package/dist/src/install/installer.js.map +1 -1
- package/dist/src/orchestration/bundled-personas.d.ts +16 -0
- package/dist/src/orchestration/bundled-personas.js +101 -0
- package/dist/src/orchestration/bundled-personas.js.map +1 -0
- package/dist/src/orchestration/effects.d.ts +8 -0
- package/dist/src/orchestration/effects.js +39 -0
- package/dist/src/orchestration/effects.js.map +1 -0
- package/dist/src/orchestration/personas.d.ts +16 -0
- package/dist/src/orchestration/personas.js +64 -0
- package/dist/src/orchestration/personas.js.map +1 -0
- package/dist/src/orchestration/pi-executor.d.ts +9 -4
- package/dist/src/orchestration/pi-executor.js +55 -22
- package/dist/src/orchestration/pi-executor.js.map +1 -1
- package/dist/src/orchestration/research-agents.d.ts +3 -7
- package/dist/src/orchestration/research-agents.js +5 -69
- package/dist/src/orchestration/research-agents.js.map +1 -1
- package/dist/src/panel/server.js +19 -4
- package/dist/src/panel/server.js.map +1 -1
- package/dist/src/project/paths.d.ts +3 -0
- package/dist/src/project/paths.js +7 -0
- package/dist/src/project/paths.js.map +1 -1
- package/dist/src/rules/user-rules.d.ts +8 -0
- package/dist/src/rules/user-rules.js +36 -0
- package/dist/src/rules/user-rules.js.map +1 -0
- package/dist/src/skills/contracts.d.ts +4 -4
- package/dist/src/skills/recommended.js +1 -1
- package/dist/src/skills/registry.js +49 -28
- package/dist/src/skills/registry.js.map +1 -1
- package/dist/src/style/cli-ui.d.ts +14 -0
- package/dist/src/style/cli-ui.js +45 -1
- package/dist/src/style/cli-ui.js.map +1 -1
- package/dist/src/tui/skill-manager.js +1 -1
- package/dist/src/tui/skill-manager.js.map +1 -1
- package/dist/src/updates/update.js +9 -3
- package/dist/src/updates/update.js.map +1 -1
- package/package.json +15 -3
- package/scripts/rebrand-pi.mjs +6 -0
- package/skills/recommended/catalog.json +2 -11
- package/vendor/ars/.claude/CLAUDE.md +371 -0
- package/vendor/ars/.command-invariants.toml +24 -0
- package/vendor/ars/CITATION.cff +35 -0
- package/vendor/ars/LICENSE +417 -0
- package/vendor/ars/MODE_REGISTRY.md +76 -0
- package/vendor/ars/NOTICE.md +26 -0
- package/vendor/ars/POSITIONING.md +99 -0
- package/vendor/ars/PSYCLAW_SOURCE.json +10 -0
- package/vendor/ars/README.md +751 -0
- package/vendor/ars/SECURITY.md +52 -0
- package/vendor/ars/THIRD_PARTY.md +70 -0
- package/vendor/ars/academic-paper/SKILL.md +542 -0
- package/vendor/ars/academic-paper/agents/abstract_bilingual_agent.md +171 -0
- package/vendor/ars/academic-paper/agents/argument_builder_agent.md +276 -0
- package/vendor/ars/academic-paper/agents/citation_compliance_agent.md +422 -0
- package/vendor/ars/academic-paper/agents/draft_writer_agent.md +656 -0
- package/vendor/ars/academic-paper/agents/formatter_agent.md +999 -0
- package/vendor/ars/academic-paper/agents/intake_agent.md +393 -0
- package/vendor/ars/academic-paper/agents/literature_strategist_agent.md +626 -0
- package/vendor/ars/academic-paper/agents/peer_reviewer_agent.md +516 -0
- package/vendor/ars/academic-paper/agents/revision_coach_agent.md +334 -0
- package/vendor/ars/academic-paper/agents/socratic_mentor_agent.md +527 -0
- package/vendor/ars/academic-paper/agents/structure_architect_agent.md +401 -0
- package/vendor/ars/academic-paper/agents/visualization_agent.md +441 -0
- package/vendor/ars/academic-paper/examples/chinese_paper_example.md +278 -0
- package/vendor/ars/academic-paper/examples/clinical_citation_verification_checklist.md +95 -0
- package/vendor/ars/academic-paper/examples/clinical_epistemic_status_example.md +100 -0
- package/vendor/ars/academic-paper/examples/commitment_ledger_example.md +147 -0
- package/vendor/ars/academic-paper/examples/imrad_hei_example.md +234 -0
- package/vendor/ars/academic-paper/examples/literature_review_example.md +260 -0
- package/vendor/ars/academic-paper/examples/plan_mode_guided_writing.md +600 -0
- package/vendor/ars/academic-paper/examples/revision_mode_example.md +344 -0
- package/vendor/ars/academic-paper/examples/revision_recovery_example.md +506 -0
- package/vendor/ars/academic-paper/examples/version_family_reconciliation_example.md +89 -0
- package/vendor/ars/academic-paper/references/abstract_writing_guide.md +169 -0
- package/vendor/ars/academic-paper/references/academic_writing_style.md +188 -0
- package/vendor/ars/academic-paper/references/anti_leakage_protocol.md +83 -0
- package/vendor/ars/academic-paper/references/apa7_chinese_citation_guide.md +364 -0
- package/vendor/ars/academic-paper/references/apa7_extended_guide.md +198 -0
- package/vendor/ars/academic-paper/references/changelog.md +11 -0
- package/vendor/ars/academic-paper/references/citation_format_switcher.md +228 -0
- package/vendor/ars/academic-paper/references/committee_correspondence_protocol.md +158 -0
- package/vendor/ars/academic-paper/references/credit_authorship_guide.md +308 -0
- package/vendor/ars/academic-paper/references/disclosure_mode_protocol.md +478 -0
- package/vendor/ars/academic-paper/references/domain_evidence_profiles.md +38 -0
- package/vendor/ars/academic-paper/references/failure_paths.md +349 -0
- package/vendor/ars/academic-paper/references/funding_statement_guide.md +319 -0
- package/vendor/ars/academic-paper/references/hei_domain_glossary.md +169 -0
- package/vendor/ars/academic-paper/references/intro_title_rhetoric_guide.md +114 -0
- package/vendor/ars/academic-paper/references/journal_submission_guide.md +249 -0
- package/vendor/ars/academic-paper/references/latex_template_reference.md +378 -0
- package/vendor/ars/academic-paper/references/mode_selection_guide.md +378 -0
- package/vendor/ars/academic-paper/references/paper_structure_patterns.md +330 -0
- package/vendor/ars/academic-paper/references/plan_mode_protocol.md +112 -0
- package/vendor/ars/academic-paper/references/policy_anchor_disclosure_protocol.md +200 -0
- package/vendor/ars/academic-paper/references/policy_anchor_table.md +157 -0
- package/vendor/ars/academic-paper/references/revision_patch_protocol.md +173 -0
- package/vendor/ars/academic-paper/references/statistical_visualization_standards.md +750 -0
- package/vendor/ars/academic-paper/references/venue_disclosure_policies.md +259 -0
- package/vendor/ars/academic-paper/references/vlm_figure_verification.md +126 -0
- package/vendor/ars/academic-paper/references/workflow_phase_details.md +135 -0
- package/vendor/ars/academic-paper/references/writing_judgment_framework.md +59 -0
- package/vendor/ars/academic-paper/references/writing_quality_check.md +173 -0
- package/vendor/ars/academic-paper/templates/bilingual_abstract_template.md +78 -0
- package/vendor/ars/academic-paper/templates/case_study_template.md +129 -0
- package/vendor/ars/academic-paper/templates/conference_paper_template.md +108 -0
- package/vendor/ars/academic-paper/templates/credit_statement_template.md +132 -0
- package/vendor/ars/academic-paper/templates/funding_statement_template.md +290 -0
- package/vendor/ars/academic-paper/templates/imrad_template.md +183 -0
- package/vendor/ars/academic-paper/templates/latex_article_template.tex +199 -0
- package/vendor/ars/academic-paper/templates/literature_review_template.md +135 -0
- package/vendor/ars/academic-paper/templates/policy_brief_template.md +139 -0
- package/vendor/ars/academic-paper/templates/revision_tracking_template.md +199 -0
- package/vendor/ars/academic-paper/templates/theoretical_paper_template.md +119 -0
- package/vendor/ars/academic-paper-reviewer/SKILL.md +491 -0
- package/vendor/ars/academic-paper-reviewer/agents/devils_advocate_reviewer_agent.md +443 -0
- package/vendor/ars/academic-paper-reviewer/agents/domain_reviewer_agent.md +412 -0
- package/vendor/ars/academic-paper-reviewer/agents/editorial_synthesizer_agent.md +478 -0
- package/vendor/ars/academic-paper-reviewer/agents/eic_agent.md +339 -0
- package/vendor/ars/academic-paper-reviewer/agents/field_analyst_agent.md +221 -0
- package/vendor/ars/academic-paper-reviewer/agents/methodology_reviewer_agent.md +449 -0
- package/vendor/ars/academic-paper-reviewer/agents/perspective_reviewer_agent.md +427 -0
- package/vendor/ars/academic-paper-reviewer/examples/hei_paper_review_example.md +391 -0
- package/vendor/ars/academic-paper-reviewer/examples/interdisciplinary_review_example.md +299 -0
- package/vendor/ars/academic-paper-reviewer/examples/subclaim_decomposition_example.md +80 -0
- package/vendor/ars/academic-paper-reviewer/references/calibration_mode_protocol.md +256 -0
- package/vendor/ars/academic-paper-reviewer/references/changelog.md +10 -0
- package/vendor/ars/academic-paper-reviewer/references/editorial_decision_standards.md +236 -0
- package/vendor/ars/academic-paper-reviewer/references/guided_mode_protocol.md +34 -0
- package/vendor/ars/academic-paper-reviewer/references/integration_guide.md +15 -0
- package/vendor/ars/academic-paper-reviewer/references/quality_rubrics.md +84 -0
- package/vendor/ars/academic-paper-reviewer/references/re_review_mode_protocol.md +340 -0
- package/vendor/ars/academic-paper-reviewer/references/review_criteria_framework.md +98 -0
- package/vendor/ars/academic-paper-reviewer/references/review_panel_provenance_protocol.md +197 -0
- package/vendor/ars/academic-paper-reviewer/references/review_quality_thinking.md +58 -0
- package/vendor/ars/academic-paper-reviewer/references/reviewer_sprint_prompt_source.md +324 -0
- package/vendor/ars/academic-paper-reviewer/references/sprint_contract_protocol.md +296 -0
- package/vendor/ars/academic-paper-reviewer/references/statistical_reporting_standards.md +505 -0
- package/vendor/ars/academic-paper-reviewer/references/top_journals_by_field.md +206 -0
- package/vendor/ars/academic-paper-reviewer/templates/editorial_decision_template.md +235 -0
- package/vendor/ars/academic-paper-reviewer/templates/peer_review_report_template.md +305 -0
- package/vendor/ars/academic-paper-reviewer/templates/revision_response_template.md +248 -0
- package/vendor/ars/academic-pipeline/SKILL.md +736 -0
- package/vendor/ars/academic-pipeline/agents/claim_ref_alignment_audit_agent.md +382 -0
- package/vendor/ars/academic-pipeline/agents/collaboration_depth_agent.md +164 -0
- package/vendor/ars/academic-pipeline/agents/integrity_verification_agent.md +870 -0
- package/vendor/ars/academic-pipeline/agents/pipeline_orchestrator_agent.md +1379 -0
- package/vendor/ars/academic-pipeline/agents/state_tracker_agent.md +622 -0
- package/vendor/ars/academic-pipeline/examples/full_pipeline_example.md +482 -0
- package/vendor/ars/academic-pipeline/examples/integrity_failure_recovery.md +389 -0
- package/vendor/ars/academic-pipeline/examples/mid_entry_example.md +414 -0
- package/vendor/ars/academic-pipeline/references/adapters/.gitkeep +0 -0
- package/vendor/ars/academic-pipeline/references/adapters/overview.md +153 -0
- package/vendor/ars/academic-pipeline/references/ai_research_failure_modes.md +185 -0
- package/vendor/ars/academic-pipeline/references/changelog.md +14 -0
- package/vendor/ars/academic-pipeline/references/claim_audit_calibration_protocol.md +175 -0
- package/vendor/ars/academic-pipeline/references/claim_verification_protocol.md +282 -0
- package/vendor/ars/academic-pipeline/references/external_review_protocol.md +131 -0
- package/vendor/ars/academic-pipeline/references/integrity_review_protocol.md +110 -0
- package/vendor/ars/academic-pipeline/references/literature_corpus_consumers.md +193 -0
- package/vendor/ars/academic-pipeline/references/mode_advisor.md +135 -0
- package/vendor/ars/academic-pipeline/references/passport_as_reset_boundary.md +132 -0
- package/vendor/ars/academic-pipeline/references/pipeline_state_machine.md +405 -0
- package/vendor/ars/academic-pipeline/references/plagiarism_detection_protocol.md +239 -0
- package/vendor/ars/academic-pipeline/references/process_summary_protocol.md +209 -0
- package/vendor/ars/academic-pipeline/references/progress_dashboard_template.md +38 -0
- package/vendor/ars/academic-pipeline/references/reinforcement_content.md +15 -0
- package/vendor/ars/academic-pipeline/references/reproducibility_audit.md +55 -0
- package/vendor/ars/academic-pipeline/references/score_trajectory_protocol.md +78 -0
- package/vendor/ars/academic-pipeline/references/team_collaboration_protocol.md +261 -0
- package/vendor/ars/academic-pipeline/references/two_stage_review_protocol.md +27 -0
- package/vendor/ars/academic-pipeline/templates/pipeline_status_template.md +146 -0
- package/vendor/ars/agents/report_compiler_agent.md +341 -0
- package/vendor/ars/agents/research_architect_agent.md +298 -0
- package/vendor/ars/agents/synthesis_agent.md +356 -0
- package/vendor/ars/commands/ars-3w.md +10 -0
- package/vendor/ars/commands/ars-abstract.md +10 -0
- package/vendor/ars/commands/ars-cache-invalidate.md +20 -0
- package/vendor/ars/commands/ars-citation-check.md +10 -0
- package/vendor/ars/commands/ars-disclosure.md +10 -0
- package/vendor/ars/commands/ars-format-convert.md +10 -0
- package/vendor/ars/commands/ars-full.md +9 -0
- package/vendor/ars/commands/ars-lit-review.md +12 -0
- package/vendor/ars/commands/ars-mark-read.md +18 -0
- package/vendor/ars/commands/ars-outline.md +10 -0
- package/vendor/ars/commands/ars-plan.md +10 -0
- package/vendor/ars/commands/ars-rebuttal-audit.md +12 -0
- package/vendor/ars/commands/ars-reviewer.md +9 -0
- package/vendor/ars/commands/ars-revision-coach.md +9 -0
- package/vendor/ars/commands/ars-revision.md +10 -0
- package/vendor/ars/commands/ars-unmark-read.md +16 -0
- package/vendor/ars/deep-research/SKILL.md +600 -0
- package/vendor/ars/deep-research/agents/bibliography_agent.md +473 -0
- package/vendor/ars/deep-research/agents/devils_advocate_agent.md +192 -0
- package/vendor/ars/deep-research/agents/editor_in_chief_agent.md +167 -0
- package/vendor/ars/deep-research/agents/ethics_review_agent.md +267 -0
- package/vendor/ars/deep-research/agents/meta_analysis_agent.md +325 -0
- package/vendor/ars/deep-research/agents/monitoring_agent.md +209 -0
- package/vendor/ars/deep-research/agents/report_compiler_agent.md +341 -0
- package/vendor/ars/deep-research/agents/research_architect_agent.md +298 -0
- package/vendor/ars/deep-research/agents/research_question_agent.md +216 -0
- package/vendor/ars/deep-research/agents/risk_of_bias_agent.md +231 -0
- package/vendor/ars/deep-research/agents/socratic_mentor_agent.md +764 -0
- package/vendor/ars/deep-research/agents/source_verification_agent.md +219 -0
- package/vendor/ars/deep-research/agents/synthesis_agent.md +356 -0
- package/vendor/ars/deep-research/agents/timeline_extraction_agent.md +99 -0
- package/vendor/ars/deep-research/examples/exploratory_research.md +157 -0
- package/vendor/ars/deep-research/examples/fact_check_mode.md +173 -0
- package/vendor/ars/deep-research/examples/handoff_to_paper.md +318 -0
- package/vendor/ars/deep-research/examples/idea_diversity_coverage_gap_advisory.md +64 -0
- package/vendor/ars/deep-research/examples/policy_analysis.md +161 -0
- package/vendor/ars/deep-research/examples/review_mode.md +253 -0
- package/vendor/ars/deep-research/examples/socratic_guided_research.md +331 -0
- package/vendor/ars/deep-research/examples/systematic_review.md +133 -0
- package/vendor/ars/deep-research/references/apa7_style_guide.md +162 -0
- package/vendor/ars/deep-research/references/argumentation_reasoning_framework.md +68 -0
- package/vendor/ars/deep-research/references/arxiv_api_protocol.md +76 -0
- package/vendor/ars/deep-research/references/changelog.md +22 -0
- package/vendor/ars/deep-research/references/chinese_literature_api_protocol.md +317 -0
- package/vendor/ars/deep-research/references/cross_agent_quality_definitions.md +14 -0
- package/vendor/ars/deep-research/references/crossref_api_protocol.md +84 -0
- package/vendor/ars/deep-research/references/equator_reporting_guidelines.md +482 -0
- package/vendor/ars/deep-research/references/ethics_checklist.md +282 -0
- package/vendor/ars/deep-research/references/failure_paths.md +355 -0
- package/vendor/ars/deep-research/references/interdisciplinary_bridges.md +292 -0
- package/vendor/ars/deep-research/references/irb_decision_tree.md +315 -0
- package/vendor/ars/deep-research/references/literature_monitoring_strategies.md +263 -0
- package/vendor/ars/deep-research/references/logical_fallacies.md +192 -0
- package/vendor/ars/deep-research/references/methodology_patterns.md +462 -0
- package/vendor/ars/deep-research/references/mode_selection_guide.md +331 -0
- package/vendor/ars/deep-research/references/openalex_api_protocol.md +82 -0
- package/vendor/ars/deep-research/references/preregistration_guide.md +324 -0
- package/vendor/ars/deep-research/references/semantic_scholar_api_protocol.md +107 -0
- package/vendor/ars/deep-research/references/socratic_mode_protocol.md +99 -0
- package/vendor/ars/deep-research/references/socratic_questioning_framework.md +232 -0
- package/vendor/ars/deep-research/references/source_quality_hierarchy.md +188 -0
- package/vendor/ars/deep-research/references/systematic_review_protocol.md +95 -0
- package/vendor/ars/deep-research/references/systematic_review_toolkit.md +353 -0
- package/vendor/ars/deep-research/templates/evidence_assessment_template.md +127 -0
- package/vendor/ars/deep-research/templates/literature_matrix_template.md +85 -0
- package/vendor/ars/deep-research/templates/preregistration_template.md +318 -0
- package/vendor/ars/deep-research/templates/prisma_protocol_template.md +248 -0
- package/vendor/ars/deep-research/templates/prisma_report_template.md +415 -0
- package/vendor/ars/deep-research/templates/research_brief_template.md +93 -0
- package/vendor/ars/package.json +24 -0
- package/vendor/ars/pi/README.md +161 -0
- package/vendor/ars/pi/package.json +26 -0
- package/vendor/ars/pi/wrapper.js +193 -0
- package/vendor/ars/pi/wrapper.test.mjs +201 -0
- package/vendor/ars/pyproject.toml +2 -0
- package/vendor/ars/requirements-pdf-content-classifier.txt +5 -0
- package/vendor/ars/scripts/_block_parser.py +396 -0
- package/vendor/ars/scripts/_ci_pytest_manifest.toml +661 -0
- package/vendor/ars/scripts/_claim_audit_constants.py +268 -0
- package/vendor/ars/scripts/_e4_evidence.py +110 -0
- package/vendor/ars/scripts/_eval_threshold_gate.py +73 -0
- package/vendor/ars/scripts/_markdown_lint_util.py +224 -0
- package/vendor/ars/scripts/_next_verified_at_ms.py +176 -0
- package/vendor/ars/scripts/_passport_yaml.py +53 -0
- package/vendor/ars/scripts/_skill_lint.py +254 -0
- package/vendor/ars/scripts/_text_similarity.py +141 -0
- package/vendor/ars/scripts/adapters/README.md +89 -0
- package/vendor/ars/scripts/adapters/_common.py +209 -0
- package/vendor/ars/scripts/adapters/examples/folder_scan/expected_passport.yaml +25 -0
- package/vendor/ars/scripts/adapters/examples/folder_scan/expected_rejection_log.yaml +18 -0
- package/vendor/ars/scripts/adapters/examples/folder_scan/input_fixture/Chen2024_AIAssessment.pdf +0 -0
- package/vendor/ars/scripts/adapters/examples/folder_scan/input_fixture/Wang_2023_formative_feedback.pdf +0 -0
- package/vendor/ars/scripts/adapters/examples/folder_scan/input_fixture/paper1.pdf +0 -0
- package/vendor/ars/scripts/adapters/examples/folder_scan/input_fixture//344/270/255/346/226/207/346/252/224/345/220/215_2024.pdf +0 -0
- package/vendor/ars/scripts/adapters/examples/obsidian/expected_passport.yaml +40 -0
- package/vendor/ars/scripts/adapters/examples/obsidian/expected_rejection_log.yaml +13 -0
- package/vendor/ars/scripts/adapters/examples/obsidian/input_fixture/vault/.gitkeep +0 -0
- package/vendor/ars/scripts/adapters/examples/obsidian/input_fixture/vault/.obsidian/app.json +1 -0
- package/vendor/ars/scripts/adapters/examples/obsidian/input_fixture/vault/_templates/tmpl.md +7 -0
- package/vendor/ars/scripts/adapters/examples/obsidian/input_fixture/vault/chen2024ai.md +13 -0
- package/vendor/ars/scripts/adapters/examples/obsidian/input_fixture/vault/invalid.md +1 -0
- package/vendor/ars/scripts/adapters/examples/obsidian/input_fixture/vault/wang2023formative.md +10 -0
- package/vendor/ars/scripts/adapters/examples/zotero/expected_passport.yaml +34 -0
- package/vendor/ars/scripts/adapters/examples/zotero/expected_rejection_log.yaml +34 -0
- package/vendor/ars/scripts/adapters/examples/zotero/input_fixture/.gitkeep +0 -0
- package/vendor/ars/scripts/adapters/examples/zotero/input_fixture/export.json +43 -0
- package/vendor/ars/scripts/adapters/folder_scan.py +214 -0
- package/vendor/ars/scripts/adapters/obsidian.py +336 -0
- package/vendor/ars/scripts/adapters/tests/.gitkeep +0 -0
- package/vendor/ars/scripts/adapters/tests/conftest.py +77 -0
- package/vendor/ars/scripts/adapters/tests/test_check_corpus_consumer_protocol.py +632 -0
- package/vendor/ars/scripts/adapters/tests/test_check_literature_corpus_schema.py +631 -0
- package/vendor/ars/scripts/adapters/tests/test_common.py +365 -0
- package/vendor/ars/scripts/adapters/tests/test_conftest.py +96 -0
- package/vendor/ars/scripts/adapters/tests/test_folder_scan.py +260 -0
- package/vendor/ars/scripts/adapters/tests/test_literature_corpus_entry_schema.py +745 -0
- package/vendor/ars/scripts/adapters/tests/test_obsidian.py +357 -0
- package/vendor/ars/scripts/adapters/tests/test_rejection_log_schema.py +271 -0
- package/vendor/ars/scripts/adapters/tests/test_sync_adapter_docs.py +88 -0
- package/vendor/ars/scripts/adapters/tests/test_zotero.py +454 -0
- package/vendor/ars/scripts/adapters/zotero.py +318 -0
- package/vendor/ars/scripts/adjudication_activity.py +1592 -0
- package/vendor/ars/scripts/announce-ars-loaded.sh +144 -0
- package/vendor/ars/scripts/ars_anchorize_draft.py +170 -0
- package/vendor/ars/scripts/ars_apply_revision_patch.py +912 -0
- package/vendor/ars/scripts/ars_cache_invalidate.py +40 -0
- package/vendor/ars/scripts/ars_mark_read.py +521 -0
- package/vendor/ars/scripts/ars_phase_scope_manifest.json +33 -0
- package/vendor/ars/scripts/ars_update_check.sh +215 -0
- package/vendor/ars/scripts/ars_write_scope_guard.py +506 -0
- package/vendor/ars/scripts/arxiv_client.py +222 -0
- package/vendor/ars/scripts/audit_snapshot.py +572 -0
- package/vendor/ars/scripts/bibliographic_integrity_signals.py +800 -0
- package/vendor/ars/scripts/bootstrap_timeline_yaml.py +146 -0
- package/vendor/ars/scripts/build_claim_standing_candidate_ledger.py +1238 -0
- package/vendor/ars/scripts/build_claim_standing_query_plan.py +643 -0
- package/vendor/ars/scripts/build_content_coverage_advisory.py +1205 -0
- package/vendor/ars/scripts/build_cross_document_consistency_advisory.py +2332 -0
- package/vendor/ars/scripts/build_review_pathway_rule_trace.py +830 -0
- package/vendor/ars/scripts/build_submission_packet_manifest.py +2310 -0
- package/vendor/ars/scripts/check_215_field_norm.py +173 -0
- package/vendor/ars/scripts/check_216_surface_form.py +250 -0
- package/vendor/ars/scripts/check_268_nested_commitment_ledger.py +180 -0
- package/vendor/ars/scripts/check_390_revision_patch_discipline.py +296 -0
- package/vendor/ars/scripts/check_392_citation_verification_intake.py +126 -0
- package/vendor/ars/scripts/check_394_submission_policy.py +178 -0
- package/vendor/ars/scripts/check_439_format_profile.py +307 -0
- package/vendor/ars/scripts/check_619_disclosure_closeout.py +237 -0
- package/vendor/ars/scripts/check_630_codex_subscription_transport.py +456 -0
- package/vendor/ars/scripts/check_669_review_pathway_rule_trace.py +662 -0
- package/vendor/ars/scripts/check_670_revision_roadmap_integration.py +518 -0
- package/vendor/ars/scripts/check_673_adjudication_activity.py +684 -0
- package/vendor/ars/scripts/check_684_review_criteria_binding.py +557 -0
- package/vendor/ars/scripts/check_agents_mirror_sync.py +115 -0
- package/vendor/ars/scripts/check_audit_artifact_consistency.py +2313 -0
- package/vendor/ars/scripts/check_benchmark_report.py +79 -0
- package/vendor/ars/scripts/check_bibliographic_integrity_signals.py +831 -0
- package/vendor/ars/scripts/check_calibration_tiers.py +235 -0
- package/vendor/ars/scripts/check_changelog_covers_merges.py +289 -0
- package/vendor/ars/scripts/check_ci_pytest_manifest.py +204 -0
- package/vendor/ars/scripts/check_claim_audit_consistency.py +1664 -0
- package/vendor/ars/scripts/check_claim_standing_candidate_ledger_integration.py +500 -0
- package/vendor/ars/scripts/check_claim_standing_freshness.py +253 -0
- package/vendor/ars/scripts/check_claim_standing_transmissions.py +449 -0
- package/vendor/ars/scripts/check_collaboration_depth_rubric.py +180 -0
- package/vendor/ars/scripts/check_command_frontmatter_name.py +116 -0
- package/vendor/ars/scripts/check_committee_correspondence.py +333 -0
- package/vendor/ars/scripts/check_compliance_report.py +108 -0
- package/vendor/ars/scripts/check_content_coverage_advisory_integration.py +796 -0
- package/vendor/ars/scripts/check_control_availability.py +172 -0
- package/vendor/ars/scripts/check_corpus_consumer_protocol.py +404 -0
- package/vendor/ars/scripts/check_cross_document_consistency_advisory_integration.py +1191 -0
- package/vendor/ars/scripts/check_cross_model_handoff_contract.py +234 -0
- package/vendor/ars/scripts/check_cross_model_verification_sync.py +261 -0
- package/vendor/ars/scripts/check_data_access_level.py +131 -0
- package/vendor/ars/scripts/check_data_flows.py +252 -0
- package/vendor/ars/scripts/check_decision_contract.py +464 -0
- package/vendor/ars/scripts/check_degradation_registry.py +326 -0
- package/vendor/ars/scripts/check_distribution_surface_claims.py +226 -0
- package/vendor/ars/scripts/check_domain_evidence_profile.py +538 -0
- package/vendor/ars/scripts/check_e4_promotion.py +195 -0
- package/vendor/ars/scripts/check_evals_gold_set.py +279 -0
- package/vendor/ars/scripts/check_evidence_row_integration.py +396 -0
- package/vendor/ars/scripts/check_experiment_provenance.py +117 -0
- package/vendor/ars/scripts/check_field_norm_severity.py +144 -0
- package/vendor/ars/scripts/check_firm_rules_sync.py +375 -0
- package/vendor/ars/scripts/check_heldout_measurement_report.py +1179 -0
- package/vendor/ars/scripts/check_human_subjects_output_contract.py +139 -0
- package/vendor/ars/scripts/check_human_subjects_reference_migration.py +844 -0
- package/vendor/ars/scripts/check_indirect_prompt_injection_no_call.py +328 -0
- package/vendor/ars/scripts/check_instruction_data_boundary.py +236 -0
- package/vendor/ars/scripts/check_judge_prompt_version.py +125 -0
- package/vendor/ars/scripts/check_literature_corpus_schema.py +402 -0
- package/vendor/ars/scripts/check_model_tiering.py +223 -0
- package/vendor/ars/scripts/check_panel_synthesis.py +1331 -0
- package/vendor/ars/scripts/check_passport_reset_contract.py +214 -0
- package/vendor/ars/scripts/check_pattern_eval_manifest.py +422 -0
- package/vendor/ars/scripts/check_persuasion_invariance_fixtures.py +637 -0
- package/vendor/ars/scripts/check_phase_conformance.py +2180 -0
- package/vendor/ars/scripts/check_pipeline_boundary_semantics.py +600 -0
- package/vendor/ars/scripts/check_pipeline_integrity.py +340 -0
- package/vendor/ars/scripts/check_policy_anchor_protocol.py +159 -0
- package/vendor/ars/scripts/check_policy_anchor_table.py +286 -0
- package/vendor/ars/scripts/check_preprint_venues_consistency.py +123 -0
- package/vendor/ars/scripts/check_prisma_trAIce_freshness.py +84 -0
- package/vendor/ars/scripts/check_promotion_bakeoff_preregistration.py +1303 -0
- package/vendor/ars/scripts/check_ranking_lift.py +323 -0
- package/vendor/ars/scripts/check_re_review_synthesis.py +2719 -0
- package/vendor/ars/scripts/check_receipt_enum_sync.py +203 -0
- package/vendor/ars/scripts/check_repro_lock.py +85 -0
- package/vendor/ars/scripts/check_review_pathway_output.py +276 -0
- package/vendor/ars/scripts/check_reviewer_data_fences.py +224 -0
- package/vendor/ars/scripts/check_reviewer_finding_contract.py +783 -0
- package/vendor/ars/scripts/check_reviewer_role_label.py +447 -0
- package/vendor/ars/scripts/check_reviewer_scoring_honesty.py +292 -0
- package/vendor/ars/scripts/check_reviewer_sprint_prompt_sync.py +409 -0
- package/vendor/ars/scripts/check_revision_claim_drift_suite_v2.py +1622 -0
- package/vendor/ars/scripts/check_revision_token_conservation.py +263 -0
- package/vendor/ars/scripts/check_risk_register.py +280 -0
- package/vendor/ars/scripts/check_role_scoped_contract.py +702 -0
- package/vendor/ars/scripts/check_rq_framing_patterns.py +184 -0
- package/vendor/ars/scripts/check_rubric_weight_consistency.py +32 -0
- package/vendor/ars/scripts/check_seeded_defect_fixtures.py +425 -0
- package/vendor/ars/scripts/check_setup_cross_model_parity.py +139 -0
- package/vendor/ars/scripts/check_spec_consistency.py +1249 -0
- package/vendor/ars/scripts/check_sprint_contract.py +371 -0
- package/vendor/ars/scripts/check_stage_capability_matrix.py +784 -0
- package/vendor/ars/scripts/check_submission_packet_manifest_integration.py +358 -0
- package/vendor/ars/scripts/check_surface_form_parity.py +445 -0
- package/vendor/ars/scripts/check_task_type.py +22 -0
- package/vendor/ars/scripts/check_tools_allowlist.py +538 -0
- package/vendor/ars/scripts/check_tortured_phrase_screening_integration.py +1974 -0
- package/vendor/ars/scripts/check_v3_10_134_write_scope.py +286 -0
- package/vendor/ars/scripts/check_v3_10_policy.py +656 -0
- package/vendor/ars/scripts/check_v3_6_6_ab_manifest.py +364 -0
- package/vendor/ars/scripts/check_v3_6_7_pattern_protection.py +1366 -0
- package/vendor/ars/scripts/check_v3_6_8_audit_scope_block.py +464 -0
- package/vendor/ars/scripts/check_v3_6_8_cite_provenance_pipeline.py +231 -0
- package/vendor/ars/scripts/check_v3_6_8_frontmatter_trust_schema.py +248 -0
- package/vendor/ars/scripts/check_v3_6_8_mark_read_commands.py +79 -0
- package/vendor/ars/scripts/check_v3_6_8_pattern_protection.py +941 -0
- package/vendor/ars/scripts/check_v3_7_3_three_layer_citation.py +318 -0
- package/vendor/ars/scripts/check_v3_8_annotation_literal_sync.py +228 -0
- package/vendor/ars/scripts/check_v3_9_0_triangulation.py +366 -0
- package/vendor/ars/scripts/check_v3_9_2_phase_boundary.py +270 -0
- package/vendor/ars/scripts/check_v3_9_4_temporal_verification.py +139 -0
- package/vendor/ars/scripts/check_venue_disclosure_policies.py +63 -0
- package/vendor/ars/scripts/check_version_consistency.py +826 -0
- package/vendor/ars/scripts/check_workflow_classification.py +223 -0
- package/vendor/ars/scripts/chinese_literature_client.py +1938 -0
- package/vendor/ars/scripts/citation_verification_summary.py +85 -0
- package/vendor/ars/scripts/claim_audit_calibration.py +517 -0
- package/vendor/ars/scripts/claim_audit_finalizer.py +456 -0
- package/vendor/ars/scripts/claim_audit_pipeline.py +1594 -0
- package/vendor/ars/scripts/claim_registry_coverage.py +493 -0
- package/vendor/ars/scripts/claim_standing_discovery.py +784 -0
- package/vendor/ars/scripts/claim_standing_stance_runner.py +758 -0
- package/vendor/ars/scripts/claim_standing_stance_scorer.py +239 -0
- package/vendor/ars/scripts/claim_strength_drift_disposition.py +666 -0
- package/vendor/ars/scripts/contamination_signals.py +689 -0
- package/vendor/ars/scripts/corpus_consumer_manifest.json +19 -0
- package/vendor/ars/scripts/cross_model_codex_transport.py +1374 -0
- package/vendor/ars/scripts/cross_model_codex_verify.sh +6 -0
- package/vendor/ars/scripts/cross_model_handoff.py +359 -0
- package/vendor/ars/scripts/cross_model_smoke_test.sh +183 -0
- package/vendor/ars/scripts/cross_model_smoke_test_codex.sh +35 -0
- package/vendor/ars/scripts/cross_model_verification/gemini_is_grounded.jq +45 -0
- package/vendor/ars/scripts/cross_model_verification/gemini_sources.jq +45 -0
- package/vendor/ars/scripts/cross_model_verification/normalize_compat_verdict.py +57 -0
- package/vendor/ars/scripts/cross_model_verification/openai_has_completed_web_search.jq +15 -0
- package/vendor/ars/scripts/cross_model_verification/openai_sources.jq +17 -0
- package/vendor/ars/scripts/cross_model_verification/openai_text.jq +11 -0
- package/vendor/ars/scripts/crossref_client.py +225 -0
- package/vendor/ars/scripts/dispatch_e4_panel.py +2731 -0
- package/vendor/ars/scripts/evidence_rows.py +2043 -0
- package/vendor/ars/scripts/fixtures/adjudication_activity/author_stage3.json +32 -0
- package/vendor/ars/scripts/fixtures/adjudication_activity/author_stage3_input.json +27 -0
- package/vendor/ars/scripts/fixtures/adjudication_activity/author_stage3_prime.json +32 -0
- package/vendor/ars/scripts/fixtures/adjudication_activity/author_stage3_prime_input.json +27 -0
- package/vendor/ars/scripts/fixtures/adjudication_activity/compliance_override.json +50 -0
- package/vendor/ars/scripts/fixtures/adjudication_activity/compliance_override_action.json +14 -0
- package/vendor/ars/scripts/fixtures/adjudication_activity/compliance_pass.json +44 -0
- package/vendor/ars/scripts/fixtures/adjudication_activity/explicit_user_request_log.json +26 -0
- package/vendor/ars/scripts/fixtures/adjudication_activity/mandatory_checkpoint_log.json +116 -0
- package/vendor/ars/scripts/fixtures/audit_artifact_consistency/README.md +56 -0
- package/vendor/ars/scripts/fixtures/audit_artifact_consistency/negative/a1_pass_with_p1/2026-04-30T15-22-04Z-d8f3.audit_artifact_entry.json +24 -0
- package/vendor/ars/scripts/fixtures/audit_artifact_consistency/negative/a1_pass_with_p1/2026-04-30T15-22-04Z-d8f3.jsonl +4 -0
- package/vendor/ars/scripts/fixtures/audit_artifact_consistency/negative/a1_pass_with_p1/2026-04-30T15-22-04Z-d8f3.meta.json +43 -0
- package/vendor/ars/scripts/fixtures/audit_artifact_consistency/negative/a1_pass_with_p1/2026-04-30T15-22-04Z-d8f3.verdict.yaml +19 -0
- package/vendor/ars/scripts/fixtures/audit_artifact_consistency/negative/a7_orphan_completion/2026-04-30T15-22-04Z-d8f3.jsonl +3 -0
- package/vendor/ars/scripts/fixtures/audit_artifact_consistency/positive/persisted_minor/2026-04-30T15-22-04Z-d8f3.audit_artifact_entry.json +26 -0
- package/vendor/ars/scripts/fixtures/audit_artifact_consistency/positive/persisted_minor/2026-04-30T15-22-04Z-d8f3.jsonl +4 -0
- package/vendor/ars/scripts/fixtures/audit_artifact_consistency/positive/persisted_minor/2026-04-30T15-22-04Z-d8f3.meta.json +43 -0
- package/vendor/ars/scripts/fixtures/audit_artifact_consistency/positive/persisted_minor/2026-04-30T15-22-04Z-d8f3.verdict.yaml +19 -0
- package/vendor/ars/scripts/fixtures/audit_artifact_consistency/positive/proposal_pass/2026-04-30T15-22-04Z-d8f3.audit_artifact_entry.json +24 -0
- package/vendor/ars/scripts/fixtures/audit_artifact_consistency/positive/proposal_pass/2026-04-30T15-22-04Z-d8f3.jsonl +4 -0
- package/vendor/ars/scripts/fixtures/audit_artifact_consistency/positive/proposal_pass/2026-04-30T15-22-04Z-d8f3.meta.json +43 -0
- package/vendor/ars/scripts/fixtures/audit_artifact_consistency/positive/proposal_pass/2026-04-30T15-22-04Z-d8f3.verdict.yaml +12 -0
- package/vendor/ars/scripts/fixtures/bibliographic_integrity_signals/retraction.json +46 -0
- package/vendor/ars/scripts/fixtures/bibliographic_integrity_signals/retraction_check_attestation.json +44 -0
- package/vendor/ars/scripts/fixtures/bibliographic_integrity_signals/tortured_phrase.json +44 -0
- package/vendor/ars/scripts/fixtures/bibliographic_integrity_signals/tortured_phrase_v1_2_abstract_missing.json +107 -0
- package/vendor/ars/scripts/fixtures/bibliographic_integrity_signals/tortured_phrase_v1_2_detected.json +124 -0
- package/vendor/ars/scripts/fixtures/check_evals_gold_set/clean/expected_outcomes.json +77 -0
- package/vendor/ars/scripts/fixtures/check_evals_gold_set/clean/manifest.yaml +37 -0
- package/vendor/ars/scripts/fixtures/check_evals_gold_set/clean/tuples/001-valid-doi-test.json +20 -0
- package/vendor/ars/scripts/fixtures/check_evals_gold_set/clean/tuples/002-valid-arxiv-test.json +19 -0
- package/vendor/ars/scripts/fixtures/check_evals_gold_set/clean/tuples/003-fabricated-test.json +20 -0
- package/vendor/ars/scripts/fixtures/claim_audit_calibration/gold_set.json +344 -0
- package/vendor/ars/scripts/fixtures/claim_standing_candidate_ledger/query_plan.json +108 -0
- package/vendor/ars/scripts/fixtures/claim_standing_candidate_ledger/retrieval_input.json +179 -0
- package/vendor/ars/scripts/fixtures/committee_correspondence/16fd83f6aec7/concern_tracker.json +129 -0
- package/vendor/ars/scripts/fixtures/committee_correspondence/16fd83f6aec7/response_skeleton.md +19 -0
- package/vendor/ars/scripts/fixtures/committee_correspondence/16fd83f6aec7/source_letter.txt +9 -0
- package/vendor/ars/scripts/fixtures/content_coverage_advisory/base_draft.json +48 -0
- package/vendor/ars/scripts/fixtures/content_coverage_advisory/base_inventory.json +38 -0
- package/vendor/ars/scripts/fixtures/content_coverage_advisory/packet/consent.txt +1 -0
- package/vendor/ars/scripts/fixtures/content_coverage_advisory/session_sources.json +3 -0
- package/vendor/ars/scripts/fixtures/cross_document_consistency/README.md +6 -0
- package/vendor/ars/scripts/fixtures/cross_document_consistency/accepted_draft.md +35 -0
- package/vendor/ars/scripts/fixtures/cross_document_consistency/cases.json +75 -0
- package/vendor/ars/scripts/fixtures/cross_document_consistency/preregistration.md +5 -0
- package/vendor/ars/scripts/fixtures/cross_model_codex_transport/forbidden_event.jsonl +4 -0
- package/vendor/ars/scripts/fixtures/cross_model_codex_transport/grounded_verified.jsonl +3 -0
- package/vendor/ars/scripts/fixtures/cross_model_codex_transport/malformed.jsonl +3 -0
- package/vendor/ars/scripts/fixtures/cross_model_codex_transport/missing_search.jsonl +2 -0
- package/vendor/ars/scripts/fixtures/cross_model_codex_transport/multiple_finals.jsonl +4 -0
- package/vendor/ars/scripts/fixtures/cross_model_codex_transport/not_found.jsonl +3 -0
- package/vendor/ars/scripts/fixtures/cross_model_codex_transport/unbound_source.jsonl +3 -0
- package/vendor/ars/scripts/fixtures/cross_model_codex_transport/wrong_search_shape.jsonl +3 -0
- package/vendor/ars/scripts/fixtures/evidence_rows/phase_e_inputs.json +114 -0
- package/vendor/ars/scripts/fixtures/evidence_rows/session_sources.json +5 -0
- package/vendor/ars/scripts/fixtures/human_subjects_authority/cross-border-us-tw-gdpr.json +71 -0
- package/vendor/ars/scripts/fixtures/human_subjects_authority/gdpr-member-state-unresolved.json +62 -0
- package/vendor/ars/scripts/fixtures/human_subjects_authority/missing-data-axis.json +45 -0
- package/vendor/ars/scripts/fixtures/human_subjects_authority/no-profile.json +33 -0
- package/vendor/ars/scripts/fixtures/human_subjects_authority/tw-gdpr-two-axis.json +74 -0
- package/vendor/ars/scripts/fixtures/human_subjects_authority/us-gdpr-two-axis.json +74 -0
- package/vendor/ars/scripts/fixtures/review_pathway_rule_trace/lint-near-misses.json +72 -0
- package/vendor/ars/scripts/fixtures/review_pathway_rule_trace/no-profile-request.json +18 -0
- package/vendor/ars/scripts/fixtures/review_pathway_rule_trace/tw-candidates-request.json +63 -0
- package/vendor/ars/scripts/fixtures/review_pathway_rule_trace/us-candidates-request.json +77 -0
- package/vendor/ars/scripts/fixtures/review_target_context/exact-declaration.json +24 -0
- package/vendor/ars/scripts/fixtures/review_target_context/field-general-declaration.json +24 -0
- package/vendor/ars/scripts/fixtures/review_target_context/msr-2027-technical-full-declaration.json +24 -0
- package/vendor/ars/scripts/fixtures/review_target_context/synthetic-registry.json +92 -0
- package/vendor/ars/scripts/fixtures/revision_claim_drift_v2/README.md +21 -0
- package/vendor/ars/scripts/fixtures/revision_claim_drift_v2/subject_context_attested_only.json +55 -0
- package/vendor/ars/scripts/fixtures/revision_claim_drift_v2/subject_context_machine_supported.json +49 -0
- package/vendor/ars/scripts/fixtures/revision_claim_drift_v2/subject_context_not_isolated.json +56 -0
- package/vendor/ars/scripts/fixtures/revision_claim_drift_v2/subject_context_unknown.json +49 -0
- package/vendor/ars/scripts/fixtures/submission_package/clean/paper.md +16 -0
- package/vendor/ars/scripts/fixtures/submission_package/clean/references.bib +13 -0
- package/vendor/ars/scripts/fixtures/submission_package/fallback_authoryear/paper.md +11 -0
- package/vendor/ars/scripts/fixtures/submission_package/fallback_authoryear/references.bib +13 -0
- package/vendor/ars/scripts/fixtures/submission_package/fallback_latex/paper.tex +9 -0
- package/vendor/ars/scripts/fixtures/submission_package/fallback_latex/references.bib +13 -0
- package/vendor/ars/scripts/fixtures/submission_package/marker_no_join/paper.md +7 -0
- package/vendor/ars/scripts/fixtures/submission_package/orphan_intext/paper.md +8 -0
- package/vendor/ars/scripts/fixtures/submission_package/orphan_intext/references.bib +6 -0
- package/vendor/ars/scripts/fixtures/submission_package/passports/corpus_only.yaml +9 -0
- package/vendor/ars/scripts/fixtures/submission_package/passports/summary_join.yaml +16 -0
- package/vendor/ars/scripts/fixtures/submission_package/profiles/full.yaml +15 -0
- package/vendor/ars/scripts/fixtures/submission_package/profiles/tight.yaml +15 -0
- package/vendor/ars/scripts/fixtures/submission_package/summary_join/paper.md +7 -0
- package/vendor/ars/scripts/fixtures/submission_package/uncited_reference/paper.md +9 -0
- package/vendor/ars/scripts/fixtures/submission_package/uncited_reference/references.bib +13 -0
- package/vendor/ars/scripts/fixtures/submission_package/venue_clean/paper.md +26 -0
- package/vendor/ars/scripts/fixtures/submission_package/venue_clean/references.bib +13 -0
- package/vendor/ars/scripts/fixtures/submission_package/venue_violations/paper.md +20 -0
- package/vendor/ars/scripts/fixtures/submission_package/venue_violations/references.bib +13 -0
- package/vendor/ars/scripts/fixtures/submission_packet_manifest/base_inventory.json +101 -0
- package/vendor/ars/scripts/fixtures/submission_packet_manifest/packet/consent-materials.txt +3 -0
- package/vendor/ars/scripts/fixtures/submission_packet_manifest/packet/training-certificate.txt +2 -0
- package/vendor/ars/scripts/fixtures/submission_packet_manifest/packet/tw-consent-materials.txt +3 -0
- package/vendor/ars/scripts/fixtures/tortured_phrase_screening/corpus_input.yaml +30 -0
- package/vendor/ars/scripts/fixtures/tortured_phrase_screening/own_draft.md +36 -0
- package/vendor/ars/scripts/fixtures/tortured_phrase_screening/own_draft.tex +21 -0
- package/vendor/ars/scripts/fixtures/tortured_phrase_screening/seed_expectations.json +218 -0
- package/vendor/ars/scripts/fixtures/tortured_phrase_screening/snapshot.json +164 -0
- package/vendor/ars/scripts/fixtures/tortured_phrase_screening/snapshot_manifest.json +29 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/README.md +55 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/arxiv/empty_feed.xml +10 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/arxiv/error_5xx.html +7 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/arxiv/id_hit.xml +26 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/chinese_literature/README.md +69 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/chinese_literature/cnki_landing_page.html +13 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/chinese_literature/error_5xx.html +2 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/chinese_literature/esearch_coordinate_ambiguous.json +16 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/chinese_literature/esearch_coordinate_hit.json +16 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/chinese_literature/esearch_coordinate_zero.json +14 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/chinese_literature/esearch_coverage_hit.json +15 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/chinese_literature/esearch_coverage_zero.json +13 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/chinese_literature/esummary_hit.json +43 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/chinese_literature/esummary_issn_mismatch.json +31 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/chinese_literature/esummary_no_doi.json +31 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/chinese_literature/esummary_unknown_ra.json +34 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/chinese_literature/esummary_year_mismatch.json +31 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/chinese_literature/handle_absent.json +4 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/chinese_literature/handle_exists.json +16 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/chinese_literature/handle_internal_error.json +4 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/chinese_literature/istic_csl_hit.json +25 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/chinese_literature/istic_csl_other_title.json +18 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/chinese_literature/ra_cnki.json +6 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/chinese_literature/ra_crossref.json +6 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/chinese_literature/ra_istic.json +6 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/chinese_literature/ra_unknown_prefix.json +6 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/crossref/doi_hit.json +24 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/crossref/error_5xx.html +7 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/crossref/title_search_miss.json +15 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/openalex/doi_hit.json +29 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/openalex/error_5xx.json +4 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/openalex/title_search_miss.json +11 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/semantic_scholar/doi_hit.json +14 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/semantic_scholar/error_5xx.json +3 -0
- package/vendor/ars/scripts/fixtures/transport_bodies/semantic_scholar/title_search_miss.json +5 -0
- package/vendor/ars/scripts/human_read_attestation_resolver.py +467 -0
- package/vendor/ars/scripts/ideation_diversity_assignment_gate.py +430 -0
- package/vendor/ars/scripts/inquiry_branch_ledger.py +2540 -0
- package/vendor/ars/scripts/legacy/ars_apply_revision_patch_v1_0.py +715 -0
- package/vendor/ars/scripts/legacy/check_re_review_synthesis_v1_0.py +2215 -0
- package/vendor/ars/scripts/migrate_literature_corpus_to_v3_10.py +223 -0
- package/vendor/ars/scripts/migrate_literature_corpus_to_v3_7_3.py +277 -0
- package/vendor/ars/scripts/migrate_literature_corpus_to_v3_9_0.py +304 -0
- package/vendor/ars/scripts/model_tiering_manifest.json +46 -0
- package/vendor/ars/scripts/openalex_client.py +232 -0
- package/vendor/ars/scripts/parse_audit_verdict.py +802 -0
- package/vendor/ars/scripts/pdf_content_classifier_worker.py +176 -0
- package/vendor/ars/scripts/pdf_read_preflight.py +1455 -0
- package/vendor/ars/scripts/policy_anchor_disclosure_referee.py +354 -0
- package/vendor/ars/scripts/recompute_receipts.py +1414 -0
- package/vendor/ars/scripts/render_claim_standing_view.py +374 -0
- package/vendor/ars/scripts/render_eval_comment.py +130 -0
- package/vendor/ars/scripts/render_harness_retirement_issue.py +167 -0
- package/vendor/ars/scripts/repro_lock_validation.py +90 -0
- package/vendor/ars/scripts/research_workflow_profile.py +1079 -0
- package/vendor/ars/scripts/resolve_human_subjects_authority.py +1158 -0
- package/vendor/ars/scripts/resolve_review_target_context.py +683 -0
- package/vendor/ars/scripts/resume_e4_record.py +509 -0
- package/vendor/ars/scripts/retraction_status.py +484 -0
- package/vendor/ars/scripts/review_criteria_binding.py +889 -0
- package/vendor/ars/scripts/review_panel_provenance.py +744 -0
- package/vendor/ars/scripts/revision_roadmap.py +1967 -0
- package/vendor/ars/scripts/run_ci_pytest_manifest.py +116 -0
- package/vendor/ars/scripts/run_codex_audit.sh +1191 -0
- package/vendor/ars/scripts/run_evals.py +513 -0
- package/vendor/ars/scripts/run_ideation_diversity_no_call.py +3505 -0
- package/vendor/ars/scripts/run_indirect_prompt_injection_no_call.py +3330 -0
- package/vendor/ars/scripts/run_indirect_prompt_injection_probe.py +399 -0
- package/vendor/ars/scripts/run_review_criteria_constructive_value.py +1895 -0
- package/vendor/ars/scripts/run_role_topology_utility_dry_run.py +606 -0
- package/vendor/ars/scripts/score_review_criteria_constructive_value.py +617 -0
- package/vendor/ars/scripts/semantic_scholar_client.py +291 -0
- package/vendor/ars/scripts/slr_lineage.py +59 -0
- package/vendor/ars/scripts/sync_adapter_docs.py +118 -0
- package/vendor/ars/scripts/temporal_integrity_audit.py +840 -0
- package/vendor/ars/scripts/test_431_exact_or_bust.py +253 -0
- package/vendor/ars/scripts/test__eval_threshold_gate.py +125 -0
- package/vendor/ars/scripts/test__markdown_lint_util.py +129 -0
- package/vendor/ars/scripts/test__next_verified_at_ms.py +256 -0
- package/vendor/ars/scripts/test_adjacent_framing_probe_lint.py +171 -0
- package/vendor/ars/scripts/test_adjudication_activity.py +1515 -0
- package/vendor/ars/scripts/test_ars_anchorize_draft.py +178 -0
- package/vendor/ars/scripts/test_ars_apply_revision_patch.py +1335 -0
- package/vendor/ars/scripts/test_ars_cache_invalidate.py +51 -0
- package/vendor/ars/scripts/test_ars_mark_read.py +910 -0
- package/vendor/ars/scripts/test_ars_update_check.py +816 -0
- package/vendor/ars/scripts/test_ars_write_scope_guard.py +790 -0
- package/vendor/ars/scripts/test_arxiv_client.py +374 -0
- package/vendor/ars/scripts/test_audit_schemas.py +560 -0
- package/vendor/ars/scripts/test_audit_snapshot_render_section_0.py +105 -0
- package/vendor/ars/scripts/test_block_parser.py +259 -0
- package/vendor/ars/scripts/test_bootstrap_timeline_yaml.py +148 -0
- package/vendor/ars/scripts/test_build_claim_standing_candidate_ledger.py +1203 -0
- package/vendor/ars/scripts/test_build_claim_standing_query_plan.py +791 -0
- package/vendor/ars/scripts/test_build_submission_packet_manifest.py +2644 -0
- package/vendor/ars/scripts/test_check_215_field_norm.py +238 -0
- package/vendor/ars/scripts/test_check_216_surface_form.py +341 -0
- package/vendor/ars/scripts/test_check_268_nested_commitment_ledger.py +194 -0
- package/vendor/ars/scripts/test_check_390_revision_patch_discipline.py +279 -0
- package/vendor/ars/scripts/test_check_392_citation_verification_intake.py +144 -0
- package/vendor/ars/scripts/test_check_394_submission_policy.py +200 -0
- package/vendor/ars/scripts/test_check_439_format_profile.py +252 -0
- package/vendor/ars/scripts/test_check_619_disclosure_closeout.py +158 -0
- package/vendor/ars/scripts/test_check_630_codex_subscription_transport.py +245 -0
- package/vendor/ars/scripts/test_check_669_review_pathway_rule_trace.py +304 -0
- package/vendor/ars/scripts/test_check_670_revision_roadmap_integration.py +260 -0
- package/vendor/ars/scripts/test_check_673_adjudication_activity.py +367 -0
- package/vendor/ars/scripts/test_check_684_review_criteria_binding.py +274 -0
- package/vendor/ars/scripts/test_check_agents_mirror_sync.py +137 -0
- package/vendor/ars/scripts/test_check_audit_artifact_consistency.py +2133 -0
- package/vendor/ars/scripts/test_check_benchmark_report.py +117 -0
- package/vendor/ars/scripts/test_check_bibliographic_integrity_signals.py +609 -0
- package/vendor/ars/scripts/test_check_calibration_tiers.py +376 -0
- package/vendor/ars/scripts/test_check_changelog_covers_merges.py +509 -0
- package/vendor/ars/scripts/test_check_ci_pytest_manifest.py +425 -0
- package/vendor/ars/scripts/test_check_claim_standing_candidate_ledger_integration.py +256 -0
- package/vendor/ars/scripts/test_check_claim_standing_freshness.py +277 -0
- package/vendor/ars/scripts/test_check_collaboration_depth_rubric.py +239 -0
- package/vendor/ars/scripts/test_check_command_frontmatter_name.py +178 -0
- package/vendor/ars/scripts/test_check_committee_correspondence.py +298 -0
- package/vendor/ars/scripts/test_check_compliance_report.py +381 -0
- package/vendor/ars/scripts/test_check_content_coverage_advisory_integration.py +308 -0
- package/vendor/ars/scripts/test_check_control_availability.py +361 -0
- package/vendor/ars/scripts/test_check_cross_document_consistency_advisory_integration.py +698 -0
- package/vendor/ars/scripts/test_check_cross_model_handoff_contract.py +301 -0
- package/vendor/ars/scripts/test_check_cross_model_verification_sync.py +203 -0
- package/vendor/ars/scripts/test_check_data_access_level.py +227 -0
- package/vendor/ars/scripts/test_check_data_flows.py +382 -0
- package/vendor/ars/scripts/test_check_decision_contract.py +387 -0
- package/vendor/ars/scripts/test_check_degradation_registry.py +270 -0
- package/vendor/ars/scripts/test_check_distribution_surface_claims.py +225 -0
- package/vendor/ars/scripts/test_check_domain_evidence_profile.py +439 -0
- package/vendor/ars/scripts/test_check_e4_promotion.py +163 -0
- package/vendor/ars/scripts/test_check_evals_gold_set.py +312 -0
- package/vendor/ars/scripts/test_check_evidence_row_integration.py +187 -0
- package/vendor/ars/scripts/test_check_field_norm_severity.py +173 -0
- package/vendor/ars/scripts/test_check_firm_rules_sync.py +342 -0
- package/vendor/ars/scripts/test_check_heldout_measurement_report.py +1508 -0
- package/vendor/ars/scripts/test_check_human_subjects_output_contract.py +129 -0
- package/vendor/ars/scripts/test_check_human_subjects_reference_migration.py +756 -0
- package/vendor/ars/scripts/test_check_instruction_data_boundary.py +204 -0
- package/vendor/ars/scripts/test_check_judge_prompt_version.py +90 -0
- package/vendor/ars/scripts/test_check_model_tiering.py +236 -0
- package/vendor/ars/scripts/test_check_panel_synthesis.py +1658 -0
- package/vendor/ars/scripts/test_check_passport_reset_contract.py +249 -0
- package/vendor/ars/scripts/test_check_pattern_eval_manifest.py +381 -0
- package/vendor/ars/scripts/test_check_persuasion_invariance_fixtures.py +591 -0
- package/vendor/ars/scripts/test_check_phase_conformance.py +4366 -0
- package/vendor/ars/scripts/test_check_pipeline_boundary_semantics.py +931 -0
- package/vendor/ars/scripts/test_check_pipeline_integrity.py +243 -0
- package/vendor/ars/scripts/test_check_policy_anchor_protocol.py +236 -0
- package/vendor/ars/scripts/test_check_policy_anchor_table.py +295 -0
- package/vendor/ars/scripts/test_check_prisma_trAIce_freshness.py +68 -0
- package/vendor/ars/scripts/test_check_promotion_bakeoff_preregistration.py +799 -0
- package/vendor/ars/scripts/test_check_ranking_lift.py +377 -0
- package/vendor/ars/scripts/test_check_re_review_synthesis.py +3398 -0
- package/vendor/ars/scripts/test_check_receipt_enum_sync.py +176 -0
- package/vendor/ars/scripts/test_check_repro_lock.py +107 -0
- package/vendor/ars/scripts/test_check_reviewer_data_fences.py +334 -0
- package/vendor/ars/scripts/test_check_reviewer_finding_contract.py +1107 -0
- package/vendor/ars/scripts/test_check_reviewer_role_label.py +491 -0
- package/vendor/ars/scripts/test_check_reviewer_scoring_honesty.py +222 -0
- package/vendor/ars/scripts/test_check_reviewer_sprint_prompt_sync.py +373 -0
- package/vendor/ars/scripts/test_check_revision_claim_drift_suite_v2.py +1925 -0
- package/vendor/ars/scripts/test_check_revision_token_conservation.py +398 -0
- package/vendor/ars/scripts/test_check_risk_register.py +336 -0
- package/vendor/ars/scripts/test_check_role_scoped_contract.py +1104 -0
- package/vendor/ars/scripts/test_check_rq_framing_patterns.py +110 -0
- package/vendor/ars/scripts/test_check_rubric_weight_consistency.py +32 -0
- package/vendor/ars/scripts/test_check_seeded_defect_fixtures.py +392 -0
- package/vendor/ars/scripts/test_check_setup_cross_model_parity.py +121 -0
- package/vendor/ars/scripts/test_check_spec_consistency.py +1081 -0
- package/vendor/ars/scripts/test_check_sprint_contract.py +458 -0
- package/vendor/ars/scripts/test_check_stage_capability_matrix.py +698 -0
- package/vendor/ars/scripts/test_check_submission_packet_manifest_integration.py +177 -0
- package/vendor/ars/scripts/test_check_surface_form_parity.py +417 -0
- package/vendor/ars/scripts/test_check_task_type.py +116 -0
- package/vendor/ars/scripts/test_check_tools_allowlist.py +835 -0
- package/vendor/ars/scripts/test_check_tortured_phrase_screening_integration.py +1306 -0
- package/vendor/ars/scripts/test_check_v3_10_134_write_scope.py +251 -0
- package/vendor/ars/scripts/test_check_v3_10_policy.py +547 -0
- package/vendor/ars/scripts/test_check_v3_6_7_pattern_protection.py +960 -0
- package/vendor/ars/scripts/test_check_v3_6_8_audit_scope_block.py +1000 -0
- package/vendor/ars/scripts/test_check_v3_6_8_cite_provenance_pipeline.py +454 -0
- package/vendor/ars/scripts/test_check_v3_6_8_frontmatter_trust_schema.py +581 -0
- package/vendor/ars/scripts/test_check_v3_6_8_mark_read_commands.py +120 -0
- package/vendor/ars/scripts/test_check_v3_6_8_pattern_protection.py +1138 -0
- package/vendor/ars/scripts/test_check_v3_7_3_three_layer_citation.py +566 -0
- package/vendor/ars/scripts/test_check_v3_8_annotation_literal_sync.py +262 -0
- package/vendor/ars/scripts/test_check_v3_9_0_triangulation.py +321 -0
- package/vendor/ars/scripts/test_check_v3_9_2_phase_boundary.py +190 -0
- package/vendor/ars/scripts/test_check_v3_9_4_temporal_verification.py +471 -0
- package/vendor/ars/scripts/test_check_version_consistency.py +1462 -0
- package/vendor/ars/scripts/test_check_workflow_classification.py +225 -0
- package/vendor/ars/scripts/test_chinese_literature_client.py +1889 -0
- package/vendor/ars/scripts/test_citation_existence_policy.py +480 -0
- package/vendor/ars/scripts/test_citation_verification_summary.py +342 -0
- package/vendor/ars/scripts/test_claim_audit_calibration.py +882 -0
- package/vendor/ars/scripts/test_claim_audit_finalizer.py +979 -0
- package/vendor/ars/scripts/test_claim_audit_pipeline.py +2398 -0
- package/vendor/ars/scripts/test_claim_audit_schema.py +1778 -0
- package/vendor/ars/scripts/test_claim_intent_manifest.py +666 -0
- package/vendor/ars/scripts/test_claim_registry_coverage.py +246 -0
- package/vendor/ars/scripts/test_claim_standing_discovery.py +579 -0
- package/vendor/ars/scripts/test_claim_standing_pipeline_wiring.py +290 -0
- package/vendor/ars/scripts/test_claim_standing_stance_assets.py +399 -0
- package/vendor/ars/scripts/test_claim_standing_stance_contracts.py +383 -0
- package/vendor/ars/scripts/test_claim_standing_stance_runner.py +349 -0
- package/vendor/ars/scripts/test_claim_standing_transmissions.py +605 -0
- package/vendor/ars/scripts/test_claim_strength_drift_disposition.py +517 -0
- package/vendor/ars/scripts/test_claim_verification_coverage_contract.py +104 -0
- package/vendor/ars/scripts/test_contamination_signals.py +1086 -0
- package/vendor/ars/scripts/test_content_coverage_advisory.py +1767 -0
- package/vendor/ars/scripts/test_cross_document_consistency_advisory.py +1270 -0
- package/vendor/ars/scripts/test_cross_model_codex_transport.py +1152 -0
- package/vendor/ars/scripts/test_cross_model_handoff.py +571 -0
- package/vendor/ars/scripts/test_cross_model_verification_guards.py +792 -0
- package/vendor/ars/scripts/test_crossref_client.py +393 -0
- package/vendor/ars/scripts/test_dispatch_e4_panel.py +4235 -0
- package/vendor/ars/scripts/test_e2e_claim_audit.py +540 -0
- package/vendor/ars/scripts/test_eval_harness_workflow.py +140 -0
- package/vendor/ars/scripts/test_evals_citation_extraction.py +150 -0
- package/vendor/ars/scripts/test_evals_lift_report_schema.py +108 -0
- package/vendor/ars/scripts/test_evidence_rows.py +2593 -0
- package/vendor/ars/scripts/test_experiment_provenance.py +915 -0
- package/vendor/ars/scripts/test_human_read_attestation_resolver.py +477 -0
- package/vendor/ars/scripts/test_ideation_diversity_assignment_gate.py +615 -0
- package/vendor/ars/scripts/test_indirect_prompt_injection_behavior_probe.py +250 -0
- package/vendor/ars/scripts/test_inquiry_branch_ledger.py +2296 -0
- package/vendor/ars/scripts/test_migrate_literature_corpus_to_v3_10.py +248 -0
- package/vendor/ars/scripts/test_migrate_literature_corpus_to_v3_7_3.py +545 -0
- package/vendor/ars/scripts/test_migrate_literature_corpus_to_v3_9_0.py +497 -0
- package/vendor/ars/scripts/test_normalize_compat_verdict.py +149 -0
- package/vendor/ars/scripts/test_openalex_client.py +490 -0
- package/vendor/ars/scripts/test_passport_yaml.py +104 -0
- package/vendor/ars/scripts/test_pattern_eval_runtime.py +1295 -0
- package/vendor/ars/scripts/test_pdf_read_preflight.py +1943 -0
- package/vendor/ars/scripts/test_policy_anchor_disclosure.py +666 -0
- package/vendor/ars/scripts/test_reading_probe_lint.py +218 -0
- package/vendor/ars/scripts/test_recompute_receipts.py +778 -0
- package/vendor/ars/scripts/test_render_claim_standing_view.py +192 -0
- package/vendor/ars/scripts/test_render_eval_comment.py +162 -0
- package/vendor/ars/scripts/test_render_harness_retirement_issue.py +110 -0
- package/vendor/ars/scripts/test_repro_lock_validation_drift.py +100 -0
- package/vendor/ars/scripts/test_research_workflow_profile.py +734 -0
- package/vendor/ars/scripts/test_resolve_human_subjects_authority.py +1219 -0
- package/vendor/ars/scripts/test_resolve_review_target_context.py +703 -0
- package/vendor/ars/scripts/test_resume_e4_record.py +315 -0
- package/vendor/ars/scripts/test_retraction_status.py +456 -0
- package/vendor/ars/scripts/test_review_criteria_binding.py +629 -0
- package/vendor/ars/scripts/test_review_panel_provenance.py +565 -0
- package/vendor/ars/scripts/test_review_pathway_rule_trace.py +821 -0
- package/vendor/ars/scripts/test_revision_roadmap.py +1255 -0
- package/vendor/ars/scripts/test_run_ci_pytest_manifest.py +186 -0
- package/vendor/ars/scripts/test_run_codex_audit_e2e.py +369 -0
- package/vendor/ars/scripts/test_run_evals.py +430 -0
- package/vendor/ars/scripts/test_run_guard_launcher.py +500 -0
- package/vendor/ars/scripts/test_run_ideation_diversity_no_call.py +1833 -0
- package/vendor/ars/scripts/test_run_indirect_prompt_injection_no_call.py +1889 -0
- package/vendor/ars/scripts/test_run_review_criteria_constructive_value.py +586 -0
- package/vendor/ars/scripts/test_run_role_topology_utility_dry_run.py +428 -0
- package/vendor/ars/scripts/test_score_review_criteria_constructive_value.py +340 -0
- package/vendor/ars/scripts/test_semantic_scholar_client.py +554 -0
- package/vendor/ars/scripts/test_slr_lineage_emission.py +230 -0
- package/vendor/ars/scripts/test_socratic_rq_non_generation_contract.py +173 -0
- package/vendor/ars/scripts/test_temporal_integrity_audit.py +438 -0
- package/vendor/ars/scripts/test_text_similarity.py +95 -0
- package/vendor/ars/scripts/test_title_fuzzy_false_positive.py +111 -0
- package/vendor/ars/scripts/test_tortured_phrase_screening.py +2959 -0
- package/vendor/ars/scripts/test_transport_fixture_citation_gate.py +338 -0
- package/vendor/ars/scripts/test_uncited_assertion.py +558 -0
- package/vendor/ars/scripts/test_v3_6_7_phase_6_6.py +1279 -0
- package/vendor/ars/scripts/test_validate_compliance_fixtures.py +36 -0
- package/vendor/ars/scripts/test_validate_ideation_diversity_assets.py +230 -0
- package/vendor/ars/scripts/test_venue_disclosure_contract.py +755 -0
- package/vendor/ars/scripts/test_verification_cache.py +280 -0
- package/vendor/ars/scripts/test_verification_gate.py +461 -0
- package/vendor/ars/scripts/test_verify_passport_cli.py +123 -0
- package/vendor/ars/scripts/test_verify_submission_package.py +1407 -0
- package/vendor/ars/scripts/test_version_records_schema.py +211 -0
- package/vendor/ars/scripts/tortured_phrase_screening.py +3502 -0
- package/vendor/ars/scripts/uncited_assertion_detector.py +254 -0
- package/vendor/ars/scripts/v3_6_7_inversion_manifest.json +9 -0
- package/vendor/ars/scripts/v3_6_8_inversion_manifest.json +10 -0
- package/vendor/ars/scripts/validate_claim_standing_stance_assets.py +249 -0
- package/vendor/ars/scripts/validate_compliance_fixtures.py +56 -0
- package/vendor/ars/scripts/validate_ideation_diversity_assets.py +303 -0
- package/vendor/ars/scripts/venue_disclosure_contract_harness.py +837 -0
- package/vendor/ars/scripts/verification_cache.py +276 -0
- package/vendor/ars/scripts/verification_gate/__init__.py +345 -0
- package/vendor/ars/scripts/verify_passport.py +133 -0
- package/vendor/ars/scripts/verify_submission_package.py +1657 -0
- package/vendor/ars/shared/agents/compliance_agent.md +136 -0
- package/vendor/ars/shared/artifact_reproducibility_pattern.md +173 -0
- package/vendor/ars/shared/benchmark_report.schema.json +81 -0
- package/vendor/ars/shared/benchmark_report_pattern.md +180 -0
- package/vendor/ars/shared/bibliographic_integrity_signals.md +142 -0
- package/vendor/ars/shared/collaboration_depth_rubric.md +154 -0
- package/vendor/ars/shared/compliance_checkpoint_protocol.md +162 -0
- package/vendor/ars/shared/compliance_report.schema.json +187 -0
- package/vendor/ars/shared/contracts/README.md +938 -0
- package/vendor/ars/shared/contracts/activity/adjudication_activity_input.schema.json +555 -0
- package/vendor/ars/shared/contracts/activity/adjudication_activity_store.schema.json +560 -0
- package/vendor/ars/shared/contracts/audit/audit_jsonl.schema.json +128 -0
- package/vendor/ars/shared/contracts/audit/audit_sidecar.schema.json +169 -0
- package/vendor/ars/shared/contracts/audit/audit_verdict.schema.json +133 -0
- package/vendor/ars/shared/contracts/audit/cross_document_consistency_advisory.schema.json +480 -0
- package/vendor/ars/shared/contracts/audit/cross_document_consistency_advisory_draft.schema.json +564 -0
- package/vendor/ars/shared/contracts/audit/cross_document_source_manifest.schema.json +202 -0
- package/vendor/ars/shared/contracts/audit/tortured_phrase_advisory.schema.json +1362 -0
- package/vendor/ars/shared/contracts/audit/tortured_phrase_snapshot.schema.json +208 -0
- package/vendor/ars/shared/contracts/audit/tortured_phrase_snapshot_manifest.schema.json +335 -0
- package/vendor/ars/shared/contracts/capability/stage_capability_matrix.json +434 -0
- package/vendor/ars/shared/contracts/claim_standing/candidate_ledger.schema.json +705 -0
- package/vendor/ars/shared/contracts/claim_standing/query_plan.schema.json +389 -0
- package/vendor/ars/shared/contracts/claim_standing/query_plan_v1_1.schema.json +782 -0
- package/vendor/ars/shared/contracts/claim_standing/retrieval_input.schema.json +440 -0
- package/vendor/ars/shared/contracts/claim_standing/stance_record.schema.json +460 -0
- package/vendor/ars/shared/contracts/claim_standing/transmission_ledger.schema.json +282 -0
- package/vendor/ars/shared/contracts/cross_model/codex_citation_receipt.schema.json +157 -0
- package/vendor/ars/shared/contracts/cross_model/codex_citation_request.schema.json +23 -0
- package/vendor/ars/shared/contracts/cross_model/promotion_bakeoff_sealed_commitment.schema.json +55 -0
- package/vendor/ars/shared/contracts/cross_model/promotion_bakeoff_sealed_reveal.schema.json +50 -0
- package/vendor/ars/shared/contracts/degradation_registry.json +428 -0
- package/vendor/ars/shared/contracts/evaluator/full.json +126 -0
- package/vendor/ars/shared/contracts/evidence/claim_registry.schema.json +50 -0
- package/vendor/ars/shared/contracts/evidence/claim_registry_coverage_report.schema.json +79 -0
- package/vendor/ars/shared/contracts/evidence/evidence_row.schema.json +504 -0
- package/vendor/ars/shared/contracts/evidence/evidence_row_v1_1.schema.json +364 -0
- package/vendor/ars/shared/contracts/evidence/evidence_row_v1_2.schema.json +714 -0
- package/vendor/ars/shared/contracts/evidence/evidence_row_v1_3.schema.json +524 -0
- package/vendor/ars/shared/contracts/human_subjects/authority_profile_registry.schema.json +497 -0
- package/vendor/ars/shared/contracts/human_subjects/committee_correspondence.schema.json +253 -0
- package/vendor/ars/shared/contracts/human_subjects/content_coverage_advisory.schema.json +620 -0
- package/vendor/ars/shared/contracts/human_subjects/irb_context_record.schema.json +329 -0
- package/vendor/ars/shared/contracts/human_subjects/resolved_authority_context.schema.json +347 -0
- package/vendor/ars/shared/contracts/human_subjects/review_pathway_rule_trace.schema.json +265 -0
- package/vendor/ars/shared/contracts/human_subjects/review_pathway_trace_request.schema.json +127 -0
- package/vendor/ars/shared/contracts/human_subjects/submission_packet_inventory.schema.json +240 -0
- package/vendor/ars/shared/contracts/human_subjects/submission_packet_manifest.schema.json +999 -0
- package/vendor/ars/shared/contracts/passport/audit_artifact_entry.schema.json +266 -0
- package/vendor/ars/shared/contracts/passport/bibliographic_integrity_signal.schema.json +1676 -0
- package/vendor/ars/shared/contracts/passport/citation_provenance.schema.json +107 -0
- package/vendor/ars/shared/contracts/passport/citation_verification_summary.schema.json +164 -0
- package/vendor/ars/shared/contracts/passport/claim_audit_result.schema.json +124 -0
- package/vendor/ars/shared/contracts/passport/claim_drift.schema.json +58 -0
- package/vendor/ars/shared/contracts/passport/claim_intent_manifest.schema.json +107 -0
- package/vendor/ars/shared/contracts/passport/constraint_violation.schema.json +65 -0
- package/vendor/ars/shared/contracts/passport/experiment_alignment_result.schema.json +69 -0
- package/vendor/ars/shared/contracts/passport/experiment_provenance_entry.schema.json +169 -0
- package/vendor/ars/shared/contracts/passport/human_read_log.schema.json +86 -0
- package/vendor/ars/shared/contracts/passport/inquiry_ledger_ref.schema.json +22 -0
- package/vendor/ars/shared/contracts/passport/literature_corpus_entry.schema.json +650 -0
- package/vendor/ars/shared/contracts/passport/preregistration_artifact.schema.json +132 -0
- package/vendor/ars/shared/contracts/passport/rejection_log.schema.json +89 -0
- package/vendor/ars/shared/contracts/passport/reset_ledger_entry.schema.json +158 -0
- package/vendor/ars/shared/contracts/passport/temporal_audit_results.schema.json +208 -0
- package/vendor/ars/shared/contracts/passport/terminal_policies.schema.json +50 -0
- package/vendor/ars/shared/contracts/passport/timeline.schema.json +102 -0
- package/vendor/ars/shared/contracts/passport/uncited_assertion.schema.json +56 -0
- package/vendor/ars/shared/contracts/passport/uncited_audit_failure.schema.json +72 -0
- package/vendor/ars/shared/contracts/passport/user_attested_read_resolution.schema.json +87 -0
- package/vendor/ars/shared/contracts/passport/version_records.schema.json +138 -0
- package/vendor/ars/shared/contracts/patch/block_manifest.schema.json +45 -0
- package/vendor/ars/shared/contracts/patch/legacy/v1_0/revision_patch.schema.json +110 -0
- package/vendor/ars/shared/contracts/patch/revision_patch.schema.json +250 -0
- package/vendor/ars/shared/contracts/pdf/pdf_content_classifier_diagnostic.schema.json +39 -0
- package/vendor/ars/shared/contracts/pdf/pdf_content_classifier_worker.schema.json +88 -0
- package/vendor/ars/shared/contracts/pdf/pdf_read_preflight.schema.json +227 -0
- package/vendor/ars/shared/contracts/re_review/input_manifest.schema.json +161 -0
- package/vendor/ars/shared/contracts/re_review/legacy/v1_0/input_manifest.schema.json +134 -0
- package/vendor/ars/shared/contracts/re_review/legacy/v1_0/precommitment.schema.json +193 -0
- package/vendor/ars/shared/contracts/re_review/legacy/v1_0/traceability.schema.json +841 -0
- package/vendor/ars/shared/contracts/re_review/legacy/v1_0/verdict_record.schema.json +244 -0
- package/vendor/ars/shared/contracts/re_review/precommitment.schema.json +193 -0
- package/vendor/ars/shared/contracts/re_review/traceability.schema.json +916 -0
- package/vendor/ars/shared/contracts/re_review/verdict_record.schema.json +245 -0
- package/vendor/ars/shared/contracts/research_workflow/inquiry_branch_ledger.schema.json +449 -0
- package/vendor/ars/shared/contracts/research_workflow/research_workflow_profile.schema.json +222 -0
- package/vendor/ars/shared/contracts/research_workflow/research_workflow_profile_selection_receipt.schema.json +111 -0
- package/vendor/ars/shared/contracts/review_target/constructive_review_findings.schema.json +172 -0
- package/vendor/ars/shared/contracts/review_target/criteria_registry.schema.json +97 -0
- package/vendor/ars/shared/contracts/review_target/review_criteria_binding_manifest.schema.json +235 -0
- package/vendor/ars/shared/contracts/review_target/review_criteria_source_receipt.schema.json +158 -0
- package/vendor/ars/shared/contracts/review_target/review_target_context.schema.json +106 -0
- package/vendor/ars/shared/contracts/review_target/review_target_declaration.schema.json +118 -0
- package/vendor/ars/shared/contracts/reviewer/full.json +114 -0
- package/vendor/ars/shared/contracts/reviewer/methodology_focus.json +75 -0
- package/vendor/ars/shared/contracts/reviewer/review_panel_provenance.schema.json +263 -0
- package/vendor/ars/shared/contracts/reviewer/review_panel_provenance_carrier.schema.json +122 -0
- package/vendor/ars/shared/contracts/reviewer/review_panel_provenance_input.schema.json +120 -0
- package/vendor/ars/shared/contracts/revision/author_adjudication.schema.json +251 -0
- package/vendor/ars/shared/contracts/revision/author_adjudication_input.schema.json +25 -0
- package/vendor/ars/shared/contracts/revision/claim_strength_drift_disposition.schema.json +97 -0
- package/vendor/ars/shared/contracts/revision/claim_strength_drift_disposition_input.schema.json +80 -0
- package/vendor/ars/shared/contracts/revision/claim_strength_drift_findings.schema.json +139 -0
- package/vendor/ars/shared/contracts/revision/claim_surface_manifest.schema.json +99 -0
- package/vendor/ars/shared/contracts/revision/integrity_correction_authorization.schema.json +140 -0
- package/vendor/ars/shared/contracts/revision/integrity_correction_authorization_input.schema.json +28 -0
- package/vendor/ars/shared/contracts/revision/integrity_correction_list.schema.json +48 -0
- package/vendor/ars/shared/contracts/revision/integrity_pass_receipt.schema.json +16 -0
- package/vendor/ars/shared/contracts/revision/revision_evidence_bundle.schema.json +134 -0
- package/vendor/ars/shared/contracts/revision/revision_roadmap.schema.json +334 -0
- package/vendor/ars/shared/contracts/submission/format_profile.example.yaml +33 -0
- package/vendor/ars/shared/contracts/submission/format_profile.schema.json +102 -0
- package/vendor/ars/shared/contracts/submission/submission_verification_report.schema.json +233 -0
- package/vendor/ars/shared/contracts/submission/venue_profile.schema.json +114 -0
- package/vendor/ars/shared/contracts/writer/full.json +87 -0
- package/vendor/ars/shared/cross_model_verification.md +714 -0
- package/vendor/ars/shared/evals_lift_report.schema.json +141 -0
- package/vendor/ars/shared/ground_truth_isolation_pattern.md +275 -0
- package/vendor/ars/shared/handoff_schemas.md +1209 -0
- package/vendor/ars/shared/human_subjects_authority_registry.json +1278 -0
- package/vendor/ars/shared/mode_spectrum.md +57 -0
- package/vendor/ars/shared/model_tiering.md +83 -0
- package/vendor/ars/shared/policy_data/nature_policy.md +56 -0
- package/vendor/ars/shared/prisma_trAIce_protocol.md +157 -0
- package/vendor/ars/shared/raise_framework.md +129 -0
- package/vendor/ars/shared/references/authority_content_coverage_advisory_protocol.md +275 -0
- package/vendor/ars/shared/references/claim_standing_candidate_ledger_protocol.md +66 -0
- package/vendor/ars/shared/references/claim_strength_ladder.md +93 -0
- package/vendor/ars/shared/references/cross_document_consistency_advisory_protocol.md +263 -0
- package/vendor/ars/shared/references/evidence_row_protocol.md +260 -0
- package/vendor/ars/shared/references/firm_rules.md +90 -0
- package/vendor/ars/shared/references/human_subjects_authority_protocol.md +274 -0
- package/vendor/ars/shared/references/intent_clarification_protocol.md +168 -0
- package/vendor/ars/shared/references/irb_terminology_glossary.md +229 -0
- package/vendor/ars/shared/references/protected_hedging_phrases.md +118 -0
- package/vendor/ars/shared/references/psychometric_terminology_glossary.md +109 -0
- package/vendor/ars/shared/references/review_criteria_consumer_protocol.md +238 -0
- package/vendor/ars/shared/references/review_pathway_rule_trace_protocol.md +166 -0
- package/vendor/ars/shared/references/submission_packet_manifest_protocol.md +292 -0
- package/vendor/ars/shared/references/word_count_conventions.md +124 -0
- package/vendor/ars/shared/research_workflow_profiles/field_general.json +1 -0
- package/vendor/ars/shared/review_criteria_registry.json +207 -0
- package/vendor/ars/shared/review_criteria_sources/msr-2027-technical-papers.2026-08-24.json +46 -0
- package/vendor/ars/shared/review_criteria_sources/sigsoft-empirical-standards.2026-08-24.json +31 -0
- package/vendor/ars/shared/sprint_contract.schema.json +482 -0
- package/vendor/ars/shared/style_calibration_protocol.md +151 -0
- package/vendor/ars/shared/templates/codex_audit_multifile_template.md +263 -0
- package/vendor/ars/tools/release-discipline/.toolkit-version +1 -0
- package/vendor/ars/tools/release-discipline/README.md +4 -0
- package/vendor/ars/tools/release-discipline/scripts/_release_doc_alignment_schema.py +1011 -0
- package/vendor/ars/tools/release-discipline/scripts/check_command_invariants.py +497 -0
- package/vendor/ars/tools/release-discipline/scripts/check_release_doc_alignment.py +263 -0
- package/vendor/ars/tools/release-discipline/scripts/sync-toolkit.sh +147 -0
- package/vendor/windows/NOTICE.md +12 -0
- package/vendor/windows/arm64/fd.exe +0 -0
- package/vendor/windows/arm64/licenses/fd/LICENSE-APACHE +201 -0
- package/vendor/windows/arm64/licenses/fd/LICENSE-MIT +21 -0
- package/vendor/windows/arm64/licenses/ripgrep/COPYING +3 -0
- package/vendor/windows/arm64/licenses/ripgrep/LICENSE-MIT +21 -0
- package/vendor/windows/arm64/licenses/ripgrep/UNLICENSE +24 -0
- package/vendor/windows/arm64/rg.exe +0 -0
- package/vendor/windows/x64/fd.exe +0 -0
- package/vendor/windows/x64/licenses/fd/LICENSE-APACHE +201 -0
- package/vendor/windows/x64/licenses/fd/LICENSE-MIT +21 -0
- package/vendor/windows/x64/licenses/ripgrep/COPYING +3 -0
- package/vendor/windows/x64/licenses/ripgrep/LICENSE-MIT +21 -0
- package/vendor/windows/x64/licenses/ripgrep/UNLICENSE +24 -0
- package/vendor/windows/x64/rg.exe +0 -0
|
@@ -0,0 +1,1833 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import argparse
|
|
4
|
+
import ast
|
|
5
|
+
import copy
|
|
6
|
+
from datetime import datetime, timedelta, timezone
|
|
7
|
+
import hashlib
|
|
8
|
+
import importlib.util
|
|
9
|
+
import json
|
|
10
|
+
import os
|
|
11
|
+
from pathlib import Path
|
|
12
|
+
import stat
|
|
13
|
+
import sys
|
|
14
|
+
|
|
15
|
+
import pytest
|
|
16
|
+
|
|
17
|
+
from scripts import check_spec_consistency as spec_consistency
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
ROOT = Path(__file__).resolve().parent.parent
|
|
21
|
+
SCRIPTS = ROOT / "scripts"
|
|
22
|
+
MODULE_PATH = SCRIPTS / "run_ideation_diversity_no_call.py"
|
|
23
|
+
sys.path.insert(0, str(SCRIPTS))
|
|
24
|
+
SPEC = importlib.util.spec_from_file_location("ideation_no_call", MODULE_PATH)
|
|
25
|
+
assert SPEC and SPEC.loader
|
|
26
|
+
runner = importlib.util.module_from_spec(SPEC)
|
|
27
|
+
SPEC.loader.exec_module(runner)
|
|
28
|
+
def _args(run_dir: Path) -> argparse.Namespace:
|
|
29
|
+
return argparse.Namespace(
|
|
30
|
+
run_dir=run_dir,
|
|
31
|
+
run_id="phase2-test-no-call",
|
|
32
|
+
suite_commit="a" * 40,
|
|
33
|
+
order_seed="phase2-test-seed-v1",
|
|
34
|
+
subject_provider="external-placeholder",
|
|
35
|
+
subject_model="no-model-called",
|
|
36
|
+
subject_runtime="external-only",
|
|
37
|
+
subject_runtime_version="none",
|
|
38
|
+
auth_mode="fresh-external-authorization-required",
|
|
39
|
+
reasoning_effort="high",
|
|
40
|
+
input_token_cap=12000,
|
|
41
|
+
output_token_cap=3000,
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def _initialize(tmp_path: Path) -> tuple[Path, str, dict]:
|
|
46
|
+
run_dir = tmp_path / "run"
|
|
47
|
+
result = runner.init_run(_args(run_dir))
|
|
48
|
+
plan_raw = (run_dir / "run-plan.json").read_bytes()
|
|
49
|
+
plan = json.loads(plan_raw)
|
|
50
|
+
assert result["run_plan_sha256"] == hashlib.sha256(plan_raw).hexdigest()
|
|
51
|
+
return run_dir, result["run_plan_sha256"], plan
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def _command_args(run_dir: Path, plan_sha: str, **values) -> argparse.Namespace:
|
|
55
|
+
return argparse.Namespace(
|
|
56
|
+
run_dir=run_dir,
|
|
57
|
+
plan_sha256=plan_sha,
|
|
58
|
+
**values,
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def _authorization(plan: dict) -> dict:
|
|
63
|
+
plan_sha = hashlib.sha256(runner._json_bytes(plan)).hexdigest()
|
|
64
|
+
return {
|
|
65
|
+
"schema_version": "ideation-diversity-authorization-record/1.0",
|
|
66
|
+
"suite": runner.SUITE,
|
|
67
|
+
"record_id": "automated-contract-fixture-auth-v1",
|
|
68
|
+
"run_plan_sha256": plan_sha,
|
|
69
|
+
"run_id": plan["run_id"],
|
|
70
|
+
"suite_commit": plan["suite_commit"],
|
|
71
|
+
"suite_commit_provenance": plan["suite_commit_provenance"],
|
|
72
|
+
"execution": plan["execution"],
|
|
73
|
+
"scope": {
|
|
74
|
+
"scope_type": "exact_run_plan_all_cells",
|
|
75
|
+
"subject_session_cells": 48,
|
|
76
|
+
"cell_ids": plan["order"]["cell_ids"],
|
|
77
|
+
"order_sha256": plan["order"]["order_sha256"],
|
|
78
|
+
},
|
|
79
|
+
"decision": {
|
|
80
|
+
"status": "authorized",
|
|
81
|
+
"decided_at": "2026-08-13T00:00:00Z",
|
|
82
|
+
"operator_reference": "automated-contract-fixture-operator-not-a-human-claim",
|
|
83
|
+
"statement": (
|
|
84
|
+
"AUTOMATED CONTRACT FIXTURE ONLY; not real consent, human evidence, "
|
|
85
|
+
"or research evidence."
|
|
86
|
+
),
|
|
87
|
+
},
|
|
88
|
+
"proof_boundary": {
|
|
89
|
+
"structural_and_byte_binding_only": True,
|
|
90
|
+
"operator_identity_verified_by_runner": False,
|
|
91
|
+
"fresh_external_authorization_is_procedural_responsibility": True,
|
|
92
|
+
"not_human_or_research_evidence": True,
|
|
93
|
+
},
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
def _authorization_file(tmp_path: Path, plan: dict) -> Path:
|
|
98
|
+
path = tmp_path / "automated-authorization-fixture.json"
|
|
99
|
+
path.write_bytes(runner._json_bytes(_authorization(plan)))
|
|
100
|
+
return path
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
def _transcript(plan: dict, cell: dict, *, partial: bool = False) -> dict:
|
|
104
|
+
heldout, _ = runner.phase1.load_assets()
|
|
105
|
+
scenario = next(
|
|
106
|
+
row for row in heldout["scenarios"] if row["scenario_id"] == cell["scenario_id"]
|
|
107
|
+
)
|
|
108
|
+
turns = []
|
|
109
|
+
for turn_index in range(1, 12):
|
|
110
|
+
is_actor = turn_index % 2 == 1
|
|
111
|
+
if turn_index == 1:
|
|
112
|
+
text = scenario["initial_message"]
|
|
113
|
+
else:
|
|
114
|
+
role = "actor" if is_actor else "subject"
|
|
115
|
+
text = (
|
|
116
|
+
f"AUTOMATED CONTRACT TEST FIXTURE {role} turn {turn_index}; "
|
|
117
|
+
"repository-owned synthetic content only."
|
|
118
|
+
)
|
|
119
|
+
turns.append(
|
|
120
|
+
{
|
|
121
|
+
"turn_index": turn_index,
|
|
122
|
+
"role": "actor" if is_actor else "subject",
|
|
123
|
+
"text": text,
|
|
124
|
+
}
|
|
125
|
+
)
|
|
126
|
+
def raw_event(
|
|
127
|
+
event_kind: str, turn_index: int | None, text: str | None = None
|
|
128
|
+
) -> dict[str, str]:
|
|
129
|
+
value = {"event_kind": event_kind, "turn_index": turn_index}
|
|
130
|
+
if text is not None:
|
|
131
|
+
value["text"] = text
|
|
132
|
+
raw = runner._canonical(value).decode("utf-8")
|
|
133
|
+
return {
|
|
134
|
+
"raw_event_utf8": raw,
|
|
135
|
+
"raw_event_sha256": hashlib.sha256(raw.encode("utf-8")).hexdigest(),
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
events = [
|
|
139
|
+
{
|
|
140
|
+
"event_index": 1,
|
|
141
|
+
"event_kind": "session_started",
|
|
142
|
+
"turn_index": None,
|
|
143
|
+
**raw_event("session_started", None),
|
|
144
|
+
}
|
|
145
|
+
]
|
|
146
|
+
for turn in turns:
|
|
147
|
+
events.append(
|
|
148
|
+
{
|
|
149
|
+
"event_index": len(events) + 1,
|
|
150
|
+
"event_kind": f"{turn['role']}_message",
|
|
151
|
+
"turn_index": turn["turn_index"],
|
|
152
|
+
**raw_event(
|
|
153
|
+
f"{turn['role']}_message", turn["turn_index"], turn["text"]
|
|
154
|
+
),
|
|
155
|
+
}
|
|
156
|
+
)
|
|
157
|
+
events.append(
|
|
158
|
+
{
|
|
159
|
+
"event_index": len(events) + 1,
|
|
160
|
+
"event_kind": "session_partial" if partial else "session_completed",
|
|
161
|
+
"turn_index": None,
|
|
162
|
+
**raw_event("session_partial" if partial else "session_completed", None),
|
|
163
|
+
}
|
|
164
|
+
)
|
|
165
|
+
started_at = datetime(2026, 8, 13, tzinfo=timezone.utc) + timedelta(
|
|
166
|
+
seconds=cell["sequence_index"] * 2 - 1
|
|
167
|
+
)
|
|
168
|
+
completed_at = started_at + timedelta(seconds=1)
|
|
169
|
+
external_receipt = {
|
|
170
|
+
"receipt_id": f"automated-external-receipt-{cell['cell_id']}",
|
|
171
|
+
"external_session_id": f"automated-fresh-session-{cell['cell_id']}",
|
|
172
|
+
"cell_id": cell["cell_id"],
|
|
173
|
+
"sequence_index": cell["sequence_index"],
|
|
174
|
+
"started_at": started_at.isoformat().replace("+00:00", "Z"),
|
|
175
|
+
"completed_at": completed_at.isoformat().replace("+00:00", "Z"),
|
|
176
|
+
"fresh_context": True,
|
|
177
|
+
}
|
|
178
|
+
external_receipt_utf8 = runner._canonical(external_receipt).decode("utf-8")
|
|
179
|
+
return {
|
|
180
|
+
"schema_version": "ideation-diversity-transcript/1.0",
|
|
181
|
+
"suite": runner.SUITE,
|
|
182
|
+
"run_plan_sha256": hashlib.sha256(
|
|
183
|
+
runner._json_bytes(plan)
|
|
184
|
+
).hexdigest(),
|
|
185
|
+
"cell_id": cell["cell_id"],
|
|
186
|
+
"sequence_index": cell["sequence_index"],
|
|
187
|
+
"source": {
|
|
188
|
+
"source_kind": "externally_recorded_session",
|
|
189
|
+
"source_artifact_id": f"automated-contract-fixture-{cell['cell_id']}",
|
|
190
|
+
"external_session_receipt_utf8": external_receipt_utf8,
|
|
191
|
+
"external_session_receipt_sha256": hashlib.sha256(
|
|
192
|
+
external_receipt_utf8.encode("utf-8")
|
|
193
|
+
).hexdigest(),
|
|
194
|
+
"authorization_record_ref": "automated-contract-fixture-auth-v1",
|
|
195
|
+
"authorization_record_sha256": hashlib.sha256(
|
|
196
|
+
runner._json_bytes(_authorization(plan))
|
|
197
|
+
).hexdigest(),
|
|
198
|
+
},
|
|
199
|
+
"bindings": {
|
|
200
|
+
"prompt_sha256": cell["prompt"]["sha256"],
|
|
201
|
+
"scenario_sha256": cell["scenario_sha256"],
|
|
202
|
+
"initial_message_sha256": cell["initial_message_sha256"],
|
|
203
|
+
"actor_packet_sha256": cell["actor_packet_sha256"],
|
|
204
|
+
"session_envelope_sha256": cell["session_envelope_sha256"],
|
|
205
|
+
},
|
|
206
|
+
"session": {
|
|
207
|
+
"fresh_context": True,
|
|
208
|
+
"complete": not partial,
|
|
209
|
+
"blocked": False,
|
|
210
|
+
"partial": partial,
|
|
211
|
+
"stop_reason": "partial" if partial else "freeze_point_reached",
|
|
212
|
+
"actor_turns": 6,
|
|
213
|
+
"subject_turns": 5,
|
|
214
|
+
"freeze_after_actor_turn": 6,
|
|
215
|
+
},
|
|
216
|
+
"turns": turns,
|
|
217
|
+
"events": events,
|
|
218
|
+
"observations": {
|
|
219
|
+
"prompt_hash_match": True,
|
|
220
|
+
"role_card_hash_match": True,
|
|
221
|
+
"arm_leakage": False,
|
|
222
|
+
"eligible": True,
|
|
223
|
+
"unplanned_tool_actions": [],
|
|
224
|
+
"unplanned_network_actions": [],
|
|
225
|
+
"evidence_write_failure": False,
|
|
226
|
+
"partial_subject_output": partial,
|
|
227
|
+
"actor_protocol_deviation": False,
|
|
228
|
+
},
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
def _set_raw_event(event: dict, normalized: dict) -> None:
|
|
233
|
+
raw = runner._canonical(normalized).decode("utf-8")
|
|
234
|
+
event["raw_event_utf8"] = raw
|
|
235
|
+
event["raw_event_sha256"] = hashlib.sha256(raw.encode("utf-8")).hexdigest()
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
def _set_external_receipt(transcript: dict, receipt: dict) -> None:
|
|
239
|
+
raw = runner._canonical(receipt).decode("utf-8")
|
|
240
|
+
transcript["source"]["external_session_receipt_utf8"] = raw
|
|
241
|
+
transcript["source"]["external_session_receipt_sha256"] = hashlib.sha256(
|
|
242
|
+
raw.encode("utf-8")
|
|
243
|
+
).hexdigest()
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
def _get_external_receipt(transcript: dict) -> dict:
|
|
247
|
+
return json.loads(transcript["source"]["external_session_receipt_utf8"])
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
def test_plan_is_exact_48_cell_counterbalanced_no_call_cross_product(tmp_path):
|
|
251
|
+
run_dir, plan_sha, plan = _initialize(tmp_path)
|
|
252
|
+
assert len(plan["cells"]) == 2 * 6 * 2 * 2 == 48
|
|
253
|
+
assert plan["order"]["cell_ids"] == [
|
|
254
|
+
f"cell-{index:03d}" for index in range(1, 49)
|
|
255
|
+
]
|
|
256
|
+
order_projection = [
|
|
257
|
+
{
|
|
258
|
+
key: cell[key]
|
|
259
|
+
for key in (
|
|
260
|
+
"cell_id",
|
|
261
|
+
"sequence_index",
|
|
262
|
+
"experiment_id",
|
|
263
|
+
"scenario_id",
|
|
264
|
+
"arm_id",
|
|
265
|
+
"replicate",
|
|
266
|
+
"actor_block_id",
|
|
267
|
+
)
|
|
268
|
+
}
|
|
269
|
+
for cell in plan["cells"]
|
|
270
|
+
]
|
|
271
|
+
assert plan["order"]["order_sha256"] == hashlib.sha256(
|
|
272
|
+
runner._canonical(order_projection)
|
|
273
|
+
).hexdigest()
|
|
274
|
+
alternate_config = runner._config_from_plan(plan)
|
|
275
|
+
alternate_config["order_seed"] = "phase2-alternate-seed-v1"
|
|
276
|
+
alternate = runner._build_plan(alternate_config)
|
|
277
|
+
assert alternate["order"]["order_sha256"] != plan["order"]["order_sha256"]
|
|
278
|
+
observed = {
|
|
279
|
+
(
|
|
280
|
+
cell["experiment_id"],
|
|
281
|
+
cell["scenario_id"],
|
|
282
|
+
cell["arm_id"],
|
|
283
|
+
cell["replicate"],
|
|
284
|
+
)
|
|
285
|
+
for cell in plan["cells"]
|
|
286
|
+
}
|
|
287
|
+
assert len(observed) == 48
|
|
288
|
+
for experiment, arms in runner.EXPERIMENTS:
|
|
289
|
+
scenario_ids = {
|
|
290
|
+
cell["scenario_id"]
|
|
291
|
+
for cell in plan["cells"]
|
|
292
|
+
if cell["experiment_id"] == experiment
|
|
293
|
+
}
|
|
294
|
+
assert len(scenario_ids) == 6
|
|
295
|
+
for scenario_id in scenario_ids:
|
|
296
|
+
rows = [
|
|
297
|
+
cell
|
|
298
|
+
for cell in plan["cells"]
|
|
299
|
+
if cell["experiment_id"] == experiment
|
|
300
|
+
and cell["scenario_id"] == scenario_id
|
|
301
|
+
]
|
|
302
|
+
first = [cell["arm_id"] for cell in rows if cell["replicate"] == 1]
|
|
303
|
+
second = [cell["arm_id"] for cell in rows if cell["replicate"] == 2]
|
|
304
|
+
assert set(first) == set(arms)
|
|
305
|
+
assert second == list(reversed(first))
|
|
306
|
+
assert plan["execution"] | {
|
|
307
|
+
"runner_transport": "none",
|
|
308
|
+
"dispatch_available": False,
|
|
309
|
+
"api_spend_ceiling_usd": 0,
|
|
310
|
+
"api_fallback": False,
|
|
311
|
+
"envelope_grants_consent": False,
|
|
312
|
+
} == plan["execution"]
|
|
313
|
+
assert plan["created_without_dispatch"] is True
|
|
314
|
+
assert len(plan["asset_bindings"]) == 18
|
|
315
|
+
assert {
|
|
316
|
+
row["path"] for row in plan["asset_bindings"]
|
|
317
|
+
} >= {
|
|
318
|
+
"evals/heldout/within_session_ideation_diversity/stop_intent.schema.json",
|
|
319
|
+
"evals/heldout/within_session_ideation_diversity/blind_intent.schema.json",
|
|
320
|
+
}
|
|
321
|
+
assert plan["suite_commit_provenance"] == {
|
|
322
|
+
"status": "operator_declared_unverified",
|
|
323
|
+
"verified_by_no_call_runner": False,
|
|
324
|
+
"verifiable_authority": "run_plan_sha256_and_asset_bindings",
|
|
325
|
+
}
|
|
326
|
+
assert plan["execution"]["token_cap_verification"] == {
|
|
327
|
+
"status": "operator_declared_unverified",
|
|
328
|
+
"enforced_by_no_call_runner": False,
|
|
329
|
+
"observed_usage_recorded": False,
|
|
330
|
+
"provider_tokenizer_verified": False,
|
|
331
|
+
}
|
|
332
|
+
assert runner.validate_run(_command_args(run_dir, plan_sha))["status"] == "initialized"
|
|
333
|
+
|
|
334
|
+
|
|
335
|
+
def test_materializer_writes_only_frozen_inputs_and_never_changes_production(tmp_path):
|
|
336
|
+
production_before = runner.PRODUCTION_PROMPT.read_bytes()
|
|
337
|
+
run_dir, plan_sha, plan = _initialize(tmp_path)
|
|
338
|
+
result = runner.materialize(_command_args(run_dir, plan_sha))
|
|
339
|
+
assert result == {
|
|
340
|
+
"materialized_files": 146,
|
|
341
|
+
"cells": 48,
|
|
342
|
+
"dispatch_available": False,
|
|
343
|
+
}
|
|
344
|
+
inventory = [path for path in (run_dir / "materials").rglob("*") if path.is_file()]
|
|
345
|
+
assert len(inventory) == 98
|
|
346
|
+
assert (
|
|
347
|
+
run_dir / "materials/prompts/production-socratic-mentor.md"
|
|
348
|
+
).read_bytes() == production_before
|
|
349
|
+
assert (
|
|
350
|
+
run_dir / "materials/prompts/exploratory-guardrails-ablated.md"
|
|
351
|
+
).read_bytes() != production_before
|
|
352
|
+
assert runner.PRODUCTION_PROMPT.read_bytes() == production_before
|
|
353
|
+
actor = json.loads((run_dir / plan["cells"][0]["actor_packet_path"]).read_bytes())
|
|
354
|
+
assert actor["model_generated_actor"] is False
|
|
355
|
+
assert "arm_id" not in actor and "experiment_id" not in actor
|
|
356
|
+
envelope = json.loads(
|
|
357
|
+
(run_dir / plan["cells"][0]["session_envelope_path"]).read_bytes()
|
|
358
|
+
)
|
|
359
|
+
assert envelope["runner_transport"] == "none"
|
|
360
|
+
assert envelope["dispatch_available"] is False
|
|
361
|
+
assert envelope["tools"] == [] and envelope["web_enabled"] is False
|
|
362
|
+
assert envelope["api_spend_ceiling_usd"] == 0
|
|
363
|
+
assert envelope["api_fallback"] is False
|
|
364
|
+
assert envelope["envelope_grants_consent"] is False
|
|
365
|
+
assert envelope["fresh_external_authorization_required"] is True
|
|
366
|
+
assert "command" not in envelope and "subject_output" not in envelope
|
|
367
|
+
assert runner.validate_run(_command_args(run_dir, plan_sha))["status"] == "materialized"
|
|
368
|
+
|
|
369
|
+
|
|
370
|
+
def test_suite_commit_and_token_caps_are_declared_unverified_not_enforced(tmp_path):
|
|
371
|
+
run_dir = tmp_path / "run"
|
|
372
|
+
args = _args(run_dir)
|
|
373
|
+
args.suite_commit = "f" * 40 # syntactically valid; existence is not asserted.
|
|
374
|
+
args.input_token_cap = 1
|
|
375
|
+
args.output_token_cap = 1
|
|
376
|
+
result = runner.init_run(args)
|
|
377
|
+
plan_sha = result["run_plan_sha256"]
|
|
378
|
+
plan = json.loads((run_dir / "run-plan.json").read_bytes())
|
|
379
|
+
assert plan["suite_commit"] == "f" * 40
|
|
380
|
+
assert plan["suite_commit_provenance"]["verified_by_no_call_runner"] is False
|
|
381
|
+
boundary = plan["execution"]["token_cap_verification"]
|
|
382
|
+
assert boundary["status"] == "operator_declared_unverified"
|
|
383
|
+
assert boundary["enforced_by_no_call_runner"] is False
|
|
384
|
+
assert boundary["observed_usage_recorded"] is False
|
|
385
|
+
runner.materialize(_command_args(run_dir, plan_sha))
|
|
386
|
+
source = tmp_path / "longer-than-one-token.json"
|
|
387
|
+
source.write_bytes(runner._json_bytes(_transcript(plan, plan["cells"][0])))
|
|
388
|
+
result = runner.ingest(
|
|
389
|
+
_command_args(
|
|
390
|
+
run_dir,
|
|
391
|
+
plan_sha,
|
|
392
|
+
transcript=source,
|
|
393
|
+
authorization_record=_authorization_file(tmp_path, plan),
|
|
394
|
+
)
|
|
395
|
+
)
|
|
396
|
+
assert result["ingested"] == 1
|
|
397
|
+
|
|
398
|
+
|
|
399
|
+
@pytest.mark.parametrize(
|
|
400
|
+
"semantic_empty", (" " * 8, "\u200b" * 8, "\u0301" * 8)
|
|
401
|
+
)
|
|
402
|
+
def test_plan_execution_identity_rejects_unicode_semantic_empty(
|
|
403
|
+
tmp_path, semantic_empty
|
|
404
|
+
):
|
|
405
|
+
args = _args(tmp_path / "run")
|
|
406
|
+
args.subject_provider = semantic_empty
|
|
407
|
+
with pytest.raises(runner.EnvelopeError, match="semantic text"):
|
|
408
|
+
runner.init_run(args)
|
|
409
|
+
|
|
410
|
+
|
|
411
|
+
def test_atomic_write_failure_never_publishes_partial_target_or_orphan(
|
|
412
|
+
tmp_path, monkeypatch
|
|
413
|
+
):
|
|
414
|
+
target = tmp_path / "authorization" / "record.json"
|
|
415
|
+
original_write = runner.os.write
|
|
416
|
+
writes = 0
|
|
417
|
+
|
|
418
|
+
def short_then_fail(descriptor, value):
|
|
419
|
+
nonlocal writes
|
|
420
|
+
writes += 1
|
|
421
|
+
if writes == 1:
|
|
422
|
+
prefix = value[: max(1, len(value) // 2)]
|
|
423
|
+
return original_write(descriptor, prefix)
|
|
424
|
+
raise OSError("AUTOMATED PARTIAL STAGING FAILURE")
|
|
425
|
+
|
|
426
|
+
monkeypatch.setattr(runner.os, "write", short_then_fail)
|
|
427
|
+
with pytest.raises(runner.EnvelopeError, match="cannot create"):
|
|
428
|
+
runner._write_new(target, b"repository-owned bytes that must stay atomic")
|
|
429
|
+
assert not target.exists()
|
|
430
|
+
assert list(target.parent.iterdir()) == []
|
|
431
|
+
|
|
432
|
+
|
|
433
|
+
def test_runner_exposes_no_transport_dispatch_probe_or_model_surface():
|
|
434
|
+
tree = ast.parse(MODULE_PATH.read_text(encoding="utf-8"))
|
|
435
|
+
forbidden_imports = {
|
|
436
|
+
"subprocess",
|
|
437
|
+
"socket",
|
|
438
|
+
"requests",
|
|
439
|
+
"httpx",
|
|
440
|
+
"aiohttp",
|
|
441
|
+
"urllib",
|
|
442
|
+
"http",
|
|
443
|
+
"openai",
|
|
444
|
+
"anthropic",
|
|
445
|
+
"cohere",
|
|
446
|
+
"litellm",
|
|
447
|
+
"mistralai",
|
|
448
|
+
"importlib",
|
|
449
|
+
"ctypes",
|
|
450
|
+
}
|
|
451
|
+
imported = set()
|
|
452
|
+
for node in ast.walk(tree):
|
|
453
|
+
if isinstance(node, ast.Import):
|
|
454
|
+
imported.update(alias.name.split(".", 1)[0] for alias in node.names)
|
|
455
|
+
elif isinstance(node, ast.ImportFrom) and node.module:
|
|
456
|
+
imported.add(node.module.split(".", 1)[0])
|
|
457
|
+
assert imported.isdisjoint(forbidden_imports)
|
|
458
|
+
forbidden_os_calls = {
|
|
459
|
+
"system",
|
|
460
|
+
"popen",
|
|
461
|
+
"spawnl",
|
|
462
|
+
"spawnle",
|
|
463
|
+
"spawnlp",
|
|
464
|
+
"spawnlpe",
|
|
465
|
+
"spawnv",
|
|
466
|
+
"spawnve",
|
|
467
|
+
"spawnvp",
|
|
468
|
+
"spawnvpe",
|
|
469
|
+
"posix_spawn",
|
|
470
|
+
"posix_spawnp",
|
|
471
|
+
"fork",
|
|
472
|
+
"forkpty",
|
|
473
|
+
"execl",
|
|
474
|
+
"execle",
|
|
475
|
+
"execlp",
|
|
476
|
+
"execlpe",
|
|
477
|
+
"execv",
|
|
478
|
+
"execve",
|
|
479
|
+
"execvp",
|
|
480
|
+
"execvpe",
|
|
481
|
+
}
|
|
482
|
+
assert not any(
|
|
483
|
+
isinstance(node, ast.Call)
|
|
484
|
+
and isinstance(node.func, ast.Attribute)
|
|
485
|
+
and isinstance(node.func.value, ast.Name)
|
|
486
|
+
and node.func.value.id == "os"
|
|
487
|
+
and node.func.attr in forbidden_os_calls
|
|
488
|
+
for node in ast.walk(tree)
|
|
489
|
+
)
|
|
490
|
+
assert not any(
|
|
491
|
+
isinstance(node, ast.Call)
|
|
492
|
+
and isinstance(node.func, ast.Name)
|
|
493
|
+
and node.func.id in {"__import__", "eval", "exec", "compile"}
|
|
494
|
+
for node in ast.walk(tree)
|
|
495
|
+
)
|
|
496
|
+
parser = runner._parser()
|
|
497
|
+
subparsers = parser._subparsers._group_actions[0]
|
|
498
|
+
assert set(subparsers.choices) == {
|
|
499
|
+
"init-run",
|
|
500
|
+
"materialize",
|
|
501
|
+
"validate",
|
|
502
|
+
"ingest",
|
|
503
|
+
"prepare-blind-packet",
|
|
504
|
+
}
|
|
505
|
+
assert {"dispatch", "probe", "detect", "run"}.isdisjoint(subparsers.choices)
|
|
506
|
+
|
|
507
|
+
|
|
508
|
+
def test_plan_or_material_hash_drift_fails_closed(tmp_path):
|
|
509
|
+
run_dir, plan_sha, plan = _initialize(tmp_path)
|
|
510
|
+
runner.materialize(_command_args(run_dir, plan_sha))
|
|
511
|
+
material = run_dir / plan["cells"][0]["actor_packet_path"]
|
|
512
|
+
material.write_bytes(material.read_bytes() + b"\n")
|
|
513
|
+
with pytest.raises(runner.EnvelopeError, match="material bytes drifted"):
|
|
514
|
+
runner.validate_run(_command_args(run_dir, plan_sha))
|
|
515
|
+
|
|
516
|
+
other_dir, _, other_plan = _initialize(tmp_path / "other")
|
|
517
|
+
mutated = copy.deepcopy(other_plan)
|
|
518
|
+
mutated["cells"][0]["arm_id"] = "adjacent_probe_on"
|
|
519
|
+
raw = runner._json_bytes(mutated)
|
|
520
|
+
(other_dir / "run-plan.json").write_bytes(raw)
|
|
521
|
+
with pytest.raises(runner.EnvelopeError, match="exact current asset/order/hash"):
|
|
522
|
+
runner.validate_run(
|
|
523
|
+
_command_args(other_dir, hashlib.sha256(raw).hexdigest())
|
|
524
|
+
)
|
|
525
|
+
|
|
526
|
+
|
|
527
|
+
def test_first_partial_output_stops_preserves_raw_and_forbids_retry(tmp_path):
|
|
528
|
+
run_dir, plan_sha, plan = _initialize(tmp_path)
|
|
529
|
+
runner.materialize(_command_args(run_dir, plan_sha))
|
|
530
|
+
raw = runner._json_bytes(_transcript(plan, plan["cells"][0], partial=True))
|
|
531
|
+
source = tmp_path / "external-transcript.json"
|
|
532
|
+
source.write_bytes(raw)
|
|
533
|
+
ingest_args = _command_args(
|
|
534
|
+
run_dir,
|
|
535
|
+
plan_sha,
|
|
536
|
+
transcript=source,
|
|
537
|
+
authorization_record=_authorization_file(tmp_path, plan),
|
|
538
|
+
)
|
|
539
|
+
with pytest.raises(runner.StopViolation) as caught:
|
|
540
|
+
runner.ingest(ingest_args)
|
|
541
|
+
assert caught.value.code == "partial_subject_output"
|
|
542
|
+
manifest = json.loads((run_dir / "ingestion-manifest.json").read_bytes())
|
|
543
|
+
assert manifest["status"] == "stopped"
|
|
544
|
+
assert manifest["next_sequence_index"] == 1
|
|
545
|
+
assert manifest["stop_receipt"]["retry_forbidden"] is True
|
|
546
|
+
blocked = run_dir / manifest["stop_receipt"]["raw_ref"]
|
|
547
|
+
assert blocked.read_bytes() == raw
|
|
548
|
+
with pytest.raises(runner.EnvelopeError, match="forbids retry"):
|
|
549
|
+
runner.ingest(ingest_args)
|
|
550
|
+
|
|
551
|
+
|
|
552
|
+
def test_oversize_transcript_acquisition_is_bounded_durable_stop(tmp_path):
|
|
553
|
+
run_dir, plan_sha, plan = _initialize(tmp_path)
|
|
554
|
+
runner.materialize(_command_args(run_dir, plan_sha))
|
|
555
|
+
source = tmp_path / "oversize-transcript.json"
|
|
556
|
+
source.write_bytes(b"x" * (runner.MAX_INPUT_BYTES + 1))
|
|
557
|
+
args = _command_args(
|
|
558
|
+
run_dir,
|
|
559
|
+
plan_sha,
|
|
560
|
+
transcript=source,
|
|
561
|
+
authorization_record=_authorization_file(tmp_path, plan),
|
|
562
|
+
)
|
|
563
|
+
with pytest.raises(runner.StopViolation) as caught:
|
|
564
|
+
runner.ingest(args)
|
|
565
|
+
assert caught.value.code == "transcript_contract_failure"
|
|
566
|
+
manifest = json.loads((run_dir / "ingestion-manifest.json").read_bytes())
|
|
567
|
+
assert manifest["status"] == "stopped"
|
|
568
|
+
assert manifest["stop_receipt"]["raw_capture_kind"] == (
|
|
569
|
+
"bounded_acquisition_failure_record"
|
|
570
|
+
)
|
|
571
|
+
evidence = json.loads(
|
|
572
|
+
(run_dir / manifest["stop_receipt"]["raw_ref"]).read_bytes()
|
|
573
|
+
)
|
|
574
|
+
assert evidence["stat"]["size_bytes"] == runner.MAX_INPUT_BYTES + 1
|
|
575
|
+
assert evidence["prefix_bytes"] == 64 * 1024
|
|
576
|
+
assert runner.validate_run(_command_args(run_dir, plan_sha))["status"] == "stopped"
|
|
577
|
+
with pytest.raises(runner.EnvelopeError, match="forbids retry"):
|
|
578
|
+
runner.ingest(args)
|
|
579
|
+
|
|
580
|
+
|
|
581
|
+
def test_durable_stop_intent_survives_manifest_replacement_failure_and_recovers(
|
|
582
|
+
tmp_path, monkeypatch
|
|
583
|
+
):
|
|
584
|
+
run_dir, plan_sha, plan = _initialize(tmp_path)
|
|
585
|
+
runner.materialize(_command_args(run_dir, plan_sha))
|
|
586
|
+
raw = runner._json_bytes(_transcript(plan, plan["cells"][0], partial=True))
|
|
587
|
+
source = tmp_path / "partial.json"
|
|
588
|
+
source.write_bytes(raw)
|
|
589
|
+
ingest_args = _command_args(
|
|
590
|
+
run_dir,
|
|
591
|
+
plan_sha,
|
|
592
|
+
transcript=source,
|
|
593
|
+
authorization_record=_authorization_file(tmp_path, plan),
|
|
594
|
+
)
|
|
595
|
+
original_replace = runner.os.replace
|
|
596
|
+
fail_replacement = True
|
|
597
|
+
|
|
598
|
+
def controlled_replace(source_path, target_path):
|
|
599
|
+
if fail_replacement and Path(target_path).name == "ingestion-manifest.json":
|
|
600
|
+
raise OSError("AUTOMATED MANIFEST REPLACEMENT FAILURE")
|
|
601
|
+
return original_replace(source_path, target_path)
|
|
602
|
+
|
|
603
|
+
monkeypatch.setattr(runner.os, "replace", controlled_replace)
|
|
604
|
+
with pytest.raises(runner.EnvelopeError, match="cannot atomically replace"):
|
|
605
|
+
runner.ingest(ingest_args)
|
|
606
|
+
marker_path = run_dir / runner.STOP_INTENT_REF
|
|
607
|
+
assert marker_path.is_file()
|
|
608
|
+
marker_raw = marker_path.read_bytes()
|
|
609
|
+
marker = json.loads(marker_raw)
|
|
610
|
+
assert marker["run_plan_sha256"] == plan_sha
|
|
611
|
+
assert marker["cell_id"] == "cell-001"
|
|
612
|
+
assert marker["reason_code"] == "partial_subject_output"
|
|
613
|
+
assert marker["raw_sha256"] == hashlib.sha256(raw).hexdigest()
|
|
614
|
+
with pytest.raises(runner.EnvelopeError, match="forbids retry"):
|
|
615
|
+
runner.ingest(ingest_args)
|
|
616
|
+
fail_replacement = False
|
|
617
|
+
recovered = runner.validate_run(_command_args(run_dir, plan_sha))
|
|
618
|
+
assert recovered["status"] == "stopped"
|
|
619
|
+
manifest = json.loads((run_dir / "ingestion-manifest.json").read_bytes())
|
|
620
|
+
assert manifest["stop_receipt"]["stop_intent_ref"] == runner.STOP_INTENT_REF
|
|
621
|
+
assert (run_dir / manifest["stop_receipt"]["raw_ref"]).read_bytes() == raw
|
|
622
|
+
assert marker_path.read_bytes() == marker_raw
|
|
623
|
+
|
|
624
|
+
|
|
625
|
+
def test_failed_success_manifest_staging_is_hash_registered_in_stopped_replay(
|
|
626
|
+
tmp_path, monkeypatch
|
|
627
|
+
):
|
|
628
|
+
run_dir, plan_sha, plan = _initialize(tmp_path)
|
|
629
|
+
runner.materialize(_command_args(run_dir, plan_sha))
|
|
630
|
+
source = tmp_path / "valid.json"
|
|
631
|
+
raw = runner._json_bytes(_transcript(plan, plan["cells"][0]))
|
|
632
|
+
source.write_bytes(raw)
|
|
633
|
+
original_replace = runner.os.replace
|
|
634
|
+
failures_remaining = 1
|
|
635
|
+
|
|
636
|
+
def fail_first_manifest_replace(source_path, target_path):
|
|
637
|
+
nonlocal failures_remaining
|
|
638
|
+
if failures_remaining and Path(target_path).name == "ingestion-manifest.json":
|
|
639
|
+
failures_remaining -= 1
|
|
640
|
+
raise OSError("AUTOMATED SUCCESS MANIFEST REPLACEMENT FAILURE")
|
|
641
|
+
return original_replace(source_path, target_path)
|
|
642
|
+
|
|
643
|
+
monkeypatch.setattr(runner.os, "replace", fail_first_manifest_replace)
|
|
644
|
+
with pytest.raises(runner.StopViolation) as caught:
|
|
645
|
+
runner.ingest(
|
|
646
|
+
_command_args(
|
|
647
|
+
run_dir,
|
|
648
|
+
plan_sha,
|
|
649
|
+
transcript=source,
|
|
650
|
+
authorization_record=_authorization_file(tmp_path, plan),
|
|
651
|
+
)
|
|
652
|
+
)
|
|
653
|
+
assert caught.value.code == "evidence_write_failure"
|
|
654
|
+
manifest = json.loads((run_dir / "ingestion-manifest.json").read_bytes())
|
|
655
|
+
staging = list(run_dir.glob(".ingestion-manifest.json.replace-*.json"))
|
|
656
|
+
assert len(staging) == 1
|
|
657
|
+
assert manifest["stop_receipt"]["pre_stop_inventory"]["entry_count"] == 1
|
|
658
|
+
assert runner.validate_run(_command_args(run_dir, plan_sha))["status"] == "stopped"
|
|
659
|
+
staging[0].write_bytes(b"AUTOMATED TAMPERED STAGING\n")
|
|
660
|
+
with pytest.raises(runner.EnvelopeError, match="compact inventory"):
|
|
661
|
+
runner.validate_run(_command_args(run_dir, plan_sha))
|
|
662
|
+
|
|
663
|
+
|
|
664
|
+
def test_blocked_raw_partial_staging_is_registered_and_replayable(
|
|
665
|
+
tmp_path, monkeypatch
|
|
666
|
+
):
|
|
667
|
+
run_dir, plan_sha, plan = _initialize(tmp_path)
|
|
668
|
+
runner.materialize(_command_args(run_dir, plan_sha))
|
|
669
|
+
source = tmp_path / "partial.json"
|
|
670
|
+
source.write_bytes(
|
|
671
|
+
runner._json_bytes(_transcript(plan, plan["cells"][0], partial=True))
|
|
672
|
+
)
|
|
673
|
+
original_write = runner._write_new
|
|
674
|
+
injected = False
|
|
675
|
+
|
|
676
|
+
def leave_one_blocked_raw_staging(path, raw_bytes, **kwargs):
|
|
677
|
+
nonlocal injected
|
|
678
|
+
if not injected and path.parent.name == "blocked":
|
|
679
|
+
injected = True
|
|
680
|
+
path.parent.mkdir(parents=True, exist_ok=True)
|
|
681
|
+
orphan = path.with_name(
|
|
682
|
+
f".{path.name}.atomic-write-{'d' * 24}.tmp"
|
|
683
|
+
)
|
|
684
|
+
orphan.write_bytes(b"AUTOMATED PARTIAL BLOCKED RAW STAGING\n")
|
|
685
|
+
raise runner.EnvelopeError("AUTOMATED BLOCKED RAW STAGING FAILURE")
|
|
686
|
+
return original_write(path, raw_bytes, **kwargs)
|
|
687
|
+
|
|
688
|
+
monkeypatch.setattr(runner, "_write_new", leave_one_blocked_raw_staging)
|
|
689
|
+
with pytest.raises(runner.StopViolation):
|
|
690
|
+
runner.ingest(
|
|
691
|
+
_command_args(
|
|
692
|
+
run_dir,
|
|
693
|
+
plan_sha,
|
|
694
|
+
transcript=source,
|
|
695
|
+
authorization_record=_authorization_file(tmp_path, plan),
|
|
696
|
+
)
|
|
697
|
+
)
|
|
698
|
+
manifest = json.loads((run_dir / "ingestion-manifest.json").read_bytes())
|
|
699
|
+
staging = list((run_dir / "blocked").glob("*.tmp"))
|
|
700
|
+
assert len(staging) == 1
|
|
701
|
+
assert manifest["stop_receipt"]["pre_stop_inventory"]["entry_count"] == 1
|
|
702
|
+
monkeypatch.setattr(runner, "_write_new", original_write)
|
|
703
|
+
assert runner.validate_run(_command_args(run_dir, plan_sha))["status"] == "stopped"
|
|
704
|
+
|
|
705
|
+
|
|
706
|
+
def test_compact_pre_stop_inventory_binds_many_long_files_and_empty_directories(
|
|
707
|
+
tmp_path,
|
|
708
|
+
):
|
|
709
|
+
run_dir, plan_sha, plan = _initialize(tmp_path)
|
|
710
|
+
runner.materialize(_command_args(run_dir, plan_sha))
|
|
711
|
+
for index in range(70):
|
|
712
|
+
directory = run_dir / f"unexpected-{index:03d}-{'d' * 80}"
|
|
713
|
+
directory.mkdir()
|
|
714
|
+
(directory / f"{'f' * 140}-{index:03d}.bin").write_bytes(
|
|
715
|
+
f"AUTOMATED INVENTORY {index}\n".encode("utf-8")
|
|
716
|
+
)
|
|
717
|
+
empty = run_dir / "unexpected-empty-directory"
|
|
718
|
+
empty.mkdir()
|
|
719
|
+
source = tmp_path / "valid.json"
|
|
720
|
+
source.write_bytes(runner._json_bytes(_transcript(plan, plan["cells"][0])))
|
|
721
|
+
with pytest.raises(runner.StopViolation) as caught:
|
|
722
|
+
runner.ingest(
|
|
723
|
+
_command_args(
|
|
724
|
+
run_dir,
|
|
725
|
+
plan_sha,
|
|
726
|
+
transcript=source,
|
|
727
|
+
authorization_record=_authorization_file(tmp_path, plan),
|
|
728
|
+
)
|
|
729
|
+
)
|
|
730
|
+
assert caught.value.code == "evidence_write_failure"
|
|
731
|
+
manifest = json.loads((run_dir / "ingestion-manifest.json").read_bytes())
|
|
732
|
+
assert manifest["stop_receipt"]["pre_stop_inventory"]["entry_count"] == 141
|
|
733
|
+
marker = json.loads((run_dir / runner.STOP_INTENT_REF).read_bytes())
|
|
734
|
+
assert marker["pre_stop_inventory"] == manifest["stop_receipt"][
|
|
735
|
+
"pre_stop_inventory"
|
|
736
|
+
]
|
|
737
|
+
assert (run_dir / runner.STOP_INTENT_REF).stat().st_size < 200_000
|
|
738
|
+
assert runner.validate_run(_command_args(run_dir, plan_sha))["status"] == "stopped"
|
|
739
|
+
(run_dir / "unexpected-after-stop").mkdir()
|
|
740
|
+
with pytest.raises(runner.EnvelopeError, match="compact inventory"):
|
|
741
|
+
runner.validate_run(_command_args(run_dir, plan_sha))
|
|
742
|
+
|
|
743
|
+
|
|
744
|
+
def test_published_stop_marker_cleanup_alias_is_registered_and_replayable(
|
|
745
|
+
tmp_path, monkeypatch
|
|
746
|
+
):
|
|
747
|
+
run_dir, plan_sha, plan = _initialize(tmp_path)
|
|
748
|
+
runner.materialize(_command_args(run_dir, plan_sha))
|
|
749
|
+
source = tmp_path / "partial.json"
|
|
750
|
+
source.write_bytes(
|
|
751
|
+
runner._json_bytes(_transcript(plan, plan["cells"][0], partial=True))
|
|
752
|
+
)
|
|
753
|
+
original_unlink = Path.unlink
|
|
754
|
+
|
|
755
|
+
def retain_registered_alias(path, *args, **kwargs):
|
|
756
|
+
if path.name.startswith(".stop-intent.json.publish-"):
|
|
757
|
+
raise OSError("AUTOMATED REGISTERED ALIAS RETENTION")
|
|
758
|
+
return original_unlink(path, *args, **kwargs)
|
|
759
|
+
|
|
760
|
+
monkeypatch.setattr(Path, "unlink", retain_registered_alias)
|
|
761
|
+
with pytest.raises(runner.StopViolation):
|
|
762
|
+
runner.ingest(
|
|
763
|
+
_command_args(
|
|
764
|
+
run_dir,
|
|
765
|
+
plan_sha,
|
|
766
|
+
transcript=source,
|
|
767
|
+
authorization_record=_authorization_file(tmp_path, plan),
|
|
768
|
+
)
|
|
769
|
+
)
|
|
770
|
+
aliases = list(run_dir.glob(".stop-intent.json.publish-*.tmp"))
|
|
771
|
+
assert len(aliases) == 1
|
|
772
|
+
marker_path = run_dir / runner.STOP_INTENT_REF
|
|
773
|
+
assert aliases[0].stat().st_ino == marker_path.stat().st_ino
|
|
774
|
+
monkeypatch.setattr(Path, "unlink", original_unlink)
|
|
775
|
+
assert runner.validate_run(_command_args(run_dir, plan_sha))["status"] == "stopped"
|
|
776
|
+
marker_raw = marker_path.read_bytes()
|
|
777
|
+
aliases[0].unlink()
|
|
778
|
+
aliases[0].write_bytes(marker_raw)
|
|
779
|
+
with pytest.raises(runner.EnvelopeError, match="is not the marker hardlink"):
|
|
780
|
+
runner.validate_run(_command_args(run_dir, plan_sha))
|
|
781
|
+
|
|
782
|
+
|
|
783
|
+
def test_primary_stop_slot_failure_uses_bound_fallback_and_stays_terminal(
|
|
784
|
+
tmp_path, monkeypatch
|
|
785
|
+
):
|
|
786
|
+
run_dir, plan_sha, plan = _initialize(tmp_path)
|
|
787
|
+
runner.materialize(_command_args(run_dir, plan_sha))
|
|
788
|
+
source = tmp_path / "partial.json"
|
|
789
|
+
source.write_bytes(
|
|
790
|
+
runner._json_bytes(_transcript(plan, plan["cells"][0], partial=True))
|
|
791
|
+
)
|
|
792
|
+
original_link = runner.os.link
|
|
793
|
+
|
|
794
|
+
def fail_primary(source_path, target_path, *args, **kwargs):
|
|
795
|
+
if Path(target_path).name == runner.STOP_INTENT_REF:
|
|
796
|
+
raise OSError("AUTOMATED PRIMARY STOP SLOT FAILURE")
|
|
797
|
+
return original_link(source_path, target_path, *args, **kwargs)
|
|
798
|
+
|
|
799
|
+
monkeypatch.setattr(runner.os, "link", fail_primary)
|
|
800
|
+
with pytest.raises(runner.StopViolation):
|
|
801
|
+
runner.ingest(
|
|
802
|
+
_command_args(
|
|
803
|
+
run_dir,
|
|
804
|
+
plan_sha,
|
|
805
|
+
transcript=source,
|
|
806
|
+
authorization_record=_authorization_file(tmp_path, plan),
|
|
807
|
+
)
|
|
808
|
+
)
|
|
809
|
+
assert not (run_dir / runner.STOP_INTENT_REF).exists()
|
|
810
|
+
assert (run_dir / runner.STOP_INTENT_FALLBACK_REF).is_file()
|
|
811
|
+
assert runner.validate_run(_command_args(run_dir, plan_sha))["status"] == "stopped"
|
|
812
|
+
|
|
813
|
+
|
|
814
|
+
def test_dual_stop_slot_failure_leaves_precommitted_active_poison_guard(
|
|
815
|
+
tmp_path, monkeypatch
|
|
816
|
+
):
|
|
817
|
+
run_dir, plan_sha, plan = _initialize(tmp_path)
|
|
818
|
+
runner.materialize(_command_args(run_dir, plan_sha))
|
|
819
|
+
source = tmp_path / "partial.json"
|
|
820
|
+
source.write_bytes(
|
|
821
|
+
runner._json_bytes(_transcript(plan, plan["cells"][0], partial=True))
|
|
822
|
+
)
|
|
823
|
+
authorization = _authorization_file(tmp_path, plan)
|
|
824
|
+
original_link = runner.os.link
|
|
825
|
+
|
|
826
|
+
def fail_both_slots(source_path, target_path, *args, **kwargs):
|
|
827
|
+
if Path(target_path).name in {
|
|
828
|
+
runner.STOP_INTENT_REF,
|
|
829
|
+
runner.STOP_INTENT_FALLBACK_REF,
|
|
830
|
+
}:
|
|
831
|
+
raise OSError("AUTOMATED DUAL STOP SLOT FAILURE")
|
|
832
|
+
return original_link(source_path, target_path, *args, **kwargs)
|
|
833
|
+
|
|
834
|
+
monkeypatch.setattr(runner.os, "link", fail_both_slots)
|
|
835
|
+
with pytest.raises(runner.EnvelopeError, match="either predeclared slot"):
|
|
836
|
+
runner.ingest(
|
|
837
|
+
_command_args(
|
|
838
|
+
run_dir,
|
|
839
|
+
plan_sha,
|
|
840
|
+
transcript=source,
|
|
841
|
+
authorization_record=authorization,
|
|
842
|
+
)
|
|
843
|
+
)
|
|
844
|
+
active = run_dir / runner._journal_ref("active", "cell-001")
|
|
845
|
+
assert active.is_file()
|
|
846
|
+
assert not (run_dir / runner.STOP_INTENT_REF).exists()
|
|
847
|
+
assert not (run_dir / runner.STOP_INTENT_FALLBACK_REF).exists()
|
|
848
|
+
monkeypatch.setattr(runner.os, "link", original_link)
|
|
849
|
+
source.write_bytes(runner._json_bytes(_transcript(plan, plan["cells"][0])))
|
|
850
|
+
with pytest.raises(runner.EnvelopeError, match="permanently forbids retry"):
|
|
851
|
+
runner.ingest(
|
|
852
|
+
_command_args(
|
|
853
|
+
run_dir,
|
|
854
|
+
plan_sha,
|
|
855
|
+
transcript=source,
|
|
856
|
+
authorization_record=authorization,
|
|
857
|
+
)
|
|
858
|
+
)
|
|
859
|
+
|
|
860
|
+
|
|
861
|
+
def test_out_of_order_ingestion_stops_on_first_event(tmp_path):
|
|
862
|
+
run_dir, plan_sha, plan = _initialize(tmp_path)
|
|
863
|
+
runner.materialize(_command_args(run_dir, plan_sha))
|
|
864
|
+
raw = runner._json_bytes(_transcript(plan, plan["cells"][1]))
|
|
865
|
+
source = tmp_path / "external-transcript.json"
|
|
866
|
+
source.write_bytes(raw)
|
|
867
|
+
with pytest.raises(runner.StopViolation) as caught:
|
|
868
|
+
runner.ingest(
|
|
869
|
+
_command_args(
|
|
870
|
+
run_dir,
|
|
871
|
+
plan_sha,
|
|
872
|
+
transcript=source,
|
|
873
|
+
authorization_record=_authorization_file(tmp_path, plan),
|
|
874
|
+
)
|
|
875
|
+
)
|
|
876
|
+
assert caught.value.code == "out_of_order_ingestion"
|
|
877
|
+
manifest = json.loads((run_dir / "ingestion-manifest.json").read_bytes())
|
|
878
|
+
assert [row["status"] for row in manifest["cells"][:2]] == [
|
|
879
|
+
"blocked",
|
|
880
|
+
"pending",
|
|
881
|
+
]
|
|
882
|
+
|
|
883
|
+
|
|
884
|
+
@pytest.mark.parametrize(
|
|
885
|
+
("mutation", "reason_code"),
|
|
886
|
+
(
|
|
887
|
+
("prompt", "prompt_or_role_card_hash_mismatch"),
|
|
888
|
+
("reported_arm_leak", "arm_leakage"),
|
|
889
|
+
("ineligible", "ineligible_session"),
|
|
890
|
+
("reported_tool", "unplanned_tool_action"),
|
|
891
|
+
("reported_network", "unplanned_network_action"),
|
|
892
|
+
("write_failure", "evidence_write_failure"),
|
|
893
|
+
("actor_deviation", "actor_protocol_deviation"),
|
|
894
|
+
),
|
|
895
|
+
)
|
|
896
|
+
def test_each_reported_stop_rule_fails_closed(tmp_path, mutation, reason_code):
|
|
897
|
+
_, plan_sha, plan = _initialize(tmp_path)
|
|
898
|
+
cell = plan["cells"][0]
|
|
899
|
+
transcript = _transcript(plan, cell)
|
|
900
|
+
observations = transcript["observations"]
|
|
901
|
+
if mutation == "prompt":
|
|
902
|
+
observations["prompt_hash_match"] = False
|
|
903
|
+
elif mutation == "reported_arm_leak":
|
|
904
|
+
observations["arm_leakage"] = True
|
|
905
|
+
elif mutation == "ineligible":
|
|
906
|
+
observations["eligible"] = False
|
|
907
|
+
elif mutation == "reported_tool":
|
|
908
|
+
observations["unplanned_tool_actions"] = ["automated test fixture"]
|
|
909
|
+
elif mutation == "reported_network":
|
|
910
|
+
observations["unplanned_network_actions"] = ["automated test fixture"]
|
|
911
|
+
elif mutation == "write_failure":
|
|
912
|
+
observations["evidence_write_failure"] = True
|
|
913
|
+
elif mutation == "actor_deviation":
|
|
914
|
+
observations["actor_protocol_deviation"] = True
|
|
915
|
+
heldout, _ = runner.phase1.load_assets()
|
|
916
|
+
scenario = next(
|
|
917
|
+
row for row in heldout["scenarios"] if row["scenario_id"] == cell["scenario_id"]
|
|
918
|
+
)
|
|
919
|
+
with pytest.raises(runner.StopViolation) as caught:
|
|
920
|
+
runner._validate_transcript(transcript, cell, plan, plan_sha, scenario)
|
|
921
|
+
assert caught.value.code == reason_code
|
|
922
|
+
|
|
923
|
+
|
|
924
|
+
@pytest.mark.parametrize(
|
|
925
|
+
("event_kind", "reason_code"),
|
|
926
|
+
(
|
|
927
|
+
("tool_action", "unplanned_tool_action"),
|
|
928
|
+
("network_action", "unplanned_network_action"),
|
|
929
|
+
("evidence_write_failure", "evidence_write_failure"),
|
|
930
|
+
),
|
|
931
|
+
)
|
|
932
|
+
def test_normalized_event_stream_cannot_hide_forbidden_actions(
|
|
933
|
+
tmp_path, event_kind, reason_code
|
|
934
|
+
):
|
|
935
|
+
_, plan_sha, plan = _initialize(tmp_path)
|
|
936
|
+
cell = plan["cells"][0]
|
|
937
|
+
transcript = _transcript(plan, cell)
|
|
938
|
+
normalized = {"event_kind": event_kind, "turn_index": None}
|
|
939
|
+
raw_event = runner._canonical(normalized).decode("utf-8")
|
|
940
|
+
transcript["events"].insert(
|
|
941
|
+
-1,
|
|
942
|
+
{
|
|
943
|
+
"event_index": len(transcript["events"]),
|
|
944
|
+
"event_kind": event_kind,
|
|
945
|
+
"turn_index": None,
|
|
946
|
+
"raw_event_utf8": raw_event,
|
|
947
|
+
"raw_event_sha256": hashlib.sha256(raw_event.encode()).hexdigest(),
|
|
948
|
+
},
|
|
949
|
+
)
|
|
950
|
+
transcript["events"][-1]["event_index"] += 1
|
|
951
|
+
heldout, _ = runner.phase1.load_assets()
|
|
952
|
+
scenario = next(
|
|
953
|
+
row for row in heldout["scenarios"] if row["scenario_id"] == cell["scenario_id"]
|
|
954
|
+
)
|
|
955
|
+
with pytest.raises(runner.StopViolation) as caught:
|
|
956
|
+
runner._validate_transcript(transcript, cell, plan, plan_sha, scenario)
|
|
957
|
+
assert caught.value.code == reason_code
|
|
958
|
+
|
|
959
|
+
|
|
960
|
+
def test_exact_arm_identifiers_in_turn_text_cannot_bypass_false_observation(tmp_path):
|
|
961
|
+
_, plan_sha, plan = _initialize(tmp_path)
|
|
962
|
+
cell = plan["cells"][0]
|
|
963
|
+
transcript = _transcript(plan, cell)
|
|
964
|
+
transcript["turns"][1]["text"] += " adjacent_probe_on"
|
|
965
|
+
heldout, _ = runner.phase1.load_assets()
|
|
966
|
+
scenario = next(
|
|
967
|
+
row for row in heldout["scenarios"] if row["scenario_id"] == cell["scenario_id"]
|
|
968
|
+
)
|
|
969
|
+
with pytest.raises(runner.StopViolation) as caught:
|
|
970
|
+
runner._validate_transcript(transcript, cell, plan, plan_sha, scenario)
|
|
971
|
+
assert caught.value.code == "arm_leakage"
|
|
972
|
+
|
|
973
|
+
|
|
974
|
+
def test_raw_event_hash_mutation_fails_closed(tmp_path):
|
|
975
|
+
_, plan_sha, plan = _initialize(tmp_path)
|
|
976
|
+
cell = plan["cells"][0]
|
|
977
|
+
transcript = _transcript(plan, cell)
|
|
978
|
+
transcript["events"][0]["raw_event_utf8"] += " mutated"
|
|
979
|
+
heldout, _ = runner.phase1.load_assets()
|
|
980
|
+
scenario = next(
|
|
981
|
+
row for row in heldout["scenarios"] if row["scenario_id"] == cell["scenario_id"]
|
|
982
|
+
)
|
|
983
|
+
with pytest.raises(runner.StopViolation, match=r"raw event (?:[0-9]+ )?hash mismatch"):
|
|
984
|
+
runner._validate_transcript(transcript, cell, plan, plan_sha, scenario)
|
|
985
|
+
|
|
986
|
+
|
|
987
|
+
def test_raw_network_action_cannot_hide_behind_normalized_message_fields(tmp_path):
|
|
988
|
+
_, plan_sha, plan = _initialize(tmp_path)
|
|
989
|
+
cell = plan["cells"][0]
|
|
990
|
+
transcript = _transcript(plan, cell)
|
|
991
|
+
_set_raw_event(
|
|
992
|
+
transcript["events"][1],
|
|
993
|
+
{"event_kind": "network_action", "turn_index": None},
|
|
994
|
+
)
|
|
995
|
+
heldout, _ = runner.phase1.load_assets()
|
|
996
|
+
scenario = next(
|
|
997
|
+
row for row in heldout["scenarios"] if row["scenario_id"] == cell["scenario_id"]
|
|
998
|
+
)
|
|
999
|
+
with pytest.raises(runner.StopViolation) as caught:
|
|
1000
|
+
runner._validate_transcript(transcript, cell, plan, plan_sha, scenario)
|
|
1001
|
+
assert caught.value.code == "unplanned_network_action"
|
|
1002
|
+
|
|
1003
|
+
|
|
1004
|
+
def test_turn_text_must_be_derived_exactly_from_raw_message_bytes(tmp_path):
|
|
1005
|
+
_, plan_sha, plan = _initialize(tmp_path)
|
|
1006
|
+
cell = plan["cells"][0]
|
|
1007
|
+
transcript = _transcript(plan, cell)
|
|
1008
|
+
transcript["turns"][1]["text"] += " externally mutated"
|
|
1009
|
+
heldout, _ = runner.phase1.load_assets()
|
|
1010
|
+
scenario = next(
|
|
1011
|
+
row for row in heldout["scenarios"] if row["scenario_id"] == cell["scenario_id"]
|
|
1012
|
+
)
|
|
1013
|
+
with pytest.raises(runner.StopViolation, match="derived byte-exactly"):
|
|
1014
|
+
runner._validate_transcript(transcript, cell, plan, plan_sha, scenario)
|
|
1015
|
+
|
|
1016
|
+
|
|
1017
|
+
@pytest.mark.parametrize("semantic_empty", (" ", "\u200b", "\u0301"))
|
|
1018
|
+
def test_semantic_empty_subject_message_is_partial_and_stops_immediately(
|
|
1019
|
+
tmp_path, semantic_empty
|
|
1020
|
+
):
|
|
1021
|
+
run_dir, plan_sha, plan = _initialize(tmp_path)
|
|
1022
|
+
runner.materialize(_command_args(run_dir, plan_sha))
|
|
1023
|
+
transcript = _transcript(plan, plan["cells"][0])
|
|
1024
|
+
transcript["turns"][1]["text"] = semantic_empty
|
|
1025
|
+
_set_raw_event(
|
|
1026
|
+
transcript["events"][2],
|
|
1027
|
+
{
|
|
1028
|
+
"event_kind": "subject_message",
|
|
1029
|
+
"turn_index": 2,
|
|
1030
|
+
"text": semantic_empty,
|
|
1031
|
+
},
|
|
1032
|
+
)
|
|
1033
|
+
source = tmp_path / "semantic-empty-subject.json"
|
|
1034
|
+
source.write_bytes(runner._json_bytes(transcript))
|
|
1035
|
+
with pytest.raises(runner.StopViolation) as caught:
|
|
1036
|
+
runner.ingest(
|
|
1037
|
+
_command_args(
|
|
1038
|
+
run_dir,
|
|
1039
|
+
plan_sha,
|
|
1040
|
+
transcript=source,
|
|
1041
|
+
authorization_record=_authorization_file(tmp_path, plan),
|
|
1042
|
+
)
|
|
1043
|
+
)
|
|
1044
|
+
assert caught.value.code == "partial_subject_output"
|
|
1045
|
+
manifest = json.loads((run_dir / "ingestion-manifest.json").read_bytes())
|
|
1046
|
+
assert [row["status"] for row in manifest["cells"][:2]] == [
|
|
1047
|
+
"blocked",
|
|
1048
|
+
"pending",
|
|
1049
|
+
]
|
|
1050
|
+
|
|
1051
|
+
|
|
1052
|
+
def test_raw_event_unknown_fields_fail_closed_instead_of_self_classifying(tmp_path):
|
|
1053
|
+
_, plan_sha, plan = _initialize(tmp_path)
|
|
1054
|
+
cell = plan["cells"][0]
|
|
1055
|
+
transcript = _transcript(plan, cell)
|
|
1056
|
+
_set_raw_event(
|
|
1057
|
+
transcript["events"][0],
|
|
1058
|
+
{
|
|
1059
|
+
"event_kind": "session_started",
|
|
1060
|
+
"turn_index": None,
|
|
1061
|
+
"network_action": "https://example.invalid",
|
|
1062
|
+
},
|
|
1063
|
+
)
|
|
1064
|
+
heldout, _ = runner.phase1.load_assets()
|
|
1065
|
+
scenario = next(
|
|
1066
|
+
row for row in heldout["scenarios"] if row["scenario_id"] == cell["scenario_id"]
|
|
1067
|
+
)
|
|
1068
|
+
with pytest.raises(runner.StopViolation, match="closed normalized event"):
|
|
1069
|
+
runner._validate_transcript(transcript, cell, plan, plan_sha, scenario)
|
|
1070
|
+
|
|
1071
|
+
|
|
1072
|
+
def test_event_lifecycle_rejects_stitched_sessions(tmp_path):
|
|
1073
|
+
_, plan_sha, plan = _initialize(tmp_path)
|
|
1074
|
+
cell = plan["cells"][0]
|
|
1075
|
+
transcript = _transcript(plan, cell)
|
|
1076
|
+
inserted = []
|
|
1077
|
+
for event_kind in ("session_completed", "session_started"):
|
|
1078
|
+
normalized = {"event_kind": event_kind, "turn_index": None}
|
|
1079
|
+
raw = runner._canonical(normalized).decode("utf-8")
|
|
1080
|
+
inserted.append(
|
|
1081
|
+
{
|
|
1082
|
+
"event_index": 0,
|
|
1083
|
+
"event_kind": event_kind,
|
|
1084
|
+
"turn_index": None,
|
|
1085
|
+
"raw_event_utf8": raw,
|
|
1086
|
+
"raw_event_sha256": hashlib.sha256(raw.encode()).hexdigest(),
|
|
1087
|
+
}
|
|
1088
|
+
)
|
|
1089
|
+
transcript["events"][3:3] = inserted
|
|
1090
|
+
for index, event in enumerate(transcript["events"], 1):
|
|
1091
|
+
event["event_index"] = index
|
|
1092
|
+
heldout, _ = runner.phase1.load_assets()
|
|
1093
|
+
scenario = next(
|
|
1094
|
+
row for row in heldout["scenarios"] if row["scenario_id"] == cell["scenario_id"]
|
|
1095
|
+
)
|
|
1096
|
+
with pytest.raises(runner.StopViolation, match="exactly one first start"):
|
|
1097
|
+
runner._validate_transcript(transcript, cell, plan, plan_sha, scenario)
|
|
1098
|
+
|
|
1099
|
+
|
|
1100
|
+
def test_authorization_record_hash_mismatch_stops_and_preserves_transcript(tmp_path):
|
|
1101
|
+
run_dir, plan_sha, plan = _initialize(tmp_path)
|
|
1102
|
+
runner.materialize(_command_args(run_dir, plan_sha))
|
|
1103
|
+
source = tmp_path / "external-transcript.json"
|
|
1104
|
+
raw = runner._json_bytes(_transcript(plan, plan["cells"][0]))
|
|
1105
|
+
source.write_bytes(raw)
|
|
1106
|
+
wrong_authorization = tmp_path / "wrong-authorization.txt"
|
|
1107
|
+
wrong_authorization.write_bytes(b"AUTOMATED WRONG HASH TEST FIXTURE\n")
|
|
1108
|
+
with pytest.raises(runner.StopViolation) as caught:
|
|
1109
|
+
runner.ingest(
|
|
1110
|
+
_command_args(
|
|
1111
|
+
run_dir,
|
|
1112
|
+
plan_sha,
|
|
1113
|
+
transcript=source,
|
|
1114
|
+
authorization_record=wrong_authorization,
|
|
1115
|
+
)
|
|
1116
|
+
)
|
|
1117
|
+
assert caught.value.code == "authorization_record_missing_or_mismatch"
|
|
1118
|
+
manifest = json.loads((run_dir / "ingestion-manifest.json").read_bytes())
|
|
1119
|
+
assert (run_dir / manifest["stop_receipt"]["raw_ref"]).read_bytes() == raw
|
|
1120
|
+
|
|
1121
|
+
|
|
1122
|
+
@pytest.mark.parametrize("mutation", ("blank", "wrong_plan", "predates"))
|
|
1123
|
+
def test_invalid_authorization_structure_plan_or_time_stops(tmp_path, mutation):
|
|
1124
|
+
run_dir, plan_sha, plan = _initialize(tmp_path)
|
|
1125
|
+
runner.materialize(_command_args(run_dir, plan_sha))
|
|
1126
|
+
transcript = _transcript(plan, plan["cells"][0])
|
|
1127
|
+
authorization_path = tmp_path / "authorization.json"
|
|
1128
|
+
if mutation == "blank":
|
|
1129
|
+
authorization_raw = b"{}\n"
|
|
1130
|
+
else:
|
|
1131
|
+
authorization = _authorization(plan)
|
|
1132
|
+
if mutation == "wrong_plan":
|
|
1133
|
+
authorization["run_plan_sha256"] = "f" * 64
|
|
1134
|
+
else:
|
|
1135
|
+
authorization["decision"]["decided_at"] = "2026-08-13T00:00:02Z"
|
|
1136
|
+
authorization_raw = runner._json_bytes(authorization)
|
|
1137
|
+
authorization_path.write_bytes(authorization_raw)
|
|
1138
|
+
transcript["source"]["authorization_record_sha256"] = hashlib.sha256(
|
|
1139
|
+
authorization_raw
|
|
1140
|
+
).hexdigest()
|
|
1141
|
+
source = tmp_path / "transcript.json"
|
|
1142
|
+
source.write_bytes(runner._json_bytes(transcript))
|
|
1143
|
+
with pytest.raises(runner.StopViolation) as caught:
|
|
1144
|
+
runner.ingest(
|
|
1145
|
+
_command_args(
|
|
1146
|
+
run_dir,
|
|
1147
|
+
plan_sha,
|
|
1148
|
+
transcript=source,
|
|
1149
|
+
authorization_record=authorization_path,
|
|
1150
|
+
)
|
|
1151
|
+
)
|
|
1152
|
+
assert caught.value.code == "authorization_record_missing_or_mismatch"
|
|
1153
|
+
|
|
1154
|
+
|
|
1155
|
+
@pytest.mark.parametrize(
|
|
1156
|
+
("operator_reference", "statement"),
|
|
1157
|
+
(
|
|
1158
|
+
(" " * 8, " " * 20),
|
|
1159
|
+
("\u200b" * 8, "\u200b" * 20),
|
|
1160
|
+
("\u0301" * 8, "\u0301" * 20),
|
|
1161
|
+
),
|
|
1162
|
+
)
|
|
1163
|
+
def test_semantic_empty_authorization_never_counts_as_consent(
|
|
1164
|
+
tmp_path, operator_reference, statement
|
|
1165
|
+
):
|
|
1166
|
+
run_dir, plan_sha, plan = _initialize(tmp_path)
|
|
1167
|
+
runner.materialize(_command_args(run_dir, plan_sha))
|
|
1168
|
+
authorization = _authorization(plan)
|
|
1169
|
+
authorization["decision"]["operator_reference"] = operator_reference
|
|
1170
|
+
authorization["decision"]["statement"] = statement
|
|
1171
|
+
authorization_raw = runner._json_bytes(authorization)
|
|
1172
|
+
authorization_path = tmp_path / "semantic-empty-authorization.json"
|
|
1173
|
+
authorization_path.write_bytes(authorization_raw)
|
|
1174
|
+
transcript = _transcript(plan, plan["cells"][0])
|
|
1175
|
+
transcript["source"]["authorization_record_sha256"] = hashlib.sha256(
|
|
1176
|
+
authorization_raw
|
|
1177
|
+
).hexdigest()
|
|
1178
|
+
source = tmp_path / "transcript.json"
|
|
1179
|
+
source.write_bytes(runner._json_bytes(transcript))
|
|
1180
|
+
with pytest.raises(runner.StopViolation) as caught:
|
|
1181
|
+
runner.ingest(
|
|
1182
|
+
_command_args(
|
|
1183
|
+
run_dir,
|
|
1184
|
+
plan_sha,
|
|
1185
|
+
transcript=source,
|
|
1186
|
+
authorization_record=authorization_path,
|
|
1187
|
+
)
|
|
1188
|
+
)
|
|
1189
|
+
assert caught.value.code == "authorization_record_missing_or_mismatch"
|
|
1190
|
+
assert json.loads((run_dir / "ingestion-manifest.json").read_bytes())[
|
|
1191
|
+
"status"
|
|
1192
|
+
] == "stopped"
|
|
1193
|
+
|
|
1194
|
+
|
|
1195
|
+
def test_prior_transcript_and_receipt_drift_blocks_further_ingestion(tmp_path):
|
|
1196
|
+
run_dir, plan_sha, plan = _initialize(tmp_path)
|
|
1197
|
+
runner.materialize(_command_args(run_dir, plan_sha))
|
|
1198
|
+
source = tmp_path / "external-transcript.json"
|
|
1199
|
+
source.write_bytes(runner._json_bytes(_transcript(plan, plan["cells"][0])))
|
|
1200
|
+
authorization = _authorization_file(tmp_path, plan)
|
|
1201
|
+
runner.ingest(
|
|
1202
|
+
_command_args(
|
|
1203
|
+
run_dir,
|
|
1204
|
+
plan_sha,
|
|
1205
|
+
transcript=source,
|
|
1206
|
+
authorization_record=authorization,
|
|
1207
|
+
)
|
|
1208
|
+
)
|
|
1209
|
+
receipt = run_dir / "receipts/cell-001.json"
|
|
1210
|
+
receipt.write_bytes(receipt.read_bytes() + b"\n")
|
|
1211
|
+
with pytest.raises(runner.EnvelopeError, match="ingestion receipt drift"):
|
|
1212
|
+
runner.validate_run(_command_args(run_dir, plan_sha))
|
|
1213
|
+
source.write_bytes(runner._json_bytes(_transcript(plan, plan["cells"][1])))
|
|
1214
|
+
with pytest.raises(runner.EnvelopeError, match="ingestion receipt drift"):
|
|
1215
|
+
runner.ingest(
|
|
1216
|
+
_command_args(
|
|
1217
|
+
run_dir,
|
|
1218
|
+
plan_sha,
|
|
1219
|
+
transcript=source,
|
|
1220
|
+
authorization_record=authorization,
|
|
1221
|
+
)
|
|
1222
|
+
)
|
|
1223
|
+
|
|
1224
|
+
|
|
1225
|
+
def test_local_evidence_write_failure_stops_without_overwrite(tmp_path):
|
|
1226
|
+
run_dir, plan_sha, plan = _initialize(tmp_path)
|
|
1227
|
+
runner.materialize(_command_args(run_dir, plan_sha))
|
|
1228
|
+
existing = run_dir / "transcripts/cell-001.json"
|
|
1229
|
+
existing.parent.mkdir()
|
|
1230
|
+
existing.write_bytes(b"PREEXISTING AUTOMATED TEST SENTINEL\n")
|
|
1231
|
+
source = tmp_path / "external-transcript.json"
|
|
1232
|
+
raw = runner._json_bytes(_transcript(plan, plan["cells"][0]))
|
|
1233
|
+
source.write_bytes(raw)
|
|
1234
|
+
with pytest.raises(runner.StopViolation) as caught:
|
|
1235
|
+
runner.ingest(
|
|
1236
|
+
_command_args(
|
|
1237
|
+
run_dir,
|
|
1238
|
+
plan_sha,
|
|
1239
|
+
transcript=source,
|
|
1240
|
+
authorization_record=_authorization_file(tmp_path, plan),
|
|
1241
|
+
)
|
|
1242
|
+
)
|
|
1243
|
+
assert caught.value.code == "evidence_write_failure"
|
|
1244
|
+
assert existing.read_bytes() == b"PREEXISTING AUTOMATED TEST SENTINEL\n"
|
|
1245
|
+
manifest = json.loads((run_dir / "ingestion-manifest.json").read_bytes())
|
|
1246
|
+
assert manifest["status"] == "stopped"
|
|
1247
|
+
assert manifest["stop_receipt"]["retry_forbidden"] is True
|
|
1248
|
+
assert (run_dir / manifest["stop_receipt"]["raw_ref"]).read_bytes() == raw
|
|
1249
|
+
|
|
1250
|
+
|
|
1251
|
+
def test_preexisting_blocked_path_cannot_prevent_irreversible_first_stop(tmp_path):
|
|
1252
|
+
run_dir, plan_sha, plan = _initialize(tmp_path)
|
|
1253
|
+
runner.materialize(_command_args(run_dir, plan_sha))
|
|
1254
|
+
sentinel = run_dir / "blocked/cell-001.transcript.raw"
|
|
1255
|
+
sentinel.parent.mkdir()
|
|
1256
|
+
sentinel.write_bytes(b"PREEXISTING BLOCKED-PATH SENTINEL\n")
|
|
1257
|
+
source = tmp_path / "external-transcript.json"
|
|
1258
|
+
raw = runner._json_bytes(_transcript(plan, plan["cells"][0]))
|
|
1259
|
+
source.write_bytes(raw)
|
|
1260
|
+
ingest_args = _command_args(
|
|
1261
|
+
run_dir,
|
|
1262
|
+
plan_sha,
|
|
1263
|
+
transcript=source,
|
|
1264
|
+
authorization_record=_authorization_file(tmp_path, plan),
|
|
1265
|
+
)
|
|
1266
|
+
with pytest.raises(runner.StopViolation) as caught:
|
|
1267
|
+
runner.ingest(ingest_args)
|
|
1268
|
+
assert caught.value.code == "evidence_write_failure"
|
|
1269
|
+
manifest = json.loads((run_dir / "ingestion-manifest.json").read_bytes())
|
|
1270
|
+
assert manifest["status"] == "stopped"
|
|
1271
|
+
assert manifest["stop_receipt"][
|
|
1272
|
+
"stop_intent_committed_before_state_replacement"
|
|
1273
|
+
] is True
|
|
1274
|
+
assert sentinel.read_bytes() == b"PREEXISTING BLOCKED-PATH SENTINEL\n"
|
|
1275
|
+
assert (run_dir / manifest["stop_receipt"]["raw_ref"]).read_bytes() == raw
|
|
1276
|
+
with pytest.raises(runner.EnvelopeError, match="forbids retry"):
|
|
1277
|
+
runner.ingest(ingest_args)
|
|
1278
|
+
|
|
1279
|
+
|
|
1280
|
+
def test_blocked_raw_evidence_tamper_is_detected_on_replay(tmp_path):
|
|
1281
|
+
run_dir, plan_sha, plan = _initialize(tmp_path)
|
|
1282
|
+
runner.materialize(_command_args(run_dir, plan_sha))
|
|
1283
|
+
source = tmp_path / "partial-transcript.json"
|
|
1284
|
+
source.write_bytes(
|
|
1285
|
+
runner._json_bytes(_transcript(plan, plan["cells"][0], partial=True))
|
|
1286
|
+
)
|
|
1287
|
+
with pytest.raises(runner.StopViolation):
|
|
1288
|
+
runner.ingest(
|
|
1289
|
+
_command_args(
|
|
1290
|
+
run_dir,
|
|
1291
|
+
plan_sha,
|
|
1292
|
+
transcript=source,
|
|
1293
|
+
authorization_record=_authorization_file(tmp_path, plan),
|
|
1294
|
+
)
|
|
1295
|
+
)
|
|
1296
|
+
manifest = json.loads((run_dir / "ingestion-manifest.json").read_bytes())
|
|
1297
|
+
blocked = run_dir / manifest["stop_receipt"]["raw_ref"]
|
|
1298
|
+
blocked.write_bytes(b"TAMPERED BLOCKED EVIDENCE\n")
|
|
1299
|
+
with pytest.raises(runner.EnvelopeError, match="blocked transcript hash drift"):
|
|
1300
|
+
runner.validate_run(_command_args(run_dir, plan_sha))
|
|
1301
|
+
|
|
1302
|
+
|
|
1303
|
+
@pytest.mark.parametrize("mutation", ("duplicate_session", "time_regression"))
|
|
1304
|
+
def test_external_session_receipts_are_unique_and_monotonic(tmp_path, mutation):
|
|
1305
|
+
run_dir, plan_sha, plan = _initialize(tmp_path)
|
|
1306
|
+
runner.materialize(_command_args(run_dir, plan_sha))
|
|
1307
|
+
source = tmp_path / "external-transcript.json"
|
|
1308
|
+
authorization = _authorization_file(tmp_path, plan)
|
|
1309
|
+
first = _transcript(plan, plan["cells"][0])
|
|
1310
|
+
source.write_bytes(runner._json_bytes(first))
|
|
1311
|
+
runner.ingest(
|
|
1312
|
+
_command_args(
|
|
1313
|
+
run_dir,
|
|
1314
|
+
plan_sha,
|
|
1315
|
+
transcript=source,
|
|
1316
|
+
authorization_record=authorization,
|
|
1317
|
+
)
|
|
1318
|
+
)
|
|
1319
|
+
second = _transcript(plan, plan["cells"][1])
|
|
1320
|
+
receipt = _get_external_receipt(second)
|
|
1321
|
+
if mutation == "duplicate_session":
|
|
1322
|
+
receipt["external_session_id"] = _get_external_receipt(first)[
|
|
1323
|
+
"external_session_id"
|
|
1324
|
+
]
|
|
1325
|
+
else:
|
|
1326
|
+
receipt["started_at"] = "2026-08-13T00:00:01.500000Z"
|
|
1327
|
+
receipt["completed_at"] = "2026-08-13T00:00:01.750000Z"
|
|
1328
|
+
_set_external_receipt(second, receipt)
|
|
1329
|
+
source.write_bytes(runner._json_bytes(second))
|
|
1330
|
+
with pytest.raises(runner.StopViolation) as caught:
|
|
1331
|
+
runner.ingest(
|
|
1332
|
+
_command_args(
|
|
1333
|
+
run_dir,
|
|
1334
|
+
plan_sha,
|
|
1335
|
+
transcript=source,
|
|
1336
|
+
authorization_record=authorization,
|
|
1337
|
+
)
|
|
1338
|
+
)
|
|
1339
|
+
assert caught.value.code == "out_of_order_ingestion"
|
|
1340
|
+
|
|
1341
|
+
|
|
1342
|
+
@pytest.mark.parametrize(
|
|
1343
|
+
"leak_text",
|
|
1344
|
+
(
|
|
1345
|
+
"cell=cell-001 pair=idi-public-health replicate=1",
|
|
1346
|
+
"prior human judge label=M1 yes; adjudicator approved",
|
|
1347
|
+
"other transcript mapping replicate 2",
|
|
1348
|
+
(
|
|
1349
|
+
"first repeat in the treatment where adjacent probe is enabled. "
|
|
1350
|
+
"The preceding session answered differently. Gold-standard coder "
|
|
1351
|
+
"marked it positive; tie-breaker approved"
|
|
1352
|
+
),
|
|
1353
|
+
),
|
|
1354
|
+
)
|
|
1355
|
+
def test_blind_packet_free_text_gate_rejects_mapping_or_human_evidence(
|
|
1356
|
+
tmp_path, leak_text
|
|
1357
|
+
):
|
|
1358
|
+
_, _, plan = _initialize(tmp_path)
|
|
1359
|
+
transcript = _transcript(plan, plan["cells"][0])
|
|
1360
|
+
transcript["turns"][1]["text"] += f" {leak_text}"
|
|
1361
|
+
_set_raw_event(
|
|
1362
|
+
transcript["events"][2],
|
|
1363
|
+
{
|
|
1364
|
+
"event_kind": "subject_message",
|
|
1365
|
+
"turn_index": 2,
|
|
1366
|
+
"text": transcript["turns"][1]["text"],
|
|
1367
|
+
},
|
|
1368
|
+
)
|
|
1369
|
+
with pytest.raises(runner.EnvelopeError, match="leak|label|mapping"):
|
|
1370
|
+
runner._assert_blindable_transcript(plan, transcript)
|
|
1371
|
+
|
|
1372
|
+
|
|
1373
|
+
@pytest.mark.parametrize(
|
|
1374
|
+
"leak_text",
|
|
1375
|
+
(
|
|
1376
|
+
"The frozen id is c\u0338e\u0338l\u0338l-048.",
|
|
1377
|
+
"The frozen id is c\u0345ell-048.",
|
|
1378
|
+
"The frozen id is c\u200be\u200bl\u200bl-048.",
|
|
1379
|
+
"The frozen id is c.e.l.l-048.",
|
|
1380
|
+
"The frozen id is c♥ell-048.",
|
|
1381
|
+
),
|
|
1382
|
+
)
|
|
1383
|
+
def test_complete_identifier_gate_rejects_unicode_separator_obfuscation(
|
|
1384
|
+
tmp_path, leak_text
|
|
1385
|
+
):
|
|
1386
|
+
_, _, plan = _initialize(tmp_path)
|
|
1387
|
+
with pytest.raises(runner.EnvelopeError, match="frozen blind identifier"):
|
|
1388
|
+
runner._assert_blind_texts(plan, [leak_text])
|
|
1389
|
+
|
|
1390
|
+
|
|
1391
|
+
@pytest.mark.parametrize(
|
|
1392
|
+
"ordinary_text",
|
|
1393
|
+
(
|
|
1394
|
+
"The scell-048 placeholder is unrelated.",
|
|
1395
|
+
"The cell-048x placeholder is unrelated.",
|
|
1396
|
+
"The éCell-048 placeholder is unrelated.",
|
|
1397
|
+
"The cell-048é placeholder is unrelated.",
|
|
1398
|
+
"The ĿCell-048 placeholder is unrelated.",
|
|
1399
|
+
"The cell-048ͺ placeholder is unrelated.",
|
|
1400
|
+
"The ⑴Cell-048 placeholder is unrelated.",
|
|
1401
|
+
"The cell-048⑴ placeholder is unrelated.",
|
|
1402
|
+
"Cell biology had 48 samples.",
|
|
1403
|
+
"The discussion used adjacent probing.",
|
|
1404
|
+
"We conducted a feature comparison.",
|
|
1405
|
+
"The probe discussion continued.",
|
|
1406
|
+
"A feature tradeoff was considered.",
|
|
1407
|
+
),
|
|
1408
|
+
)
|
|
1409
|
+
def test_complete_identifier_gate_keeps_letter_number_boundaries(
|
|
1410
|
+
tmp_path, ordinary_text
|
|
1411
|
+
):
|
|
1412
|
+
_, _, plan = _initialize(tmp_path)
|
|
1413
|
+
runner._assert_blind_texts(plan, [ordinary_text])
|
|
1414
|
+
|
|
1415
|
+
|
|
1416
|
+
@pytest.mark.parametrize(
|
|
1417
|
+
"leak_text",
|
|
1418
|
+
(
|
|
1419
|
+
"I remember this treatment–arm from the previous‑session.",
|
|
1420
|
+
"cell‑001 pair: idi‑public‑health replicate‑1",
|
|
1421
|
+
"The unrelated frozen identifier is cell‑048.",
|
|
1422
|
+
"The tie–breaker approved the prior human judge label.",
|
|
1423
|
+
"The prior l\u0338abel was positive.",
|
|
1424
|
+
"The treat.ment arm was enabled.",
|
|
1425
|
+
"The adjudi\u200bcator approved it.",
|
|
1426
|
+
"前\u200b輪標註已完成。",
|
|
1427
|
+
"處.置組已啟用。",
|
|
1428
|
+
"The treat\u00a0ment condition was active.",
|
|
1429
|
+
"The prior deci\u00a0sion was positive.",
|
|
1430
|
+
"前\u00a0輪標註已完成。",
|
|
1431
|
+
"The preced\u00a0ing response differed.",
|
|
1432
|
+
"The review\u00a0er evidence was positive.",
|
|
1433
|
+
"The prior evi\u00a0dences were positive.",
|
|
1434
|
+
"The other trans\u00a0cripts were compared.",
|
|
1435
|
+
"The mech\u00a0anism was clearly ena\u00a0bled.",
|
|
1436
|
+
"The treat♥ment arm was active.",
|
|
1437
|
+
"The prior lab♥el was positive.",
|
|
1438
|
+
"前♥輪標註已完成。",
|
|
1439
|
+
"處♥置組已啟用。",
|
|
1440
|
+
"The frozen id is c\u0338e\u0338l\u0338l-048.",
|
|
1441
|
+
"The frozen id is c\u0345ell-048.",
|
|
1442
|
+
"The frozen id is c\u200be\u200bl\u200bl-048.",
|
|
1443
|
+
"The frozen id is c.e.l.l-048.",
|
|
1444
|
+
),
|
|
1445
|
+
)
|
|
1446
|
+
def test_semantic_leak_stops_during_first_ingestion_before_next_cell(
|
|
1447
|
+
tmp_path, leak_text
|
|
1448
|
+
):
|
|
1449
|
+
run_dir, plan_sha, plan = _initialize(tmp_path)
|
|
1450
|
+
runner.materialize(_command_args(run_dir, plan_sha))
|
|
1451
|
+
transcript = _transcript(plan, plan["cells"][0])
|
|
1452
|
+
transcript["turns"][1]["text"] += f" {leak_text}"
|
|
1453
|
+
_set_raw_event(
|
|
1454
|
+
transcript["events"][2],
|
|
1455
|
+
{
|
|
1456
|
+
"event_kind": "subject_message",
|
|
1457
|
+
"turn_index": 2,
|
|
1458
|
+
"text": transcript["turns"][1]["text"],
|
|
1459
|
+
},
|
|
1460
|
+
)
|
|
1461
|
+
source = tmp_path / "semantic-leak.json"
|
|
1462
|
+
source.write_bytes(runner._json_bytes(transcript))
|
|
1463
|
+
with pytest.raises(runner.StopViolation) as caught:
|
|
1464
|
+
runner.ingest(
|
|
1465
|
+
_command_args(
|
|
1466
|
+
run_dir,
|
|
1467
|
+
plan_sha,
|
|
1468
|
+
transcript=source,
|
|
1469
|
+
authorization_record=_authorization_file(tmp_path, plan),
|
|
1470
|
+
)
|
|
1471
|
+
)
|
|
1472
|
+
assert caught.value.code == "arm_leakage"
|
|
1473
|
+
manifest = json.loads((run_dir / "ingestion-manifest.json").read_bytes())
|
|
1474
|
+
assert [row["status"] for row in manifest["cells"][:2]] == [
|
|
1475
|
+
"blocked",
|
|
1476
|
+
"pending",
|
|
1477
|
+
]
|
|
1478
|
+
assert manifest["next_sequence_index"] == 1
|
|
1479
|
+
assert runner.validate_run(_command_args(run_dir, plan_sha))["status"] == (
|
|
1480
|
+
"stopped"
|
|
1481
|
+
)
|
|
1482
|
+
with pytest.raises(runner.EnvelopeError, match="forbids retry"):
|
|
1483
|
+
runner.ingest(
|
|
1484
|
+
_command_args(
|
|
1485
|
+
run_dir,
|
|
1486
|
+
plan_sha,
|
|
1487
|
+
transcript=source,
|
|
1488
|
+
authorization_record=_authorization_file(tmp_path, plan),
|
|
1489
|
+
)
|
|
1490
|
+
)
|
|
1491
|
+
|
|
1492
|
+
|
|
1493
|
+
def test_partial_success_writes_are_registered_in_stopped_replay(tmp_path, monkeypatch):
|
|
1494
|
+
run_dir, plan_sha, plan = _initialize(tmp_path)
|
|
1495
|
+
runner.materialize(_command_args(run_dir, plan_sha))
|
|
1496
|
+
source = tmp_path / "external-transcript.json"
|
|
1497
|
+
raw = runner._json_bytes(_transcript(plan, plan["cells"][0]))
|
|
1498
|
+
source.write_bytes(raw)
|
|
1499
|
+
authorization = _authorization_file(tmp_path, plan)
|
|
1500
|
+
original_write = runner._write_new
|
|
1501
|
+
|
|
1502
|
+
def fail_receipt(path, raw_bytes, **kwargs):
|
|
1503
|
+
if str(path).endswith("receipts/cell-001.json"):
|
|
1504
|
+
raise runner.EnvelopeError("AUTOMATED RECEIPT WRITE FAILURE")
|
|
1505
|
+
return original_write(path, raw_bytes, **kwargs)
|
|
1506
|
+
|
|
1507
|
+
monkeypatch.setattr(runner, "_write_new", fail_receipt)
|
|
1508
|
+
with pytest.raises(runner.StopViolation) as caught:
|
|
1509
|
+
runner.ingest(
|
|
1510
|
+
_command_args(
|
|
1511
|
+
run_dir,
|
|
1512
|
+
plan_sha,
|
|
1513
|
+
transcript=source,
|
|
1514
|
+
authorization_record=authorization,
|
|
1515
|
+
)
|
|
1516
|
+
)
|
|
1517
|
+
assert caught.value.code == "evidence_write_failure"
|
|
1518
|
+
manifest = json.loads((run_dir / "ingestion-manifest.json").read_bytes())
|
|
1519
|
+
assert manifest["status"] == "stopped"
|
|
1520
|
+
preserved = manifest["stop_receipt"]["preserved_auxiliary_artifacts"]
|
|
1521
|
+
assert [(row["role"], row["ref"]) for row in preserved] == [
|
|
1522
|
+
("authorization_record", "authorization/record.json"),
|
|
1523
|
+
(
|
|
1524
|
+
"accepted_transcript_before_state_commit",
|
|
1525
|
+
"transcripts/cell-001.json",
|
|
1526
|
+
),
|
|
1527
|
+
]
|
|
1528
|
+
monkeypatch.setattr(runner, "_write_new", original_write)
|
|
1529
|
+
assert runner.validate_run(_command_args(run_dir, plan_sha))["status"] == "stopped"
|
|
1530
|
+
(run_dir / "transcripts/cell-001.json").write_bytes(b"TAMPERED\n")
|
|
1531
|
+
with pytest.raises(runner.EnvelopeError, match="pre-stop artifact hash drift"):
|
|
1532
|
+
runner.validate_run(_command_args(run_dir, plan_sha))
|
|
1533
|
+
|
|
1534
|
+
|
|
1535
|
+
def test_48_external_ingestions_prepare_unlabeled_arm_blind_packet(
|
|
1536
|
+
tmp_path, monkeypatch
|
|
1537
|
+
):
|
|
1538
|
+
run_dir, plan_sha, plan = _initialize(tmp_path)
|
|
1539
|
+
runner.materialize(_command_args(run_dir, plan_sha))
|
|
1540
|
+
source = tmp_path / "external-transcript.json"
|
|
1541
|
+
authorization = _authorization_file(tmp_path, plan)
|
|
1542
|
+
for index, cell in enumerate(plan["cells"], 1):
|
|
1543
|
+
source.write_bytes(runner._json_bytes(_transcript(plan, cell)))
|
|
1544
|
+
result = runner.ingest(
|
|
1545
|
+
_command_args(
|
|
1546
|
+
run_dir,
|
|
1547
|
+
plan_sha,
|
|
1548
|
+
transcript=source,
|
|
1549
|
+
authorization_record=authorization,
|
|
1550
|
+
)
|
|
1551
|
+
)
|
|
1552
|
+
assert result["ingested"] == index
|
|
1553
|
+
assert runner.validate_run(_command_args(run_dir, plan_sha))["status"] == "complete"
|
|
1554
|
+
original_blind_write = runner._ensure_blind_exact
|
|
1555
|
+
|
|
1556
|
+
def fail_after_private_map(target_run_dir, target_ref, raw_bytes):
|
|
1557
|
+
if target_ref == "manifest.json":
|
|
1558
|
+
raise runner.EnvelopeError("AUTOMATED BLIND MANIFEST STAGING FAILURE")
|
|
1559
|
+
return original_blind_write(target_run_dir, target_ref, raw_bytes)
|
|
1560
|
+
|
|
1561
|
+
monkeypatch.setattr(runner, "_ensure_blind_exact", fail_after_private_map)
|
|
1562
|
+
with pytest.raises(runner.EnvelopeError, match="BLIND MANIFEST STAGING FAILURE"):
|
|
1563
|
+
runner.prepare_blind_packet(_command_args(run_dir, plan_sha))
|
|
1564
|
+
intent_path = run_dir / runner.BLIND_INTENT_REF
|
|
1565
|
+
intent_raw = intent_path.read_bytes()
|
|
1566
|
+
intent = json.loads(intent_raw)
|
|
1567
|
+
assert intent["protection"] == {
|
|
1568
|
+
"procedural_nondisclosure_only": True,
|
|
1569
|
+
"file_mode": "0600",
|
|
1570
|
+
"deliver_to_judges": False,
|
|
1571
|
+
}
|
|
1572
|
+
assert stat.S_IMODE(intent_path.stat().st_mode) == 0o600
|
|
1573
|
+
staging_map = run_dir / runner.BLIND_STAGING_REF / "private/arm-map.json"
|
|
1574
|
+
assert staging_map.is_file()
|
|
1575
|
+
assert stat.S_IMODE(staging_map.parent.stat().st_mode) == 0o700
|
|
1576
|
+
assert stat.S_IMODE(staging_map.stat().st_mode) == 0o600
|
|
1577
|
+
pending = runner.validate_run(_command_args(run_dir, plan_sha))
|
|
1578
|
+
assert pending["status"] == "complete"
|
|
1579
|
+
assert pending["blind_transaction_pending"] is True
|
|
1580
|
+
staged_ids = {
|
|
1581
|
+
path.stem
|
|
1582
|
+
for path in (run_dir / runner.BLIND_STAGING_REF / "sessions").glob("*.json")
|
|
1583
|
+
}
|
|
1584
|
+
assert len(staged_ids) == 48
|
|
1585
|
+
monkeypatch.setattr(runner, "_ensure_blind_exact", original_blind_write)
|
|
1586
|
+
collision_path = next(
|
|
1587
|
+
(run_dir / runner.BLIND_STAGING_REF / "sessions").glob("*.json")
|
|
1588
|
+
)
|
|
1589
|
+
collision_raw = collision_path.read_bytes()
|
|
1590
|
+
collision_path.write_bytes(b"AUTOMATED BLIND STAGING COLLISION\n")
|
|
1591
|
+
with pytest.raises(runner.EnvelopeError, match="blind staging artifact collision"):
|
|
1592
|
+
runner.prepare_blind_packet(_command_args(run_dir, plan_sha))
|
|
1593
|
+
collision_path.write_bytes(collision_raw)
|
|
1594
|
+
original_unlink = Path.unlink
|
|
1595
|
+
|
|
1596
|
+
def retain_blind_alias(path, *args, **kwargs):
|
|
1597
|
+
if path.parent.name == runner.BLIND_ALIAS_ROOT:
|
|
1598
|
+
raise OSError("AUTOMATED BLIND ALIAS CLEANUP FAILURE")
|
|
1599
|
+
return original_unlink(path, *args, **kwargs)
|
|
1600
|
+
|
|
1601
|
+
monkeypatch.setattr(Path, "unlink", retain_blind_alias)
|
|
1602
|
+
result = runner.prepare_blind_packet(_command_args(run_dir, plan_sha))
|
|
1603
|
+
retained_aliases = list((run_dir / runner.BLIND_ALIAS_ROOT).glob("*.tmp"))
|
|
1604
|
+
assert len(retained_aliases) == 1
|
|
1605
|
+
assert stat.S_IMODE(retained_aliases[0].stat().st_mode) == 0o600
|
|
1606
|
+
assert retained_aliases[0].stat().st_ino == (
|
|
1607
|
+
run_dir / "blind/manifest.json"
|
|
1608
|
+
).stat().st_ino
|
|
1609
|
+
monkeypatch.setattr(Path, "unlink", original_unlink)
|
|
1610
|
+
assert result["sessions"] == 48
|
|
1611
|
+
assert result["artifact_presence"] == runner._artifact_presence()
|
|
1612
|
+
assert result["state"] == "blind_finalized"
|
|
1613
|
+
assert result["recovered_existing_atomic_bundle"] is True
|
|
1614
|
+
assert intent_path.read_bytes() == intent_raw
|
|
1615
|
+
assert not (run_dir / runner.BLIND_STAGING_REF).exists()
|
|
1616
|
+
assert intent["blind_manifest_sha256"] == hashlib.sha256(
|
|
1617
|
+
(run_dir / "blind/manifest.json").read_bytes()
|
|
1618
|
+
).hexdigest()
|
|
1619
|
+
assert intent["inventory_sha256"] == hashlib.sha256(
|
|
1620
|
+
(run_dir / "blind/inventory.json").read_bytes()
|
|
1621
|
+
).hexdigest()
|
|
1622
|
+
inventory = json.loads((run_dir / "blind/inventory.json").read_bytes())
|
|
1623
|
+
assert inventory["artifact_presence"] == runner._artifact_presence()
|
|
1624
|
+
assert inventory["assignment_boundary"] == runner._assignment_boundary()
|
|
1625
|
+
assert len(inventory["packets"]) == 48
|
|
1626
|
+
assert all(
|
|
1627
|
+
set(row) == {"blind_session_id", "packet_sha256"}
|
|
1628
|
+
for row in inventory["packets"]
|
|
1629
|
+
)
|
|
1630
|
+
public_inventory_text = json.dumps(inventory, sort_keys=True)
|
|
1631
|
+
for forbidden in (
|
|
1632
|
+
"arm_id",
|
|
1633
|
+
"experiment_id",
|
|
1634
|
+
"pair_id",
|
|
1635
|
+
"replicate",
|
|
1636
|
+
"scenario_id",
|
|
1637
|
+
"role_card",
|
|
1638
|
+
"transcript",
|
|
1639
|
+
):
|
|
1640
|
+
assert forbidden not in public_inventory_text
|
|
1641
|
+
isolated_paths = sorted((run_dir / "blind/sessions").glob("*.json"))
|
|
1642
|
+
assert len(isolated_paths) == 48
|
|
1643
|
+
assert {path.stem for path in isolated_paths} == staged_ids
|
|
1644
|
+
for packet_path in isolated_paths:
|
|
1645
|
+
isolated = json.loads(packet_path.read_bytes())
|
|
1646
|
+
assert isolated["delivery"] == {
|
|
1647
|
+
"isolated_single_session": True,
|
|
1648
|
+
"deliver_other_sessions_together": False,
|
|
1649
|
+
"assignment_ledger_gate_required_before_delivery": True,
|
|
1650
|
+
}
|
|
1651
|
+
assert isolated["assignment_boundary"] == runner._assignment_boundary()
|
|
1652
|
+
assert isolated["artifact_presence"] == runner._artifact_presence()
|
|
1653
|
+
assert "sessions" not in isolated
|
|
1654
|
+
assert len(isolated["transcript"]["turns"]) <= 11
|
|
1655
|
+
for forbidden in (
|
|
1656
|
+
"arm_id",
|
|
1657
|
+
"experiment_id",
|
|
1658
|
+
"pair_id",
|
|
1659
|
+
"replicate",
|
|
1660
|
+
"scenario_id",
|
|
1661
|
+
):
|
|
1662
|
+
assert forbidden not in isolated
|
|
1663
|
+
assert forbidden not in isolated["role_card"]
|
|
1664
|
+
assert forbidden not in isolated["transcript"]
|
|
1665
|
+
arm_map_path = run_dir / "blind/private/arm-map.json"
|
|
1666
|
+
arm_map = json.loads(arm_map_path.read_bytes())
|
|
1667
|
+
assert arm_map["private"] is True
|
|
1668
|
+
assert arm_map["protection"] == {
|
|
1669
|
+
"kind": "procedural_nondisclosure_only",
|
|
1670
|
+
"encrypted": False,
|
|
1671
|
+
"directory_mode": "0700",
|
|
1672
|
+
"file_mode": "0600",
|
|
1673
|
+
"unblind_only_after_raw_labels_and_adjudication_sealed": True,
|
|
1674
|
+
}
|
|
1675
|
+
assert stat.S_IMODE(arm_map_path.parent.stat().st_mode) == 0o700
|
|
1676
|
+
assert stat.S_IMODE(arm_map_path.stat().st_mode) == 0o600
|
|
1677
|
+
assert len(arm_map["mapping"]) == 48
|
|
1678
|
+
assert arm_map["inventory_sha256"] == hashlib.sha256(
|
|
1679
|
+
(run_dir / "blind/inventory.json").read_bytes()
|
|
1680
|
+
).hexdigest()
|
|
1681
|
+
final = runner.validate_run(_command_args(run_dir, plan_sha))
|
|
1682
|
+
assert final["status"] == "blind_finalized"
|
|
1683
|
+
# Replay the crash boundary after the atomic bundle rename but before the
|
|
1684
|
+
# ingestion manifest's final state replacement.
|
|
1685
|
+
final_manifest_path = run_dir / "ingestion-manifest.json"
|
|
1686
|
+
final_manifest = json.loads(final_manifest_path.read_bytes())
|
|
1687
|
+
final_manifest_path.write_bytes(
|
|
1688
|
+
runner._json_bytes(runner._source_ingestion_manifest(final_manifest))
|
|
1689
|
+
)
|
|
1690
|
+
recovered = runner.prepare_blind_packet(_command_args(run_dir, plan_sha))
|
|
1691
|
+
assert recovered["recovered_existing_atomic_bundle"] is True
|
|
1692
|
+
assert runner.validate_run(_command_args(run_dir, plan_sha))["status"] == (
|
|
1693
|
+
"blind_finalized"
|
|
1694
|
+
)
|
|
1695
|
+
isolated_paths[0].write_bytes(b"TAMPERED BLIND PACKET\n")
|
|
1696
|
+
with pytest.raises(runner.EnvelopeError, match="blind packet replay|hash drift"):
|
|
1697
|
+
runner.validate_run(_command_args(run_dir, plan_sha))
|
|
1698
|
+
|
|
1699
|
+
|
|
1700
|
+
def test_manifest_tampering_cannot_reorder_append_only_state(tmp_path):
|
|
1701
|
+
run_dir, plan_sha, _ = _initialize(tmp_path)
|
|
1702
|
+
manifest_path = run_dir / "ingestion-manifest.json"
|
|
1703
|
+
manifest = json.loads(manifest_path.read_bytes())
|
|
1704
|
+
manifest["status"] = "ingesting"
|
|
1705
|
+
manifest["next_sequence_index"] = 2
|
|
1706
|
+
manifest["cells"][-1].update(
|
|
1707
|
+
status="ingested",
|
|
1708
|
+
transcript_ref="transcripts/cell-048.json",
|
|
1709
|
+
transcript_sha256="c" * 64,
|
|
1710
|
+
ingestion_receipt_ref="receipts/cell-048.json",
|
|
1711
|
+
)
|
|
1712
|
+
manifest_path.write_bytes(runner._json_bytes(manifest))
|
|
1713
|
+
with pytest.raises(
|
|
1714
|
+
runner.EnvelopeError,
|
|
1715
|
+
match="authorization record|append-only prefix",
|
|
1716
|
+
):
|
|
1717
|
+
runner.validate_run(_command_args(run_dir, plan_sha))
|
|
1718
|
+
|
|
1719
|
+
|
|
1720
|
+
def test_run_tree_symlink_is_rejected_before_ingestion_write(tmp_path):
|
|
1721
|
+
run_dir, plan_sha, _ = _initialize(tmp_path)
|
|
1722
|
+
runner.materialize(_command_args(run_dir, plan_sha))
|
|
1723
|
+
outside = tmp_path / "outside"
|
|
1724
|
+
outside.mkdir()
|
|
1725
|
+
os.symlink(outside, run_dir / "transcripts")
|
|
1726
|
+
with pytest.raises(runner.EnvelopeError, match="must not contain symlinks"):
|
|
1727
|
+
runner.validate_run(_command_args(run_dir, plan_sha))
|
|
1728
|
+
assert list(outside.iterdir()) == []
|
|
1729
|
+
|
|
1730
|
+
|
|
1731
|
+
def test_spec_consistency_integration_accepts_current_no_call_contract():
|
|
1732
|
+
previous = list(spec_consistency.ERRORS)
|
|
1733
|
+
spec_consistency.ERRORS.clear()
|
|
1734
|
+
try:
|
|
1735
|
+
spec_consistency.check_ideation_diversity_no_call_contract()
|
|
1736
|
+
assert spec_consistency.ERRORS == []
|
|
1737
|
+
finally:
|
|
1738
|
+
spec_consistency.ERRORS.clear()
|
|
1739
|
+
spec_consistency.ERRORS.extend(previous)
|
|
1740
|
+
|
|
1741
|
+
|
|
1742
|
+
def test_spec_consistency_integration_rejects_48_cell_drift(monkeypatch):
|
|
1743
|
+
original_read = spec_consistency.read
|
|
1744
|
+
|
|
1745
|
+
def mutated_read(rel_path: str) -> str:
|
|
1746
|
+
text = original_read(rel_path)
|
|
1747
|
+
if rel_path.endswith("run_plan.schema.json"):
|
|
1748
|
+
value = json.loads(text)
|
|
1749
|
+
value["properties"]["design"]["properties"][
|
|
1750
|
+
"subject_session_cells"
|
|
1751
|
+
]["const"] = 47
|
|
1752
|
+
return json.dumps(value)
|
|
1753
|
+
return text
|
|
1754
|
+
|
|
1755
|
+
previous = list(spec_consistency.ERRORS)
|
|
1756
|
+
spec_consistency.ERRORS.clear()
|
|
1757
|
+
monkeypatch.setattr(spec_consistency, "read", mutated_read)
|
|
1758
|
+
try:
|
|
1759
|
+
spec_consistency.check_ideation_diversity_no_call_contract()
|
|
1760
|
+
assert any(
|
|
1761
|
+
"subject_session_cells must remain const 48" in error
|
|
1762
|
+
for error in spec_consistency.ERRORS
|
|
1763
|
+
)
|
|
1764
|
+
finally:
|
|
1765
|
+
spec_consistency.ERRORS.clear()
|
|
1766
|
+
spec_consistency.ERRORS.extend(previous)
|
|
1767
|
+
|
|
1768
|
+
|
|
1769
|
+
@pytest.mark.parametrize(
|
|
1770
|
+
"runner_mutation",
|
|
1771
|
+
(
|
|
1772
|
+
"import requests\n",
|
|
1773
|
+
"import http.client\n",
|
|
1774
|
+
"import os\nos.system('forbidden')\n",
|
|
1775
|
+
"import os as operating\noperating.popen('forbidden')\n",
|
|
1776
|
+
"from os import system as launch\nlaunch('forbidden')\n",
|
|
1777
|
+
"import subprocess\nsubprocess.run(['forbidden'])\n",
|
|
1778
|
+
"import httpx\nhttpx.get('https://example.invalid')\n",
|
|
1779
|
+
"__import__('subprocess').run(['forbidden'])\n",
|
|
1780
|
+
"import os\nlauncher = os\nlauncher.system('forbidden')\n",
|
|
1781
|
+
"import os\ngetattr(os, 'system')('forbidden')\n",
|
|
1782
|
+
"import os\nos.__dict__['system']('forbidden')\n",
|
|
1783
|
+
"import os\nmatch object():\n case os:\n os.open('forbidden', 0)\n",
|
|
1784
|
+
"import os\nmatch []:\n case [*os]:\n os.open('forbidden', 0)\n",
|
|
1785
|
+
"import os\nmatch {}:\n case {**os}:\n os.open('forbidden', 0)\n",
|
|
1786
|
+
),
|
|
1787
|
+
)
|
|
1788
|
+
def test_spec_consistency_ast_rejects_transport_or_process_surface(
|
|
1789
|
+
monkeypatch, runner_mutation
|
|
1790
|
+
):
|
|
1791
|
+
original_read = spec_consistency.read
|
|
1792
|
+
|
|
1793
|
+
def mutated_read(rel_path: str) -> str:
|
|
1794
|
+
text = original_read(rel_path)
|
|
1795
|
+
if rel_path == "scripts/run_ideation_diversity_no_call.py":
|
|
1796
|
+
return runner_mutation + text
|
|
1797
|
+
return text
|
|
1798
|
+
|
|
1799
|
+
previous = list(spec_consistency.ERRORS)
|
|
1800
|
+
spec_consistency.ERRORS.clear()
|
|
1801
|
+
monkeypatch.setattr(spec_consistency, "read", mutated_read)
|
|
1802
|
+
try:
|
|
1803
|
+
spec_consistency.check_ideation_diversity_no_call_contract()
|
|
1804
|
+
assert any(
|
|
1805
|
+
"exact import allowlist" in error
|
|
1806
|
+
or "exact current-use" in error
|
|
1807
|
+
or "dynamic import, introspection" in error
|
|
1808
|
+
or "direct module bindings cannot be shadowed" in error
|
|
1809
|
+
for error in spec_consistency.ERRORS
|
|
1810
|
+
)
|
|
1811
|
+
finally:
|
|
1812
|
+
spec_consistency.ERRORS.clear()
|
|
1813
|
+
spec_consistency.ERRORS.extend(previous)
|
|
1814
|
+
|
|
1815
|
+
|
|
1816
|
+
def test_spec_consistency_ast_accepts_current_exact_module_surface():
|
|
1817
|
+
previous = list(spec_consistency.ERRORS)
|
|
1818
|
+
spec_consistency.ERRORS.clear()
|
|
1819
|
+
try:
|
|
1820
|
+
spec_consistency.check_ideation_diversity_no_call_contract()
|
|
1821
|
+
assert not any(
|
|
1822
|
+
"scripts/run_ideation_diversity_no_call.py" in error
|
|
1823
|
+
and (
|
|
1824
|
+
"exact import allowlist" in error
|
|
1825
|
+
or "exact current-use" in error
|
|
1826
|
+
or "dynamic import, introspection" in error
|
|
1827
|
+
or "direct module bindings cannot be shadowed" in error
|
|
1828
|
+
)
|
|
1829
|
+
for error in spec_consistency.ERRORS
|
|
1830
|
+
)
|
|
1831
|
+
finally:
|
|
1832
|
+
spec_consistency.ERRORS.clear()
|
|
1833
|
+
spec_consistency.ERRORS.extend(previous)
|