fix(server): log an unreadable config at warn, not error - #33
Merged
Merged
Conversation
`_read_databases` and `_read_primers` both answer `json_error(400, ...)`: the route's own verdict that a malformed `config/databases.yml` or `config/primers.yml` is an operator-fixable input, not a server fault. Logging that at `@error` with a full backtrace reports a routine bad file as if the server had crashed, and the backtrace pointed into YAML.jl's parser rather than at the offending line, so it carried no diagnostic value either. The reason string is kept -- `reason=sprint(showerror, e)` is what actually names the YAML defect. Only the backtrace goes. Deliberately NOT changed: the three 500-class sites, which stay at `@error` with their backtraces -- src/server/routes/analysis_config.jl:144 src/server/routes/annotations.jl:318 src/server/routes/composition.jl:370 A 500 is the route saying it did not expect this, and there the backtrace is the only thing separating a data problem from a code bug. Dropping it would be muting a diagnostic rather than fixing one. `analysis_config.jl` already draws this line itself: its `ArgumentError` branch returns 400 with no logging at all, while everything else logs at `@error` and returns 500. `src/server/routes/pipeline.jl:520` is untouched -- it is the silent-degradation shape tracked in #31, not a severity question. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01X3hgXxWm6umMgZkjYyHnnm
|
Warning Review limit reachedNext included review available in 34 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (2)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
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.



What
_read_databases(src/server/routes/databases.jl) and_read_primers(
src/server/routes/config.jl) both log at@errorwith a full backtrace, thenanswer
json_error(400, ...). This changes those two to@warnand keeps thereason string.
Why this is a fix and not a mute
The status the route already assigns is the discriminator.
json_error(400, ...)is the function's own verdict that a malformed
config/databases.ymlorconfig/primers.ymlis an operator-fixable input, not a server fault.Logging that at error severity with a stack trace reports a routine bad file as
if the server had crashed.
The backtrace also carried no diagnostic value here: it pointed into YAML.jl's
parser, never at the offending line. What actually names the defect is
sprint(showerror, e), and that is kept asreason=. Only the backtrace goes.Deliberately NOT changed — 3 of the 5 route
@errorsites stay as they areroutes/databases.jl:31@warnroutes/config.jl:272@warnroutes/analysis_config.jl:144routes/annotations.jl:318routes/composition.jl:370A 500 is the route saying it did not expect this. There the backtrace is the
only thing separating a data problem from a code bug, so dropping it would be
muting a diagnostic rather than repairing one.
analysis_config.jlalready draws exactly this line itself: itsArgumentErrorbranch returns 400 with no logging at all, while everything else logs at
@errorand returns 500. That is the existing precedent this PR follows ratherthan overrides.
src/server/routes/pipeline.jl:520is untouched — it setsmerged_results[i] = nothinginside a
Threads.@threadsloop with nojson_errorat all. That is thesilent-degradation shape tracked in #31, not a severity question.
Verification
Meta.lowerafter editing, not justMeta.parseall—a lowering error (e.g. an orphaned
break) passesparseallsilently.@test_logsare(:warn, ...)onfilter_tableand_apply_single_mapping!inTaxonomyTableTools; neither reaches_read_databasesor_read_primers, andnothing matches
databases_unreadable/primers_unreadable/is not readable.main; touches onlysrc/, so it could not conflict with fix: clear all 27 SonarCloud findings and unblock the Julia analysis-config step #29(frontend-only apart from one test file).
🤖 Generated with Claude Code
https://claude.ai/code/session_01X3hgXxWm6umMgZkjYyHnnm