Conversation
Co-authored-by: JonnyTran <4750391+JonnyTran@users.noreply.github.com>
Co-authored-by: JonnyTran <4750391+JonnyTran@users.noreply.github.com>
Co-authored-by: JonnyTran <4750391+JonnyTran@users.noreply.github.com>
Co-authored-by: JonnyTran <4750391+JonnyTran@users.noreply.github.com>
Co-authored-by: JonnyTran <4750391+JonnyTran@users.noreply.github.com>
Co-authored-by: JonnyTran <4750391+JonnyTran@users.noreply.github.com>
Sparshr04
left a comment
There was a problem hiding this comment.
Thanks @JonnyTran for kicking off this feature!
I tested the extralit workspaces doctor command locally and found one integration issue on the client side.
Originally in the the CLI was calling client.workspaces.doctor(...) but, client.workspaces (fromextralit/src/extralit/client/resources.py) is the high-level resource manager and does not expose doctor(). The actual low-level API wrapper (which does include .doctor() and .get_by_name()) is located at client.api.workspaces (at extralit/src/extralit/_api/_workspaces.py)
So I switched the CLI to use the low-level WorkspacesAPI, which does include .get_by_name() and .doctor() updating the extralit/src/extralit/cli/workspaces/__main__.py file.
Essentially I replaced high-level resource manager with low-level WorkspacesAPI
api = client.api.workspaces
workspace_obj = api.get_by_name(workspace.name)
doctor_response = api.doctor(workspace_obj.id, autofix=autofix)|
Hey @JonnyTran, thanks for your patience on this one! The debugging took way longer than expected. Fixed failing integration tests for the workspaces doctor command by switching from subprocess-based testing to Typer's CliRunner. I mainly had to tweak the
Both test variants |
- Updated user guide to clarify CLI usage for workspace diagnostics. - Removed redundant code and comments in workspace model and API handler. - Enhanced test CLI commands for better readability and consistency.
- Streamlined the doctor method in WorkspacesAPI for better readability. - Enhanced test fixtures for workspace creation and cleanup in integration tests. - Removed unnecessary comments and consolidated code for clarity.
…formatting - Changed default value of the autofix option to False for the workspace doctor command. - Removed unnecessary status emoji from the output for clearer diagnostics. - Cleaned up whitespace for improved code readability.
- Updated the command line interface documentation to include the new --autofix option for the workspace doctor command. - Cleaned up test method formatting for improved readability in the workspace doctor tests. - Ensured proper formatting in package-lock.json by adding a newline at the end of the file.
Description
Adds
extralit workspaces doctorCLI command to diagnose and autofix workspace infrastructure issues, particularly S3 bucket configurations that can break after environment changes or manual deletions.Related Tickets & Documents
Closes #
What type of PR is this? (check all applicable)
Implementation
Server API
POST /api/v1/workspaces/{workspace_id}/doctor?autofix=trueClient & CLI
WorkspacesAPI.doctor(workspace_id, autofix=True)methodUsage
Steps to QA
extralit workspaces --name test doctor--no-autofixvariant, confirm no autofix occursAdded/updated tests?
Added/updated documentations?
Checklist
Original prompt
extralit workspaces doctorcommand to autofix missing bucket issues #163✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.