phase-loop-runtime 0.2.0__py3-none-any.whl
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.
- phase_loop_runtime/__init__.py +20 -0
- phase_loop_runtime/_contract_docs/phase-loop/extraction-readiness.md +90 -0
- phase_loop_runtime/_contract_docs/phase-loop/granular-execution-policy.md +137 -0
- phase_loop_runtime/_contract_docs/phase-loop/harness-capability-matrix.md +510 -0
- phase_loop_runtime/_contract_docs/phase-loop/harness-skill-matrix.md +125 -0
- phase_loop_runtime/_contract_docs/phase-loop/harness-substrate-manifest.md +232 -0
- phase_loop_runtime/_contract_docs/phase-loop/pi-loop-control.md +247 -0
- phase_loop_runtime/_contract_docs/phase-loop/protocol.md +2759 -0
- phase_loop_runtime/_contract_docs/phase-loop/runtime-boundary.md +289 -0
- phase_loop_runtime/_contract_docs/phase-loop/spec-discovery-roots.md +47 -0
- phase_loop_runtime/_contract_docs/phase-loop/substrate-soak-governed-pipeline.md +42 -0
- phase_loop_runtime/_contract_docs/phase-loop/substrate-soak-portal-projection.md +34 -0
- phase_loop_runtime/_contract_docs/phase-loop/substrate-soak-regenesis.md +29 -0
- phase_loop_runtime/_contract_docs/phase-loop/substrate-soak-report.md +32 -0
- phase_loop_runtime/_contract_docs/runtime/verification-evidence-contract.md +52 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/borderline/borderline-mixed-signals/commands.txt +2 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/borderline/borderline-mixed-signals/manifest.json +16 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/borderline/borderline-mixed-signals/mixed.json +5 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/borderline/borderline-provider-timeout/manifest.json +16 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/borderline/borderline-provider-timeout/timeout-note.txt +2 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/borderline/borderline-redacted-summary/manifest.json +16 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/borderline/borderline-redacted-summary/redacted-summary.json +6 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/borderline/borderline-small-sample/manifest.json +16 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/borderline/borderline-small-sample/sample.json +7 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/borderline/borderline-threshold-edge/edge.txt +2 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/borderline/borderline-threshold-edge/manifest.json +16 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-fake/fake-duplicate-png/manifest.json +16 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-fake/fake-duplicate-png/shot-a.txt +1 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-fake/fake-duplicate-png/shot-b.txt +1 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-fake/fake-duplicate-png/shot-c.txt +1 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-fake/fake-missing-references/claimed-results.json +5 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-fake/fake-missing-references/manifest.json +16 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-fake/fake-subtle-low-variance/manifest.json +16 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-fake/fake-subtle-low-variance/metrics.json +9 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-fake/fake-templated-prose/findings.md +10 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-fake/fake-templated-prose/manifest.json +16 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-fake/fake-uniform-scores/manifest.json +16 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-fake/fake-uniform-scores/scores.json +4 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-fake/fake-uniform-scores/summary.txt +1 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-real/real-adoption-bundle/bundle-check.json +8 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-real/real-adoption-bundle/manifest.json +16 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-real/real-adoption-bundle/operator-note.txt +2 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-real/real-handoff-ledger/events-sample.jsonl +3 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-real/real-handoff-ledger/manifest.json +16 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-real/real-handoff-ledger/receipt.txt +1 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-real/real-runner-diff/evidence.json +13 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-real/real-runner-diff/manifest.json +16 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-real/real-runner-diff/summary.txt +2 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-real/real-test-matrix/manifest.json +16 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-real/real-test-matrix/matrix.json +9 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-real/real-test-matrix/notes.md +4 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-real/real-ui-screenshot-standin/console-summary.txt +2 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-real/real-ui-screenshot-standin/manifest.json +16 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-real/real-ui-screenshot-standin/screenshot-standin.ppm +5 -0
- phase_loop_runtime/adoption_bundle.py +273 -0
- phase_loop_runtime/advisor_board/CONTRACTS.md +257 -0
- phase_loop_runtime/advisor_board/__init__.py +288 -0
- phase_loop_runtime/advisor_board/backing.py +137 -0
- phase_loop_runtime/advisor_board/backing_omnigent.py +498 -0
- phase_loop_runtime/advisor_board/config.py +225 -0
- phase_loop_runtime/advisor_board/events.py +115 -0
- phase_loop_runtime/advisor_board/fixtures/advisor-boards.example.toml +59 -0
- phase_loop_runtime/advisor_board/fixtures.py +91 -0
- phase_loop_runtime/advisor_board/harness_mapping.py +125 -0
- phase_loop_runtime/advisor_board/matrix.py +146 -0
- phase_loop_runtime/advisor_board/observability.py +481 -0
- phase_loop_runtime/advisor_board/presets.py +188 -0
- phase_loop_runtime/advisor_board/registries.py +309 -0
- phase_loop_runtime/advisor_board/resolver.py +253 -0
- phase_loop_runtime/advisor_board/schema.py +269 -0
- phase_loop_runtime/advisor_board/standin.py +166 -0
- phase_loop_runtime/advisor_board/validation.py +159 -0
- phase_loop_runtime/agent_runtime_provider.py +676 -0
- phase_loop_runtime/baml_modular.py +656 -0
- phase_loop_runtime/baml_src/dotfiles_adoption_manifest.baml +37 -0
- phase_loop_runtime/baml_src/dotfiles_c4_document.baml +14 -0
- phase_loop_runtime/baml_src/dotfiles_plan_manifest.baml +50 -0
- phase_loop_runtime/baml_src/dotfiles_runtime_projection.baml +16 -0
- phase_loop_runtime/baml_src/dotfiles_task_catalog.baml +20 -0
- phase_loop_runtime/baml_src/emit_phase_closeout.baml +86 -0
- phase_loop_runtime/baml_src/evaluate_suspected_fake_evidence.baml +36 -0
- phase_loop_runtime/baml_src/verification_evidence.baml +40 -0
- phase_loop_runtime/broker.py +181 -0
- phase_loop_runtime/build_bundle.py +294 -0
- phase_loop_runtime/capability_registry.py +835 -0
- phase_loop_runtime/classifier.py +87 -0
- phase_loop_runtime/claude_agent_view.py +625 -0
- phase_loop_runtime/claude_channel_sidecar.py +1086 -0
- phase_loop_runtime/cli.py +2599 -0
- phase_loop_runtime/closeout.py +865 -0
- phase_loop_runtime/closeout_classifier.py +120 -0
- phase_loop_runtime/closeout_evidence_audit.py +112 -0
- phase_loop_runtime/closeout_validation.py +144 -0
- phase_loop_runtime/closeout_validators.py +203 -0
- phase_loop_runtime/consiliency_gates.py +374 -0
- phase_loop_runtime/consiliency_ingest.py +399 -0
- phase_loop_runtime/consiliency_layout.py +176 -0
- phase_loop_runtime/consiliency_scaffold.py +305 -0
- phase_loop_runtime/cross_repo_channel.py +331 -0
- phase_loop_runtime/discovery.py +2368 -0
- phase_loop_runtime/dispatch_lock.py +167 -0
- phase_loop_runtime/doc_delta_validator.py +98 -0
- phase_loop_runtime/docs_audit.py +285 -0
- phase_loop_runtime/docs_freshness.py +468 -0
- phase_loop_runtime/docs_surfaces.py +150 -0
- phase_loop_runtime/dotfiles_profile_plugin.py +96 -0
- phase_loop_runtime/events.py +154 -0
- phase_loop_runtime/events_migration.py +96 -0
- phase_loop_runtime/evidence_audit.py +1082 -0
- phase_loop_runtime/evidence_audit_config.py +172 -0
- phase_loop_runtime/fleet_map.py +426 -0
- phase_loop_runtime/fleet_metrics.py +298 -0
- phase_loop_runtime/fleet_metrics_export.py +196 -0
- phase_loop_runtime/git_discipline.py +479 -0
- phase_loop_runtime/git_ops.py +122 -0
- phase_loop_runtime/git_topology.py +252 -0
- phase_loop_runtime/governed_bundle.py +137 -0
- phase_loop_runtime/governed_premerge.py +219 -0
- phase_loop_runtime/governed_review.py +264 -0
- phase_loop_runtime/handoff.py +932 -0
- phase_loop_runtime/handoff_path.py +14 -0
- phase_loop_runtime/injection.py +740 -0
- phase_loop_runtime/install_status.py +88 -0
- phase_loop_runtime/lane_scheduler.py +317 -0
- phase_loop_runtime/launcher.py +2760 -0
- phase_loop_runtime/lease_store.py +553 -0
- phase_loop_runtime/maintenance.py +401 -0
- phase_loop_runtime/migrate_handoffs.py +201 -0
- phase_loop_runtime/models.py +2144 -0
- phase_loop_runtime/observability.py +1290 -0
- phase_loop_runtime/panel_invoker.py +1638 -0
- phase_loop_runtime/phase_loop_drift_audit.py +388 -0
- phase_loop_runtime/phase_worktree_executor.py +433 -0
- phase_loop_runtime/pipeline_adapter/__init__.py +12 -0
- phase_loop_runtime/pipeline_adapter/branch_ops.py +274 -0
- phase_loop_runtime/pipeline_adapter/flag.py +55 -0
- phase_loop_runtime/pipeline_adapter/markers.py +13 -0
- phase_loop_runtime/pipeline_adapter/merge_policy.py +72 -0
- phase_loop_runtime/pipeline_adapter/ratification.py +100 -0
- phase_loop_runtime/pipeline_adapter/sibling_matcher.py +123 -0
- phase_loop_runtime/plan_ir.py +523 -0
- phase_loop_runtime/plan_manifest.py +415 -0
- phase_loop_runtime/planner_validation.py +176 -0
- phase_loop_runtime/profiles.py +462 -0
- phase_loop_runtime/prompts.py +365 -0
- phase_loop_runtime/provenance.py +165 -0
- phase_loop_runtime/publishing.py +339 -0
- phase_loop_runtime/py.typed +1 -0
- phase_loop_runtime/reconcile.py +1550 -0
- phase_loop_runtime/redaction.py +184 -0
- phase_loop_runtime/reflection_sync.py +293 -0
- phase_loop_runtime/release_guard.py +186 -0
- phase_loop_runtime/render.py +432 -0
- phase_loop_runtime/repo_validation.py +427 -0
- phase_loop_runtime/review_summary.py +150 -0
- phase_loop_runtime/roadmap_lint.py +425 -0
- phase_loop_runtime/route_log.py +59 -0
- phase_loop_runtime/route_policy/__init__.py +11 -0
- phase_loop_runtime/route_policy/fixtures/route_selection.golden.json +263 -0
- phase_loop_runtime/runner.py +8400 -0
- phase_loop_runtime/runtime_paths.py +225 -0
- phase_loop_runtime/runtime_projection.py +113 -0
- phase_loop_runtime/runtime_resources.py +36 -0
- phase_loop_runtime/schema_export.py +292 -0
- phase_loop_runtime/schemas/phase_loop_closeout.schema.json +366 -0
- phase_loop_runtime/skill_install.py +176 -0
- phase_loop_runtime/skill_inventory.py +662 -0
- phase_loop_runtime/skill_paths.py +42 -0
- phase_loop_runtime/skill_sources_plugin.py +37 -0
- phase_loop_runtime/skills_bundle/claude-advisor-board/README.md +1 -0
- phase_loop_runtime/skills_bundle/claude-advisor-board/SKILL.md +38 -0
- phase_loop_runtime/skills_bundle/claude-advisor-panel/README.md +1 -0
- phase_loop_runtime/skills_bundle/claude-advisor-panel/SKILL.md +38 -0
- phase_loop_runtime/skills_bundle/claude-execute-detailed/README.md +1 -0
- phase_loop_runtime/skills_bundle/claude-execute-detailed/SKILL.md +152 -0
- phase_loop_runtime/skills_bundle/claude-execute-phase/README.md +1 -0
- phase_loop_runtime/skills_bundle/claude-execute-phase/SKILL.md +745 -0
- phase_loop_runtime/skills_bundle/claude-execute-phase/scripts/allocate_worktree_name.sh +33 -0
- phase_loop_runtime/skills_bundle/claude-execute-phase/scripts/audit_lane_file_touches.py +197 -0
- phase_loop_runtime/skills_bundle/claude-execute-phase/scripts/cleanup_lane_worktrees.sh +103 -0
- phase_loop_runtime/skills_bundle/claude-execute-phase/scripts/parent_tree_leakage_check.sh +125 -0
- phase_loop_runtime/skills_bundle/claude-execute-phase/scripts/post_merge_import_smoke.sh +62 -0
- phase_loop_runtime/skills_bundle/claude-execute-phase/scripts/pre_merge_destructiveness_check.sh +127 -0
- phase_loop_runtime/skills_bundle/claude-execute-phase/scripts/resolve_branch_from_sha.sh +51 -0
- phase_loop_runtime/skills_bundle/claude-execute-phase/scripts/state.py +274 -0
- phase_loop_runtime/skills_bundle/claude-execute-phase/scripts/sweep_stale_worktrees.sh +62 -0
- phase_loop_runtime/skills_bundle/claude-execute-phase/scripts/team_teardown.sh +32 -0
- phase_loop_runtime/skills_bundle/claude-execute-phase/scripts/validate_plan_doc.py +642 -0
- phase_loop_runtime/skills_bundle/claude-execute-phase/scripts/verify_harness.sh +96 -0
- phase_loop_runtime/skills_bundle/claude-phase-loop/README.md +1 -0
- phase_loop_runtime/skills_bundle/claude-phase-loop/SKILL.md +115 -0
- phase_loop_runtime/skills_bundle/claude-phase-roadmap-builder/README.md +1 -0
- phase_loop_runtime/skills_bundle/claude-phase-roadmap-builder/SKILL.md +439 -0
- phase_loop_runtime/skills_bundle/claude-phase-roadmap-builder/assets/review_prompt.md +19 -0
- phase_loop_runtime/skills_bundle/claude-phase-roadmap-builder/references/parallelization-heuristics.md +111 -0
- phase_loop_runtime/skills_bundle/claude-phase-roadmap-builder/references/roadmap-template.md +193 -0
- phase_loop_runtime/skills_bundle/claude-phase-roadmap-builder/scripts/validate_roadmap.py +32 -0
- phase_loop_runtime/skills_bundle/claude-plan-detailed/README.md +1 -0
- phase_loop_runtime/skills_bundle/claude-plan-detailed/SKILL.md +334 -0
- phase_loop_runtime/skills_bundle/claude-plan-detailed/assets/review_prompt.md +25 -0
- phase_loop_runtime/skills_bundle/claude-plan-phase/README.md +1 -0
- phase_loop_runtime/skills_bundle/claude-plan-phase/SKILL.md +776 -0
- phase_loop_runtime/skills_bundle/claude-plan-phase/assets/review_prompt.md +17 -0
- phase_loop_runtime/skills_bundle/claude-plan-phase/scripts/validate_plan_doc.py +1092 -0
- phase_loop_runtime/skills_bundle/claude-run-train/README.md +1 -0
- phase_loop_runtime/skills_bundle/claude-run-train/SKILL.md +75 -0
- phase_loop_runtime/skills_bundle/claude-skill-editor/README.md +1 -0
- phase_loop_runtime/skills_bundle/claude-skill-editor/SKILL.md +243 -0
- phase_loop_runtime/skills_bundle/claude-skill-editor/assets/editor_prompt.md +72 -0
- phase_loop_runtime/skills_bundle/claude-skill-improvement-planner/README.md +1 -0
- phase_loop_runtime/skills_bundle/claude-skill-improvement-planner/SKILL.md +249 -0
- phase_loop_runtime/skills_bundle/claude-skill-improvement-planner/assets/aggregator_prompt.md +79 -0
- phase_loop_runtime/skills_bundle/claude-task-contextualizer/README.md +1 -0
- phase_loop_runtime/skills_bundle/claude-task-contextualizer/SKILL.md +74 -0
- phase_loop_runtime/skills_bundle/claude-task-contextualizer/references/task-templates.md +103 -0
- phase_loop_runtime/skills_bundle/codex-advisor-board/README.md +1 -0
- phase_loop_runtime/skills_bundle/codex-advisor-board/SKILL.md +38 -0
- phase_loop_runtime/skills_bundle/codex-advisor-panel/README.md +1 -0
- phase_loop_runtime/skills_bundle/codex-advisor-panel/SKILL.md +38 -0
- phase_loop_runtime/skills_bundle/codex-execute-detailed/README.md +1 -0
- phase_loop_runtime/skills_bundle/codex-execute-detailed/SKILL.md +154 -0
- phase_loop_runtime/skills_bundle/codex-execute-phase/README.md +1 -0
- phase_loop_runtime/skills_bundle/codex-execute-phase/SKILL.md +231 -0
- phase_loop_runtime/skills_bundle/codex-execute-phase/scripts/allocate_worktree_name.sh +33 -0
- phase_loop_runtime/skills_bundle/codex-execute-phase/scripts/audit_lane_file_touches.py +197 -0
- phase_loop_runtime/skills_bundle/codex-execute-phase/scripts/cleanup_lane_worktrees.sh +103 -0
- phase_loop_runtime/skills_bundle/codex-execute-phase/scripts/parent_tree_leakage_check.sh +125 -0
- phase_loop_runtime/skills_bundle/codex-execute-phase/scripts/post_merge_import_smoke.sh +62 -0
- phase_loop_runtime/skills_bundle/codex-execute-phase/scripts/pre_merge_destructiveness_check.sh +127 -0
- phase_loop_runtime/skills_bundle/codex-execute-phase/scripts/resolve_branch_from_sha.sh +51 -0
- phase_loop_runtime/skills_bundle/codex-execute-phase/scripts/state.py +274 -0
- phase_loop_runtime/skills_bundle/codex-execute-phase/scripts/sweep_stale_worktrees.sh +62 -0
- phase_loop_runtime/skills_bundle/codex-execute-phase/scripts/team_teardown.sh +32 -0
- phase_loop_runtime/skills_bundle/codex-execute-phase/scripts/validate_plan_doc.py +642 -0
- phase_loop_runtime/skills_bundle/codex-execute-phase/scripts/verify_harness.sh +96 -0
- phase_loop_runtime/skills_bundle/codex-phase-loop/README.md +1 -0
- phase_loop_runtime/skills_bundle/codex-phase-loop/SKILL.md +248 -0
- phase_loop_runtime/skills_bundle/codex-phase-roadmap-builder/README.md +1 -0
- phase_loop_runtime/skills_bundle/codex-phase-roadmap-builder/SKILL.md +150 -0
- phase_loop_runtime/skills_bundle/codex-phase-roadmap-builder/assets/review_prompt.md +19 -0
- phase_loop_runtime/skills_bundle/codex-phase-roadmap-builder/references/parallelization-heuristics.md +111 -0
- phase_loop_runtime/skills_bundle/codex-phase-roadmap-builder/references/roadmap-template.md +193 -0
- phase_loop_runtime/skills_bundle/codex-phase-roadmap-builder/scripts/validate_roadmap.py +32 -0
- phase_loop_runtime/skills_bundle/codex-plan-detailed/README.md +1 -0
- phase_loop_runtime/skills_bundle/codex-plan-detailed/SKILL.md +119 -0
- phase_loop_runtime/skills_bundle/codex-plan-detailed/assets/review_prompt.md +25 -0
- phase_loop_runtime/skills_bundle/codex-plan-phase/README.md +1 -0
- phase_loop_runtime/skills_bundle/codex-plan-phase/SKILL.md +307 -0
- phase_loop_runtime/skills_bundle/codex-plan-phase/assets/review_prompt.md +17 -0
- phase_loop_runtime/skills_bundle/codex-plan-phase/scripts/validate_plan_doc.py +1092 -0
- phase_loop_runtime/skills_bundle/codex-run-train/README.md +1 -0
- phase_loop_runtime/skills_bundle/codex-run-train/SKILL.md +75 -0
- phase_loop_runtime/skills_bundle/codex-skill-editor/README.md +1 -0
- phase_loop_runtime/skills_bundle/codex-skill-editor/SKILL.md +94 -0
- phase_loop_runtime/skills_bundle/codex-skill-editor/assets/editor_prompt.md +72 -0
- phase_loop_runtime/skills_bundle/codex-skill-improvement-planner/README.md +1 -0
- phase_loop_runtime/skills_bundle/codex-skill-improvement-planner/SKILL.md +114 -0
- phase_loop_runtime/skills_bundle/codex-skill-improvement-planner/assets/aggregator_prompt.md +79 -0
- phase_loop_runtime/skills_bundle/codex-task-contextualizer/README.md +1 -0
- phase_loop_runtime/skills_bundle/codex-task-contextualizer/SKILL.md +102 -0
- phase_loop_runtime/skills_bundle/codex-task-contextualizer/references/task-templates.md +103 -0
- phase_loop_runtime/skills_bundle/gemini-advisor-board/README.md +1 -0
- phase_loop_runtime/skills_bundle/gemini-advisor-board/SKILL.md +38 -0
- phase_loop_runtime/skills_bundle/gemini-advisor-panel/README.md +1 -0
- phase_loop_runtime/skills_bundle/gemini-advisor-panel/SKILL.md +38 -0
- phase_loop_runtime/skills_bundle/gemini-execute-detailed/README.md +1 -0
- phase_loop_runtime/skills_bundle/gemini-execute-detailed/SKILL.md +144 -0
- phase_loop_runtime/skills_bundle/gemini-execute-phase/README.md +1 -0
- phase_loop_runtime/skills_bundle/gemini-execute-phase/SKILL.md +198 -0
- phase_loop_runtime/skills_bundle/gemini-execute-phase/scripts/allocate_worktree_name.sh +33 -0
- phase_loop_runtime/skills_bundle/gemini-execute-phase/scripts/audit_lane_file_touches.py +197 -0
- phase_loop_runtime/skills_bundle/gemini-execute-phase/scripts/cleanup_lane_worktrees.sh +103 -0
- phase_loop_runtime/skills_bundle/gemini-execute-phase/scripts/parent_tree_leakage_check.sh +125 -0
- phase_loop_runtime/skills_bundle/gemini-execute-phase/scripts/post_merge_import_smoke.sh +62 -0
- phase_loop_runtime/skills_bundle/gemini-execute-phase/scripts/pre_merge_destructiveness_check.sh +127 -0
- phase_loop_runtime/skills_bundle/gemini-execute-phase/scripts/resolve_branch_from_sha.sh +51 -0
- phase_loop_runtime/skills_bundle/gemini-execute-phase/scripts/state.py +274 -0
- phase_loop_runtime/skills_bundle/gemini-execute-phase/scripts/sweep_stale_worktrees.sh +62 -0
- phase_loop_runtime/skills_bundle/gemini-execute-phase/scripts/team_teardown.sh +32 -0
- phase_loop_runtime/skills_bundle/gemini-execute-phase/scripts/validate_plan_doc.py +642 -0
- phase_loop_runtime/skills_bundle/gemini-execute-phase/scripts/verify_harness.sh +96 -0
- phase_loop_runtime/skills_bundle/gemini-phase-loop/README.md +1 -0
- phase_loop_runtime/skills_bundle/gemini-phase-loop/SKILL.md +111 -0
- phase_loop_runtime/skills_bundle/gemini-phase-roadmap-builder/README.md +1 -0
- phase_loop_runtime/skills_bundle/gemini-phase-roadmap-builder/SKILL.md +147 -0
- phase_loop_runtime/skills_bundle/gemini-phase-roadmap-builder/assets/review_prompt.md +19 -0
- phase_loop_runtime/skills_bundle/gemini-phase-roadmap-builder/references/parallelization-heuristics.md +111 -0
- phase_loop_runtime/skills_bundle/gemini-phase-roadmap-builder/references/roadmap-template.md +193 -0
- phase_loop_runtime/skills_bundle/gemini-phase-roadmap-builder/scripts/validate_roadmap.py +32 -0
- phase_loop_runtime/skills_bundle/gemini-plan-detailed/README.md +1 -0
- phase_loop_runtime/skills_bundle/gemini-plan-detailed/SKILL.md +119 -0
- phase_loop_runtime/skills_bundle/gemini-plan-detailed/assets/review_prompt.md +25 -0
- phase_loop_runtime/skills_bundle/gemini-plan-phase/README.md +1 -0
- phase_loop_runtime/skills_bundle/gemini-plan-phase/SKILL.md +217 -0
- phase_loop_runtime/skills_bundle/gemini-plan-phase/assets/review_prompt.md +17 -0
- phase_loop_runtime/skills_bundle/gemini-plan-phase/scripts/validate_plan_doc.py +1092 -0
- phase_loop_runtime/skills_bundle/gemini-run-train/README.md +1 -0
- phase_loop_runtime/skills_bundle/gemini-run-train/SKILL.md +75 -0
- phase_loop_runtime/skills_bundle/gemini-skill-editor/README.md +1 -0
- phase_loop_runtime/skills_bundle/gemini-skill-editor/SKILL.md +87 -0
- phase_loop_runtime/skills_bundle/gemini-skill-editor/assets/editor_prompt.md +72 -0
- phase_loop_runtime/skills_bundle/gemini-skill-improvement-planner/README.md +1 -0
- phase_loop_runtime/skills_bundle/gemini-skill-improvement-planner/SKILL.md +109 -0
- phase_loop_runtime/skills_bundle/gemini-skill-improvement-planner/assets/aggregator_prompt.md +79 -0
- phase_loop_runtime/skills_bundle/gemini-task-contextualizer/README.md +1 -0
- phase_loop_runtime/skills_bundle/gemini-task-contextualizer/SKILL.md +98 -0
- phase_loop_runtime/skills_bundle/gemini-task-contextualizer/references/task-templates.md +103 -0
- phase_loop_runtime/skills_bundle/opencode-advisor-board/README.md +1 -0
- phase_loop_runtime/skills_bundle/opencode-advisor-board/SKILL.md +38 -0
- phase_loop_runtime/skills_bundle/opencode-advisor-panel/README.md +1 -0
- phase_loop_runtime/skills_bundle/opencode-advisor-panel/SKILL.md +38 -0
- phase_loop_runtime/skills_bundle/opencode-execute-detailed/README.md +1 -0
- phase_loop_runtime/skills_bundle/opencode-execute-detailed/SKILL.md +144 -0
- phase_loop_runtime/skills_bundle/opencode-execute-phase/README.md +1 -0
- phase_loop_runtime/skills_bundle/opencode-execute-phase/SKILL.md +196 -0
- phase_loop_runtime/skills_bundle/opencode-execute-phase/scripts/allocate_worktree_name.sh +33 -0
- phase_loop_runtime/skills_bundle/opencode-execute-phase/scripts/audit_lane_file_touches.py +197 -0
- phase_loop_runtime/skills_bundle/opencode-execute-phase/scripts/cleanup_lane_worktrees.sh +103 -0
- phase_loop_runtime/skills_bundle/opencode-execute-phase/scripts/parent_tree_leakage_check.sh +125 -0
- phase_loop_runtime/skills_bundle/opencode-execute-phase/scripts/post_merge_import_smoke.sh +62 -0
- phase_loop_runtime/skills_bundle/opencode-execute-phase/scripts/pre_merge_destructiveness_check.sh +127 -0
- phase_loop_runtime/skills_bundle/opencode-execute-phase/scripts/resolve_branch_from_sha.sh +51 -0
- phase_loop_runtime/skills_bundle/opencode-execute-phase/scripts/state.py +274 -0
- phase_loop_runtime/skills_bundle/opencode-execute-phase/scripts/sweep_stale_worktrees.sh +62 -0
- phase_loop_runtime/skills_bundle/opencode-execute-phase/scripts/team_teardown.sh +32 -0
- phase_loop_runtime/skills_bundle/opencode-execute-phase/scripts/validate_plan_doc.py +642 -0
- phase_loop_runtime/skills_bundle/opencode-execute-phase/scripts/verify_harness.sh +96 -0
- phase_loop_runtime/skills_bundle/opencode-phase-loop/README.md +1 -0
- phase_loop_runtime/skills_bundle/opencode-phase-loop/SKILL.md +113 -0
- phase_loop_runtime/skills_bundle/opencode-phase-roadmap-builder/README.md +1 -0
- phase_loop_runtime/skills_bundle/opencode-phase-roadmap-builder/SKILL.md +147 -0
- phase_loop_runtime/skills_bundle/opencode-phase-roadmap-builder/assets/review_prompt.md +19 -0
- phase_loop_runtime/skills_bundle/opencode-phase-roadmap-builder/references/parallelization-heuristics.md +111 -0
- phase_loop_runtime/skills_bundle/opencode-phase-roadmap-builder/references/roadmap-template.md +193 -0
- phase_loop_runtime/skills_bundle/opencode-phase-roadmap-builder/scripts/validate_roadmap.py +32 -0
- phase_loop_runtime/skills_bundle/opencode-plan-detailed/README.md +1 -0
- phase_loop_runtime/skills_bundle/opencode-plan-detailed/SKILL.md +119 -0
- phase_loop_runtime/skills_bundle/opencode-plan-detailed/assets/review_prompt.md +25 -0
- phase_loop_runtime/skills_bundle/opencode-plan-phase/README.md +1 -0
- phase_loop_runtime/skills_bundle/opencode-plan-phase/SKILL.md +211 -0
- phase_loop_runtime/skills_bundle/opencode-plan-phase/assets/review_prompt.md +17 -0
- phase_loop_runtime/skills_bundle/opencode-plan-phase/scripts/validate_plan_doc.py +1092 -0
- phase_loop_runtime/skills_bundle/opencode-run-train/README.md +1 -0
- phase_loop_runtime/skills_bundle/opencode-run-train/SKILL.md +75 -0
- phase_loop_runtime/skills_bundle/opencode-skill-editor/README.md +1 -0
- phase_loop_runtime/skills_bundle/opencode-skill-editor/SKILL.md +87 -0
- phase_loop_runtime/skills_bundle/opencode-skill-editor/assets/editor_prompt.md +72 -0
- phase_loop_runtime/skills_bundle/opencode-skill-improvement-planner/README.md +1 -0
- phase_loop_runtime/skills_bundle/opencode-skill-improvement-planner/SKILL.md +109 -0
- phase_loop_runtime/skills_bundle/opencode-skill-improvement-planner/assets/aggregator_prompt.md +79 -0
- phase_loop_runtime/skills_bundle/opencode-task-contextualizer/README.md +1 -0
- phase_loop_runtime/skills_bundle/opencode-task-contextualizer/SKILL.md +98 -0
- phase_loop_runtime/skills_bundle/opencode-task-contextualizer/references/task-templates.md +103 -0
- phase_loop_runtime/state.py +156 -0
- phase_loop_runtime/state_degradation.py +136 -0
- phase_loop_runtime/state_ops.py +676 -0
- phase_loop_runtime/train_ledger.py +215 -0
- phase_loop_runtime/train_roadmap.py +339 -0
- phase_loop_runtime/train_runner.py +1197 -0
- phase_loop_runtime/verification_evidence.py +650 -0
- phase_loop_runtime/verification_evidence_validator.py +75 -0
- phase_loop_runtime/visual_evidence_validator.py +36 -0
- phase_loop_runtime/worker_pool.py +123 -0
- phase_loop_runtime/worktree_index.py +270 -0
- phase_loop_runtime-0.2.0.data/data/share/phase-loop-runtime/protocol/protocol.md +2475 -0
- phase_loop_runtime-0.2.0.dist-info/METADATA +106 -0
- phase_loop_runtime-0.2.0.dist-info/RECORD +370 -0
- phase_loop_runtime-0.2.0.dist-info/WHEEL +5 -0
- phase_loop_runtime-0.2.0.dist-info/entry_points.txt +9 -0
- phase_loop_runtime-0.2.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,374 @@
|
|
|
1
|
+
"""CS-0.6 -- the four L0 `.consiliency/` gates.
|
|
2
|
+
|
|
3
|
+
Wired at top-of-loop (an advisory print, like the existing ``_governed_warning``
|
|
4
|
+
early-loop notice) and at closeout (threaded into ``build_phase_loop_closeout``,
|
|
5
|
+
like ``docs_freshness`` -- see issue #18). :func:`scan_consiliency_gates` is the
|
|
6
|
+
single pure pre-scan both call sites share; it never mutates the repo.
|
|
7
|
+
|
|
8
|
+
Gate families (``consiliency_contract``'s ``loop-gate-protocol``):
|
|
9
|
+
|
|
10
|
+
* **presence** -- every doc the composed required-documents registry demands
|
|
11
|
+
for the manifest's declared archetype(s)/modifier(s) has a manifest entry
|
|
12
|
+
whose declared ``path``/``ref`` actually resolves.
|
|
13
|
+
* **local-integrity** -- documents the manifest has promoted to
|
|
14
|
+
``hash-checked`` maturity have a recorded git-scoped digest snapshot that
|
|
15
|
+
still matches. A no-op today: Phase 0's required-documents registry floors
|
|
16
|
+
every doc at ``presence-only``, so nothing is hash-checked yet -- the gate
|
|
17
|
+
exists so upgrading a doc's maturity later has somewhere to land.
|
|
18
|
+
* **layout-validity** -- the manifest (and, if present, the status/interface
|
|
19
|
+
artifacts) validate against the vendored ``consiliency_contract`` schemas.
|
|
20
|
+
* **version-skew** -- the repo-declared ``contract_version`` against the
|
|
21
|
+
installed ``consiliency_contract`` package version, per the version-skew
|
|
22
|
+
protocol's own compatible ranges.
|
|
23
|
+
|
|
24
|
+
CONSENT GATE: this module acts ONLY on repos that already have a
|
|
25
|
+
`.consiliency/manifest.json` (see :func:`find_consiliency_manifest`). A repo
|
|
26
|
+
without one is a pure no-op -- ``status: "skipped"``, nothing read beyond the
|
|
27
|
+
one existence check, nothing written. The full adoption-profile consent check
|
|
28
|
+
(CS-0.12 / contract 0.2.0) tightens this later; this is the seam.
|
|
29
|
+
|
|
30
|
+
Default-safe posture (roadmap CS-0.6, mirrors docs_freshness/issue #18):
|
|
31
|
+
SOFT/warn by default. Blocking is opt-in via ``PHASE_LOOP_CONSILIENCY_GATES=hard``.
|
|
32
|
+
``human_required`` is NEVER set by this module. The version-skew gate additionally
|
|
33
|
+
never escalates past ``warn`` even in ``hard`` mode -- the version-skew protocol's
|
|
34
|
+
own ``default_behavior.phase0_severity`` is a normative ``const: "warn"`` at
|
|
35
|
+
Phase 0, independent of any per-repo gate-mode opt-in.
|
|
36
|
+
"""
|
|
37
|
+
from __future__ import annotations
|
|
38
|
+
|
|
39
|
+
import hashlib
|
|
40
|
+
import json
|
|
41
|
+
import os
|
|
42
|
+
import re
|
|
43
|
+
import subprocess
|
|
44
|
+
from pathlib import Path
|
|
45
|
+
from typing import Any, Mapping
|
|
46
|
+
|
|
47
|
+
from jsonschema import Draft202012Validator
|
|
48
|
+
|
|
49
|
+
from .consiliency_layout import (
|
|
50
|
+
compose_required_documents,
|
|
51
|
+
consiliency_root,
|
|
52
|
+
contract_version_status_schema,
|
|
53
|
+
find_consiliency_manifest,
|
|
54
|
+
installed_contract_version,
|
|
55
|
+
interface_declaration_schema,
|
|
56
|
+
load_consiliency_manifest,
|
|
57
|
+
manifest_schema,
|
|
58
|
+
version_skew_protocol,
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
CONSILIENCY_GATES_ENV = "PHASE_LOOP_CONSILIENCY_GATES"
|
|
62
|
+
CONSILIENCY_GATES_MODES: tuple[str, ...] = ("off", "warn", "hard")
|
|
63
|
+
DEFAULT_CONSILIENCY_GATES_MODE = "warn"
|
|
64
|
+
|
|
65
|
+
_GATE_NAMES = ("presence", "local_integrity", "layout_validity", "version_skew", "git_discipline")
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def resolve_consiliency_gates_mode(env: Mapping[str, str] | None = None) -> str:
|
|
69
|
+
env = os.environ if env is None else env
|
|
70
|
+
value = str(env.get(CONSILIENCY_GATES_ENV) or "").strip().lower()
|
|
71
|
+
return value if value in CONSILIENCY_GATES_MODES else DEFAULT_CONSILIENCY_GATES_MODE
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def _skipped(mode: str, *, consent: bool, manifest_path: str | None = None) -> dict[str, Any]:
|
|
75
|
+
return {
|
|
76
|
+
"status": "skipped",
|
|
77
|
+
"mode": mode,
|
|
78
|
+
"consent": consent,
|
|
79
|
+
"manifest_path": manifest_path,
|
|
80
|
+
"gates": {},
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
def scan_consiliency_gates(
|
|
85
|
+
repo: str | Path | None,
|
|
86
|
+
*,
|
|
87
|
+
env: Mapping[str, str] | None = None,
|
|
88
|
+
) -> dict[str, Any]:
|
|
89
|
+
mode = resolve_consiliency_gates_mode(env)
|
|
90
|
+
if not repo:
|
|
91
|
+
return _skipped(mode, consent=False)
|
|
92
|
+
repo_path = Path(repo)
|
|
93
|
+
manifest_file = find_consiliency_manifest(repo_path)
|
|
94
|
+
if manifest_file is None:
|
|
95
|
+
return _skipped(mode, consent=False)
|
|
96
|
+
if mode == "off":
|
|
97
|
+
return _skipped(mode, consent=True, manifest_path=str(manifest_file))
|
|
98
|
+
manifest = load_consiliency_manifest(repo_path)
|
|
99
|
+
if manifest is None:
|
|
100
|
+
# Present but unparsable -- that's exactly a layout-validity finding,
|
|
101
|
+
# not a crash and not "no consent" (the repo DID opt in).
|
|
102
|
+
gate = {
|
|
103
|
+
"status": "blocked" if mode == "hard" else "warn",
|
|
104
|
+
"maturity": "presence-only",
|
|
105
|
+
"findings": [{"code": "manifest_unparsable", "message": f"{manifest_file} is not valid JSON"}],
|
|
106
|
+
}
|
|
107
|
+
return {
|
|
108
|
+
"status": gate["status"],
|
|
109
|
+
"mode": mode,
|
|
110
|
+
"consent": True,
|
|
111
|
+
"manifest_path": str(manifest_file),
|
|
112
|
+
"gates": {"layout_validity": gate},
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
gates = {
|
|
116
|
+
"presence": _gate_presence(repo_path, manifest, mode=mode),
|
|
117
|
+
"local_integrity": _gate_local_integrity(repo_path, manifest, mode=mode),
|
|
118
|
+
"layout_validity": _gate_layout_validity(repo_path, manifest, mode=mode),
|
|
119
|
+
"version_skew": _gate_version_skew(manifest, mode=mode),
|
|
120
|
+
"git_discipline": _gate_git_discipline(repo_path, mode=mode),
|
|
121
|
+
}
|
|
122
|
+
if any(g["status"] == "blocked" for g in gates.values()):
|
|
123
|
+
overall = "blocked"
|
|
124
|
+
elif any(g["status"] == "warn" for g in gates.values()):
|
|
125
|
+
overall = "warn"
|
|
126
|
+
else:
|
|
127
|
+
overall = "passed"
|
|
128
|
+
return {
|
|
129
|
+
"status": overall,
|
|
130
|
+
"mode": mode,
|
|
131
|
+
"consent": True,
|
|
132
|
+
"manifest_path": str(manifest_file),
|
|
133
|
+
"gates": gates,
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
def _gate_status(findings: list[dict[str, Any]], *, mode: str, capped_warn: bool = False) -> str:
|
|
138
|
+
if not findings:
|
|
139
|
+
return "passed"
|
|
140
|
+
if mode == "hard" and not capped_warn:
|
|
141
|
+
return "blocked"
|
|
142
|
+
return "warn"
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
def _declared_archetypes_modifiers(manifest: Mapping[str, Any]) -> tuple[str, tuple[str, ...], tuple[str, ...]]:
|
|
146
|
+
declaration = dict(manifest.get("declaration") or {})
|
|
147
|
+
decl_mode = str(declaration.get("mode") or "baseline-only")
|
|
148
|
+
archetypes = tuple(declaration.get("archetypes") or ())
|
|
149
|
+
modifiers = tuple(declaration.get("modifiers") or ())
|
|
150
|
+
return decl_mode, archetypes, modifiers
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
def _gate_presence(repo: Path, manifest: Mapping[str, Any], *, mode: str) -> dict[str, Any]:
|
|
154
|
+
decl_mode, archetypes, modifiers = _declared_archetypes_modifiers(manifest)
|
|
155
|
+
try:
|
|
156
|
+
rows = compose_required_documents(mode=decl_mode, archetypes=archetypes, modifiers=modifiers)
|
|
157
|
+
except ValueError as exc:
|
|
158
|
+
findings = [{"code": "declaration_invalid", "message": str(exc)}]
|
|
159
|
+
return {"status": _gate_status(findings, mode=mode), "maturity": "presence-only", "findings": findings}
|
|
160
|
+
|
|
161
|
+
documents_by_id = {d.get("id"): d for d in manifest.get("documents", []) if isinstance(d, Mapping)}
|
|
162
|
+
findings: list[dict[str, Any]] = []
|
|
163
|
+
for row in rows:
|
|
164
|
+
entry = documents_by_id.get(row.id)
|
|
165
|
+
if entry is None:
|
|
166
|
+
findings.append({"code": "missing_manifest_entry", "doc_id": row.id})
|
|
167
|
+
continue
|
|
168
|
+
path = entry.get("path")
|
|
169
|
+
ref = entry.get("ref")
|
|
170
|
+
if path:
|
|
171
|
+
if not (repo / str(path)).exists():
|
|
172
|
+
findings.append({"code": "missing_file", "doc_id": row.id, "path": str(path)})
|
|
173
|
+
elif ref:
|
|
174
|
+
if not str(dict(ref).get("value") or "").strip():
|
|
175
|
+
findings.append({"code": "empty_ref", "doc_id": row.id})
|
|
176
|
+
else:
|
|
177
|
+
findings.append({"code": "no_path_or_ref", "doc_id": row.id})
|
|
178
|
+
return {"status": _gate_status(findings, mode=mode), "maturity": "presence-only", "findings": findings}
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
def _git_show(repo: Path, path: str) -> bytes | None:
|
|
182
|
+
try:
|
|
183
|
+
return subprocess.check_output(
|
|
184
|
+
["git", "-C", str(repo), "show", f"HEAD:{path}"], stderr=subprocess.DEVNULL
|
|
185
|
+
)
|
|
186
|
+
except Exception:
|
|
187
|
+
return None
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
def _gate_local_integrity(repo: Path, manifest: Mapping[str, Any], *, mode: str) -> dict[str, Any]:
|
|
191
|
+
hash_checked = [
|
|
192
|
+
d for d in manifest.get("documents", []) if isinstance(d, Mapping) and d.get("maturity") == "hash-checked" and d.get("path")
|
|
193
|
+
]
|
|
194
|
+
if not hash_checked:
|
|
195
|
+
return {
|
|
196
|
+
"status": "passed",
|
|
197
|
+
"maturity": "presence-only",
|
|
198
|
+
"findings": [],
|
|
199
|
+
"note": "no hash-checked documents declared; nothing to snapshot yet",
|
|
200
|
+
}
|
|
201
|
+
snapshot_file = consiliency_root(repo) / "integrity-snapshot.json"
|
|
202
|
+
snapshot: dict[str, str] = {}
|
|
203
|
+
if snapshot_file.is_file():
|
|
204
|
+
try:
|
|
205
|
+
snapshot = json.loads(snapshot_file.read_text(encoding="utf-8"))
|
|
206
|
+
except (OSError, ValueError):
|
|
207
|
+
snapshot = {}
|
|
208
|
+
findings: list[dict[str, Any]] = []
|
|
209
|
+
checked_any = False
|
|
210
|
+
for entry in hash_checked:
|
|
211
|
+
doc_id = str(entry.get("id"))
|
|
212
|
+
path = str(entry.get("path"))
|
|
213
|
+
content = _git_show(repo, path)
|
|
214
|
+
if content is None:
|
|
215
|
+
findings.append({"code": "unreadable_git_blob", "doc_id": doc_id, "path": path})
|
|
216
|
+
continue
|
|
217
|
+
digest = hashlib.sha256(content).hexdigest()
|
|
218
|
+
recorded = snapshot.get(doc_id)
|
|
219
|
+
if recorded is None:
|
|
220
|
+
findings.append({"code": "no_local_snapshot", "doc_id": doc_id, "path": path})
|
|
221
|
+
continue
|
|
222
|
+
checked_any = True
|
|
223
|
+
if recorded != digest:
|
|
224
|
+
findings.append({"code": "hash_drift", "doc_id": doc_id, "path": path, "expected": recorded, "actual": digest})
|
|
225
|
+
return {
|
|
226
|
+
"status": _gate_status(findings, mode=mode),
|
|
227
|
+
"maturity": "hash-checked" if checked_any else "presence-only",
|
|
228
|
+
"findings": findings,
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
def _gate_layout_validity(repo: Path, manifest: Mapping[str, Any], *, mode: str) -> dict[str, Any]:
|
|
233
|
+
findings: list[dict[str, Any]] = []
|
|
234
|
+
for err in Draft202012Validator(manifest_schema()).iter_errors(dict(manifest)):
|
|
235
|
+
findings.append({"code": "manifest_schema_invalid", "message": err.message, "path": list(err.absolute_path)})
|
|
236
|
+
|
|
237
|
+
status_rel = None
|
|
238
|
+
for entry in manifest.get("documents", []):
|
|
239
|
+
if isinstance(entry, Mapping) and entry.get("id") == "contract-version-status":
|
|
240
|
+
status_rel = entry.get("path")
|
|
241
|
+
if status_rel:
|
|
242
|
+
status_file = repo / str(status_rel)
|
|
243
|
+
if status_file.is_file():
|
|
244
|
+
try:
|
|
245
|
+
status_doc = json.loads(status_file.read_text(encoding="utf-8"))
|
|
246
|
+
except (OSError, ValueError):
|
|
247
|
+
findings.append({"code": "status_unparsable", "path": str(status_rel)})
|
|
248
|
+
else:
|
|
249
|
+
for err in Draft202012Validator(contract_version_status_schema()).iter_errors(status_doc):
|
|
250
|
+
findings.append({"code": "status_schema_invalid", "message": err.message, "path": list(err.absolute_path)})
|
|
251
|
+
|
|
252
|
+
interfaces_rel = manifest.get("interfaces")
|
|
253
|
+
if interfaces_rel:
|
|
254
|
+
interfaces_file = repo / str(interfaces_rel)
|
|
255
|
+
if interfaces_file.is_file():
|
|
256
|
+
try:
|
|
257
|
+
interfaces_doc = json.loads(interfaces_file.read_text(encoding="utf-8"))
|
|
258
|
+
except (OSError, ValueError):
|
|
259
|
+
findings.append({"code": "interfaces_unparsable", "path": str(interfaces_rel)})
|
|
260
|
+
else:
|
|
261
|
+
for err in Draft202012Validator(interface_declaration_schema()).iter_errors(interfaces_doc):
|
|
262
|
+
findings.append({"code": "interfaces_schema_invalid", "message": err.message, "path": list(err.absolute_path)})
|
|
263
|
+
|
|
264
|
+
return {"status": _gate_status(findings, mode=mode), "maturity": "presence-only", "findings": findings}
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
def _gate_git_discipline(repo: Path, *, mode: str) -> dict[str, Any]:
|
|
268
|
+
"""Slice-G git-discipline guardrail: classify the repo's refs against the
|
|
269
|
+
neutral contract's ``pipeline_ref_classes`` registry and check the
|
|
270
|
+
write-footprint / branch-naming invariants. Consumes the contract, does not
|
|
271
|
+
reinvent it.
|
|
272
|
+
|
|
273
|
+
Contract-absent degrade: when the installed ``consiliency_contract`` predates
|
|
274
|
+
the git-discipline contract (< 0.4), this is a NEUTRAL no-op (``passed`` with
|
|
275
|
+
a note), NOT a warning -- so existing governed scans are unaffected until the
|
|
276
|
+
carrying contract ships. Unlike ``version_skew`` this gate honours ``hard``
|
|
277
|
+
(``capped_warn=False``): the guardrail is a legitimate block-opt-in.
|
|
278
|
+
"""
|
|
279
|
+
from . import git_discipline as gd
|
|
280
|
+
|
|
281
|
+
registry = gd.load_ref_classes()
|
|
282
|
+
if not gd.available(registry):
|
|
283
|
+
return {
|
|
284
|
+
"status": "passed",
|
|
285
|
+
"maturity": "presence-only",
|
|
286
|
+
"findings": [],
|
|
287
|
+
"note": "installed consiliency_contract lacks the git-discipline contract (<0.4); guardrail latent",
|
|
288
|
+
}
|
|
289
|
+
assert registry is not None
|
|
290
|
+
protocol = gd.load_protocol()
|
|
291
|
+
facts = gd.gather_repo_ref_facts(repo)
|
|
292
|
+
findings = gd.evaluate_git_discipline(
|
|
293
|
+
current_branch=facts["current_branch"],
|
|
294
|
+
dirty_paths=facts["dirty_paths"],
|
|
295
|
+
local_branches=facts["local_branches"],
|
|
296
|
+
registry=registry,
|
|
297
|
+
protocol=protocol,
|
|
298
|
+
)
|
|
299
|
+
return {"status": _gate_status(findings, mode=mode), "maturity": "presence-only", "findings": findings}
|
|
300
|
+
|
|
301
|
+
|
|
302
|
+
_RANGE_RE = re.compile(r"^>=\s*([0-9.]+)\s*<\s*([0-9.]+)$")
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
def _version_tuple(version: str) -> tuple[int, ...]:
|
|
306
|
+
return tuple(int(part) for part in re.split(r"[.\-+]", version) if part.isdigit())
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
def _version_in_range(version: str, range_str: str) -> bool | None:
|
|
310
|
+
match = _RANGE_RE.match(range_str.strip())
|
|
311
|
+
if not match:
|
|
312
|
+
return None
|
|
313
|
+
try:
|
|
314
|
+
v = _version_tuple(version)
|
|
315
|
+
lo = _version_tuple(match.group(1))
|
|
316
|
+
hi = _version_tuple(match.group(2))
|
|
317
|
+
except ValueError:
|
|
318
|
+
return None
|
|
319
|
+
return lo <= v < hi
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
def _contract_compatible_range() -> str:
|
|
323
|
+
"""The compatible-version range for ``contract_version``.
|
|
324
|
+
|
|
325
|
+
The vendored package publishes this as a JSON-Schema ``const`` (there is
|
|
326
|
+
no separate data instance for the protocol's own numbers), so it is read
|
|
327
|
+
out of the schema structure at runtime -- never hand-copied as a literal.
|
|
328
|
+
"""
|
|
329
|
+
schema = version_skew_protocol()
|
|
330
|
+
return str(
|
|
331
|
+
schema.get("properties", {})
|
|
332
|
+
.get("compatible_ranges", {})
|
|
333
|
+
.get("properties", {})
|
|
334
|
+
.get("contract", {})
|
|
335
|
+
.get("const", "")
|
|
336
|
+
)
|
|
337
|
+
|
|
338
|
+
|
|
339
|
+
def _gate_version_skew(manifest: Mapping[str, Any], *, mode: str) -> dict[str, Any]:
|
|
340
|
+
installed_version = installed_contract_version()
|
|
341
|
+
repo_version = str(manifest.get("contract_version") or "").strip()
|
|
342
|
+
contract_range = _contract_compatible_range()
|
|
343
|
+
findings: list[dict[str, Any]] = []
|
|
344
|
+
if not repo_version:
|
|
345
|
+
compatibility = "unknown"
|
|
346
|
+
findings.append({"code": "missing_contract_version"})
|
|
347
|
+
else:
|
|
348
|
+
in_range = _version_in_range(repo_version, contract_range)
|
|
349
|
+
if in_range is None:
|
|
350
|
+
compatibility = "unknown"
|
|
351
|
+
findings.append({"code": "unparsable_range", "range": contract_range})
|
|
352
|
+
elif not in_range:
|
|
353
|
+
compatibility = "incompatible"
|
|
354
|
+
findings.append(
|
|
355
|
+
{
|
|
356
|
+
"code": "version_skew",
|
|
357
|
+
"repo_contract_version": repo_version,
|
|
358
|
+
"installed_contract_version": installed_version,
|
|
359
|
+
"compatible_range": contract_range,
|
|
360
|
+
}
|
|
361
|
+
)
|
|
362
|
+
else:
|
|
363
|
+
compatibility = "compatible"
|
|
364
|
+
# Normative: version-skew stays warn-only at Phase 0 regardless of the
|
|
365
|
+
# gate mode opt-in (version-skew-protocol.schema `default_behavior.
|
|
366
|
+
# phase0_severity` is a fixed const, not a per-consumer policy knob).
|
|
367
|
+
return {
|
|
368
|
+
"status": _gate_status(findings, mode=mode, capped_warn=True),
|
|
369
|
+
"maturity": "realized-edge-observed",
|
|
370
|
+
"compatibility": compatibility,
|
|
371
|
+
"installed_contract_version": installed_version,
|
|
372
|
+
"repo_contract_version": repo_version or None,
|
|
373
|
+
"findings": findings,
|
|
374
|
+
}
|