wrolpi/modules/repos
lrnselfreliance 673c23188c
Request sessions keep objects after commit; guard dict() serializers (#811)
A RequestSession no longer expires loaded objects at commit, so a handler serializes what it
committed without a reload query.  An AsyncSession cannot run that reload at all, so this is
groundwork for moving request handling to async.  Background sessions (get_db_session) keep
SQLAlchemy's default: they change data outside the ORM (raw SQL, triggers) and rely on the reload.

Collection, CollectionItem and Channel dict() now run inside the serializer guard.  Fixes it found:
- Channel.dict() no longer loads the deferred yt-dlp catalog (info_json), which the channel
  handler loaded only to discard.
- get_channel eager-loads what Channel.dict() reads (populate_existing replaces a refresh query).
- create_channel / get_or_create_download link through relationships, so a loaded
  Collection.downloads stays current.
- Setting a Repo to Never removes the deleted Download from the loaded collection; the response
  reported the old frequency.
- The downloader no longer calls channel.dict() to preload a Channel; its callers read it inside
  the session.

Tests run each request with expiry off, as production does, and turn it back on for the background
work that shares the test Session.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-10 19:15:33 -06:00
..
test Give the repos ownership tests a fixed git identity (#790) 2026-10-08 17:01:59 -06:00
__init__.py Add a Repos module that mirrors git repositories (#783) 2026-10-07 15:16:58 -06:00
api.py Add a Repos module that mirrors git repositories (#783) 2026-10-07 15:16:58 -06:00
conftest.py Add a Repos module that mirrors git repositories (#783) 2026-10-07 15:16:58 -06:00
downloader.py Add a Repos module that mirrors git repositories (#783) 2026-10-07 15:16:58 -06:00
errors.py Add a Repos module that mirrors git repositories (#783) 2026-10-07 15:16:58 -06:00
lib.py Request sessions keep objects after commit; guard dict() serializers (#811) 2026-10-10 19:15:33 -06:00
models.py Add a Repos module that mirrors git repositories (#783) 2026-10-07 15:16:58 -06:00
schema.py Add a Repos module that mirrors git repositories (#783) 2026-10-07 15:16:58 -06:00