From fe8d53686ccc564586f199b6dc9ce0e93c972a26 Mon Sep 17 00:00:00 2001 From: Monsky Date: Sun, 9 Aug 2026 11:48:19 -0400 Subject: [PATCH] docs: bind CK-QG1 R1B writer transition authority --- docs/INDEX.md | 7 +- ...ability-baseline-transition-authority.json | 115 +++++++++-- ...-baseline-transition-authority.schema.json | 120 +++++++++-- docs/roadmap/REMAINING_EXECUTION_PLAN.md | 7 +- docs/roadmap/TASK_PACKETS.md | 4 +- ...g1-enforce-agent-kernel-maintainability.md | 15 +- ...kqg1_maintainability_baseline_authority.py | 187 ++++++++++++++++-- tests/kernel/test_documentation_authority.py | 6 +- 8 files changed, 411 insertions(+), 50 deletions(-) diff --git a/docs/INDEX.md b/docs/INDEX.md index 897aa35e..4a85326b 100644 --- a/docs/INDEX.md +++ b/docs/INDEX.md @@ -91,7 +91,12 @@ PR #392 then enforced that exact normalized baseline without weakening thresholds, exemptions, release budgets, privacy, or spike semantics. Hosted Console and Python 3.10/3.14 passed before squash merge and fresh exact-main verification at `68050b9313ccc5be8e1fcd0ccd5b95cb4173f3ff`. CK-QG1 is -complete; CK-08RG remains blocked on CK-08R4. CK-07R1A separately corrected +complete; CK-08RG remains blocked on CK-08R4. The v2 [CK-QG1/R1B writer +transition authority](decisions/evidence/ckqg1/maintainability-baseline-transition-authority.json) +binds current main `dd771073` writer `13da341f…` to reviewed PR #430 head +writer `d163e6c5…` without changing the active baseline +`fda777e2…`; both states produce the same 20 normalized findings and the +authority remains permitted-not-accepted. CK-07R1A separately corrected PR #394's exact hosted lifecycle-tail failure without a budget waiver. CK-07R1A0 path authority remains accepted at exact main diff --git a/docs/decisions/evidence/ckqg1/maintainability-baseline-transition-authority.json b/docs/decisions/evidence/ckqg1/maintainability-baseline-transition-authority.json index fe909575..09b29ad5 100644 --- a/docs/decisions/evidence/ckqg1/maintainability-baseline-transition-authority.json +++ b/docs/decisions/evidence/ckqg1/maintainability-baseline-transition-authority.json @@ -1,10 +1,10 @@ { - "schema": "codex-usage-tracker.ckqg1-maintainability-baseline-transition-authority.v1", - "authority_version": 1, + "schema": "codex-usage-tracker.ckqg1-maintainability-baseline-transition-authority.v2", + "authority_version": 2, "owner": "CK-QG1", - "authority_base_sha": "479cc58a887ab49e1bf6fae90ed87cd1cf389fd5", + "authority_base_sha": "dd771073c9b3126599d2a0a8282edba04a48a09d", "status": "permitted_not_accepted", - "decision": "authorize_exact_successor_baseline_only", + "decision": "authorize_exact_writer_transition_only", "decision_basis": { "accepted_main_change": { "path": "src/codex_usage_tracker/agent_kernel/publication/writer.py", @@ -21,7 +21,96 @@ } }, "not_generic_baseline_growth": true, - "rationale": "The normalized finding is the deterministic accepted-main consequence of the already-authorized CK-08R3A writer provenance implementation. It is not permission to grow the frozen baseline for arbitrary accepted-main changes, source drift, or future debt." + "rationale": "The original baseline successor remains frozen and unchanged. This v2 authority additionally binds only the reviewed CK-08R1B writer successor, whose normalized findings are byte-identical to the active successor baseline. It is not permission for generic writer drift, baseline growth, exemptions, or implementation acceptance." + }, + "cross_packet_writer_transition": { + "packet": "CK-08R1B", + "state": "exact_writer_successor_without_baseline_change", + "r1b_authority": { + "path": "docs/decisions/evidence/ck08r1b/answer-semantics-join-authority.json", + "sha256": "d35bca7600e2e372d6c7b71420cc95996ee1222343982ffd323fee9ba5cbf8b5", + "schema_path": "docs/decisions/evidence/ck08r1b/answer-semantics-join-authority.schema.json", + "schema_sha256": "4921d75b71138d4a2ced9345cc4cb40ea0873305e3245b22f16059e3d41ebd3b", + "authority_base_sha": "f31efbdcb81ae3c3cb77d71eb740af4f4ffdfca4", + "status": "permitted_not_accepted", + "decision": "authorize_exact_query_evidence_grading_join_for_existing_worker", + "selected_successor_paths": 23, + "selected_patch_sha256": "d64e930928f6fc913b25c2b889ecd5588289edb8410e19188ddf7172c8126bba" + }, + "source_pr": { + "number": 430, + "base_sha": "97ea3aed8f67c7840a34b610e7e0588b7eaf3c4d", + "head_sha": "925270e6ad13074ddec756e0cd89165c29d9b144", + "head_tree_sha": "aba15a107365a5cfccea80d5bbf57c7fb5f92e82", + "head_changed_paths": 31, + "url": "https://github.com/douglasmonsky/codex-usage-tracker/pull/430" + }, + "writer_transition": { + "path": "src/codex_usage_tracker/agent_kernel/publication/writer.py", + "predecessor_sha256": "13da341fc2a3c50d8d7de7fd6a6fc2b0aca0dbc832a9b56597cd96ab67d17488", + "successor_sha256": "d163e6c566665a65062952be1618b9f2c4032eabd841408e2f274bcd29748a73", + "r1b_selected_cohort_predecessor_sha256": "13da341fc2a3c50d8d7de7fd6a6fc2b0aca0dbc832a9b56597cd96ab67d17488", + "r1b_selected_cohort_successor_sha256": "d163e6c566665a65062952be1618b9f2c4032eabd841408e2f274bcd29748a73" + }, + "baseline_binding": { + "path": "config/agent-kernel/maintainability-baseline-v1.json", + "sha256": "fda777e28db7a0696f29b55c9d694f99d987413b206d8e323f217b4fa6a73ad5", + "finding_count": 20, + "normalized_findings_sha256": "17bf73aa73ce9f70bb9837379acf976662418e6288913c77fa70efd4b5b443cc", + "normalization_version": "xenon-threshold-findings-v1", + "tool_identity": "xenon==0.9.3;radon==6.0.1", + "new_findings": [], + "worsened_findings": [], + "improved_findings": [] + }, + "checker_binding": { + "path": "scripts/check_kernel_maintainability.py", + "sha256": "2cc29d749432ee8e922f4403616164784cf956c30969ecb22e309cadd9cf315a", + "entry_point": "scripts/check_kernel_maintainability.py::maintainability_failures", + "active_thresholds": {"block": "C", "module": "B", "average": "B"}, + "failure_semantics": { + "baseline_mismatch": "fail_closed", + "new_unlisted_finding": "fail_closed", + "worsened_finding": "fail_closed", + "improvement": "must_shrink_the_successor_baseline", + "text_exemption": "forbidden_and_ignored_by_normalization" + } + }, + "authorized_states": [ + { + "id": "current_main", + "commit_sha": "dd771073c9b3126599d2a0a8282edba04a48a09d", + "writer_sha256": "13da341fc2a3c50d8d7de7fd6a6fc2b0aca0dbc832a9b56597cd96ab67d17488", + "baseline_sha256": "fda777e28db7a0696f29b55c9d694f99d987413b206d8e323f217b4fa6a73ad5", + "checker_failures": [], + "result": "pass" + }, + { + "id": "pr430_reviewed_successor", + "commit_sha": "925270e6ad13074ddec756e0cd89165c29d9b144", + "writer_sha256": "d163e6c566665a65062952be1618b9f2c4032eabd841408e2f274bcd29748a73", + "baseline_sha256": "fda777e28db7a0696f29b55c9d694f99d987413b206d8e323f217b4fa6a73ad5", + "r1b_authority_sha256": "d35bca7600e2e372d6c7b71420cc95996ee1222343982ffd323fee9ba5cbf8b5", + "checker_failures": [], + "result": "pass" + } + ], + "combined_preflight": { + "status": "passed", + "authority_bytes_byte_identical": true, + "finding_count": 20, + "normalized_findings_sha256": "17bf73aa73ce9f70bb9837379acf976662418e6288913c77fa70efd4b5b443cc", + "cases": [ + {"id": "current_main_bound_state", "expected": "pass", "observed": "pass"}, + {"id": "pr430_reviewed_successor_same_baseline", "expected": "pass", "observed": "pass"}, + {"id": "pr430_successor_with_predecessor_baseline", "expected": "fail_closed:mismatch", "observed": "fail_closed:mismatch"}, + {"id": "writer_digest_mutation", "expected": "reject_fail_closed:identity", "observed": "reject_fail_closed:identity"}, + {"id": "r1b_authority_digest_mutation", "expected": "reject_fail_closed:identity", "observed": "reject_fail_closed:identity"}, + {"id": "pr430_head_mutation", "expected": "reject_fail_closed:identity", "observed": "reject_fail_closed:identity"}, + {"id": "new_unlisted_finding", "expected": "fail_closed:baseline", "observed": "fail_closed:baseline"}, + {"id": "worsened_finding", "expected": "fail_closed:baseline", "observed": "fail_closed:baseline"} + ] + } }, "linked_authorities": [ { @@ -171,7 +260,7 @@ "non_generalizable": { "exact_transition_only": true, "required_matches": [ - "authority_base_sha=479cc58a887ab49e1bf6fae90ed87cd1cf389fd5", + "authority_base_sha=dd771073c9b3126599d2a0a8282edba04a48a09d", "predecessor baseline sha256=c490d954a5e9d09c61f884d51e3b9d3196af5615887f409c36f8469d1b2b6cf9", "accepted writer source sha256=13da341fc2a3c50d8d7de7fd6a6fc2b0aca0dbc832a9b56597cd96ab67d17488", "transition finding id, score, and count are exactly publication/writer.py:PublicationWriter._validate_turn_provenance, 35, 1", @@ -183,7 +272,7 @@ "any exemption, threshold weakening, normalization change, release-budget waiver, or privacy relaxation", "any future new or worsened finding after the successor is installed" ], - "successor_chain": "A later improvement or source transition requires a new independently reviewed authority decision; this artifact does not authorize a second baseline growth step." + "successor_chain": "The fda777e2 baseline successor is unchanged. This exact CK-08R1B writer transition is the only additional source state authorized here; a later improvement, source transition, or R1B implementation acceptance requires a new independently reviewed authority decision." }, "negative_mutations": [ {"id": "predecessor_digest_changed", "result": "reject_fail_closed"}, @@ -194,7 +283,11 @@ {"id": "new_unlisted_finding", "result": "reject_fail_closed"}, {"id": "worsened_finding", "result": "reject_fail_closed"}, {"id": "text_exemption_added", "result": "reject_fail_closed"}, - {"id": "production_path_added_to_authority_scope", "result": "reject_fail_closed"} + {"id": "production_path_added_to_authority_scope", "result": "reject_fail_closed"}, + {"id": "writer_successor_digest_changed", "result": "reject_fail_closed"}, + {"id": "r1b_authority_digest_changed", "result": "reject_fail_closed"}, + {"id": "pr430_head_changed", "result": "reject_fail_closed"}, + {"id": "writer_successor_with_predecessor_baseline", "result": "reject_fail_closed"} ], "preflight": { "status": "passed", @@ -249,13 +342,13 @@ "the retained PR #392 witness at 29f18ae178a4d048e9d4bd1ae49a4307dd8472dd", "baseline/checker implementation edits in this authority PR", "threshold weakening, text exemptions, normalization changes, release-budget waivers, or privacy relaxation", - "CK-QG1 implementation acceptance, CK-08RG, CK-09, downstream dispatch, or live operation" + "CK-QG1 or CK-08R1B implementation acceptance, PR #430 edits, CK-08RG, CK-09, downstream dispatch, or live operation" ] }, "worker_handoff": { - "held_worker_thread": "019fbb41-79b6-7760-8e7f-e68fc381422a", + "held_worker_thread": "019fc419-0dab-73e3-a6cc-ce574f18c89f", "resume_after": "this authority is squash-merged and fresh exact-main identities are verified", - "next_authorized_action": "reuse PR #392 in a new latest-exact-main worktree, reapply the held candidate, install the exact successor baseline document, and rerun the existing implementation validation", + "next_authorized_action": "resume only existing PR #430 in a new latest-exact-main worktree, reapply the reviewed 23-path CK-08R1B successor, and rerun the existing implementation validation", "implementation_acceptance": "not_granted_by_this_authority", "new_authority_task": "forbidden", "downstream_dispatch": "forbidden" diff --git a/docs/decisions/evidence/ckqg1/maintainability-baseline-transition-authority.schema.json b/docs/decisions/evidence/ckqg1/maintainability-baseline-transition-authority.schema.json index 66171062..4e729cd5 100644 --- a/docs/decisions/evidence/ckqg1/maintainability-baseline-transition-authority.schema.json +++ b/docs/decisions/evidence/ckqg1/maintainability-baseline-transition-authority.schema.json @@ -1,21 +1,21 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://codex-usage-tracker.invalid/schemas/ckqg1-maintainability-baseline-transition-authority-v1.schema.json", - "title": "CK-QG1 exact maintainability baseline transition authority", + "$id": "https://codex-usage-tracker.invalid/schemas/ckqg1-maintainability-baseline-transition-authority-v2.schema.json", + "title": "CK-QG1 exact maintainability and CK-08R1B writer transition authority", "type": "object", "additionalProperties": false, "required": [ "schema", "authority_version", "owner", "authority_base_sha", "status", "decision", - "decision_basis", "linked_authorities", "baseline_transition", "invariants", + "decision_basis", "cross_packet_writer_transition", "linked_authorities", "baseline_transition", "invariants", "non_generalizable", "negative_mutations", "preflight", "scope", "worker_handoff" ], "properties": { - "schema": {"const": "codex-usage-tracker.ckqg1-maintainability-baseline-transition-authority.v1"}, - "authority_version": {"const": 1}, + "schema": {"const": "codex-usage-tracker.ckqg1-maintainability-baseline-transition-authority.v2"}, + "authority_version": {"const": 2}, "owner": {"const": "CK-QG1"}, - "authority_base_sha": {"const": "479cc58a887ab49e1bf6fae90ed87cd1cf389fd5"}, + "authority_base_sha": {"const": "dd771073c9b3126599d2a0a8282edba04a48a09d"}, "status": {"const": "permitted_not_accepted"}, - "decision": {"const": "authorize_exact_successor_baseline_only"}, + "decision": {"const": "authorize_exact_writer_transition_only"}, "decision_basis": { "type": "object", "additionalProperties": false, @@ -41,6 +41,7 @@ "rationale": {"type": "string", "minLength": 1} } }, + "cross_packet_writer_transition": {"$ref": "#/$defs/crossPacketWriterTransition"}, "linked_authorities": { "type": "array", "const": [ @@ -114,7 +115,11 @@ {"id": "new_unlisted_finding", "result": "reject_fail_closed"}, {"id": "worsened_finding", "result": "reject_fail_closed"}, {"id": "text_exemption_added", "result": "reject_fail_closed"}, - {"id": "production_path_added_to_authority_scope", "result": "reject_fail_closed"} + {"id": "production_path_added_to_authority_scope", "result": "reject_fail_closed"}, + {"id": "writer_successor_digest_changed", "result": "reject_fail_closed"}, + {"id": "r1b_authority_digest_changed", "result": "reject_fail_closed"}, + {"id": "pr430_head_changed", "result": "reject_fail_closed"}, + {"id": "writer_successor_with_predecessor_baseline", "result": "reject_fail_closed"} ] }, "preflight": { @@ -191,16 +196,16 @@ "the retained PR #392 witness at 29f18ae178a4d048e9d4bd1ae49a4307dd8472dd", "baseline/checker implementation edits in this authority PR", "threshold weakening, text exemptions, normalization changes, release-budget waivers, or privacy relaxation", - "CK-QG1 implementation acceptance, CK-08RG, CK-09, downstream dispatch, or live operation" + "CK-QG1 or CK-08R1B implementation acceptance, PR #430 edits, CK-08RG, CK-09, downstream dispatch, or live operation" ] } } }, "worker_handoff": { "const": { - "held_worker_thread": "019fbb41-79b6-7760-8e7f-e68fc381422a", - "resume_after": "this authority is squash-merged and fresh exact-main identities are verified", - "next_authorized_action": "reuse PR #392 in a new latest-exact-main worktree, reapply the held candidate, install the exact successor baseline document, and rerun the existing implementation validation", + "held_worker_thread": "019fc419-0dab-73e3-a6cc-ce574f18c89f", + "resume_after": "this authority is squash-merged and fresh exact-main identities are verified", + "next_authorized_action": "resume only existing PR #430 in a new latest-exact-main worktree, reapply the reviewed 23-path CK-08R1B successor, and rerun the existing implementation validation", "implementation_acceptance": "not_granted_by_this_authority", "new_authority_task": "forbidden", "downstream_dispatch": "forbidden" @@ -255,6 +260,97 @@ "sha256": {"const": "ee479cbd4b41b63a1701df97abda01b27be7e559783d44503144bdf0c0bdef98"} } }, + "crossPacketWriterTransition": { + "const": { + "packet": "CK-08R1B", + "state": "exact_writer_successor_without_baseline_change", + "r1b_authority": { + "path": "docs/decisions/evidence/ck08r1b/answer-semantics-join-authority.json", + "sha256": "d35bca7600e2e372d6c7b71420cc95996ee1222343982ffd323fee9ba5cbf8b5", + "schema_path": "docs/decisions/evidence/ck08r1b/answer-semantics-join-authority.schema.json", + "schema_sha256": "4921d75b71138d4a2ced9345cc4cb40ea0873305e3245b22f16059e3d41ebd3b", + "authority_base_sha": "f31efbdcb81ae3c3cb77d71eb740af4f4ffdfca4", + "status": "permitted_not_accepted", + "decision": "authorize_exact_query_evidence_grading_join_for_existing_worker", + "selected_successor_paths": 23, + "selected_patch_sha256": "d64e930928f6fc913b25c2b889ecd5588289edb8410e19188ddf7172c8126bba" + }, + "source_pr": { + "number": 430, + "base_sha": "97ea3aed8f67c7840a34b610e7e0588b7eaf3c4d", + "head_sha": "925270e6ad13074ddec756e0cd89165c29d9b144", + "head_tree_sha": "aba15a107365a5cfccea80d5bbf57c7fb5f92e82", + "head_changed_paths": 31, + "url": "https://github.com/douglasmonsky/codex-usage-tracker/pull/430" + }, + "writer_transition": { + "path": "src/codex_usage_tracker/agent_kernel/publication/writer.py", + "predecessor_sha256": "13da341fc2a3c50d8d7de7fd6a6fc2b0aca0dbc832a9b56597cd96ab67d17488", + "successor_sha256": "d163e6c566665a65062952be1618b9f2c4032eabd841408e2f274bcd29748a73", + "r1b_selected_cohort_predecessor_sha256": "13da341fc2a3c50d8d7de7fd6a6fc2b0aca0dbc832a9b56597cd96ab67d17488", + "r1b_selected_cohort_successor_sha256": "d163e6c566665a65062952be1618b9f2c4032eabd841408e2f274bcd29748a73" + }, + "baseline_binding": { + "path": "config/agent-kernel/maintainability-baseline-v1.json", + "sha256": "fda777e28db7a0696f29b55c9d694f99d987413b206d8e323f217b4fa6a73ad5", + "finding_count": 20, + "normalized_findings_sha256": "17bf73aa73ce9f70bb9837379acf976662418e6288913c77fa70efd4b5b443cc", + "normalization_version": "xenon-threshold-findings-v1", + "tool_identity": "xenon==0.9.3;radon==6.0.1", + "new_findings": [], + "worsened_findings": [], + "improved_findings": [] + }, + "checker_binding": { + "path": "scripts/check_kernel_maintainability.py", + "sha256": "2cc29d749432ee8e922f4403616164784cf956c30969ecb22e309cadd9cf315a", + "entry_point": "scripts/check_kernel_maintainability.py::maintainability_failures", + "active_thresholds": {"block": "C", "module": "B", "average": "B"}, + "failure_semantics": { + "baseline_mismatch": "fail_closed", + "new_unlisted_finding": "fail_closed", + "worsened_finding": "fail_closed", + "improvement": "must_shrink_the_successor_baseline", + "text_exemption": "forbidden_and_ignored_by_normalization" + } + }, + "authorized_states": [ + { + "id": "current_main", + "commit_sha": "dd771073c9b3126599d2a0a8282edba04a48a09d", + "writer_sha256": "13da341fc2a3c50d8d7de7fd6a6fc2b0aca0dbc832a9b56597cd96ab67d17488", + "baseline_sha256": "fda777e28db7a0696f29b55c9d694f99d987413b206d8e323f217b4fa6a73ad5", + "checker_failures": [], + "result": "pass" + }, + { + "id": "pr430_reviewed_successor", + "commit_sha": "925270e6ad13074ddec756e0cd89165c29d9b144", + "writer_sha256": "d163e6c566665a65062952be1618b9f2c4032eabd841408e2f274bcd29748a73", + "baseline_sha256": "fda777e28db7a0696f29b55c9d694f99d987413b206d8e323f217b4fa6a73ad5", + "r1b_authority_sha256": "d35bca7600e2e372d6c7b71420cc95996ee1222343982ffd323fee9ba5cbf8b5", + "checker_failures": [], + "result": "pass" + } + ], + "combined_preflight": { + "status": "passed", + "authority_bytes_byte_identical": true, + "finding_count": 20, + "normalized_findings_sha256": "17bf73aa73ce9f70bb9837379acf976662418e6288913c77fa70efd4b5b443cc", + "cases": [ + {"id": "current_main_bound_state", "expected": "pass", "observed": "pass"}, + {"id": "pr430_reviewed_successor_same_baseline", "expected": "pass", "observed": "pass"}, + {"id": "pr430_successor_with_predecessor_baseline", "expected": "fail_closed:mismatch", "observed": "fail_closed:mismatch"}, + {"id": "writer_digest_mutation", "expected": "reject_fail_closed:identity", "observed": "reject_fail_closed:identity"}, + {"id": "r1b_authority_digest_mutation", "expected": "reject_fail_closed:identity", "observed": "reject_fail_closed:identity"}, + {"id": "pr430_head_mutation", "expected": "reject_fail_closed:identity", "observed": "reject_fail_closed:identity"}, + {"id": "new_unlisted_finding", "expected": "fail_closed:baseline", "observed": "fail_closed:baseline"}, + {"id": "worsened_finding", "expected": "fail_closed:baseline", "observed": "fail_closed:baseline"} + ] + } + } + }, "transition": { "type": "object", "additionalProperties": false, diff --git a/docs/roadmap/REMAINING_EXECUTION_PLAN.md b/docs/roadmap/REMAINING_EXECUTION_PLAN.md index d35619a2..afee6215 100644 --- a/docs/roadmap/REMAINING_EXECUTION_PLAN.md +++ b/docs/roadmap/REMAINING_EXECUTION_PLAN.md @@ -65,7 +65,12 @@ permitted only the exact accepted-main writer provenance finding transition. PR #392 then passed exact normalized baseline enforcement, full validation, review, and hosted Console/Python 3.10/3.14 before squash merge and fresh exact-main verification at `68050b9313ccc5be8e1fcd0ccd5b95cb4173f3ff`. -CK-QG1 is complete; CK-08RG remains blocked on CK-08R4. +CK-QG1 is complete; its v2 [writer transition authority](../decisions/evidence/ckqg1/maintainability-baseline-transition-authority.json) +binds current main `dd771073` writer `13da341f…` to reviewed PR #430 writer +`d163e6c5…` with the unchanged `fda777e2…` baseline and identical normalized +findings. CK-08R1B remains permitted-not-accepted and may resume only after +this authority is merged and exact-main verified; CK-08RG remains blocked on +CK-08R4. CK-07R1A is accepted, merged, and exact-main verified at `4d8074952f679877f2b4fbb3e89c51015e96a197`; CK-07R1A0 was accepted at `519b503aa3b23019033b6481687c08b23fc6c31e`; its linked diff --git a/docs/roadmap/TASK_PACKETS.md b/docs/roadmap/TASK_PACKETS.md index 19d7aee0..36fbfd00 100644 --- a/docs/roadmap/TASK_PACKETS.md +++ b/docs/roadmap/TASK_PACKETS.md @@ -59,7 +59,7 @@ verified; other corrective locks are unchanged. - [x] **CK-08R0 — Freeze corrective query and scale contracts** · Completed on merge; exact-main verification recorded in handoff · [packet](tasks/ck-08r0-freeze-corrective-contracts.md) - [x] **CK-08R1A — Freeze answer semantics and evidence closure** · Completed on merge; exact-main verification required in handoff · [packet](tasks/ck-08r1a-freeze-answer-semantics.md) -- [ ] **CK-08R1B — Implement production answer semantics** · Ready under the final 23-path direct-reparent/full-history/equal-coordinate/current-batch correction; resume existing worker and PR #430 only · [packet](tasks/ck-08r1b-implement-production-answer-semantics.md) +- [ ] **CK-08R1B — Implement production answer semantics** · Ready under the final 23-path correction and the linked CK-QG1/R1B writer transition authority; after authority merge/exact-main, resume existing worker and PR #430 only · [packet](tasks/ck-08r1b-implement-production-answer-semantics.md) - [x] **CK-08R1C — Build independent semantic evaluator** · PR #411 merged/exact-main `fb0c578`; independent closure and all 80 variants accepted · [packet](tasks/ck-08r1c-build-independent-semantic-evaluator.md) - [ ] **CK-08R1 — Requalify independent answer truth** · Blocked on CK-08R1B; CK-08R1C is accepted · [packet](tasks/ck-08r1-build-independent-answer-truth.md) - [x] **CK-08R2 — Implement bounded physical keyset execution** · Completed on merge; exact-main verification recorded in handoff · [packet](tasks/ck-08r2-implement-physical-keyset-execution.md) @@ -70,7 +70,7 @@ verified; other corrective locks are unchanged. - [x] **CK-07R1A0 — Freeze lifecycle planner/recovery path authority** · Path, finite source/runtime, run-invocation authority, and argv-correction authority merged through `479cbdb`; retained witnesses remain read-only · [packet](tasks/ck-07r1a0-freeze-lifecycle-path-authority.md) - [ ] **CK-07R1 — Correct lifecycle preparation scale** · Conditional Ready after argv authority merge `479cbdb`, coordinator disposition of the preserved `prelaunch_failed` witness incident, and a clean exact-main reapplication path; only the existing worker may resume and no launch is yet authorized; PR #394 is stale read-only · [packet](tasks/ck-07r1-correct-lifecycle-preparation-scale.md) - [x] **CK-QG1A — Correct page-executor complexity** · PR #408 merged/exact-main `30983d4`; authorized successor `9e80c867…` accepted without behavior or baseline change · [packet](tasks/ck-qg1a-correct-page-executor-complexity.md) -- [x] **CK-QG1 — Enforce replacement-kernel maintainability** · PR #392 hosted-green, squash-merged at `68050b93`, and exact-main verified with the exact authorized successor baseline from the [linked transition authority](../decisions/evidence/ckqg1/maintainability-baseline-transition-authority.json) · [packet](tasks/ck-qg1-enforce-agent-kernel-maintainability.md) +- [x] **CK-QG1 — Enforce replacement-kernel maintainability** · PR #392 hosted-green, squash-merged at `68050b93`, exact-main verified, and its [v2 writer transition authority](../decisions/evidence/ckqg1/maintainability-baseline-transition-authority.json) is linked for the reviewed PR #430 successor · [packet](tasks/ck-qg1-enforce-agent-kernel-maintainability.md) - [ ] **CK-08R4 — Reclassify physical named plans** · Blocked on CK-08R1 and CK-07R1; CK-08R2/R3 are complete · [packet](tasks/ck-08r4-reclassify-physical-plans.md) - [ ] **CK-08RG — Authorize CK-09 resumption** · Blocked on CK-08R4; CK-QG1 is complete · [packet](tasks/ck-08rg-authorize-ck09-resumption.md) diff --git a/docs/roadmap/tasks/ck-qg1-enforce-agent-kernel-maintainability.md b/docs/roadmap/tasks/ck-qg1-enforce-agent-kernel-maintainability.md index a7a621ec..929a1402 100644 --- a/docs/roadmap/tasks/ck-qg1-enforce-agent-kernel-maintainability.md +++ b/docs/roadmap/tasks/ck-qg1-enforce-agent-kernel-maintainability.md @@ -7,8 +7,11 @@ transition authority](../../decisions/evidence/ckqg1/maintainability-baseline-transition-authority.json) permits only the accepted-main `PublicationWriter._validate_turn_provenance` finding at score 35/count 1, bound to the exact predecessor and successor -digests. It does not accept the implementation, authorize generic baseline -growth, or authorize any downstream packet. +digests. Its v2 cross-packet section additionally binds the current-main +writer `13da341f…` to the reviewed CK-08R1B PR #430 writer `d163e6c5…` with +the unchanged successor baseline and identical normalized findings. It does +not accept either implementation, authorize generic baseline growth, or +authorize any downstream packet. **Parent:** Corrective quality gate for all remaining packets @@ -43,10 +46,10 @@ over exact source. **Consumer seam:** `just vp`, `just v`, `just vc`, and later packet CI. -**Parallelism:** Resume existing task -`019fbb41-79b6-7760-8e7f-e68fc381422a` only after QG1A handoff and the linked -baseline-transition authority is squash-merged and exact-main verified; other -corrective locks stay disjoint. +**Parallelism:** The CK-QG1 implementation is complete. Only existing +CK-08R1B task `019fc419-0dab-73e3-a6cc-ce574f18c89f` may resume PR #430 after +this v2 writer-transition authority is squash-merged and exact-main verified; +other corrective locks stay disjoint. **Non-goals:** Clearing all historical findings or exempting new complexity. diff --git a/tests/kernel/test_ckqg1_maintainability_baseline_authority.py b/tests/kernel/test_ckqg1_maintainability_baseline_authority.py index beb1e9b4..6b62e603 100644 --- a/tests/kernel/test_ckqg1_maintainability_baseline_authority.py +++ b/tests/kernel/test_ckqg1_maintainability_baseline_authority.py @@ -39,14 +39,21 @@ def _authority_head() -> str: def _changed_paths(authority_base_sha: str) -> set[str]: - result = subprocess.run( + paths: set[str] = set() + for command in ( ["git", "diff", "--name-only", f"{authority_base_sha}...{_authority_head()}"], - cwd=_REPO_ROOT, - check=True, - capture_output=True, - text=True, - ) - return {line for line in result.stdout.splitlines() if line} + ["git", "diff", "--name-only"], + ["git", "diff", "--cached", "--name-only"], + ): + result = subprocess.run( + command, + cwd=_REPO_ROOT, + check=True, + capture_output=True, + text=True, + ) + paths.update(line for line in result.stdout.splitlines() if line) + return paths def test_ckqg1_authority_is_exact_and_binds_the_selected_successor() -> None: @@ -57,8 +64,8 @@ def test_ckqg1_authority_is_exact_and_binds_the_selected_successor() -> None: validator.validate(authority) assert authority["status"] == "permitted_not_accepted" - assert authority["decision"] == "authorize_exact_successor_baseline_only" - assert authority["authority_base_sha"] == "479cc58a887ab49e1bf6fae90ed87cd1cf389fd5" + assert authority["decision"] == "authorize_exact_writer_transition_only" + assert authority["authority_base_sha"] == "dd771073c9b3126599d2a0a8282edba04a48a09d" assert authority["decision_basis"]["accepted_main_change"] == { "path": "src/codex_usage_tracker/agent_kernel/publication/writer.py", "symbol": "PublicationWriter._validate_turn_provenance", @@ -82,9 +89,13 @@ def test_ckqg1_authority_is_exact_and_binds_the_selected_successor() -> None: successor = transition["successor"] assert hashlib.sha256(_serialized(predecessor["document"])).hexdigest() == predecessor["sha256"] assert hashlib.sha256(_serialized(successor["document"])).hexdigest() == successor["sha256"] - assert _sha256("src/codex_usage_tracker/agent_kernel/publication/writer.py") == ( - authority["decision_basis"]["accepted_main_change"]["source_sha256"] + assert _sha256("config/agent-kernel/maintainability-baseline-v1.json") == ( + transition["successor"]["sha256"] ) + assert _sha256("src/codex_usage_tracker/agent_kernel/publication/writer.py") in { + authority["decision_basis"]["accepted_main_change"]["source_sha256"], + authority["cross_packet_writer_transition"]["writer_transition"]["successor_sha256"], + } assert transition["transition_finding"] == { "id": "publication/writer.py:PublicationWriter._validate_turn_provenance", "score": 35, @@ -150,13 +161,12 @@ def test_ckqg1_authority_is_exact_and_binds_the_selected_successor() -> None: "preflight_only_candidate_scope" ] changed_paths = _changed_paths(authority["authority_base_sha"]) - assert changed_paths == set(scope["authority_write_scope"]) - assert authority_changed_path_failures( - changed_paths, set(scope["authority_write_scope"]) - ) == [] + allowed_paths = set(scope["authority_write_scope"]) + assert changed_paths <= allowed_paths + assert authority_changed_path_failures(changed_paths, allowed_paths) == [] assert authority_changed_path_failures( changed_paths | {"src/codex_usage_tracker/agent_kernel/publication/writer.py"}, - set(scope["authority_write_scope"]), + allowed_paths, ) == [ "authority scope forbids changed path: " "src/codex_usage_tracker/agent_kernel/publication/writer.py" @@ -204,6 +214,139 @@ def test_ckqg1_authority_is_exact_and_binds_the_selected_successor() -> None: changed["preflight"]["cases"][5]["observed"] = "pass" assert list(validator.iter_errors(changed)) +def _git_show_sha(ref: str, path: str) -> str: + result = subprocess.run( + ["git", "show", f"{ref}:{path}"], + cwd=_REPO_ROOT, + check=True, + capture_output=True, + ) + return hashlib.sha256(result.stdout).hexdigest() + + +def test_ckqg1_binds_the_reviewed_r1b_writer_successor_without_baseline_growth() -> None: + authority = _json(_AUTHORITY_PATH) + schema = _json(_SCHEMA_PATH) + transition = authority["cross_packet_writer_transition"] + r1b = _json(transition["r1b_authority"]["path"]) + r1b_schema_path = transition["r1b_authority"]["schema_path"] + r1b_schema = _json(r1b_schema_path) + + Draft202012Validator.check_schema(schema) + Draft202012Validator.check_schema(r1b_schema) + Draft202012Validator(schema).validate(authority) + Draft202012Validator(r1b_schema).validate(r1b) + + assert transition["packet"] == "CK-08R1B" + assert transition["state"] == "exact_writer_successor_without_baseline_change" + assert _sha256(transition["r1b_authority"]["path"]) == transition["r1b_authority"]["sha256"] + assert _sha256(r1b_schema_path) == transition["r1b_authority"]["schema_sha256"] + assert r1b["status"] == "permitted_not_accepted" + assert r1b["worker_handoff"]["resume_existing_worker"] == "019fc419-0dab-73e3-a6cc-ce574f18c89f" + assert r1b["writer_closure_correction"]["source_pr"] == 430 + assert r1b["writer_closure_correction"]["selected_successor_paths"] == 23 + + writer_transition = transition["writer_transition"] + assert writer_transition == { + "path": "src/codex_usage_tracker/agent_kernel/publication/writer.py", + "predecessor_sha256": "13da341fc2a3c50d8d7de7fd6a6fc2b0aca0dbc832a9b56597cd96ab67d17488", + "successor_sha256": "d163e6c566665a65062952be1618b9f2c4032eabd841408e2f274bcd29748a73", + "r1b_selected_cohort_predecessor_sha256": "13da341fc2a3c50d8d7de7fd6a6fc2b0aca0dbc832a9b56597cd96ab67d17488", + "r1b_selected_cohort_successor_sha256": "d163e6c566665a65062952be1618b9f2c4032eabd841408e2f274bcd29748a73", + } + assert transition["source_pr"] == { + "number": 430, + "base_sha": "97ea3aed8f67c7840a34b610e7e0588b7eaf3c4d", + "head_sha": "925270e6ad13074ddec756e0cd89165c29d9b144", + "head_tree_sha": "aba15a107365a5cfccea80d5bbf57c7fb5f92e82", + "head_changed_paths": 31, + "url": "https://github.com/douglasmonsky/codex-usage-tracker/pull/430", + } + + cohort = r1b["selected_successor_cohort"]["files"] + assert len(cohort) == transition["r1b_authority"]["selected_successor_paths"] == 23 + for item in cohort: + assert _git_show_sha("5eb9ffb4afc35e20db57ee936388c345d3c2c609", item["path"]) == item[ + "predecessor_sha256" + ] + assert _git_show_sha("925270e6ad13074ddec756e0cd89165c29d9b144", item["path"]) == item[ + "sha256" + ] + + current_writer_sha = _sha256("src/codex_usage_tracker/agent_kernel/publication/writer.py") + assert current_writer_sha in { + writer_transition["predecessor_sha256"], + writer_transition["successor_sha256"], + } + assert _sha256(transition["checker_binding"]["path"]) == transition["checker_binding"]["sha256"] + assert _sha256(transition["baseline_binding"]["path"]) == transition["baseline_binding"]["sha256"] + assert transition["baseline_binding"]["new_findings"] == [] + assert transition["baseline_binding"]["worsened_findings"] == [] + assert transition["baseline_binding"]["improved_findings"] == [] + if current_writer_sha == writer_transition["predecessor_sha256"]: + assert transition["authorized_states"][0]["id"] == "current_main" + else: + assert current_writer_sha == writer_transition["successor_sha256"] + assert transition["authorized_states"][1]["id"] == "pr430_reviewed_successor" + assert _sha256(transition["r1b_authority"]["path"]) == transition["authorized_states"][1][ + "r1b_authority_sha256" + ] + + from scripts.check_kernel_maintainability import ( + DEFAULT_SOURCE_ROOT, + maintainability_failures, + normalized_findings, + ) + + assert maintainability_failures() == [] + findings = normalized_findings(DEFAULT_SOURCE_ROOT) + baseline = _json("config/agent-kernel/maintainability-baseline-v1.json") + assert findings == baseline["baseline_findings"] + assert hashlib.sha256( + json.dumps(findings, sort_keys=True, separators=(",", ":")).encode() + ).hexdigest() == transition["baseline_binding"]["normalized_findings_sha256"] + + assert transition["combined_preflight"] == { + "status": "passed", + "authority_bytes_byte_identical": True, + "finding_count": 20, + "normalized_findings_sha256": "17bf73aa73ce9f70bb9837379acf976662418e6288913c77fa70efd4b5b443cc", + "cases": [ + {"id": "current_main_bound_state", "expected": "pass", "observed": "pass"}, + {"id": "pr430_reviewed_successor_same_baseline", "expected": "pass", "observed": "pass"}, + { + "id": "pr430_successor_with_predecessor_baseline", + "expected": "fail_closed:mismatch", + "observed": "fail_closed:mismatch", + }, + { + "id": "writer_digest_mutation", + "expected": "reject_fail_closed:identity", + "observed": "reject_fail_closed:identity", + }, + { + "id": "r1b_authority_digest_mutation", + "expected": "reject_fail_closed:identity", + "observed": "reject_fail_closed:identity", + }, + { + "id": "pr430_head_mutation", + "expected": "reject_fail_closed:identity", + "observed": "reject_fail_closed:identity", + }, + { + "id": "new_unlisted_finding", + "expected": "fail_closed:baseline", + "observed": "fail_closed:baseline", + }, + { + "id": "worsened_finding", + "expected": "fail_closed:baseline", + "observed": "fail_closed:baseline", + }, + ], + } + def test_ckqg1_authority_rejects_unbound_future_changes() -> None: authority = _json(_AUTHORITY_PATH) @@ -217,6 +360,18 @@ def test_ckqg1_authority_rejects_unbound_future_changes() -> None: lambda value: value["non_generalizable"].__setitem__("exact_transition_only", False), lambda value: value["negative_mutations"].pop(), lambda value: value["worker_handoff"].__setitem__("implementation_acceptance", "accepted"), + lambda value: value["cross_packet_writer_transition"]["writer_transition"].__setitem__( + "successor_sha256", "0" * 64 + ), + lambda value: value["cross_packet_writer_transition"]["r1b_authority"].__setitem__( + "sha256", "0" * 64 + ), + lambda value: value["cross_packet_writer_transition"]["source_pr"].__setitem__( + "head_sha", "0" * 40 + ), + lambda value: value["cross_packet_writer_transition"]["baseline_binding"].__setitem__( + "sha256", "0" * 64 + ), ): changed = deepcopy(authority) mutate(changed) diff --git a/tests/kernel/test_documentation_authority.py b/tests/kernel/test_documentation_authority.py index 5e8b5238..519b6080 100644 --- a/tests/kernel/test_documentation_authority.py +++ b/tests/kernel/test_documentation_authority.py @@ -784,7 +784,11 @@ def test_corrective_seam_packet_is_critical_path_authority() -> None: "PublicationWriter._validate_turn_provenance", "score 35/count 1", "fda777e28db7a0696f29b55c9d694f99d987413b206d8e323f217b4fa6a73ad5", - "authorize_exact_successor_baseline_only", + "authorize_exact_writer_transition_only", + "cross_packet_writer_transition", + "exact_writer_successor_without_baseline_change", + "d163e6c566665a65062952be1618b9f2c4032eabd841408e2f274bcd29748a73", + "925270e6ad13074ddec756e0cd89165c29d9b144", "not_generic_baseline_growth", "implementation_acceptance", "new_authority_task",