Repository navigation
fix(watchsync): keep the MDBList API key out of error text - #1351
Conversation
Trakt and Simkl answered every non-2xx the same way, so a 429 never became a RateLimitedError and the sync service never deferred the account. Both providers now map 429 (and Simkl's documented rate_limit/RATE_LIMIT bodies) to RateLimitedError with the provider's Retry-After, retry short waits in place, and pace authenticated writes to one per second per access token as the providers document. Retry-After parsing and the per-credential write limiter move into internal/watchsync so MDBList, Trakt and Simkl share them. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The MDBList watch-sync provider puts the API key in the request query string. Transport errors wrap *url.Error, whose message includes that URL, and those errors reach the connection's last_error, sync run errors shown in the web UI, and logs. Build the keyed URL only inside the single request helper, sanitize transport and request-build errors with logredact.SanitizeURLError, and mask the key (raw or escaped) in error-body excerpts. Cancellation and timeout classification is kept. Same bug class as #692, which covers the separate internal/mdblist discovery client. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (10)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 |
There was a problem hiding this comment.
Quick104 has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
A provider 429 during a watch-provider call, such as Trakt's slow_down answer to a device-code poll, now reaches clients as a rate-limited problem carrying the provider's wait instead of an internal error. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…mdblist-key-redaction
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7e86836bb2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
A local limiter refuses at once when the next slot lies past the context deadline. That was an ordinary error, so watched exports that were never sent were marked failed. The refusal is now a RateLimitedError, which leaves the work pending for a later run; a cancelled context still returns its own error. MDBList's limiter gets the same treatment. Starting Trakt device authorization now reports a 429 as a rate limit with the provider's Retry-After, like polling and token refresh. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
When a transport error quoted the keyed URL in its own message, the masking fallback replaced it with a plain error, so errors.Is and errors.As no longer matched cancellations, deadlines, or net.Error timeouts. The masked error now answers Is and As from the original, without an Unwrap that would expose its message. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…mdblist-key-redaction
main fixed the watchsync MDBList provider's key leak independently (Silo-Server#1351: logredact.SanitizeURLError plus a masked, non-unwrapping error), so its provider.go and provider_test.go are kept whole and this branch's provider changes are dropped. jellycompat/handlers_items_test.go keeps main's rewrite. internal/mdblist/discovery.go still returned request and transport errors unredacted on main. Rework this branch's fix there to the provider's shape: logredact.SanitizeURLError, then mask any remaining raw or query-escaped key in a redactedError that has no Unwrap. errors.Unwrap can no longer reach the unmasked cause, while Is/As keep sentinel matching and net.Error timeout classification at any depth. The tests now walk the whole unwrap chain (messages and url.Error.URL), never print the key on failure, and cover timeout classification. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Problem
Related issue: N/A (same bug class as #692, which covers the separate
internal/mdblistdiscovery client)Validation tasks: none
Stack: builds on #1350; merge that first.
The MDBList watch-sync provider sends the user's API key as a query parameter. Go transport errors wrap
*url.Error, whose message includes the full request URL, key included. Those errors reach the connection'slast_errorand the sync run error that the web settings page shows, and they reach logs.internal/logredactredacts by attribute name, so it doesn't catch a key inside error text.Approach
logredact.SanitizeURLError, which drops the query string and keeps the cause chain.errors.Isstill matchescontext.Canceledandcontext.DeadlineExceeded, anderrors.Asstill findsnet.Errortimeouts.Locationheader, which Go quotes verbatim. The masked error keeps the original as its cause forerrors.Isanderrors.As, so classification still works.internal/mdblist(#692) is not touched here.Validation
go test -race ./internal/watchsync/...passes.make lint-changedreports 0 issues.Risks
None identified. Error messages keep method and path; only the query string is dropped.
Checklist
AI Disclosure
%vformatting, and error-body excerpts, for remaining key leaks and for losterrors.Is/errors.Asbehavior. No findings for this PR.🤖 Generated with Claude Code