Skip to content

feat(cli): add qq doctor readiness report (OB4) - #138

Merged
lg2m merged 3 commits into
mainfrom
feat/eng-878-doctor
Sep 23, 2026
Merged

lg2m merged 3 commits into
mainfrom
feat/eng-878-doctor

Conversation

@lg2m

@lg2m lg2m commented Sep 23, 2026 •

Copy link
Copy Markdown
Collaborator

OB4: qq doctor — one screen that says whether QQ is ready here

Spec: docs/plans/onboarding-ux.md#ob4 Linear: ENG-878 (parent ENG-875)

What changes for users

qq 0.1.3 (a58bf10 2026-09-23) · protocol 26 · capabilities … · descriptor … · store schema 33
ok    configuration    3 sources; qq config sources lists them
ok    project trust    nothing pending
ok    model            anthropic/claude-sonnet-5
fail  credential       anthropic: none found
                       run `qq auth login anthropic` or set ANTHROPIC_API_KEY
ok    credential store 2 stored (keyring)
ok    server           none running; qq starts one on demand
ok    workspace        /home/you/repo (.qq/config.ron, AGENTS.md)
ok    data             ~/.local/share/qq (sessions.sqlite3, 2.1 MiB)

1 check failed

Checks in order: configuration, project trust, model, credential, credential store, server, workspace, data; statuses ok|warn|fail|skipped. Exit 0 unless a check fails (warnings never affect exit). --json emits {version, checks:[{name,status,summary,remedy,details}], failed}. Colour only on a TTY. No network, no state mutation; the keyring is never probed blindly (a read-only command must not trigger unlock prompts) — keyring unavailability surfaces on the credential check when the model's credential is keyring-backed.

Untrusted project: configuration is warn: awaiting trust, project trust is fail listing each pending file with the sections it declares, model/credential are skipped with the reason.

Design

src/doctor.rs: run_checks(&ConfigLoader, &CredentialStore, &LoadRequest, &ServerPaths, &Path) -> DoctorReport (no printing) + render_text / render_json. doctor_command runs it in spawn_blocking. server check drives discover_at on a private current-thread runtime inside the blocking task. runtime::aws_default_chain_source() extracted so the doctor and provider_authenticated agree on the AWS chain.

How verified

fmt, clippy, cargo test --workspace. 12 new tests in doctor::tests (no config → model fail names the global path and credential skipped; stored credential → ok; missing → remedy names login + env var; untrusted project fails until grant_pending_trust; keyring unavailable; JSON round-trip with known statuses; text renderer indents remedies and summarises; workspace warn / data store size; declared Custom provider NoAuth; unregistered Stored → qq auth set; unparseable config skips dependents) + cli::tests::parses_doctor_with_optional_json. Manual: temp dir with no config (exit 1), with model and no key (matches the sample above), with the key (all checks passed, exit 0), repo root (trust pending on two files, server running, 185 MiB store), --json parses.

Docs

docs/guide/troubleshooting.md ("first stop": qq doctor), cli.md, quickstart.md, guide README; ledger.

Compatibility

No protocol/schema change. New subcommand only.

Follow-ups / decisions

  • Should warn ever affect exit status? Currently never.
  • Once OB3 (#TBD) lands, the google remedy should mention GOOGLE_API_KEY too (one-line follow-up).

@lg2m
lg2m force-pushed the feat/eng-878-doctor branch from 1395e25 to 89f1195 Compare September 23, 2026 04:05
One screen that says whether QQ is ready to run here: configuration,
project trust, model, credential for the model's provider, credential
store, server discovery, workspace, and data directory. Each line is
ok/warn/fail/skip with the remedy indented beneath anything not ok.
Exit 0 when nothing fails, 1 otherwise; `--json` for scripts.

`src/doctor.rs` keeps `run_checks` free of I/O to stdout so the text and
JSON renderers and the tests share one report. The credential check
mirrors `RuntimeFactory::provider_authenticated`; the AWS chain helpers in
`runtime.rs` are now `pub(crate)` and shared rather than duplicated. No
provider is contacted; the keyring is exercised only through the model's
stored credential, never probed blindly.

Slice OB4 of docs/plans/onboarding-ux.md. ENG-878.
CLI reference section for `qq doctor [--json]` with the check table;
troubleshooting opens with a sample report; quickstart and the guide index
mention it. Ledger: OB4 to In review.

Slice OB4. ENG-878.
OB3 (#137) made GOOGLE_API_KEY an alias of GEMINI_API_KEY; the doctor's
credential check now reads HttpCredential::ApiKey.alternate_variables,
accepts any of them as authenticating, and writes the remedy as
`set GEMINI_API_KEY (or GOOGLE_API_KEY)`. Closes the OB3→OB4 follow-up
named in #138 (OB4, ENG-878).
@lg2m
lg2m force-pushed the feat/eng-878-doctor branch from 89f1195 to 67f0685 Compare September 23, 2026 04:20
@lg2m
lg2m merged commit 5bb5867 into main Sep 23, 2026
4 checks passed
@lg2m
lg2m deleted the feat/eng-878-doctor branch September 23, 2026 04:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant