Fix logs export/search: drop invalid tail=all from full_url#93
Merged
Conversation
The logs view built full_url with tail=all, but the /services/~logs and /logs/stream endpoints type tail as Optional[int], so FastAPI rejected "all" with a 422. The export and search features (both fetch FULL_URL) saved/searched that error JSON instead of the log. Omit tail entirely so the endpoint receives None; the runtime connector already maps a falsy tail to Docker's "all" (whole log). Guard tests updated to assert full_url carries no tail and that tail=all is absent. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.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.
Problem
Exporting (or searching) logs in the new logs view saved a 150-byte JSON error instead of the log:
{"detail":[{"type":"int_parsing","loc":["query","tail"],"msg":"Input should be a valid integer, unable to parse string as an integer","input":"all"}]}full_urlwas built withtail=all, but/services/~logsand/logs/streamtypetailasOptional[int], so FastAPI 422s on"all". Both export and search fetchFULL_URL, so both were broken.Fix
Omit
tailfromfull_url. The endpoint then receivestail=None, and the runtime connector already maps a falsytailto Docker's"all"(whole log) — seeruntime_connectors.py"tail": tail if tail else "all".manager/routers/service_api.py— service log viewfull_url→base(no tail)manager/routers/logging_api.py— manager log viewfull_url→/logs/streamtests/manager_test/test_ui_redesign.py— guard tests previously asserted the buggytail=all; now assertfull_urlcarries no tail andtail=allis absent.Verification
tail=all→ 422 (reproduced the bug); omitted/inttail→ reaches handler (200).test_ui_redesign.pypass; black ✓, flake8 ✓, pylint 10/10.🤖 Generated with Claude Code