Repository navigation
fix(html-documents): make library errors readable - #223
Merged
Merged
Conversation
Decode a code-only API body into server_code and a sentence, name only shortcuts that exist, accept folder root in any case, and reject an empty --q. Co-authored-by: Weimeng Chen <MikeChenWM@users.noreply.github.com>
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.
Why
Mike (CTO) wants museoncli html-documents errors to be clear. Production QA of 2.3.0 found four failures:
{"detail": {"code": "folder_not_found"}}(andfolder_name_taken) with no message. The shared envelope copied that object intoerror.messageas"{\"code\": \"folder_not_found\"}", so an agent saw JSON instead of a sentence. When the body was itself a JSON string,server_codewas missing too.+listand no+get.--folder ROOT/Rootwas rejected as not a UUID. The valid literal isroot.+list --q ""(and whitespace) was treated as no search, even though the schema saysminLength1.What changed
{"code": ...}body. HTML-document codes becomeserver_codeplus a sentence (Folder not found,A folder with this name already exists, and the other codes that endpoint returns with no message). A body that already has its own message is unchanged. An unknown code-only object keeps the JSON text it showed before; decoding a string body also setsserver_code.+list). Other commands still say+list or +get.--folderacceptsrootin any case and sendsroot. Any other value saysrootis valid.--qis a usage error (exit 2) and sends no request.No version bump.
Tests
uv run ruff check .anduv run pytest -q(1949 passed).