feat: add doctor command for CLI diagnostics#79
Merged
Conversation
albert20260301
suggested changes
Jul 20, 2026
albert20260301
left a comment
Contributor
There was a problem hiding this comment.
Required: Please add an [Unreleased] / Added changelog entry for altertable doctor before merge. This is a user-facing feature with new human and JSON output, and the repository’s release policy requires it to be documented alongside the README and command reference.
leonkenneth
approved these changes
Jul 20, 2026
| return getActiveProfileName(); | ||
| } | ||
|
|
||
| export function resolveWorkingProfileReadOnly(override?: string): string { |
Contributor
There was a problem hiding this comment.
I don't follow how this makes it RO
Member
Author
There was a problem hiding this comment.
Name is misleading, it just means that it doesn't mutate anything, so it's safe to call whenever. I did a pass on naming and renamed that one resolveProfileReference().
francoischalifour
enabled auto-merge (squash)
July 20, 2026 13:33
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
The CLI previously had no single command for diagnosing its local configuration, credential backends, and connectivity to Altertable’s two API planes.
Troubleshooting required combining several commands while understanding:
Command-reference generation also wrote files during verification. Although drift was detected, the workflow mixed intentional regeneration with CI validation.
Solution
Add
altertable doctor, a read-only diagnostic command with human-readable and structured JSON output.The command evaluates seven checks:
Checks declare their dependencies explicitly. Independent management and lakehouse branches run concurrently, while dependent checks are skipped with a clear blocker when an earlier check fails.
Preview
Success
1 failure
Read-only behavior
Doctor uses a dedicated read-only execution context and disables authentication recovery for its HTTP probes.
It does not:
--offlinesuppresses both Altertable API probes while retaining the local profile and credential checks.A completed diagnostic exits successfully even when the report is unhealthy. Automation should inspect the JSON
healthyfield and individual findings.Diagnostic ownership
Profile configuration and secret-backed authentication inspection are now separate operations.
This ensures:
active_profilereferences are reported instead of silently falling back todefault.API validation and error reporting
Successful HTTP status codes are not sufficient to mark an API healthy.
The management probe validates
/whoamiagainst the generated OpenAPI response shape. The lakehouse probe parses the NDJSON response and verifies thatSELECT 1returned the numeric value1.Failed findings preserve structured CLI error information, including:
Output
Human output presents an aligned diagnostic report with status icons, actionable remediation, and a final health summary.
JSON output includes:
Generated artifacts
Generated-artifact handling now has explicit write and check modes shared by:
COMMANDS.mdgeneration.New scripts provide intentional regeneration and non-mutating verification:
cd cli bun run generate:commands bun run generate:checkThe repository verification script now checks generated content without rewriting the working tree.
COMMANDS.mdremains generated from command metadata and includes the new doctor command.Testing
Coverage includes: