code review

This commit is contained in:
lda
2026-06-03 03:15:08 +07:00 Verified
parent 170bb1110d
commit 688dcb69a9
10 changed files with 105 additions and 32 deletions
@@ -11,12 +11,13 @@
**Architecture:** `wf_api` becomes the long-lived in-process application service layer. `wf_mcp`, `wf_cli`, and future HTTP/UI adapters call `wf_api`; `wf_api` must not import `wf_mcp`.
**Current State:** Slice 1 introduced `wf_api.WorkflowApi`,
`wf_api.WorkflowApiBackend`, and `wf_mcp.broker.service.WfMcpWorkflowApiBackend`.
Both CLI and MCP workflow tools now call `WorkflowApi`; `wf_api` imports no
`wf_mcp` modules. `WorkflowSurfaceHandlers` still contains the existing
operation implementation and still depends on `WfMcpService`, but it is now
MCP-owned backend plumbing rather than the public application API.
**Current State:** Slice 1 originally introduced `wf_api.WorkflowApi`, a
`WorkflowApiBackend` protocol, and an MCP adapter backend. Later slices removed
that double-delegation seam: `WorkflowApi` now composes domain services directly
from `WorkflowOperationContext`. Both CLI and MCP workflow tools call
`WorkflowApi`; `wf_api` imports no `wf_mcp` modules. `WorkflowSurfaceHandlers`
is now a thin MCP compatibility subclass rather than the operation
implementation.
Slice 3 moved the protocol-neutral workflow helpers into `wf_api`: constants,
capability refs, wrapper hints, next actions, raw workflow plan model, runtime
@@ -24,9 +25,11 @@ dependency resolution, saved subgraph preparation, and durable run lifecycle
helpers. The old `wf_mcp.workflow_surface.*` module paths remain compatibility
shims for those helpers.
**Current Constraint:** `WorkflowSurfaceHandlers` is large and still carries
most workflow-surface logic. Slice 1 fixed dependency direction only; later
slices can split and rename once the boundary is correct.
**Current Constraint:** `WfMcpService` still acts as a compatibility facade over
focused broker services. Recent slices have extracted source/catalog, runtime,
upstream transport, events, connection sync, and content access; the remaining
work is to keep shrinking facade responsibilities while preserving process-local
behavior.
---
@@ -34,6 +34,7 @@
### Task 1: Add Direct ConnectionService Tests
**Files:**
- Create: `tests/wf_mcp/service/test_connection_service.py`
- [ ] **Step 1: Create direct tests for the new service boundary**
@@ -161,6 +162,7 @@ Expected: import failure for `wf_mcp.broker.service.connection_service`.
### Task 2: Implement ConnectionService
**Files:**
- Create: `src/wf_mcp/broker/service/connection_service.py`
- [ ] **Step 1: Add the service implementation**
@@ -270,6 +272,7 @@ Expected: all checks pass.
### Task 3: Wire WfMcpService Through ConnectionService
**Files:**
- Modify: `src/wf_mcp/broker/service/core.py`
- [ ] **Step 1: Update imports and dataclass fields**
@@ -379,6 +382,7 @@ Expected: all selected tests pass.
### Task 4: Add Facade Compatibility Tests
**Files:**
- Modify: `tests/wf_mcp/service/test_connection_service.py`
- [ ] **Step 1: Add WfMcpService compatibility coverage**
@@ -446,6 +450,7 @@ Expected: all tests pass.
### Task 5: Clean Imports and Verify Call Sites
**Files:**
- Modify: `src/wf_mcp/broker/service/core.py`
- Possibly modify files only if ruff reports stale imports.
@@ -458,6 +463,7 @@ rg -n 'parse_connection_id|RESERVED_CONNECTION_IDS|connection_service|Connection
```
Expected:
- `parse_connection_id` and `RESERVED_CONNECTION_IDS` appear in `connection_service.py`, not `core.py`.
- `connections: ConnectionRegistry` appears in `connection_service.py`, not `core.py`.
- `connection_service` appears in `core.py` and direct tests.
@@ -487,6 +493,7 @@ Expected: 0 errors.
### Task 6: Update Roadmap and Extraction Map
**Files:**
- Modify: `docs/current_roadmap.md`
- Modify if present/relevant: `docs/superpowers/research/2026-06-01-wf-api-extraction-map.md`
@@ -538,6 +545,7 @@ rg -n 'ConnectionService|Connection ownership|Next planned service extraction' d
```
Expected:
- `docs/current_roadmap.md` mentions completed `ConnectionService` ownership.
- No stale "Next planned service extraction" wording for this same slice remains.
@@ -546,6 +554,7 @@ Expected:
### Task 7: Final Verification
**Files:**
- No new files.
- [ ] **Step 1: Run focused tests**
@@ -579,6 +588,7 @@ uv run basedpyright --level error
```
Expected:
- ruff check passes.
- ruff format check passes for Python files.
- basedpyright reports 0 errors.