Repository navigation
Closed
Labels
Description
Context
After the substrate renewals, the user-facing surfaces should be simplified to consume the new contracts directly. Today some CLI/MCP/UI paths still compensate for earlier substrate ambiguity with duplicated formatting/coercion logic, dict-shaped request envelopes, and repeated destination/output branching.
Scope
Focus on surface contraction over already-renewed substrate contracts:
polylogue/cli/polylogue/mcp/- selected
polylogue/ui/,polylogue/rendering/, andpolylogue/site/modules when they still carry substrate-shaped glue
Anchor rewrites
The architectural center for this tranche should stay focused on a small set of surface-contract files:
polylogue/cli/query.pypolylogue/cli/query_output.pypolylogue/cli/query_actions.pypolylogue/cli/query_verbs.pypolylogue/cli/root_request.pypolylogue/cli/commands/products.pypolylogue/mcp/server_product_tools.pypolylogue/ui/facade_console.pypolylogue/rendering/block_models.py
Mechanical follow-through
Once the new request/output contracts are established, narrower follow-through can propagate through:
polylogue/cli/query_stats.pypolylogue/cli/query_semantic.pypolylogue/cli/schema_rendering_results.pypolylogue/cli/schema_rendering_explain.pypolylogue/cli/products_rendering.pypolylogue/cli/commands/check.pypolylogue/cli/commands/schema.pypolylogue/cli/shell_completion_values.py- adjacent MCP/UI/rendering helpers required by the new surface contracts
Acceptance criteria
- Surface layers consume explicit substrate/product models rather than rebuilding them ad hoc.
- Dict-based CLI envelopes are replaced or materially reduced in favor of typed request/plan/output models.
- Repeated output-format and destination-dispatch glue is centralized instead of duplicated.
- CLI and MCP machine/human outputs stay contract-consistent over the same underlying semantics.
- The tranche lands as one coherent PR with full verification.
Out of scope
- Large substrate rewrites that belong in earlier tranches
- Broad test-suite modernization beyond fallout and targeted coverage
Activity
Sinity commentedon Apr 20, 2026
Planned execution shape for this tranche:
Anchor rewrites to keep local:
polylogue/cli/query.pypolylogue/cli/query_output.pypolylogue/cli/query_actions.pypolylogue/cli/query_verbs.pypolylogue/cli/root_request.pypolylogue/cli/commands/products.pypolylogue/mcp/server_product_tools.pypolylogue/ui/facade_console.pypolylogue/rendering/block_models.pypolylogue/rendering/core_messages.pyMechanical follow-through candidates after the anchor contracts land:
polylogue/cli/query_stats.pypolylogue/cli/query_semantic.pypolylogue/cli/schema_rendering_results.pypolylogue/cli/schema_rendering_explain.pypolylogue/cli/products_rendering.pypolylogue/cli/commands/check.pypolylogue/cli/commands/schema.pypolylogue/cli/shell_completion_values.pypolylogue/rendering/core_markdown.pypolylogue/rendering/blocks.pyMain repeated patterns to remove:
stdout, clipboard, browser, file path)Execution intent:
refactor: contract CLI, MCP, and UI surfaces over renewed substrate (#…
refactor: contract CLI, MCP, and UI surfaces over renewed substrate (#…
refactor: contract CLI, MCP, and UI surfaces over renewed substrate (#…
refactor: contract CLI, MCP, and UI surfaces over renewed substrate (#…
Sinity commentedon Apr 22, 2026
Starting execution on
feature/refactor/surface-contracts.Initial decisions:
Sinity commentedon Apr 22, 2026
Implementation update for #273:
e9fb8b9d refactor(cli): contract query and product outputspolylogue/cli/query_output_contracts.pywithStructuredRowsDocumentandQueryOutputDocument;_send_outputtest seam;product_items_payload()and reused it from both CLI JSON product rendering and MCP product list tools.RenderableBlock,RenderedMessage) from prior renewal work, so this tranche targeted the remaining active glue rather than rewriting already-contracted surfaces.Verification:
ruff format polylogue/cli/query_output_contracts.py polylogue/cli/query_output.py polylogue/products/registry.py polylogue/mcp/server_product_tools.py tests/unit/cli/test_query_fmt.py tests/unit/cli/test_products.pyruff check polylogue/cli/query_output_contracts.py polylogue/cli/query_output.py polylogue/products/registry.py polylogue/mcp/server_product_tools.py tests/unit/cli/test_query_fmt.py tests/unit/cli/test_products.pymypy polylogue/cli/query_output_contracts.py polylogue/cli/query_output.py polylogue/products/registry.py polylogue/mcp/server_product_tools.py tests/unit/cli/test_query_fmt.py tests/unit/cli/test_products.pypytest -q tests/unit/cli/test_query_fmt.py tests/unit/cli/test_query_exec_laws.py tests/unit/cli/test_products.py tests/unit/mcp/test_tool_contracts.py->216 passed in 18.43sdevtools verify->verify: all checks passeddevtools verify --quick->verify: all checks passedrefactor(cli): contract query and product outputs (#365)
Sinity commentedon Apr 22, 2026
#273 merged in PR #365.
Merge commit:
d458ad1873e8eb560e6984fd67968b65e1ba28d8Final checks before merge:
devtools verifypassed before opening the PR.devtools verify --quickpassed.devtools verify, and this matched the CI-quota constraint for this run.refactor(cli): contract query and product outputs (#365)