agentic-project-kit 1.0.1__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.
- agentic_project_kit/__init__.py +1 -0
- agentic_project_kit/absolute_path_portability_audit.py +241 -0
- agentic_project_kit/access_level_policy.py +14 -0
- agentic_project_kit/access_levels.py +22 -0
- agentic_project_kit/action_registry.py +195 -0
- agentic_project_kit/action_specs.py +286 -0
- agentic_project_kit/agent_command_runner.py +516 -0
- agentic_project_kit/audit_test_matrix.py +36 -0
- agentic_project_kit/audit_test_matrix_cli.py +43 -0
- agentic_project_kit/chat_bootloader.py +257 -0
- agentic_project_kit/chat_entrypoint_contract.py +297 -0
- agentic_project_kit/checks.py +511 -0
- agentic_project_kit/ci_readiness.py +211 -0
- agentic_project_kit/cli.py +147 -0
- agentic_project_kit/cli_commands/__init__.py +1 -0
- agentic_project_kit/cli_commands/absolute_path_audit.py +25 -0
- agentic_project_kit/cli_commands/actions.py +21 -0
- agentic_project_kit/cli_commands/artifact_gc.py +240 -0
- agentic_project_kit/cli_commands/boot.py +55 -0
- agentic_project_kit/cli_commands/chat.py +34 -0
- agentic_project_kit/cli_commands/checks.py +305 -0
- agentic_project_kit/cli_commands/cockpit.py +103 -0
- agentic_project_kit/cli_commands/command_taxonomy.py +25 -0
- agentic_project_kit/cli_commands/commands.py +129 -0
- agentic_project_kit/cli_commands/dev.py +23 -0
- agentic_project_kit/cli_commands/direction.py +92 -0
- agentic_project_kit/cli_commands/doc_currency_audit.py +25 -0
- agentic_project_kit/cli_commands/doc_registry.py +126 -0
- agentic_project_kit/cli_commands/docs.py +223 -0
- agentic_project_kit/cli_commands/dpa.py +1338 -0
- agentic_project_kit/cli_commands/evidence.py +251 -0
- agentic_project_kit/cli_commands/github.py +34 -0
- agentic_project_kit/cli_commands/governance.py +14 -0
- agentic_project_kit/cli_commands/gui.py +23 -0
- agentic_project_kit/cli_commands/gui_readiness_gate.py +27 -0
- agentic_project_kit/cli_commands/handoff.py +183 -0
- agentic_project_kit/cli_commands/human_workflows.py +430 -0
- agentic_project_kit/cli_commands/init.py +132 -0
- agentic_project_kit/cli_commands/instruction.py +75 -0
- agentic_project_kit/cli_commands/mutation_lock_audit.py +24 -0
- agentic_project_kit/cli_commands/ns_legacy_audit.py +25 -0
- agentic_project_kit/cli_commands/pass_already_done.py +66 -0
- agentic_project_kit/cli_commands/patch_failure_discipline_audit.py +26 -0
- agentic_project_kit/cli_commands/patch_preflight.py +37 -0
- agentic_project_kit/cli_commands/path_literal_audit.py +39 -0
- agentic_project_kit/cli_commands/patterns.py +40 -0
- agentic_project_kit/cli_commands/planning_docs_audit.py +25 -0
- agentic_project_kit/cli_commands/pr.py +133 -0
- agentic_project_kit/cli_commands/pr_hygiene.py +27 -0
- agentic_project_kit/cli_commands/profiles.py +26 -0
- agentic_project_kit/cli_commands/program_redundancy_audit.py +25 -0
- agentic_project_kit/cli_commands/project_direction.py +25 -0
- agentic_project_kit/cli_commands/release.py +392 -0
- agentic_project_kit/cli_commands/release_publish_orchestration.py +36 -0
- agentic_project_kit/cli_commands/remote_branch_hygiene.py +152 -0
- agentic_project_kit/cli_commands/remote_next.py +57 -0
- agentic_project_kit/cli_commands/removed_ns_commands.py +65 -0
- agentic_project_kit/cli_commands/rule_registry.py +129 -0
- agentic_project_kit/cli_commands/rules.py +222 -0
- agentic_project_kit/cli_commands/scaffold.py +46 -0
- agentic_project_kit/cli_commands/slice.py +21 -0
- agentic_project_kit/cli_commands/standard_gates_audit_suite.py +27 -0
- agentic_project_kit/cli_commands/state.py +51 -0
- agentic_project_kit/cli_commands/status_current_state_audit.py +30 -0
- agentic_project_kit/cli_commands/todo.py +53 -0
- agentic_project_kit/cli_commands/transfer.py +19 -0
- agentic_project_kit/cli_commands/transfer_context_flow.py +398 -0
- agentic_project_kit/cli_commands/transfer_context_helpers.py +398 -0
- agentic_project_kit/cli_commands/transfer_diagnostics.py +767 -0
- agentic_project_kit/cli_commands/transfer_evidence_flow.py +368 -0
- agentic_project_kit/cli_commands/transfer_handoff_flow.py +594 -0
- agentic_project_kit/cli_commands/transfer_order_contract.py +74 -0
- agentic_project_kit/cli_commands/transfer_post_merge_complete.py +442 -0
- agentic_project_kit/cli_commands/transfer_post_merge_settle.py +171 -0
- agentic_project_kit/cli_commands/transfer_pr_closeout_complete.py +124 -0
- agentic_project_kit/cli_commands/transfer_pr_create_flow.py +743 -0
- agentic_project_kit/cli_commands/transfer_pr_merge_flow.py +547 -0
- agentic_project_kit/cli_commands/transfer_repo_after_pr.py +160 -0
- agentic_project_kit/cli_commands/transfer_repo_pre_pr.py +664 -0
- agentic_project_kit/cli_commands/transfer_runner_flow.py +131 -0
- agentic_project_kit/cli_commands/transfer_runtime_initial.py +194 -0
- agentic_project_kit/cli_commands/transfer_shared.py +274 -0
- agentic_project_kit/cli_commands/validation.py +200 -0
- agentic_project_kit/cli_commands/version.py +27 -0
- agentic_project_kit/cli_commands/work_orders.py +219 -0
- agentic_project_kit/cli_commands/workflow.py +471 -0
- agentic_project_kit/cli_commands/workflow_guard.py +26 -0
- agentic_project_kit/cli_commands/workspace.py +252 -0
- agentic_project_kit/cockpit.py +608 -0
- agentic_project_kit/cockpit_readiness.py +67 -0
- agentic_project_kit/command_authority_audit.py +192 -0
- agentic_project_kit/command_inbox_check.py +103 -0
- agentic_project_kit/command_manifest.py +591 -0
- agentic_project_kit/command_queue_contract.py +161 -0
- agentic_project_kit/command_selector.py +245 -0
- agentic_project_kit/command_taxonomy.py +264 -0
- agentic_project_kit/commit_guard.py +67 -0
- agentic_project_kit/communication_artifact_gc.py +495 -0
- agentic_project_kit/communication_rule_context.py +437 -0
- agentic_project_kit/communication_state.py +115 -0
- agentic_project_kit/composed_wrapper_invariants.py +97 -0
- agentic_project_kit/composite_short_circuit.py +140 -0
- agentic_project_kit/contract.py +251 -0
- agentic_project_kit/control_state.py +83 -0
- agentic_project_kit/doc_currency_audit.py +536 -0
- agentic_project_kit/doc_lifecycle.py +1179 -0
- agentic_project_kit/doc_lifecycle_signals.py +446 -0
- agentic_project_kit/doc_lifecycle_sweep.py +639 -0
- agentic_project_kit/doc_mesh.py +491 -0
- agentic_project_kit/doctor.py +379 -0
- agentic_project_kit/documentation_registry.py +1122 -0
- agentic_project_kit/documentation_system_audit.py +310 -0
- agentic_project_kit/dpa_current_handoff_lifecycle.py +549 -0
- agentic_project_kit/dpa_dp2_decision_readiness.py +362 -0
- agentic_project_kit/dpa_dp3_dp4_adjudication.py +604 -0
- agentic_project_kit/dpa_dp5_block_new_gate.py +294 -0
- agentic_project_kit/dpa_dp5_stage_adoption.py +615 -0
- agentic_project_kit/dpa_dp5_strict_gate.py +187 -0
- agentic_project_kit/dpa_final_closeout.py +627 -0
- agentic_project_kit/dpa_fixture_evidence.py +680 -0
- agentic_project_kit/dpa_maintainer_record_check.py +711 -0
- agentic_project_kit/dpa_post_dp2_scope_assessment.py +734 -0
- agentic_project_kit/dpa_probe_002_readiness.py +509 -0
- agentic_project_kit/dpa_probe_003_readiness.py +417 -0
- agentic_project_kit/dpa_probe_004_readiness.py +437 -0
- agentic_project_kit/dpa_readiness.py +505 -0
- agentic_project_kit/dpa_readonly_probe_execution.py +500 -0
- agentic_project_kit/dpa_registry_contracts.py +312 -0
- agentic_project_kit/dpa_renderer_readiness.py +407 -0
- agentic_project_kit/dpa_repo_adoption_assessment.py +574 -0
- agentic_project_kit/dpa_stable_readiness.py +743 -0
- agentic_project_kit/dpa_successor_projection.py +168 -0
- agentic_project_kit/dpa_workspace_init_projection.py +93 -0
- agentic_project_kit/dpa_wrt_ch001_evidence.py +327 -0
- agentic_project_kit/entrypoint_slice_runner.py +153 -0
- agentic_project_kit/evidence_clean.py +152 -0
- agentic_project_kit/evidence_commit_paths.py +214 -0
- agentic_project_kit/evidence_finalize_log.py +204 -0
- agentic_project_kit/evidence_guard.py +114 -0
- agentic_project_kit/evidence_inspector.py +507 -0
- agentic_project_kit/evidence_state_contract.py +99 -0
- agentic_project_kit/execution_mode_state.py +148 -0
- agentic_project_kit/final_summary_contract.py +85 -0
- agentic_project_kit/finalize_guard.py +139 -0
- agentic_project_kit/gatekeeper_core.py +232 -0
- agentic_project_kit/github.py +25 -0
- agentic_project_kit/governance.py +59 -0
- agentic_project_kit/gui_action_execution.py +105 -0
- agentic_project_kit/gui_action_renderer.py +81 -0
- agentic_project_kit/gui_action_run_intent.py +98 -0
- agentic_project_kit/gui_action_views.py +195 -0
- agentic_project_kit/gui_activity_log.py +76 -0
- agentic_project_kit/gui_button_catalog.py +605 -0
- agentic_project_kit/gui_cockpit.py +365 -0
- agentic_project_kit/gui_cockpit_actions.py +695 -0
- agentic_project_kit/gui_cockpit_common.py +172 -0
- agentic_project_kit/gui_cockpit_header.py +501 -0
- agentic_project_kit/gui_cockpit_sidebar.py +387 -0
- agentic_project_kit/gui_cockpit_task.py +748 -0
- agentic_project_kit/gui_command_projection.py +355 -0
- agentic_project_kit/gui_communication_modes.py +130 -0
- agentic_project_kit/gui_dry_run.py +219 -0
- agentic_project_kit/gui_gatekeeper_status.py +259 -0
- agentic_project_kit/gui_layout_plan.py +148 -0
- agentic_project_kit/gui_open_folder.py +18 -0
- agentic_project_kit/gui_output_status_panel.py +61 -0
- agentic_project_kit/gui_panel_state.py +47 -0
- agentic_project_kit/gui_presenter.py +62 -0
- agentic_project_kit/gui_readiness_gate.py +206 -0
- agentic_project_kit/gui_release_flow.py +59 -0
- agentic_project_kit/gui_task_editor.py +1077 -0
- agentic_project_kit/gui_tk_widgets.py +177 -0
- agentic_project_kit/gui_tkinter_renderer.py +87 -0
- agentic_project_kit/gui_tkinter_shell.py +1176 -0
- agentic_project_kit/gui_transfer_contract.py +28 -0
- agentic_project_kit/gui_viewmodel.py +698 -0
- agentic_project_kit/gui_window_guard.py +46 -0
- agentic_project_kit/handoff_freshness.py +390 -0
- agentic_project_kit/handoff_prompt.py +180 -0
- agentic_project_kit/handoff_state.py +254 -0
- agentic_project_kit/instruction_lint.py +455 -0
- agentic_project_kit/llm_context_carriers.py +66 -0
- agentic_project_kit/llm_execution_context.py +285 -0
- agentic_project_kit/local_command_stack.py +133 -0
- agentic_project_kit/local_feature_gate.py +82 -0
- agentic_project_kit/local_garbage_collector.py +269 -0
- agentic_project_kit/models.py +18 -0
- agentic_project_kit/mutation_lock_audit.py +421 -0
- agentic_project_kit/next_turn_evidence.py +253 -0
- agentic_project_kit/next_turn_merge_if_green.py +459 -0
- agentic_project_kit/next_turn_pr_status.py +255 -0
- agentic_project_kit/next_turn_result.py +183 -0
- agentic_project_kit/next_turn_runner.py +159 -0
- agentic_project_kit/next_turn_slot.py +107 -0
- agentic_project_kit/next_turn_status.py +274 -0
- agentic_project_kit/ns_legacy_reference_audit.py +258 -0
- agentic_project_kit/ns_slice_runner.py +16 -0
- agentic_project_kit/operational_handoff_projection.py +124 -0
- agentic_project_kit/output_contract.py +80 -0
- agentic_project_kit/output_repair.py +61 -0
- agentic_project_kit/pass_already_done.py +216 -0
- agentic_project_kit/patch_artifact_preflight.py +147 -0
- agentic_project_kit/patch_cycle_workflow.py +440 -0
- agentic_project_kit/patch_failure_discipline_audit.py +223 -0
- agentic_project_kit/patch_preflight.py +215 -0
- agentic_project_kit/path_literal_audit.py +612 -0
- agentic_project_kit/patterns.py +99 -0
- agentic_project_kit/planning_docs_consolidation_audit.py +313 -0
- agentic_project_kit/portability_shell_gate.py +40 -0
- agentic_project_kit/post_merge_handoff_refresh.py +56 -0
- agentic_project_kit/post_release.py +252 -0
- agentic_project_kit/post_release_closeout.py +616 -0
- agentic_project_kit/pr_cleanup.py +172 -0
- agentic_project_kit/pr_closeout.py +50 -0
- agentic_project_kit/pr_closeout_complete.py +344 -0
- agentic_project_kit/pr_create_or_skip.py +71 -0
- agentic_project_kit/pr_hygiene.py +210 -0
- agentic_project_kit/program_redundancy_audit.py +251 -0
- agentic_project_kit/project_direction.py +840 -0
- agentic_project_kit/protected_change_planner.py +194 -0
- agentic_project_kit/release.py +401 -0
- agentic_project_kit/release_doi_safety.py +24 -0
- agentic_project_kit/release_gate_core.py +174 -0
- agentic_project_kit/release_metadata_authority_gate.py +328 -0
- agentic_project_kit/release_metadata_prep.py +43 -0
- agentic_project_kit/release_notes.py +823 -0
- agentic_project_kit/release_prep_core.py +204 -0
- agentic_project_kit/release_prepare.py +369 -0
- agentic_project_kit/release_process_guardrails.py +247 -0
- agentic_project_kit/release_publish_core.py +114 -0
- agentic_project_kit/release_publish_orchestration.py +469 -0
- agentic_project_kit/release_state.py +552 -0
- agentic_project_kit/release_verify_core.py +175 -0
- agentic_project_kit/remote_branch_hygiene.py +223 -0
- agentic_project_kit/remote_next.py +89 -0
- agentic_project_kit/remote_next_closeout.py +101 -0
- agentic_project_kit/remote_next_order_contract.py +391 -0
- agentic_project_kit/removed_ns_commands.py +458 -0
- agentic_project_kit/removed_source_audit.py +225 -0
- agentic_project_kit/rendering.py +13 -0
- agentic_project_kit/repair_report.py +79 -0
- agentic_project_kit/repo_identity.py +59 -0
- agentic_project_kit/result_report_classifier.py +57 -0
- agentic_project_kit/rule_ack.py +105 -0
- agentic_project_kit/rule_preservation.py +58 -0
- agentic_project_kit/rule_refresh.py +174 -0
- agentic_project_kit/rule_registry_registration.py +322 -0
- agentic_project_kit/rule_registry_report.py +206 -0
- agentic_project_kit/rule_registry_validator.py +704 -0
- agentic_project_kit/rule_snapshot.py +98 -0
- agentic_project_kit/rule_source_validator.py +133 -0
- agentic_project_kit/run_summary.py +68 -0
- agentic_project_kit/run_summary_renderer.py +238 -0
- agentic_project_kit/runtime_validator.py +68 -0
- agentic_project_kit/safe_file_replace.py +35 -0
- agentic_project_kit/safe_patch.py +47 -0
- agentic_project_kit/safe_push.py +218 -0
- agentic_project_kit/safe_remove_diagnostic.py +51 -0
- agentic_project_kit/scaffold.py +69 -0
- agentic_project_kit/site_claims.py +444 -0
- agentic_project_kit/site_generator.py +1140 -0
- agentic_project_kit/slice_gate.py +225 -0
- agentic_project_kit/slice_runner.py +75 -0
- agentic_project_kit/standard_gates_audit_suite.py +167 -0
- agentic_project_kit/state_freshness.py +135 -0
- agentic_project_kit/status_current_state_audit.py +762 -0
- agentic_project_kit/successor_handoff_package.py +1763 -0
- agentic_project_kit/templates.py +292 -0
- agentic_project_kit/terminal_block_guard.py +166 -0
- agentic_project_kit/terminal_logging.py +275 -0
- agentic_project_kit/todo.py +97 -0
- agentic_project_kit/transfer_closeout.py +136 -0
- agentic_project_kit/transfer_continue.py +215 -0
- agentic_project_kit/transfer_local_runner.py +101 -0
- agentic_project_kit/transfer_operation_monitor.py +236 -0
- agentic_project_kit/transfer_post_merge_lifecycle.py +356 -0
- agentic_project_kit/transfer_post_merge_settle.py +383 -0
- agentic_project_kit/transfer_pr_actions.py +164 -0
- agentic_project_kit/transfer_remote_next.py +959 -0
- agentic_project_kit/transfer_repo_actions.py +2253 -0
- agentic_project_kit/transfer_runner.py +347 -0
- agentic_project_kit/transfer_safety_context.py +291 -0
- agentic_project_kit/transfer_state.py +483 -0
- agentic_project_kit/transfer_uplink.py +471 -0
- agentic_project_kit/transfer_workflow_next.py +148 -0
- agentic_project_kit/typed_work_order_evidence.py +58 -0
- agentic_project_kit/typed_work_order_queue.py +166 -0
- agentic_project_kit/typed_work_order_runner.py +168 -0
- agentic_project_kit/work_cycle.py +317 -0
- agentic_project_kit/work_discard_changes.py +129 -0
- agentic_project_kit/work_order_patch.py +199 -0
- agentic_project_kit/work_order_runner.py +120 -0
- agentic_project_kit/work_order_uploader.py +220 -0
- agentic_project_kit/work_order_validator.py +185 -0
- agentic_project_kit/work_orders.py +246 -0
- agentic_project_kit/workflow_guard.py +262 -0
- agentic_project_kit/workflow_summary_runner.py +124 -0
- agentic_project_kit/workspace.py +665 -0
- agentic_project_kit/workspace_adopt.py +471 -0
- agentic_project_kit/workspace_dpa_intake.py +406 -0
- agentic_project_kit/workspace_init.py +487 -0
- agentic_project_kit/workspace_lock.py +129 -0
- agentic_project_kit/workspace_remove.py +381 -0
- agentic_project_kit/workspace_upgrade.py +324 -0
- agentic_project_kit/wrapper_live_status.py +104 -0
- agentic_project_kit-1.0.1.dist-info/METADATA +724 -0
- agentic_project_kit-1.0.1.dist-info/RECORD +310 -0
- agentic_project_kit-1.0.1.dist-info/WHEEL +4 -0
- agentic_project_kit-1.0.1.dist-info/entry_points.txt +3 -0
- agentic_project_kit-1.0.1.dist-info/licenses/LICENSE +10 -0
|
@@ -0,0 +1,604 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from dataclasses import dataclass
|
|
4
|
+
import json
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
import subprocess
|
|
7
|
+
from typing import Any
|
|
8
|
+
|
|
9
|
+
from agentic_project_kit.dpa_successor_projection import (
|
|
10
|
+
DPA_SUCCESSOR_PROJECTION_CONTRACT_ID,
|
|
11
|
+
DPA_SUCCESSOR_PROJECTION_SOURCE_PATHS,
|
|
12
|
+
DPA_SUCCESSOR_PROJECTION_TARGET_SCOPE,
|
|
13
|
+
DPA_SUCCESSOR_PROJECTION_WRITER_ID,
|
|
14
|
+
)
|
|
15
|
+
from agentic_project_kit.dpa_workspace_init_projection import (
|
|
16
|
+
DPA_WORKSPACE_INIT_CONTRACT_ID,
|
|
17
|
+
DPA_WORKSPACE_INIT_MANIFEST_PATH,
|
|
18
|
+
DPA_WORKSPACE_INIT_SOURCE_PATHS,
|
|
19
|
+
DPA_WORKSPACE_INIT_TARGET_SCOPE,
|
|
20
|
+
DPA_WORKSPACE_INIT_WRITER_ID,
|
|
21
|
+
)
|
|
22
|
+
from agentic_project_kit.workspace import load_workspace
|
|
23
|
+
|
|
24
|
+
DEFAULT_DP3_DP4_ADJUDICATION_RECORD_PATH = Path(
|
|
25
|
+
"docs/architecture/evidence/dpa/assessment/DP3_DP4_ADJUDICATION_RECORD_20260801.json"
|
|
26
|
+
)
|
|
27
|
+
ADJUDICATION_MODEL = "dpa-dp3-dp4-adjudication-record-v1"
|
|
28
|
+
VALID_STATUS = "VALID_DP3_DP4_ADJUDICATION_RECORD"
|
|
29
|
+
ACCEPTED_RECORD_STATUS = "DP3_DP4_BOUNDED_ADJUDICATION_ACCEPTED"
|
|
30
|
+
ACCEPTED_DECISION_TOKEN = "DPA_DP3_DP4_BOUNDED_ADJUDICATION_ACCEPTED"
|
|
31
|
+
EVIDENCE_OUTPUT_ROOT_PARTS = ("evidence", "dpa", "assessment")
|
|
32
|
+
|
|
33
|
+
REQUIRED_DP3_TARGETS: dict[str, dict[str, object]] = {
|
|
34
|
+
DPA_WORKSPACE_INIT_WRITER_ID: {
|
|
35
|
+
"target_identity": DPA_WORKSPACE_INIT_TARGET_SCOPE,
|
|
36
|
+
"target_path": DPA_WORKSPACE_INIT_MANIFEST_PATH,
|
|
37
|
+
"source_authority": DPA_WORKSPACE_INIT_CONTRACT_ID,
|
|
38
|
+
"source_paths": DPA_WORKSPACE_INIT_SOURCE_PATHS,
|
|
39
|
+
"document_form": "external-generated-initialization-manifest",
|
|
40
|
+
"implementation_result_ref": "f653bbbb",
|
|
41
|
+
"evidence": (
|
|
42
|
+
"docs/architecture/evidence/dpa/probes/fixture-evidence-0b985a22-wrt-ch005-20260729/results.json",
|
|
43
|
+
),
|
|
44
|
+
},
|
|
45
|
+
DPA_SUCCESSOR_PROJECTION_WRITER_ID: {
|
|
46
|
+
"target_identity": DPA_SUCCESSOR_PROJECTION_TARGET_SCOPE,
|
|
47
|
+
"target_path": "docs/reports/handoff-packages/latest/",
|
|
48
|
+
"source_authority": DPA_SUCCESSOR_PROJECTION_CONTRACT_ID,
|
|
49
|
+
"source_paths": DPA_SUCCESSOR_PROJECTION_SOURCE_PATHS,
|
|
50
|
+
"document_form": "command-generated-successor-handoff-projection",
|
|
51
|
+
"implementation_result_ref": "644f470a",
|
|
52
|
+
"evidence": (
|
|
53
|
+
"docs/architecture/evidence/dpa/probes/fixture-evidence-9cd4a7fc-wrt-ch006-20260729/results.json",
|
|
54
|
+
),
|
|
55
|
+
},
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
REQUIRED_DP4_CANDIDATES: dict[str, dict[str, object]] = {
|
|
59
|
+
"DP4-CURRENT-HANDOFF": {
|
|
60
|
+
"path": "docs/handoff/CURRENT_HANDOFF.md",
|
|
61
|
+
"decision": "MANUAL_PRESERVATION_WITH_LIFECYCLE_OWNED_GENERATED_BLOCK",
|
|
62
|
+
"document_form": "hybrid-current-state-document",
|
|
63
|
+
"target_identity": "CURRENT_HANDOFF_SELF_HOSTING_TARGET",
|
|
64
|
+
},
|
|
65
|
+
"DP4-STATUS": {
|
|
66
|
+
"path": "docs/STATUS.md",
|
|
67
|
+
"decision": "NO_MIGRATION_MANUAL_STATUS_DASHBOARD",
|
|
68
|
+
"document_form": "manual-current-state-dashboard",
|
|
69
|
+
"target_identity": "PROJECT_STATUS_CURRENT_STATE",
|
|
70
|
+
},
|
|
71
|
+
"DP4-SUCCESSOR-PROJECTIONS": {
|
|
72
|
+
"path": "docs/reports/handoff-packages/latest/ and docs/handoff/NEXT_CHAT_BOOTSTRAP.md",
|
|
73
|
+
"decision": "NO_MIGRATION_COMMAND_GENERATED_OUTPUT_BOUNDARY",
|
|
74
|
+
"document_form": "command-generated-successor-handoff-projection-family",
|
|
75
|
+
"target_identity": DPA_SUCCESSOR_PROJECTION_TARGET_SCOPE,
|
|
76
|
+
},
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
FALSE_CLAIM_FIELDS = (
|
|
80
|
+
"kit_wide_dpa_conformance_claimed",
|
|
81
|
+
"dp5_strict_enforced",
|
|
82
|
+
"production_mutation_performed",
|
|
83
|
+
"generated_outputs_manually_patched",
|
|
84
|
+
"stable_dpa_claimed",
|
|
85
|
+
)
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
@dataclass(frozen=True)
|
|
89
|
+
class Dp3Dp4AdjudicationFinding:
|
|
90
|
+
code: str
|
|
91
|
+
message: str
|
|
92
|
+
path: str
|
|
93
|
+
|
|
94
|
+
def as_dict(self) -> dict[str, str]:
|
|
95
|
+
return {"code": self.code, "message": self.message, "path": self.path}
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
@dataclass(frozen=True)
|
|
99
|
+
class Dp3Dp4AdjudicationResult:
|
|
100
|
+
root: str
|
|
101
|
+
record_path: str
|
|
102
|
+
record_present: bool
|
|
103
|
+
record_validation_ref: str
|
|
104
|
+
current_validation_ref: str
|
|
105
|
+
record_status: str
|
|
106
|
+
decision_token: str
|
|
107
|
+
dp3_target_status: dict[str, str]
|
|
108
|
+
dp4_candidate_status: dict[str, str]
|
|
109
|
+
dp5_next_stage_authorized: bool
|
|
110
|
+
findings: tuple[Dp3Dp4AdjudicationFinding, ...]
|
|
111
|
+
|
|
112
|
+
@property
|
|
113
|
+
def ok(self) -> bool:
|
|
114
|
+
return self.result_status == VALID_STATUS
|
|
115
|
+
|
|
116
|
+
@property
|
|
117
|
+
def result_status(self) -> str:
|
|
118
|
+
if not self.record_present:
|
|
119
|
+
return "MISSING_DP3_DP4_ADJUDICATION_RECORD"
|
|
120
|
+
if self.findings:
|
|
121
|
+
return "INVALID_DP3_DP4_ADJUDICATION_RECORD"
|
|
122
|
+
return VALID_STATUS
|
|
123
|
+
|
|
124
|
+
def dp3_target_accepted(self, writer_id: str) -> bool:
|
|
125
|
+
return self.ok and self.dp3_target_status.get(writer_id) == "ACCEPTED_FOR_BOUNDED_DP3_ROLLOUT"
|
|
126
|
+
|
|
127
|
+
def dp4_candidate_accepted(self, candidate_id: str) -> bool:
|
|
128
|
+
return (
|
|
129
|
+
self.ok
|
|
130
|
+
and self.dp4_candidate_status.get(candidate_id)
|
|
131
|
+
== "ACCEPTED_FOR_BOUNDED_DP4_NO_MIGRATION_OR_MANUAL_PRESERVATION"
|
|
132
|
+
)
|
|
133
|
+
|
|
134
|
+
def as_dict(self) -> dict[str, Any]:
|
|
135
|
+
return {
|
|
136
|
+
"schema_version": 1,
|
|
137
|
+
"kind": "dpa_dp3_dp4_adjudication_check",
|
|
138
|
+
"adjudication_model": ADJUDICATION_MODEL,
|
|
139
|
+
"result_status": self.result_status,
|
|
140
|
+
"record_path": self.record_path,
|
|
141
|
+
"record_present": self.record_present,
|
|
142
|
+
"record_validation_ref": self.record_validation_ref,
|
|
143
|
+
"current_validation_ref": self.current_validation_ref,
|
|
144
|
+
"record_status": self.record_status,
|
|
145
|
+
"decision_token": self.decision_token,
|
|
146
|
+
"dp3_target_status": self.dp3_target_status,
|
|
147
|
+
"dp4_candidate_status": self.dp4_candidate_status,
|
|
148
|
+
"dp5_next_stage_authorized": self.dp5_next_stage_authorized,
|
|
149
|
+
"finding_count": len(self.findings),
|
|
150
|
+
"findings": [finding.as_dict() for finding in self.findings],
|
|
151
|
+
"claims": _false_claims(),
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
def evaluate_dp3_dp4_adjudication_record(
|
|
156
|
+
root: Path | str = ".",
|
|
157
|
+
*,
|
|
158
|
+
record_path: Path | str = DEFAULT_DP3_DP4_ADJUDICATION_RECORD_PATH,
|
|
159
|
+
validation_ref: str | None = None,
|
|
160
|
+
) -> Dp3Dp4AdjudicationResult:
|
|
161
|
+
base = Path(root).resolve()
|
|
162
|
+
path = _resolve_under_root(base, record_path)
|
|
163
|
+
display_path = _display_path(path, base)
|
|
164
|
+
current_ref = validation_ref or _git_head(base)
|
|
165
|
+
findings: list[Dp3Dp4AdjudicationFinding] = []
|
|
166
|
+
|
|
167
|
+
if not path.exists():
|
|
168
|
+
return Dp3Dp4AdjudicationResult(
|
|
169
|
+
root=base.as_posix(),
|
|
170
|
+
record_path=display_path,
|
|
171
|
+
record_present=False,
|
|
172
|
+
record_validation_ref="",
|
|
173
|
+
current_validation_ref=current_ref,
|
|
174
|
+
record_status="MISSING",
|
|
175
|
+
decision_token="",
|
|
176
|
+
dp3_target_status={},
|
|
177
|
+
dp4_candidate_status={},
|
|
178
|
+
dp5_next_stage_authorized=False,
|
|
179
|
+
findings=(
|
|
180
|
+
Dp3Dp4AdjudicationFinding(
|
|
181
|
+
code="adjudication-record-missing",
|
|
182
|
+
message="Record DP3/DP4 bounded adjudication before clearing post-DP2 blockers.",
|
|
183
|
+
path=display_path,
|
|
184
|
+
),
|
|
185
|
+
),
|
|
186
|
+
)
|
|
187
|
+
|
|
188
|
+
try:
|
|
189
|
+
data = json.loads(path.read_text(encoding="utf-8"))
|
|
190
|
+
except json.JSONDecodeError as exc:
|
|
191
|
+
return _invalid_result(base, display_path, current_ref, f"record JSON is invalid: {exc}")
|
|
192
|
+
if not isinstance(data, dict):
|
|
193
|
+
return _invalid_result(base, display_path, current_ref, "record root must be a JSON object")
|
|
194
|
+
|
|
195
|
+
_validate_header(data, findings, display_path, root=base)
|
|
196
|
+
dp3_status = _validate_dp3_scope(data, findings, display_path, root=base)
|
|
197
|
+
dp4_status = _validate_dp4_scope(data, findings, display_path, root=base)
|
|
198
|
+
_validate_dp5_boundary(data, findings, display_path)
|
|
199
|
+
_validate_claims(data, findings, display_path)
|
|
200
|
+
|
|
201
|
+
return Dp3Dp4AdjudicationResult(
|
|
202
|
+
root=base.as_posix(),
|
|
203
|
+
record_path=display_path,
|
|
204
|
+
record_present=True,
|
|
205
|
+
record_validation_ref=str(data.get("validation_ref", "")),
|
|
206
|
+
current_validation_ref=current_ref,
|
|
207
|
+
record_status=str(data.get("status", "")),
|
|
208
|
+
decision_token=str(data.get("decision_token", "")),
|
|
209
|
+
dp3_target_status=dp3_status,
|
|
210
|
+
dp4_candidate_status=dp4_status,
|
|
211
|
+
dp5_next_stage_authorized=_mapping(data.get("dp5")).get("next_stage_authorized") is True,
|
|
212
|
+
findings=tuple(findings),
|
|
213
|
+
)
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
def render_dp3_dp4_adjudication_check(result: Dp3Dp4AdjudicationResult) -> str:
|
|
217
|
+
payload = result.as_dict()
|
|
218
|
+
lines = [
|
|
219
|
+
"DPA_DP3_DP4_ADJUDICATION_CHECK",
|
|
220
|
+
f"STATUS={payload['result_status']}",
|
|
221
|
+
f"RECORD={payload['record_path']}",
|
|
222
|
+
f"RECORD_VALIDATION_REF={payload['record_validation_ref']}",
|
|
223
|
+
f"CURRENT_VALIDATION_REF={payload['current_validation_ref']}",
|
|
224
|
+
f"RECORD_STATUS={payload['record_status']}",
|
|
225
|
+
f"DECISION_TOKEN={payload['decision_token']}",
|
|
226
|
+
f"DP5_NEXT_STAGE_AUTHORIZED={str(payload['dp5_next_stage_authorized']).lower()}",
|
|
227
|
+
f"FINDINGS={payload['finding_count']}",
|
|
228
|
+
]
|
|
229
|
+
for writer_id, status in sorted(result.dp3_target_status.items()):
|
|
230
|
+
lines.append(f"DP3_TARGET={writer_id}|status={status}")
|
|
231
|
+
for candidate_id, status in sorted(result.dp4_candidate_status.items()):
|
|
232
|
+
lines.append(f"DP4_CANDIDATE={candidate_id}|status={status}")
|
|
233
|
+
for finding in result.findings:
|
|
234
|
+
lines.append(f"FINDING={finding.code}|path={finding.path}|{finding.message}")
|
|
235
|
+
return "\n".join(lines) + "\n"
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
def write_dp3_dp4_adjudication_check_json(
|
|
239
|
+
result: Dp3Dp4AdjudicationResult,
|
|
240
|
+
root: Path | str,
|
|
241
|
+
output: Path | str,
|
|
242
|
+
*,
|
|
243
|
+
execute: bool,
|
|
244
|
+
) -> dict[str, Any]:
|
|
245
|
+
base = Path(root).resolve()
|
|
246
|
+
output_path = _resolve_under_root(base, output)
|
|
247
|
+
relative = output_path.relative_to(base)
|
|
248
|
+
evidence_root = _evidence_output_root(base)
|
|
249
|
+
if evidence_root not in (output_path, *output_path.parents):
|
|
250
|
+
return {
|
|
251
|
+
"result_status": "BLOCK",
|
|
252
|
+
"reason": "output_outside_dpa_assessment_evidence_root",
|
|
253
|
+
"output_path": relative.as_posix(),
|
|
254
|
+
"written": False,
|
|
255
|
+
}
|
|
256
|
+
rendered = json.dumps(result.as_dict(), indent=2, sort_keys=True) + "\n"
|
|
257
|
+
changed = True
|
|
258
|
+
if output_path.exists():
|
|
259
|
+
changed = output_path.read_text(encoding="utf-8") != rendered
|
|
260
|
+
if execute:
|
|
261
|
+
output_path.parent.mkdir(parents=True, exist_ok=True)
|
|
262
|
+
output_path.write_text(rendered, encoding="utf-8")
|
|
263
|
+
return {
|
|
264
|
+
"result_status": "PASS",
|
|
265
|
+
"output_path": relative.as_posix(),
|
|
266
|
+
"changed": changed,
|
|
267
|
+
"written": bool(execute),
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
def _invalid_result(
|
|
272
|
+
root: Path,
|
|
273
|
+
display_path: str,
|
|
274
|
+
current_ref: str,
|
|
275
|
+
message: str,
|
|
276
|
+
) -> Dp3Dp4AdjudicationResult:
|
|
277
|
+
return Dp3Dp4AdjudicationResult(
|
|
278
|
+
root=root.as_posix(),
|
|
279
|
+
record_path=display_path,
|
|
280
|
+
record_present=True,
|
|
281
|
+
record_validation_ref="",
|
|
282
|
+
current_validation_ref=current_ref,
|
|
283
|
+
record_status="INVALID",
|
|
284
|
+
decision_token="",
|
|
285
|
+
dp3_target_status={},
|
|
286
|
+
dp4_candidate_status={},
|
|
287
|
+
dp5_next_stage_authorized=False,
|
|
288
|
+
findings=(
|
|
289
|
+
Dp3Dp4AdjudicationFinding(
|
|
290
|
+
code="adjudication-record-invalid-json",
|
|
291
|
+
message=message,
|
|
292
|
+
path=display_path,
|
|
293
|
+
),
|
|
294
|
+
),
|
|
295
|
+
)
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
def _validate_header(
|
|
299
|
+
data: dict[str, Any],
|
|
300
|
+
findings: list[Dp3Dp4AdjudicationFinding],
|
|
301
|
+
path: str,
|
|
302
|
+
*,
|
|
303
|
+
root: Path,
|
|
304
|
+
) -> None:
|
|
305
|
+
if data.get("schema_version") != 1:
|
|
306
|
+
_finding(findings, "schema-version-invalid", "schema_version must be 1", path)
|
|
307
|
+
if data.get("kind") != "dpa_dp3_dp4_adjudication_record":
|
|
308
|
+
_finding(findings, "kind-invalid", "kind must be dpa_dp3_dp4_adjudication_record", path)
|
|
309
|
+
if data.get("status") != ACCEPTED_RECORD_STATUS:
|
|
310
|
+
_finding(findings, "status-not-accepted", f"status must be {ACCEPTED_RECORD_STATUS}", path)
|
|
311
|
+
if data.get("decision_token") != ACCEPTED_DECISION_TOKEN:
|
|
312
|
+
_finding(findings, "decision-token-invalid", f"decision_token must be {ACCEPTED_DECISION_TOKEN}", path)
|
|
313
|
+
validation_ref = str(data.get("validation_ref", ""))
|
|
314
|
+
if not validation_ref:
|
|
315
|
+
_finding(findings, "validation-ref-missing", "validation_ref must record an exact ref", path)
|
|
316
|
+
elif _git_ref_exists(root, validation_ref) is False:
|
|
317
|
+
_finding(findings, "validation-ref-unresolvable", f"validation_ref is not a known commit: {validation_ref}", path)
|
|
318
|
+
if not str(data.get("maintainer", "")).strip():
|
|
319
|
+
_finding(findings, "maintainer-missing", "maintainer instruction/adjudication text must be recorded", path)
|
|
320
|
+
assessment = str(data.get("post_dp2_scope_assessment", ""))
|
|
321
|
+
if not assessment:
|
|
322
|
+
_finding(findings, "post-dp2-assessment-missing", "post_dp2_scope_assessment must be recorded", path)
|
|
323
|
+
elif not (root / assessment).exists():
|
|
324
|
+
_finding(findings, "post-dp2-assessment-path-missing", f"missing evidence path: {assessment}", path)
|
|
325
|
+
|
|
326
|
+
|
|
327
|
+
def _validate_dp3_scope(
|
|
328
|
+
data: dict[str, Any],
|
|
329
|
+
findings: list[Dp3Dp4AdjudicationFinding],
|
|
330
|
+
path: str,
|
|
331
|
+
*,
|
|
332
|
+
root: Path,
|
|
333
|
+
) -> dict[str, str]:
|
|
334
|
+
scope = _mapping(data.get("dp3_scope"))
|
|
335
|
+
targets = _indexed_mappings(scope.get("rollout_targets"), "writer_id")
|
|
336
|
+
statuses: dict[str, str] = {}
|
|
337
|
+
for writer_id, expected in REQUIRED_DP3_TARGETS.items():
|
|
338
|
+
target = targets.get(writer_id)
|
|
339
|
+
target_path = f"{path}#dp3:{writer_id}"
|
|
340
|
+
if target is None:
|
|
341
|
+
_finding(findings, "dp3-target-missing", f"missing DP3 target {writer_id}", target_path)
|
|
342
|
+
continue
|
|
343
|
+
status = str(_mapping(target.get("adjudication")).get("status", ""))
|
|
344
|
+
statuses[writer_id] = status
|
|
345
|
+
if status != "ACCEPTED_FOR_BOUNDED_DP3_ROLLOUT":
|
|
346
|
+
_finding(findings, "dp3-target-not-accepted", f"{writer_id} is not accepted for bounded DP3 rollout", target_path)
|
|
347
|
+
_require_equal(target, "target_identity", expected["target_identity"], findings, target_path)
|
|
348
|
+
_require_equal(target, "target_path", expected["target_path"], findings, target_path)
|
|
349
|
+
_require_equal(target, "source_authority", expected["source_authority"], findings, target_path)
|
|
350
|
+
_require_equal(target, "document_form", expected["document_form"], findings, target_path)
|
|
351
|
+
_require_equal(target, "implementation_result_ref", expected["implementation_result_ref"], findings, target_path)
|
|
352
|
+
for source_path in expected["source_paths"]: # type: ignore[index]
|
|
353
|
+
if source_path not in _string_list(target.get("source_paths")):
|
|
354
|
+
_finding(findings, "dp3-source-path-missing", f"{writer_id} missing source path {source_path}", target_path)
|
|
355
|
+
_require_inventory(target, "reader_inventory", findings, target_path)
|
|
356
|
+
_require_inventory(target, "writer_inventory", findings, target_path)
|
|
357
|
+
_require_existing_paths(target.get("rollout_evidence"), root, findings, target_path, "dp3-rollout-evidence-missing")
|
|
358
|
+
_require_status_with_evidence(target, "dpa_600", "SATISFIED_FOR_CURRENT_KIT_REF", root, findings, target_path)
|
|
359
|
+
_require_status_with_evidence(target, "dpa_700", "SATISFIED_FOR_CURRENT_KIT_REF", root, findings, target_path)
|
|
360
|
+
tests = _mapping(target.get("tests"))
|
|
361
|
+
if not _string_list(tests.get("positive")) or not _string_list(tests.get("negative")):
|
|
362
|
+
_finding(findings, "dp3-tests-missing", f"{writer_id} requires positive and negative tests", target_path)
|
|
363
|
+
rollback = _mapping(target.get("rollback"))
|
|
364
|
+
if rollback.get("independently_revertible") is not True and rollback.get("cleanup_proven") is not True:
|
|
365
|
+
_finding(findings, "dp3-rollback-not-proven", f"{writer_id} requires revertible cleanup or proven rollback", target_path)
|
|
366
|
+
if _mapping(target.get("adjudication")).get("maintainer_accepted") is not True:
|
|
367
|
+
_finding(findings, "dp3-maintainer-acceptance-missing", f"{writer_id} requires maintainer acceptance", target_path)
|
|
368
|
+
_validate_false_claims(target, findings, target_path)
|
|
369
|
+
return statuses
|
|
370
|
+
|
|
371
|
+
|
|
372
|
+
def _validate_dp4_scope(
|
|
373
|
+
data: dict[str, Any],
|
|
374
|
+
findings: list[Dp3Dp4AdjudicationFinding],
|
|
375
|
+
path: str,
|
|
376
|
+
*,
|
|
377
|
+
root: Path,
|
|
378
|
+
) -> dict[str, str]:
|
|
379
|
+
scope = _mapping(data.get("dp4_scope"))
|
|
380
|
+
candidates = _indexed_mappings(scope.get("status_authority_candidates"), "id")
|
|
381
|
+
statuses: dict[str, str] = {}
|
|
382
|
+
for candidate_id, expected in REQUIRED_DP4_CANDIDATES.items():
|
|
383
|
+
candidate = candidates.get(candidate_id)
|
|
384
|
+
candidate_path = f"{path}#dp4:{candidate_id}"
|
|
385
|
+
if candidate is None:
|
|
386
|
+
_finding(findings, "dp4-candidate-missing", f"missing DP4 candidate {candidate_id}", candidate_path)
|
|
387
|
+
continue
|
|
388
|
+
status = str(_mapping(candidate.get("adjudication")).get("status", ""))
|
|
389
|
+
statuses[candidate_id] = status
|
|
390
|
+
if status != "ACCEPTED_FOR_BOUNDED_DP4_NO_MIGRATION_OR_MANUAL_PRESERVATION":
|
|
391
|
+
_finding(findings, "dp4-candidate-not-accepted", f"{candidate_id} is not accepted for DP4 exit", candidate_path)
|
|
392
|
+
for field in ("path", "decision", "document_form", "target_identity"):
|
|
393
|
+
_require_equal(candidate, field, expected[field], findings, candidate_path)
|
|
394
|
+
for inventory_field in (
|
|
395
|
+
"reader_inventory",
|
|
396
|
+
"writer_inventory",
|
|
397
|
+
"generator_inventory",
|
|
398
|
+
"command_update_inventory",
|
|
399
|
+
):
|
|
400
|
+
_require_inventory(candidate, inventory_field, findings, candidate_path)
|
|
401
|
+
_require_status_with_evidence(candidate, "dpa_600", "SATISFIED_FOR_CURRENT_KIT_REF", root, findings, candidate_path)
|
|
402
|
+
_require_status_with_evidence(candidate, "dpa_700", "NO_MIGRATION_OR_MANUAL_PRESERVATION", root, findings, candidate_path)
|
|
403
|
+
preservation = _mapping(candidate.get("rollback_or_preservation"))
|
|
404
|
+
if preservation.get("status") not in {
|
|
405
|
+
"MANUAL_PRESERVATION_RECORDED",
|
|
406
|
+
"NO_MIGRATION_RECORDED",
|
|
407
|
+
"COMMAND_CONTRACT_BOUNDARY_RECORDED",
|
|
408
|
+
}:
|
|
409
|
+
_finding(findings, "dp4-preservation-status-invalid", f"{candidate_id} preservation/no-migration status is invalid", candidate_path)
|
|
410
|
+
_require_existing_paths(preservation.get("evidence"), root, findings, candidate_path, "dp4-preservation-evidence-missing")
|
|
411
|
+
if not str(candidate.get("status_authority_consequences", "")).strip():
|
|
412
|
+
_finding(findings, "dp4-status-authority-consequences-missing", f"{candidate_id} must record status-authority consequences", candidate_path)
|
|
413
|
+
if _mapping(candidate.get("adjudication")).get("maintainer_accepted") is not True:
|
|
414
|
+
_finding(findings, "dp4-maintainer-acceptance-missing", f"{candidate_id} requires maintainer acceptance", candidate_path)
|
|
415
|
+
_validate_false_claims(candidate, findings, candidate_path)
|
|
416
|
+
return statuses
|
|
417
|
+
|
|
418
|
+
|
|
419
|
+
def _validate_dp5_boundary(
|
|
420
|
+
data: dict[str, Any],
|
|
421
|
+
findings: list[Dp3Dp4AdjudicationFinding],
|
|
422
|
+
path: str,
|
|
423
|
+
) -> None:
|
|
424
|
+
dp5 = _mapping(data.get("dp5"))
|
|
425
|
+
if dp5.get("next_stage_authorized") is not False:
|
|
426
|
+
_finding(findings, "dp5-stage-overclaim", "this DP3/DP4 record must not authorize a DP5 stage transition", path)
|
|
427
|
+
if dp5.get("stage_transition") != "NOT_AUTHORIZED_IN_THIS_RECORD":
|
|
428
|
+
_finding(findings, "dp5-stage-boundary-missing", "dp5.stage_transition must remain NOT_AUTHORIZED_IN_THIS_RECORD", path)
|
|
429
|
+
|
|
430
|
+
|
|
431
|
+
def _validate_claims(
|
|
432
|
+
data: dict[str, Any],
|
|
433
|
+
findings: list[Dp3Dp4AdjudicationFinding],
|
|
434
|
+
path: str,
|
|
435
|
+
) -> None:
|
|
436
|
+
claims = _mapping(data.get("claims"))
|
|
437
|
+
if claims.get("dp3_complete_for_bounded_slice") is not True:
|
|
438
|
+
_finding(findings, "dp3-bounded-claim-missing", "claims.dp3_complete_for_bounded_slice must be true", path)
|
|
439
|
+
if claims.get("dp4_complete_for_bounded_slice") is not True:
|
|
440
|
+
_finding(findings, "dp4-bounded-claim-missing", "claims.dp4_complete_for_bounded_slice must be true", path)
|
|
441
|
+
for field in FALSE_CLAIM_FIELDS:
|
|
442
|
+
if claims.get(field) is not False:
|
|
443
|
+
_finding(findings, "false-claim-invalid", f"claims.{field} must be false", path)
|
|
444
|
+
|
|
445
|
+
|
|
446
|
+
def _validate_false_claims(
|
|
447
|
+
data: dict[str, Any],
|
|
448
|
+
findings: list[Dp3Dp4AdjudicationFinding],
|
|
449
|
+
path: str,
|
|
450
|
+
) -> None:
|
|
451
|
+
claims = _mapping(data.get("claims"))
|
|
452
|
+
for field in FALSE_CLAIM_FIELDS:
|
|
453
|
+
if claims.get(field) is not False:
|
|
454
|
+
_finding(findings, "false-claim-invalid", f"claims.{field} must be false", path)
|
|
455
|
+
|
|
456
|
+
|
|
457
|
+
def _require_equal(
|
|
458
|
+
data: dict[str, Any],
|
|
459
|
+
field: str,
|
|
460
|
+
expected: object,
|
|
461
|
+
findings: list[Dp3Dp4AdjudicationFinding],
|
|
462
|
+
path: str,
|
|
463
|
+
) -> None:
|
|
464
|
+
if data.get(field) != expected:
|
|
465
|
+
_finding(findings, f"{field.replace('_', '-')}-mismatch", f"{field} must be {expected}", path)
|
|
466
|
+
|
|
467
|
+
|
|
468
|
+
def _require_inventory(
|
|
469
|
+
data: dict[str, Any],
|
|
470
|
+
field: str,
|
|
471
|
+
findings: list[Dp3Dp4AdjudicationFinding],
|
|
472
|
+
path: str,
|
|
473
|
+
) -> None:
|
|
474
|
+
entries = _list_of_mappings(data.get(field))
|
|
475
|
+
if not entries:
|
|
476
|
+
_finding(findings, f"{field.replace('_', '-')}-missing", f"{field} must contain at least one entry", path)
|
|
477
|
+
return
|
|
478
|
+
for index, entry in enumerate(entries):
|
|
479
|
+
if not str(entry.get("id") or entry.get("command") or entry.get("path") or "").strip():
|
|
480
|
+
_finding(findings, f"{field.replace('_', '-')}-entry-id-missing", f"{field}[{index}] needs id, command or path", path)
|
|
481
|
+
|
|
482
|
+
|
|
483
|
+
def _require_status_with_evidence(
|
|
484
|
+
data: dict[str, Any],
|
|
485
|
+
field: str,
|
|
486
|
+
expected_status: str,
|
|
487
|
+
root: Path,
|
|
488
|
+
findings: list[Dp3Dp4AdjudicationFinding],
|
|
489
|
+
path: str,
|
|
490
|
+
) -> None:
|
|
491
|
+
payload = _mapping(data.get(field))
|
|
492
|
+
if payload.get("status") != expected_status:
|
|
493
|
+
_finding(findings, f"{field.replace('_', '-')}-status-invalid", f"{field}.status must be {expected_status}", path)
|
|
494
|
+
_require_existing_paths(payload.get("evidence"), root, findings, path, f"{field.replace('_', '-')}-evidence-missing")
|
|
495
|
+
|
|
496
|
+
|
|
497
|
+
def _require_existing_paths(
|
|
498
|
+
value: Any,
|
|
499
|
+
root: Path,
|
|
500
|
+
findings: list[Dp3Dp4AdjudicationFinding],
|
|
501
|
+
path: str,
|
|
502
|
+
code: str,
|
|
503
|
+
) -> None:
|
|
504
|
+
paths = _string_list(value)
|
|
505
|
+
if not paths:
|
|
506
|
+
_finding(findings, code, "evidence paths must be a non-empty string list", path)
|
|
507
|
+
return
|
|
508
|
+
for evidence_path in paths:
|
|
509
|
+
if not (root / evidence_path).exists():
|
|
510
|
+
_finding(findings, code, f"missing evidence path: {evidence_path}", path)
|
|
511
|
+
|
|
512
|
+
|
|
513
|
+
def _indexed_mappings(value: Any, key: str) -> dict[str, dict[str, Any]]:
|
|
514
|
+
result: dict[str, dict[str, Any]] = {}
|
|
515
|
+
for item in _list_of_mappings(value):
|
|
516
|
+
item_key = item.get(key)
|
|
517
|
+
if isinstance(item_key, str) and item_key:
|
|
518
|
+
result[item_key] = item
|
|
519
|
+
return result
|
|
520
|
+
|
|
521
|
+
|
|
522
|
+
def _list_of_mappings(value: Any) -> list[dict[str, Any]]:
|
|
523
|
+
if not isinstance(value, list):
|
|
524
|
+
return []
|
|
525
|
+
return [item for item in value if isinstance(item, dict)]
|
|
526
|
+
|
|
527
|
+
|
|
528
|
+
def _string_list(value: Any) -> list[str]:
|
|
529
|
+
if not isinstance(value, list):
|
|
530
|
+
return []
|
|
531
|
+
return [item for item in value if isinstance(item, str) and item]
|
|
532
|
+
|
|
533
|
+
|
|
534
|
+
def _mapping(value: Any) -> dict[str, Any]:
|
|
535
|
+
return value if isinstance(value, dict) else {}
|
|
536
|
+
|
|
537
|
+
|
|
538
|
+
def _finding(
|
|
539
|
+
findings: list[Dp3Dp4AdjudicationFinding],
|
|
540
|
+
code: str,
|
|
541
|
+
message: str,
|
|
542
|
+
path: str,
|
|
543
|
+
) -> None:
|
|
544
|
+
findings.append(Dp3Dp4AdjudicationFinding(code=code, message=message, path=path))
|
|
545
|
+
|
|
546
|
+
|
|
547
|
+
def _false_claims() -> dict[str, bool]:
|
|
548
|
+
return {
|
|
549
|
+
"dp3_complete": False,
|
|
550
|
+
"dp4_complete": False,
|
|
551
|
+
"dp5_strict_enforced": False,
|
|
552
|
+
"kit_wide_dpa_conformance_claimed": False,
|
|
553
|
+
"production_mutation_performed": False,
|
|
554
|
+
"generated_outputs_manually_patched": False,
|
|
555
|
+
"stable_dpa_claimed": False,
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
|
|
559
|
+
def _resolve_under_root(root: Path, path: Path | str) -> Path:
|
|
560
|
+
candidate = Path(path)
|
|
561
|
+
if candidate.is_absolute():
|
|
562
|
+
return candidate
|
|
563
|
+
return root / candidate
|
|
564
|
+
|
|
565
|
+
|
|
566
|
+
def _display_path(path: Path, root: Path) -> str:
|
|
567
|
+
try:
|
|
568
|
+
return path.relative_to(root).as_posix()
|
|
569
|
+
except ValueError:
|
|
570
|
+
return path.as_posix()
|
|
571
|
+
|
|
572
|
+
|
|
573
|
+
def _evidence_output_root(root: Path) -> Path:
|
|
574
|
+
ws = load_workspace(root, suppress_legacy_profile_warning=True)
|
|
575
|
+
return ws.architecture_file(Path(*EVIDENCE_OUTPUT_ROOT_PARTS)).resolve()
|
|
576
|
+
|
|
577
|
+
|
|
578
|
+
def _git_head(root: Path) -> str:
|
|
579
|
+
try:
|
|
580
|
+
completed = subprocess.run(
|
|
581
|
+
["git", "rev-parse", "HEAD"],
|
|
582
|
+
cwd=root,
|
|
583
|
+
check=True,
|
|
584
|
+
text=True,
|
|
585
|
+
stdout=subprocess.PIPE,
|
|
586
|
+
stderr=subprocess.PIPE,
|
|
587
|
+
)
|
|
588
|
+
except (OSError, subprocess.CalledProcessError):
|
|
589
|
+
return "UNKNOWN"
|
|
590
|
+
return completed.stdout.strip() or "UNKNOWN"
|
|
591
|
+
|
|
592
|
+
|
|
593
|
+
def _git_ref_exists(root: Path, ref: str) -> bool | None:
|
|
594
|
+
if not (root / ".git").exists():
|
|
595
|
+
return None
|
|
596
|
+
completed = subprocess.run(
|
|
597
|
+
["git", "rev-parse", "--verify", f"{ref}^{{commit}}"],
|
|
598
|
+
cwd=root,
|
|
599
|
+
check=False,
|
|
600
|
+
text=True,
|
|
601
|
+
stdout=subprocess.PIPE,
|
|
602
|
+
stderr=subprocess.PIPE,
|
|
603
|
+
)
|
|
604
|
+
return completed.returncode == 0
|