refactor(backends): decompose execution-authority files (#4664) - #4675
Closed
Trecek wants to merge 11 commits into
Closed
refactor(backends): decompose execution-authority files (#4664)#4675Trecek wants to merge 11 commits into
Trecek wants to merge 11 commits into
Conversation
…ntory re-export Extract ClaudeStreamParser + ClaudeResultParser to _claude_parse.py and ClaudeSessionLocator to _claude_session_locator.py. Re-export from claude.py so the public surface is unchanged. Also re-add _validate_codex_mcp_inventory to the _codex_probes re-export block (it was dropped by the linter since the import was not used inside codex.py itself; evidence_reader imports it via the canonical codex path). Refs: #4664
…torage.py Move stateless filesystem primitives (lexists/fsync/atomic_json/write_reconciliation_audit/ read_bounded/ensure_directory_chain/decode_mount_path/filesystem_mount_root/ filesystem_type/replace_symlink) to _codex_fs_atomic.py. The transaction- boundary core (CodexSessionStore, CodexInteractiveSessionLease, _FileLease) remains in _codex_session_storage.py. Update DURABLE_ARTIFACT_WRITERS registry and AST-target guard in test_durable_artifact_writers_guard.py to point at the new module location. Narrow E13 exemption to 1500 lines to accommodate the remaining core after extraction. Refs: #4664
…_poster_finalize.py Move post-attempt finalize/reconcile helpers out of poster.py (997 → 854 lines) into _poster_finalize.py as module-level functions. The mutation authority remains in GitHubReviewLedger — these are pure shaping helpers that operate on receipts/result tuples post-attempt. _EXPECTED_REMOTE_STATES and _FINAL_STATES constants move with the helpers that consume them. Refs: #4664
Move _SCHEMA_VERSION/_DIRECTORY_MODE/_DATABASE_MODE/_SCHEMA + dataclasses ReviewOperationRecord/ReviewAttemptRecord/MutationSlot from ledger.py (868 → 772 lines) into _ledger_schema.py. ledger.py imports them and re-exports for sibling modules; existing test imports keep working. Refs: #4664
…ation.py Move _resolve_skill_session_id/_parse_stdout/_build_api_retry_outcome/ _make_terminated_result/_has_out_of_cwd_file_change/_apply_post_session_adjudication/ _validate_declared_artifact from _headless_result.py (1030 → 846 lines) to _headless_adjudication.py. _build_skill_result remains as the headless orchestration authority. Re-export the moved symbols so existing imports keep working. Narrow E25 line-cap to acknowledge the residual 846-line _headless_result.py. Refs: #4664
Move decide_termination_action (pure decision function) and execute_termination_action (sole authorized async kill executor) from process/__init__.py (942 → 821 lines) to process/_termination.py. The public process.__init__ facade re-exports both so existing callers keep working; _EXPECTED_PROCESS_SYMBOLS test continues to pass. Refs: #4664
Move per-record creation/projection/anchor helpers to _records.py, runner observation helpers to _runner.py, and index path helpers to _indexes.py. _managed_headless_session_lineage.py retains the conflict/CAS mismatch errors and the DefaultManagedHeadlessSessionLineageStore class plus the unaccounted _validate_anchor_identity/_require_cas/ _read_bounded helpers. Existing canonical-path imports keep working via re-export facade. Refs: #4664
…codec.py Move validation, source/exploration-vector/execution-identity serialization, contract to/from dict, manifest construction, and _digest_json helper from _skill_session_contract_store.py (907 → 393 lines) into _skill_session_contract_codec.py. The parent re-exports _digest_json and all other moved symbols so existing imports keep working — notably tests/server/test_run_skill_resume.py:640 and tests/execution/test_skill_session_contract_store.py which import _digest_json from the canonical path. Refs: #4664
Final pass to make pre-commit (ruff, mypy, contract checks) pass on all decomposed files. Adds missing imports for _skill_session_contract_codec extracted types (SkillSource, RepositoryProfileId, ChildExecutionIdentity, etc.) and re-adds _validate_codex_mcp_inventory to codex.py re-export block after linter removed it. Refs: #4664
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Decomposed 10 execution-authority files (12,385 LOC) at 750/1000-line decomposition seams per issue #4664. 10 of 11 groups shipped in this PR; evidence_reader.py (#4) is deferred to follow-up issue #4674 due to circular-dependency risk in the launch/probe/auth decomposition. E9 (codex.py), E13 (_codex_session_storage.py), and E25 (_headless_result.py) line-cap exemptions were narrowed to acknowledge the residual after extraction.
pre-commit run --all-files(ruff, mypy, contract checks, doc count, version consistency, stub completeness, merge-conflict check, secret detection) all pass.Decomposition seams:
codex.py(2444) →codex.py(1216) +_codex_cmd_builders.py(411) +_codex_probes.py(375) +_codex_explorer_projection.py(599)claude.py(1234) →claude.py(931) +_claude_parse.py(231) +_claude_session_locator.py(117)_codex_session_storage.py(1600) →_codex_session_storage.py(1408) +_codex_fs_atomic.py(225)poster.py(997) →poster.py(854) +_poster_finalize.py(242)ledger.py(868) →ledger.py(773) +_ledger_schema.py(137)_headless_result.py(1030) →_headless_result.py(846) +_headless_adjudication.py(247)process/__init__.py(942) →process/__init__.py(821) +_termination.py(177)_managed_headless_session_lineage.py(911) →_managed_headless_session_lineage.py(611) +_records.py(167) +_runner.py(137) +_indexes.py(76)_skill_session_contract_store.py(907) →_skill_session_contract_store.py(393) +_codec.py(571)evidence_reader.py(1452) → deferred to Investigate evidence_reader.py decomposition (1452 lines, E25 still applies) #4674Requirements
Issue #4664: Decompose execution backend authority files (10 files, 12,385 LOC).
Closes #4664
Implementation Plan
Plan file:
/home/talon/projects/generic_automation_mcp/.autoskillit/temp/make-plan/issue-4664-decompose-execution-authority-files_plan_2026-08-17_000000.md🤖 Generated with Claude Code via AutoSkillit