mocactl: login failures hide the control plane and the API error; no way to capture failure details
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 35/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- node.js, typescript
- Ambito
- backend-api-design, cli, observability
Direzione di ricerca
Start with packages/mocactl/src/api/errors.ts and packages/mocactl/src/core/messages.ts, then trace the login requests and control-plane response handling to see where URL sources and request details are available. The proposal spans client errors, request logging, report generation, and server response IDs; check the related server code and tests before estimating the full scope. Done means the acceptance criteria are met, including redaction and distinct messages for the listed failure causes.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Problem
1. A failed login doesn't say where it went or what came back
When the control plane answers with a 5xx, mocactl sbx login (and mocactl login, and the TUI) prints only:
sbx: the control plane is unavailable — try again shortly
classify() (packages/mocactl/src/api/errors.ts:136) maps every status ≥ 500, plus redis_unavailable, credential_unavailable and internal_error, to unavailable and keeps only the source. describeError() (packages/mocactl/src/core/messages.ts:46) then prints a fixed sentence. mocactl parses the status, the server's error code and message, and Retry-After into the ApiError, then drops them.
So the user can't tell:
-
Which control plane was tried. The URL comes from
--control-plane-url,MOCACTL_SBX_URL, the bound sandbox, or the one saved at an earlier login (sbxControlPlaneUrlinconfig.json). A user may not remember which one is in effect, and the message doesn't say. -
Why it failed. These all look alike:
- the control plane is down for maintenance
- a firewall or corporate proxy answered instead (a non-JSON page is reported as
http_<status>, or as "unavailable" when it is a 5xx) - the control plane has moved
- a real server bug
"Try again shortly" only helps in the maintenance case.
-
Which step failed:
GET /v1/discovery,POST /v1/auth/device, orPOST /v1/auth/device/token.
2. API failure details can't be seen or reported
mocactl has no --verbose or --debug flag and no env var for one. The only MOCACTL_* variables it reads are MOCACTL_SBX_URL and MOCACTL_VERSION. The only way to see a failing response today is to replay the requests with curl.
- Developers need these details for each request: method, URL, status, error code and message,
Retry-After, the network cause code (ECONNREFUSED,UND_ERR_HEADERS_TIMEOUT, …), and timing. - Users need a way to send those details to developers without leaking tokens. The control plane also returns no request ID, so there's nothing in a client-side report to match against the server logs.
Proposal
Error messages
- Name the control-plane URL and its source (flag, env, sandbox, saved config) in every login failure and every "unavailable" or "cannot reach" message.
- Put the HTTP status and the server's
errorcode, plusmessagewhen present, in the one-line error. For example:sbx: the control plane at https://… is unavailable (503 redis_unavailable) — try again shortly. - Give different advice for different causes:
- 503 with
Retry-Afteror a maintenance code: down for maintenance, retry in N seconds. - A non-JSON response: something other than the control plane answered (a proxy or firewall?).
- A DNS failure, a 404 at
/v1/discovery, or a redirect to another host: the control plane may have moved, so check the URL. - A 500: a server error to report (see below).
- 503 with
- Server side: add a maintenance signal the client can recognize, such as a 503 with
Retry-Afterand{"error":"maintenance"}. There is none today.
Logging and reporting
- An opt-in debug switch (
--debugand/orMOCACTL_DEBUG=1) that writes one line per request to stderr: method, URL, status, code, message, timing, and cause code. - A local, rotated log of failed requests under
$XDG_STATE_HOME/mocactl/, with the same fields. It should be 0600 like the sbx flight recorder (<state>/sbx/<id>.log). It must never record tokens,Authorizationheaders, device codes, or any body content other than the error JSON. - A command that builds a redacted report for a bug ticket, such as
mocactl doctor --report. It would include the mocactl version, Node version, platform, the effective control-plane URLs and their sources, and the recent failures from the log. - A request ID on every control-plane response (such as
X-Request-Id). The server logs it, and the client includes it in the error line and its log, so a user's report can be matched to the server's logs.
Acceptance criteria
- A login that fails with a 5xx prints the URL, its source, the step that failed, the status, and the server's error code.
- Maintenance, proxy/firewall, moved-control-plane, and server-error failures each get their own message.
- With the debug switch on, the outcome of every request appears on stderr. With it off, output is unchanged.
- A user can produce a redacted report file with one command and attach it to an issue.
- Lingua principale
- TypeScript
- Stelle
- 12
- Fork
- 12
- Merge medio
- 9h 27m
- PR unite (30g)
- 164
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di rossoctl/moca
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
I maintainer di solito rispondono entro 1 giorno
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 64/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
I maintainer di solito rispondono entro 1 giorno
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
rossoctl/moca#421 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di rossoctl/moca
Issue simili
-
account bug communication lecture
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
area:tui bug platform:macos
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
anthropics/claude-code#109005 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 87/100
openedx/end-to-end-tests#196 ·
I maintainer di solito rispondono entro 1 giorno
-
area:tooling good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
interledger/publisher-tools#1007 ·
I maintainer di solito rispondono entro 1 giorno
-
priority/medium roadmap/v1.1.1 stakeholder/rapr type/bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
databrickslabs/ontos#1420 ·
I maintainer di solito rispondono entro 3 giorni