fix(miner-ui): type a chat-dispatch mock against the union #9815 closed - #9846
Conversation
main is red on ui:typecheck, which blocks every open PR. #9659/#9815 correctly tightened ChatActionDispatchResult from a loose `{ ok: boolean; status: string; ... }` into a union discriminated on `ok`, so the miner MCP server's refusal -> error-code mapping could finally be checked. But this miner-UI test mocks the dispatcher with a bare object literal, whose `ok`/`status` widen to boolean/string on inference -- and a widened literal no longer satisfies the closed union. Annotate the mock's return type (and import the real type) so it is validated against the shipped contract instead of inference. That also stops the mock drifting from the union the next time it changes -- the widened version would have kept compiling against any shape at all.
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
loopover-ui | 8c8976e | Commit Preview URL Branch Preview URL |
Jul 29 2026, 01:54 PM |
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
|
Warning ⏸️ LoopOver review result - manual review recommendedReview updated: 2026-07-29 14:01:00 UTC
Review summary Nits — 2 non-blocking
Concerns raised — review before merging
📋 Copy for AI agents — paste into your coding agentDecision drivers
Context & advisory signals — never blocks the verdict
Review context
Contributor next steps
Signal definitions
🧪 Chat with LoopOverAsk LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.
Full command reference: https://loopover.ai/docs/loopover-commands 🧪 Experimental — new and may change. Decision record
Visual preview
Click any thumbnail to open the full-size screenshot. Before = production · After = this PR's preview deploy · Diff highlights exactly what changed. Scroll preview
A short scroll-through clip (desktop) — click either thumbnail to open the full animation. Evidence for scroll-linked behavior a single screenshot can't show. 🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by LoopOver, a quiet PR intelligence layer for OSS maintainers.
|
Bundle ReportChanges will increase total bundle size by 844 bytes (0.01%) ⬆️. This is within the configured threshold ✅ Detailed changes
Affected Assets, Files, and Routes:view changes for bundle: loopover-uiAssets Changed:
|
…ed (#9846) main is red on ui:typecheck, which blocks every open PR. #9659/#9815 correctly tightened ChatActionDispatchResult from a loose `{ ok: boolean; status: string; ... }` into a union discriminated on `ok`, so the miner MCP server's refusal -> error-code mapping could finally be checked. But this miner-UI test mocks the dispatcher with a bare object literal, whose `ok`/`status` widen to boolean/string on inference -- and a widened literal no longer satisfies the closed union. Annotate the mock's return type (and import the real type) so it is validated against the shipped contract instead of inference. That also stops the mock drifting from the union the next time it changes -- the widened version would have kept compiling against any shape at all.



main is red, and it blocks every open PR
Reproduced on a clean
origin/maincheckout — not caused by any open PR. It's why #9840, #9821 and #9780 all showvalidate-codefailures: they inherit it.Cause
#9659/#9815 correctly tightened
ChatActionDispatchResult:That's a real improvement — the miner MCP server maps a refusal onto a closed error-code set, and a bare
stringmade that mapping uncheckable.But this miner-UI test mocks the dispatcher with a bare object literal:
Inference widens
oktobooleanandstatustostring, and a widened literal can't satisfy the closed union. The roottypecheckdoesn't coverapps/loopover-miner-ui— onlyui:typecheckdoes — which is how it reached main.Fix
Annotate the mock's return type and import the real
ChatActionDispatchResult, so the mock is validated against the shipped contract rather than inference. That also stops it drifting the next time the union changes: the widened version would have kept compiling against literally any shape.Only the one mock needed it — the sibling that throws is unaffected, and the other tests pass registries rather than inline literals.
Verification
ui:typecheckclean,ui:lintclean (prettier applied),ui:test645 passed, miner-ui 407 passed, roottscclean.