diff --git a/SPECS/ARCHIVE/FU-P12-T1-2_Add_code_comment_clarifying_stdin-only_client_capture_in_on_request/FU-P12-T1-2_Add_code_comment_clarifying_stdin_only_client_capture_in_on_request.md b/SPECS/ARCHIVE/FU-P12-T1-2_Add_code_comment_clarifying_stdin-only_client_capture_in_on_request/FU-P12-T1-2_Add_code_comment_clarifying_stdin_only_client_capture_in_on_request.md new file mode 100644 index 00000000..00b4873a --- /dev/null +++ b/SPECS/ARCHIVE/FU-P12-T1-2_Add_code_comment_clarifying_stdin-only_client_capture_in_on_request/FU-P12-T1-2_Add_code_comment_clarifying_stdin_only_client_capture_in_on_request.md @@ -0,0 +1,79 @@ +# PRD: FU-P12-T1-2 — Add code comment clarifying stdin-only client capture in `on_request` + +**Created:** 2026-02-18 +**Priority:** P3 +**Branch:** `codex/feature/FU-P12-T1-2-stdin-only-capture-comment` +**Status:** PLAN + +--- + +## 1. Problem Statement + +`on_request()` in `src/mcpbridge_wrapper/__main__.py` captures client metadata +from `initialize` requests that arrive from stdin. This is intentional, but the +scope is not obvious without reading stream-direction assumptions. + +--- + +## 2. Scope + +### In Scope +- Add a concise code comment near initialize client-capture logic. +- Clarify that capture is intentionally stdin-only (client -> wrapper path). +- Keep behavior and data flow unchanged. + +### Out of Scope +- Any functional changes to request/response handling. +- Additional telemetry or dashboard behavior changes. + +--- + +## 3. Deliverables + +1. `src/mcpbridge_wrapper/__main__.py` +- Add a comment by the client info capture block in `on_request()`. + +2. Validation evidence +- Confirm no runtime behavior changes. +- Run required quality gates and document results. + +3. `SPECS/INPROGRESS/FU-P12-T1-2_Validation_Report.md` +- Record command outcomes and verdict. + +--- + +## 4. Acceptance Criteria + +- [ ] Comment clearly states stdin-only capture direction. +- [ ] No functional changes are introduced. +- [ ] `pytest` passes. +- [ ] `ruff check src/` passes. +- [ ] `mypy src/` passes. +- [ ] `pytest --cov` reports coverage >= 90%. + +--- + +## 5. Dependencies + +- P12-T1 ✅ + +--- + +## 6. Risks and Mitigations + +- **Risk:** Comment wording may be ambiguous and still invite misinterpretation. + - **Mitigation:** Use explicit direction language (`stdin`, `client -> wrapper`) and keep it adjacent to the relevant block. + +--- + +## 7. Validation Plan + +1. Insert the clarifying comment in `on_request()`. +2. Run full quality gates. +3. Capture results and verdict in validation report. + +--- + +--- +**Archived:** 2026-02-18 +**Verdict:** PASS diff --git a/SPECS/ARCHIVE/FU-P12-T1-2_Add_code_comment_clarifying_stdin-only_client_capture_in_on_request/FU-P12-T1-2_Validation_Report.md b/SPECS/ARCHIVE/FU-P12-T1-2_Add_code_comment_clarifying_stdin-only_client_capture_in_on_request/FU-P12-T1-2_Validation_Report.md new file mode 100644 index 00000000..45be4731 --- /dev/null +++ b/SPECS/ARCHIVE/FU-P12-T1-2_Add_code_comment_clarifying_stdin-only_client_capture_in_on_request/FU-P12-T1-2_Validation_Report.md @@ -0,0 +1,38 @@ +# Validation Report — FU-P12-T1-2 + +**Task:** FU-P12-T1-2 — Add code comment clarifying stdin-only client capture in `on_request` +**Date:** 2026-02-18 +**Verdict:** PASS + +## Scope + +- Added a clarifying comment in `src/mcpbridge_wrapper/__main__.py` near the + initialize client identity capture block in `on_request()`. +- No functional behavior changes were introduced. + +## Evidence + +- Code diff scope: + - `src/mcpbridge_wrapper/__main__.py` + - Change type: comment-only clarification. + +## Required Quality Gates + +- `pytest` + - Result: **PASS** (`582 passed, 5 skipped, 2 warnings`) +- `ruff check src/` + - Result: **PASS** (`All checks passed!`) +- `mypy src/` + - Result: **PASS** (`Success: no issues found in 18 source files`) +- `pytest --cov` + - Result: **PASS** (`582 passed, 5 skipped, 2 warnings`; total coverage **92.18%**, threshold 90%) + +## Acceptance Criteria Status + +- [x] Comment clearly states stdin-only capture direction. +- [x] No functional changes are introduced. + +## Notes + +- Existing third-party deprecation warnings from `websockets`/`uvicorn` were + observed during tests and are unrelated to this task. diff --git a/SPECS/ARCHIVE/INDEX.md b/SPECS/ARCHIVE/INDEX.md index 2f475bdd..15b72698 100644 --- a/SPECS/ARCHIVE/INDEX.md +++ b/SPECS/ARCHIVE/INDEX.md @@ -1,6 +1,6 @@ # mcpbridge-wrapper Tasks Archive -**Last Updated:** 2026-02-18 (REVIEW_fu_p12_t1_1_mcpinitializeparams_archived) +**Last Updated:** 2026-02-18 (REVIEW_fu_p12_t1_2_stdin_capture_comment_archived) ## Archived Tasks @@ -116,6 +116,7 @@ | FU-P13-T2-2 | [FU-P13-T2-2_Move_PID_file_write_to_after_successful_upstream_launch/](FU-P13-T2-2_Move_PID_file_write_to_after_successful_upstream_launch/) | 2026-02-18 | PASS | | FU-BUG-T7-1 | [FU-BUG-T7-1_Cap_pending_methods_map_to_guard_unbounded_growth/](FU-BUG-T7-1_Cap_pending_methods_map_to_guard_unbounded_growth/) | 2026-02-18 | PASS | | FU-P12-T1-1 | [FU-P12-T1-1_Remove_or_document_MCPInitializeParams_in_schemas/](FU-P12-T1-1_Remove_or_document_MCPInitializeParams_in_schemas/) | 2026-02-18 | PASS | +| FU-P12-T1-2 | [FU-P12-T1-2_Add_code_comment_clarifying_stdin-only_client_capture_in_on_request/](FU-P12-T1-2_Add_code_comment_clarifying_stdin-only_client_capture_in_on_request/) | 2026-02-18 | PASS | ## Historical Artifacts @@ -195,6 +196,7 @@ | [REVIEW_FU-P13-T2-2_pid_write_order.md](_Historical/REVIEW_FU-P13-T2-2_pid_write_order.md) | Review report for FU-P13-T2-2 | | [REVIEW_fu_bug_t7_1_pending_methods_cap.md](_Historical/REVIEW_fu_bug_t7_1_pending_methods_cap.md) | Review report for FU-BUG-T7-1 | | [REVIEW_FU-P12-T1-1_mcpinitializeparams.md](_Historical/REVIEW_FU-P12-T1-1_mcpinitializeparams.md) | Review report for FU-P12-T1-1 | +| [REVIEW_FU-P12-T1-2_stdin_capture_comment.md](_Historical/REVIEW_FU-P12-T1-2_stdin_capture_comment.md) | Review report for FU-P12-T1-2 | ## Archive Log @@ -344,3 +346,5 @@ | 2026-02-18 | FU-BUG-T7-1 | Archived REVIEW_fu_bug_t7_1_pending_methods_cap report | | 2026-02-18 | FU-P12-T1-1 | Archived Remove_or_document_MCPInitializeParams_in_schemas (PASS) | | 2026-02-18 | FU-P12-T1-1 | Archived REVIEW_FU-P12-T1-1_mcpinitializeparams report | +| 2026-02-18 | FU-P12-T1-2 | Archived Add_code_comment_clarifying_stdin-only_client_capture_in_on_request (PASS) | +| 2026-02-18 | FU-P12-T1-2 | Archived REVIEW_FU-P12-T1-2_stdin_capture_comment report | diff --git a/SPECS/ARCHIVE/_Historical/REVIEW_FU-P12-T1-2_stdin_capture_comment.md b/SPECS/ARCHIVE/_Historical/REVIEW_FU-P12-T1-2_stdin_capture_comment.md new file mode 100644 index 00000000..c8dcfd3a --- /dev/null +++ b/SPECS/ARCHIVE/_Historical/REVIEW_FU-P12-T1-2_stdin_capture_comment.md @@ -0,0 +1,33 @@ +## REVIEW REPORT — FU-P12-T1-2 stdin capture comment + +**Scope:** origin/main..HEAD +**Files:** 6 + +### Summary Verdict +- [x] Approve +- [ ] Approve with comments +- [ ] Request changes +- [ ] Block + +### Critical Issues +- None. + +### Secondary Issues +- None. + +### Architectural Notes +- The comment added in `on_request()` correctly clarifies directional scope + (stdin client requests only) without altering request handling logic. +- Archive bookkeeping and task-tracking updates remain consistent with FLOW + conventions. + +### Tests +- Full quality gates were executed during EXECUTE: + - `pytest` (582 passed, 5 skipped) + - `ruff check src/` (pass) + - `mypy src/` (pass) + - `pytest --cov` (92.18%, threshold 90%) + +### Next Steps +- No actionable findings. +- FOLLOW-UP step is skipped per FLOW rules. diff --git a/SPECS/INPROGRESS/next.md b/SPECS/INPROGRESS/next.md index 508ee001..32d2a809 100644 --- a/SPECS/INPROGRESS/next.md +++ b/SPECS/INPROGRESS/next.md @@ -2,15 +2,15 @@ ## Recently Archived +- 2026-02-18 — FU-P12-T1-2: Add code comment clarifying stdin-only client capture in `on_request` (PASS) - 2026-02-18 — FU-P12-T1-1: Remove or document `MCPInitializeParams` in schemas (PASS) - 2026-02-18 — FU-BUG-T7-1: Cap `pending_methods` map to guard against unbounded growth (PASS) - 2026-02-18 — FU-P13-T2-2: Move PID file write to after successful upstream launch (PASS) - 2026-02-18 — FU-P13-T2-1: Replace run_forever() polling loop with asyncio.Event-based wait (PASS) - 2026-02-18 — FU-P13-T4-2: Implement or remove reconnect parameter in BrokerProxy (PASS) -- 2026-02-18 — FU-P13-T4-1: Fix asyncio.get_event_loop() deprecation in BrokerProxy (PASS) ## Suggested Next Tasks - P13-T5 follow-up — Complete interactive prompt verification in a desktop session (P1) -- FU-P12-T1-2 — Add code comment clarifying stdin-only client capture in `on_request` (P3) +- FU-P12-T1-3 — Show multi-client widgets in Web UI instead of single overwritten active client (P2) - FU-P12-T3-2 — Add `error_code` column to audit CSV export (P3) diff --git a/SPECS/Workplan.md b/SPECS/Workplan.md index bafb26c7..cf1cb046 100644 --- a/SPECS/Workplan.md +++ b/SPECS/Workplan.md @@ -2217,7 +2217,8 @@ Phase 9 Follow-up Backlog --- -#### FU-P12-T1-2: Add code comment clarifying stdin-only client capture in `on_request` +#### ✅ FU-P12-T1-2: Add code comment clarifying stdin-only client capture in `on_request` +- **Status:** ✅ Completed (2026-02-18) - **Description:** In `__main__.py`'s `on_request()`, the `initialize` client info capture only fires for requests arriving on stdin (client→bridge). Add a brief comment clarifying this intentional scope to prevent future confusion about whether stdout initialize messages are also handled. - **Priority:** P3 - **Dependencies:** P12-T1 @@ -2225,8 +2226,8 @@ Phase 9 Follow-up Backlog - **Outputs/Artifacts:** - Updated `src/mcpbridge_wrapper/__main__.py` — comment added near client info capture block - **Acceptance Criteria:** - - [ ] Comment clearly states stdin-only capture direction - - [ ] No functional changes + - [x] Comment clearly states stdin-only capture direction + - [x] No functional changes --- diff --git a/src/mcpbridge_wrapper/__main__.py b/src/mcpbridge_wrapper/__main__.py index dbe3f500..089dc2b7 100644 --- a/src/mcpbridge_wrapper/__main__.py +++ b/src/mcpbridge_wrapper/__main__.py @@ -406,7 +406,8 @@ def on_request(line: str) -> None: max_size=MAX_PENDING_METHODS, ) - # Extract MCP client identity from initialize handshake + # This callback sees only stdin traffic (client -> wrapper), so client + # identity capture is intentionally limited to inbound initialize calls. if method == "initialize" and metrics is not None: client_info = req.get_client_info() if client_info is not None: