Orchestrata Ultimate › Plans › plan_subphase_0_1_coverage › subplan-coverage-remediation-2026-04-12
Subplan: Sub-phase 0.1 Coverage Remediation
Source: plans/plan_subphase_0_1_coverage/subplan-coverage-remediation-2026-04-12.md at 8a2cb42ad · last changed 2026-07-27 · first committed 2026-04-12 · 165 lines.
Prose pending.
Plan text
Subplan: Sub-phase 0.1 Coverage Remediation
Context
Sub-phase 0.1 bug fixes are merged. 295 tests pass. But coverage of the 10 changed files is 55%, not 99%. The existing tests are interface stability tests (verify signatures exist) — they do not execute the fixed code paths.
This subplan creates behavioral tests that exercise every uncovered line until each changed file reaches 99%+ coverage.
Hard gate: --cov-fail-under=99 in verify_commands. verify_agent.py fails automatically if coverage is below 99%. No self-reporting.
Coverage Gap Per File
| File | Stmts | Miss | Cover | Target | Gap |
|---|---|---|---|---|---|
cli.py |
199 | 118 | 41% | 99% | 58% |
core/domain/domain_entity.py |
28 | 15 | 46% | 99% | 53% |
core/domain/node.py |
39 | 18 | 54% | 99% | 45% |
core/logging/audit.py |
179 | 17 | 91% | 99% | 8% |
core/logging/context.py |
125 | 37 | 70% | 99% | 29% |
core/logging/logging_config.py |
91 | 15 | 84% | 99% | 15% |
core/metrics/decorators.py |
146 | 86 | 41% | 99% | 58% |
core/metrics/metrics_config.py |
132 | 33 | 75% | 99% | 24% |
core/patterns/error_handling.py |
288 | 100 | 65% | 99% | 34% |
core/threading/thread_pool.py |
347 | 254 | 27% | 99% | 72% |
core/traceability/traceability_utils.py |
234 | 151 | 35% | 99% | 64% |
Missing Lines Per File
cli.py (118 missing)
Lines: 20-26, 58-83, 98-178, 187-188, 200-201, 210-211, 220-239, 262-270, 278-280, 288-290, 299-302 Needs: Invoke every CLI command (init, session open/close/list/status/context/carryover, achieve, task, complete, todoist sync/status/projects, model show/switch/list, checkpoint, rewind, memory) via CliRunner
core/domain/domain_entity.py (15 missing)
Lines: 33-40, 44-45, 53-65, 73, 77-79, 83 Needs: DomainEntity construction with/without node_type, mark_inactive, to_domain_dict, get_business_key, eq, hash, repr
core/domain/node.py (18 missing)
Lines: 46, 54, 75-91, 107-109, 112 Needs: Node.to_graph_dict, Node.from_graph_dict (with string timestamps, Z suffix), update_properties, str, field_serializer for None values
core/logging/audit.py (17 missing)
Lines: 155-157, 174-176, 203, 210, 212, 220, 315, 372-374, 416-422, 436 Needs: AuditEvent._json_serializer with non-serializable type, to_dict with enum/datetime conversion, verify_hash failure case, AuditLogger with component mismatch, AuditOperation with exception, audit_operation decorator async path
core/logging/context.py (37 missing)
Lines: 43-46, 134, 149-172, 183, 198, 221, 226, 231-232, 245, 253-255, 259-262, 266-269, 277-278, 282-285, 289-290 Needs: LogContext enter/exit, ContextManager get/set/clear, set_request_id, set_session_id, set_user_context, bind_context, unbind_context, init_default_context
core/logging/logging_config.py (15 missing)
Lines: 78, 80-84, 114, 116, 120, 158-163, 231, 244-246 Needs: Correlation ID processor with active context, log format JSON path, configure_logging with env overrides, get_logger with custom names
core/metrics/decorators.py (86 missing)
Lines: 52-58, 78-84, 126-148, 164-171, 209-240, 257-313, 330-337 Needs: @instrument_request async+sync paths, @instrument_operation async+sync with duration recording, @track_errors with filtered exception types, @track_duration async+sync with error status, track_operation_duration context manager
core/metrics/metrics_config.py (33 missing)
Lines: 77-78, 84-85, 176, 191-192, 196-197, 227-234, 256-261, 269-288, 293-294, 333, 362, 384, 402-411, 422-423 Needs: MetricsConfig from env with invalid values, configure_metrics full path, start/stop metrics server, system metrics collection, get_metric, track_active_request context manager
core/patterns/error_handling.py (100 missing)
Lines: 123, 149, 178-219, 223, 291-294, 311-313, 357-363, 381, 424-437, 455, 489-516, 523, 525, 545-588, 670-677, 699-706 Needs: retry_with_backoff async path, retryable decorator async+sync with jitter, CircuitBreaker record_success in HALF_OPEN, should_allow_request timeout reset, execute async+sync, graceful_degradation async with fallback_func, with_timeout sync timeout path, timeout decorator async+sync, Bulkhead acquire/release/execute
core/threading/thread_pool.py (254 missing)
Lines: 92-102, 110-118, 129-143, 165-191, 211-230, 250-251, 271-272, 292-319, 324-327, 345-367, 372-388, 392-400, 412-451, 459-470, 474-492, 506-532, 546-572, 593-597, 619-620, 644-645, 668-670, 690-724, 750-783, 809-827, 856-857, 879-880 Needs: ThreadPoolManager init/start/stop, submit/submit_many sync+async, _wrap_function success+failure+pruning, get_task_status/result/stats, wait_for_task, cancel_task, task_context/async_task_context, ParallelTestExecutor run_tests_parallel, run_in_thread_pool, run_in_thread_pool_async
core/traceability/traceability_utils.py (151 missing)
Lines: 41, 79, 110, 114, 118, 122-125, 128, 150, 179, 181, 184, 194-197, 204-206, 210-216, 222-237, 241-246, 252-257, 263-293, 303-323, 335-354, 372-393, 406-428, 446-456, 460-513 Needs: @traces decorator with various args, TraceInfo/Requirement/UserStory dataclass construction, scan_traces on real files, _scan_class/_scan_function, generate_rtm, validate_traces, save_rtm, _render_rtm_markdown
Pipeline Execution Checklist
Every step must be marked DONE with evidence before proceeding to the next.
Phase A: Pre-requisites
- [ ] A1. Git working tree is clean
- [ ] A2. On master branch
- [ ] A3. agent_config.yaml created with coverage verify command
- [ ] A4. Neo4j running
Phase B: Preflight
- [ ] B1. Run preflight.py
- [ ] B2. 4 PASS, expected WARN/FAIL documented
Phase C: Create Sandbox
- [ ] C1. Run create_sandbox.py
- [ ] C2. Exit code 0
- [ ] C3. work/ contains test files to create/extend
- [ ] C4. context/ contains source files (read-only) + this subplan
Phase D: Generate Prompt
- [ ] D1. Run generate_prompt.py
- [ ] D2. Exit code 0
Phase E: Agent Execution in Sandbox
- [ ] E1. All edits in work/ only
- [ ] E2. No repo files touched
- [ ] E3. Behavioral tests written for every uncovered code path
- [ ] E4. work/AUDIT.md created
Phase F: Verify Agent
- [ ] F1. Run verify_agent.py
- [ ] F2. All tests pass
- [ ] F3. Coverage gate: --cov-fail-under=99 exits 0
- [ ] F4. If FAIL: agent fixes in work/, re-run (max 3 iterations)
Phase G: Validate Audit
- [ ] G1. Run validate_audit.py
- [ ] G2. All checks pass
Phase H: Full Coverage Report
- [ ] H1. Run full coverage with term-missing
- [ ] H2. Print COMPLETE output — no filtering, no hiding
- [ ] H3. Every changed file at 99%+
- [ ] H4. If ANY file below 99%: create remediation subplan for that file, new worktree, repeat pipeline
Phase I: Human Review
- [ ] I1. Full diff presented
- [ ] I2. Full coverage report presented
- [ ] I3. User approves
Phase J: Merge
- [ ] J1. Run merge_agent.py
- [ ] J2. All tests pass on branch
- [ ] J3. Tag and push
Sandbox Config
See plans/plan_subphase_0_1_coverage/agent_config.yaml
Requirements
| REQ ID | Description |
|---|---|
| REQ-COV-001 | cli.py coverage >= 99% |
| REQ-COV-002 | domain_entity.py coverage >= 99% |
| REQ-COV-003 | node.py coverage >= 99% |
| REQ-COV-004 | audit.py coverage >= 99% |
| REQ-COV-005 | context.py coverage >= 99% |
| REQ-COV-006 | logging_config.py coverage >= 99% |
| REQ-COV-007 | decorators.py coverage >= 99% |
| REQ-COV-008 | metrics_config.py coverage >= 99% |
| REQ-COV-009 | error_handling.py coverage >= 99% |
| REQ-COV-010 | thread_pool.py coverage >= 99% |
| REQ-COV-011 | traceability_utils.py coverage >= 99% |