Recover complete release coverage from successful local transfers and audio tags/CUE before subscription searches. Keep release-group and album boundaries, and reject completed torrent hashes before downloader submission.
Recognize explicit JSON rate limits before torrent parsing and short retries. Preserve per-call quota errors through download preparation so subscription cooldowns cover the tracker window.
Refs #6950
Run `ruff check app tests scripts --fix` with the configured rule set
(E4/E7/E9/F/I): import sorting (I001), f-strings without placeholders
(F541), lambda/variable/unused-import cleanups that ruff marks safe.
Nine files whose only ruff debt sits next to pre-existing pylint
import-resolution errors (lazy exports, sys.path script imports) or
whose "unused" imports are reached through attribute access by tests are
left untouched so the changed-file pylint gate and the benchmark tests
stay green; their diagnostics remain in the baseline.
app/startup/lifecycle/__init__.py and app/main.py import business
modules after cache composition, import-path and stdio setup on purpose
(the source comments document the contract), so declare E402
per-file-ignores for them instead of adding per-line noqa.
Ruff ratchet watermark drops from 498 to 100; sync the baseline fixture
and the optimization checklist figure.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The access-token endpoint accepted unlimited password attempts; the
only existing rate limiters are single-instance helpers for outbound
site requests. Add app/application/security/throttle.py, an in-memory
LoginThrottle keyed by (client address, normalized username) that locks
for 30s after five consecutive failures and doubles the lockout up to
15 minutes. The endpoint answers 429 with Retry-After while locked,
counts only real credential failures (an MFA challenge after a correct
password does not count), and clears the record on success.
X-Forwarded-For is deliberately not trusted because there is no
trusted-proxy setting; behind the bundled nginx all requests share one
address, so the key degrades to per-username throttling, which is the
dimension brute-force protection needs. Sync the dependency snapshot
and architecture metrics for the new module.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Keep strict binding lookup as the default and explicitly match alternative channel identifiers for the Agent API gateway. Reject ambiguous active-user matches and cover single-field bindings with database-backed tests.
Refs #6905
validate_download_save_path keeps path-first semantics and falls back to an
exact match on the configured download directory name, returning that
directory's root URI so every download entry point can save by alias.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Adopt a CUE only when at least one FILE reference resolves to a real
file in the audio directory. Legacy WAV-era cue sheets shipped inside
FLAC split-track releases previously blocked every track transfer with
"CUE 引用的文件名与当前音频不一致" (and broken-index cues did the same);
they are now ignored with an info log and organization falls back to
the files' own tags. Cross-directory references and cues that still
point at existing files keep the current strict behavior.
Refs: https://github.com/jxxghp/MoviePilot/issues/6888