Compare commits

...
Author SHA1 Message Date
kiskaadee 083fe61549 chore(toolchain): update pyproject.toml type checking and add test target to Makefile
- Include tests/ in pyright and configure extraPaths for contracts package.
- Unmask generated gRPC stubs so type checks verify contract seams.
- Add test target to Makefile invoking uv run pytest.

Closes #3
2026-10-31 20:49:11 -05:00
kiskaadee f5e290fd96 build(workspace): update worker and bff dependencies to use magnetflix-contracts
- Add magnetflix-contracts workspace dependency to services/worker and services/bff.
- Update imports in models.py and test_db.py to use canonical magnetflix.v1 package.
- Bump protobuf dependency to >=7.36.2 to align runtime with gencode.

Closes #2
2026-10-31 20:49:05 -05:00
kiskaadee 9edc5e20cf feat(contracts): create services/contracts workspace package and commit stubs
- Create services/contracts workspace package with module magnetflix.
- Reconfigure buf.gen.yaml to output stubs once into services/contracts/src.
- Remove stubs and docs/api_spec.md from .gitignore and track in Git.
- Add public seam tests in tests/test_contracts.py.

Closes #1
2026-10-31 20:48:58 -05:00
kiskaadee 9b16758eec docs(architecture): reconcile ADRs, roadmap, and pipeline invariants
- Record ADR 002 establishing two-tier sanitizer policy (DEC-3), two-stage
  metadata resolution (DEC-4), multi-track subtitle relocation (DEC-5),
  active startup crash recovery (DEC-6), and thread offloading (DEC-7).
- Update docs/architecture.md, docs/deployment.md, and README.md with
  the pluggable SSO identity adapter (DEC-8) and storage invariants.
- Update docs/roadmap.md and todo.txt with the reconciled 5-Milestone plan.
- Record historical Phase A current-state audit and portfolio assessment.
2026-10-31 14:03:56 -05:00
kiskaadee a73fd2679d fix(deps): bump certifi to 2026.10.23 (CVE-2026-115557)
Remediate eMudhra/emSign intermediate CA private key compromise by updating certifi to 2026.10.23 across HTTP client runtimes.
2026-10-29 13:27:41 -05:00
kiskaadee 22d0952b3a docs(adr): record ADR 001 for pipeline safety, storage boundaries, and dual-client BFF
- Add MADR 4.0 ADR 001 defining storage boundaries, two-stage relocation, and dual-client BFF architecture
- Update architecture.md with dual-client diagram, route compatibility, and ADR link
- Mark SQLite WAL setup as completed in roadmap.md
2026-10-13 08:40:57 -05:00
kiskaadee 4b4ba20ef8 feat(worker): implement async SQLite WAL engine, ORM model, and Alembic migrations
- Build async SQLAlchemy engine with PRAGMA journal_mode=WAL, foreign_keys=ON, and synchronous=NORMAL
- Implement DownloadJob ORM model with protobuf mapping and state transition guards
- Initialize Alembic async migrations and create initial download_jobs table schema
- Add unit test suite in tests/test_db.py covering WAL pragmas, CRUD, and state transitions
- Update todo.txt marking Priority (A) tasks complete
2026-10-13 07:26:27 -05:00
kiskaadee 38cd58a190 build(workspace): configure uv build-backend and add package readmes
- Configure [tool.uv.build-backend] with module-name and module-root for worker and bff
- Add package README files for services/worker and services/bff
- Add pytest-asyncio to dev dependencies with auto loop scope
- Mandate live todo.txt tracking in AGENTS.md
2026-10-13 07:26:03 -05:00
kiskaadee c3cc139216 build(worker): replace cinemagoer with httpx and add TMDB key template
- Replace cinemagoer scraping dependency with httpx for official TMDB API queries
- Add TMDB_API_KEY placeholder to .envrc-example
- Update lockfile via uv lock
2026-10-13 06:53:18 -05:00
kiskaadee 3954cadc54 docs(arch): reconcile deployment domain, staging volumes, and relocation invariants
- Update edge routing domain to roadtotech.me in overview and deployment specs
- Align Transmission container staging mount to /data/staging
- Document two-stage atomic relocation using /media/movies/.staging_<job_id>/ to prevent Jellyfin indexing races
- Formalize 15-minute stalled download timeout and Transmission session cleanup
- Add TMDB_API_KEY environment variable to deployment spec
2026-10-13 06:53:04 -05:00
39 changed files with 2734 additions and 342 deletions

No files matched your search

+3
View File
@@ -1 +1,4 @@
use flake use flake
# TMDB API Key for movie metadata verification
export TMDB_API_KEY=""
+1 -4
View File
@@ -15,9 +15,6 @@ dist/
data/ data/
config/ config/
# Generated docs and proto stubs in services (if re-generated on build) # Local environment
docs/api_spec.md
.envrc .envrc
.direnv/ .direnv/
services/bff/src/bff/magnetflix/v1/
services/worker/src/worker/magnetflix/v1/
+2 -1
View File
@@ -15,7 +15,8 @@ The working tree represents the user's active work.
2. **Check for Existing Files:** Before creating any new file, verify whether the file (or a user equivalent) already exists on disk. Never overwrite or re-scaffold user work. 2. **Check for Existing Files:** Before creating any new file, verify whether the file (or a user equivalent) already exists on disk. Never overwrite or re-scaffold user work.
3. **Never Overwrite Blindly:** Use available file-reading tools. Preserve user comments, links, and conventions. Prefer surgical edits over wholesale overwrites. 3. **Never Overwrite Blindly:** Use available file-reading tools. Preserve user comments, links, and conventions. Prefer surgical edits over wholesale overwrites.
4. **No Destructive Git Commands:** Never run `reset --hard`, `clean -fd`, `restore`, `checkout`, `stash`, `rebase`, or `amend` without explicit permission. 4. **No Destructive Git Commands:** Never run `reset --hard`, `clean -fd`, `restore`, `checkout`, `stash`, `rebase`, or `amend` without explicit permission.
5. **Final Diff Verification:** Before completing work, run `git status` and `git diff` to verify that no unrelated user changes were modified or discarded. Distinguish user changes from agent changes in completion reports. 5. **Live Task Tracking (`todo.txt`):** Keep `todo.txt` synchronized with code reality. When a task or milestone is implemented and verified, mark it as completed (`x YYYY-MM-DD ...`) immediately. Never leave completed work marked as pending.
6. **Final Diff Verification:** Before completing work, run `git status` and `git diff` to verify that no unrelated user changes were modified or discarded. Distinguish user changes from agent changes in completion reports.
--- ---
+4 -1
View File
@@ -1,7 +1,10 @@
.PHONY: generate test lint format check .PHONY: generate test lint format check
generate: generate:
uv run buf generate nix develop --command buf generate
test:
uv run pytest
lint: lint:
uv run ruff check . uv run ruff check .
+35 -30
View File
@@ -1,33 +1,40 @@
# 🎬 MagNetFlix # 🎬 MagNetFlix
> Automated, secure movie fetching and library organization pipeline via gRPC, Transmission, and Traefik/Authelia SSO. > Self-hosted, automated media acquisition and library organization pipeline built with **FastAPI (BFF)**, **gRPC**, **SQLite WAL**, **Transmission RPC**, and **pluggable SSO/OIDC authentication**.
--- ---
## 📖 Table of Contents ## 📖 Table of Contents
- [Overview](docs/overview.md) - Project mission, key features, and user workflow. - [Overview](docs/overview.md) — Mission, user workflow, and features.
- [Architecture](docs/architecture.md) - System design, BFF pattern, gRPC contracts, and data flow. - [Architecture](docs/architecture.md) — System design, state machine, security boundaries, and storage invariants.
- [Development Rules & Agent Guidelines](AGENTS.md) - Coding standards, monorepo conventions, and toolchain rules. - [Reconciled Roadmap](docs/roadmap.md) — Dependency-ordered implementation milestones.
- [Roadmap](docs/roadmap.md) - Milestone-by-milestone development plan. - [Deployment Guide](docs/deployment.md) — Docker Compose topology, volume mounts, and SSO identity adapter.
- [Deployment Guide](docs/deployment.md) - Docker Compose, Traefik integration, and Authelia SSO setup. - [Architecture Decision Records](docs/adr/) — Canonical records of design choices, tradeoffs, and invariants:
- [ADR 001: Pipeline Safety, Storage Boundaries, and BFF Dual-Client Architecture](docs/adr/001-pipeline-safety-and-bff-dual-client.md)
- [ADR 002: Pipeline Invariants, Two-Stage Metadata, and Active Reconciliation](docs/adr/002-pipeline-invariants-and-active-reconciliation.md)
- [Historical Audit Ledger](docs/history/phase-a-current-state-audit.md) — Phase A current-state audit and portfolio assessment.
- [Development Rules & Agent Guidelines](AGENTS.md) — Code quality standards, safety rules, and workspace invariants.
--- ---
## ⚡ Quick Start ## ⚡ Quick Start
```bash ```bash
# Enter hermetic dev shell (Nix) # 1. Enter hermetic dev shell (Nix)
nix develop nix develop
# Or install dependencies with uv workspace # 2. Or install dependencies with uv workspace
uv sync uv sync
# Generate protobuf stubs # 3. Generate protobuf stubs & documentation
make generate make generate
# Start full local stack with docker compose # 4. Run test suite
docker compose up -d uv run pytest
# 5. Run static type checking and linters
make check
``` ```
--- ---
@@ -36,28 +43,26 @@ docker compose up -d
```text ```text
. .
├── AGENTS.md # Development guidelines & rules for AI/human contributors ├── AGENTS.md # Development guidelines & safety invariants
├── Makefile # High-level build & generation commands ├── CLAUDE.md # Developer CLI commands & tool directives
├── Makefile # High-level build, codegen, lint, and test targets
├── README.md # Project landing page ├── README.md # Project landing page
├── buf.gen.yaml # Buf remote plugin generation config ├── buf.gen.yaml # Buf code generation configuration
├── buf.yaml # Buf module definition ├── buf.yaml # Buf module configuration
├── docker-compose.yml # Local development & production compose stack ├── docker-compose.yml # Multi-container Compose stack specification
├── docs/ # Detailed system documentation ├── docs/ # Authoritative architecture and operations documentation
│ ├── architecture.md # Architecture & component interactions │ ├── adr/ # Architecture Decision Records (ADRs)
│ ├── deployment.md # Traefik & Authelia deployment guide │ ├── history/ # Audit logs and review ledgers
│ ├── architecture.md # System design, data flow, and invariants
│ ├── deployment.md # Container topology and reverse proxy integration
│ ├── overview.md # Feature overview & workflow │ ├── overview.md # Feature overview & workflow
│ └── roadmap.md # Development milestones │ └── roadmap.md # 5-Milestone implementation plan
├── proto/ # Protocol Buffer definitions ├── proto/ # Protocol Buffer definitions
│ └── magnetflix/v1/ │ └── magnetflix/v1/
│ └── pipeline.proto │ └── pipeline.proto
└── services/ ├── services/
├── bff/ # FastAPI Web Gateway / HTML Form / Authelia SSO │ ├── bff/ # FastAPI Web Gateway / HTML Form / Pluggable SSO
│ ├── Dockerfile │ ├── contracts/ # Shared Protobuf & gRPC contracts package
│ ├── pyproject.toml │ └── worker/ # gRPC Pipeline Worker & Transmission Coordinator
│ └── src/bff/ └── tests/ # Unit and integration test suites
└── worker/ # gRPC Pipeline Worker & Transmission Coordinator
├── Dockerfile
├── alembic/
├── pyproject.toml
└── src/worker/
``` ```
+148
View File
@@ -0,0 +1,148 @@
# A generic, single database configuration.
[alembic]
# path to migration scripts.
# this is typically a path given in POSIX (e.g. forward slashes)
# format, relative to the token %(here)s which refers to the location of this
# ini file
script_location = %(here)s/services/worker/alembic
# template used to generate migration file names; The default value is %%(rev)s_%%(slug)s
# Uncomment the line below if you want the files to be prepended with date and time
# see https://alembic.sqlalchemy.org/en/latest/tutorial.html#editing-the-ini-file
# for all available tokens
# file_template = %%(year)d_%%(month).2d_%%(day).2d_%%(hour).2d%%(minute).2d-%%(rev)s_%%(slug)s
# Or organize into date-based subdirectories (requires recursive_version_locations = true)
# file_template = %%(year)d/%%(month).2d/%%(day).2d_%%(hour).2d%%(minute).2d_%%(second).2d_%%(rev)s_%%(slug)s
# sys.path path, will be prepended to sys.path if present.
# defaults to the current working directory. for multiple paths, the path separator
# is defined by "path_separator" below.
prepend_sys_path = .
# timezone to use when rendering the date within the migration file
# as well as the filename.
# If specified, requires the tzdata library which can be installed by adding
# `alembic[tz]` to the pip requirements.
# string value is passed to ZoneInfo()
# leave blank for localtime
# timezone =
# max length of characters to apply to the "slug" field
# truncate_slug_length = 40
# set to 'true' to run the environment during
# the 'revision' command, regardless of autogenerate
# revision_environment = false
# set to 'true' to allow .pyc and .pyo files without
# a source .py file to be detected as revisions in the
# versions/ directory
# sourceless = false
# version location specification; This defaults
# to <script_location>/versions. When using multiple version
# directories, initial revisions must be specified with --version-path.
# The path separator used here should be the separator specified by "path_separator"
# below.
# version_locations = %(here)s/bar:%(here)s/bat:%(here)s/alembic/versions
# path_separator; This indicates what character is used to split lists of file
# paths, including version_locations and prepend_sys_path within configparser
# files such as alembic.ini.
# The default rendered in new alembic.ini files is "os", which uses os.pathsep
# to provide os-dependent path splitting.
#
# Note that in order to support legacy alembic.ini files, this default does NOT
# take place if path_separator is not present in alembic.ini. If this
# option is omitted entirely, fallback logic is as follows:
#
# 1. Parsing of the version_locations option falls back to using the legacy
# "version_path_separator" key, which if absent then falls back to the legacy
# behavior of splitting on spaces and/or commas.
# 2. Parsing of the prepend_sys_path option falls back to the legacy
# behavior of splitting on spaces, commas, or colons.
#
# Valid values for path_separator are:
#
# path_separator = :
# path_separator = ;
# path_separator = space
# path_separator = newline
#
# Use os.pathsep. Default configuration used for new projects.
path_separator = os
# set to 'true' to search source files recursively
# in each "version_locations" directory
# new in Alembic version 1.10
# recursive_version_locations = false
# the output encoding used when revision files
# are written from script.py.mako
# output_encoding = utf-8
# database URL. This is consumed by the user-maintained env.py script only.
# other means of configuring database URLs may be customized within the env.py
sqlalchemy.url = sqlite+aiosqlite:///data/magnetflix.sqlite3
[post_write_hooks]
# post_write_hooks defines scripts or Python functions that are run
# on newly generated revision scripts. See the documentation for further
# detail and examples
# format using "black" - use the console_scripts runner, against the "black" entrypoint
# hooks = black
# black.type = console_scripts
# black.entrypoint = black
# black.options = -l 79 REVISION_SCRIPT_FILENAME
# lint with attempts to fix using "ruff" - use the module runner, against the "ruff" module
# hooks = ruff
# ruff.type = module
# ruff.module = ruff
# ruff.options = check --fix REVISION_SCRIPT_FILENAME
# Alternatively, use the exec runner to execute a binary found on your PATH
# hooks = ruff
# ruff.type = exec
# ruff.executable = ruff
# ruff.options = check --fix REVISION_SCRIPT_FILENAME
# Logging configuration. This is also consumed by the user-maintained
# env.py script only.
[loggers]
keys = root,sqlalchemy,alembic
[handlers]
keys = console
[formatters]
keys = generic
[logger_root]
level = WARNING
handlers = console
qualname =
[logger_sqlalchemy]
level = WARNING
handlers =
qualname = sqlalchemy.engine
[logger_alembic]
level = INFO
handlers =
qualname = alembic
[handler_console]
class = StreamHandler
args = (sys.stderr,)
level = NOTSET
formatter = generic
[formatter_generic]
format = %(levelname)-5.5s [%(name)s] %(message)s
datefmt = %H:%M:%S
+4 -12
View File
@@ -3,21 +3,13 @@ inputs:
- directory: proto - directory: proto
plugins: plugins:
- remote: buf.build/protocolbuffers/python - remote: buf.build/protocolbuffers/python
out: services/worker/src/worker out: services/contracts/src
- remote: buf.build/grpc/python - remote: buf.build/grpc/python
out: services/worker/src/worker out: services/contracts/src
- remote: buf.build/community/nipunn1313-mypy - remote: buf.build/community/nipunn1313-mypy
out: services/worker/src/worker out: services/contracts/src
- remote: buf.build/community/nipunn1313-mypy-grpc - remote: buf.build/community/nipunn1313-mypy-grpc
out: services/worker/src/worker out: services/contracts/src
- remote: buf.build/protocolbuffers/python
out: services/bff/src/bff
- remote: buf.build/grpc/python
out: services/bff/src/bff
- remote: buf.build/community/nipunn1313-mypy
out: services/bff/src/bff
- remote: buf.build/community/nipunn1313-mypy-grpc
out: services/bff/src/bff
- remote: buf.build/community/pseudomuto-doc - remote: buf.build/community/pseudomuto-doc
out: docs out: docs
opt: opt:
@@ -0,0 +1,116 @@
---
type: decision
status: accepted
project: MagNetFlix
date: 2026-10-13
tags: [architecture, security, storage, bff, grpc, api, webextension]
---
# ADR 001: Pipeline Safety, Storage Boundaries, and BFF Dual-Client Architecture
## Context and Problem Statement
MagNetFlix automates media acquisition from user submission to structured library organization for Jellyfin and Plex. During architectural audit and alignment with an existing browser extension proof-of-concept (`magnetflix-extension`), several critical design questions and operational hazards were identified:
1. **Client & API Alignment**: How should public users interact with the system? Should the web portal and browser extension require separate backends or conflicting API contracts?
2. **Security & Ingress Boundary**: How can torrent downloading be offered to authenticated home users without exposing the underlying Transmission daemon or internal disk structures to the public network?
3. **Cross-Volume Storage Integrity**: Downloads occur on fast scratch disks (`/data/staging`), while final libraries live on large storage pools (`/media/movies`). Moving files across filesystem boundaries cannot be done via atomic filesystem links (`EXDEV`). How do we prevent media servers from indexing 30GB media files while they are still being copied?
4. **Metadata Authority**: Should metadata matching rely on web scraping (IMDb HTML scraping) or structured API integration (TMDB)?
5. **Daemon Lifecycle & Path Alignment**: How do we prevent container volume path translation errors and eliminate ghost torrent sessions in Transmission daemon state?
## Decision Drivers
* **Minimal Attack Surface**: Zero public exposure of torrent engines, RPC ports, or staging filesystems.
* **Ingestion Atomicity**: Guarantee that Jellyfin/Plex will never detect, lock, or play a partially transferred file.
* **Deterministic Metadata Verification**: Authoritative title/year verification without fragility to HTML changes or IP rate-limiting.
* **Client Versatility with Zero Divergence**: Unified support for both a self-hosted Web UI and a companion browser WebExtension without managing divergent APIs or CORS holes.
* **Resource Hygiene**: Guaranteed reclamation of disk space and torrent session memory on terminal success or failure.
## Considered Options
* **Option 1: Direct Exposed Torrent Client with Script Hooks**: Expose Transmission's Web UI directly via reverse proxy and rely on `torrent-done-script.sh` bash scripts for post-processing.
* **Option 2: Monolithic FastAPI Application**: Run HTTP endpoints, in-process BitTorrent client (`libtorrent`), and media processing inside a single Python process.
* **Option 3: Decoupled FastAPI BFF + Private gRPC Pipeline Worker + Isolated Transmission Daemon (Dual-Client Compatible)**:
* FastAPI acts as a Backend-for-Frontend (BFF), serving the web UI directly on `addmovie.roadtotech.me` behind Traefik/Authelia SSO, and providing dual API route bindings.
* Worker runs as a private gRPC service coordinating an isolated Transmission daemon over an internal Docker bridge.
* Filesystem operations enforce a two-stage copy-and-swap on the target volume.
## Decision Outcome
Chosen option: **Option 3**, because it provides complete physical separation between the public ingress tier and the torrent/filesystem execution tier while supporting both the browser extension and the web UI through a single API surface.
---
### Summary of Architectural Commitments
#### 1. Dual-Client BFF Gateway & Web UI Hosting
* The FastAPI BFF directly serves the public web UI (adapted from the standalone `app.html` design) as a single-origin application behind Traefik and Authelia forward-auth.
* The BFF simultaneously acts as the API backend for the companion browser extension (`magnetflix-extension`).
* To support both clients without friction:
* Dual route bindings are established: `POST /api/v1/downloads` (canonical) and `POST /download` (extension alias).
* Inbound Pydantic schemas accept both naming conventions via validation aliases: `magnet` / `magnet_uri` and `imdbid` / `imdb_id`.
* The BFF extracts authenticated user identity strictly from the Traefik `Remote-User` header. In local development or extension contexts lacking SSO headers, a deterministic fallback (`local_user`) is applied.
#### 2. Engine & Network Isolation (Defense-in-Depth)
* Transmission daemon and gRPC Worker run strictly on a private, internal Docker bridge (`magnetflix_internal`).
* Neither Transmission's web interface nor its RPC port (9091) is exposed to the host or internet.
* Transmission is controllable exclusively through the Worker's `transmission-rpc` client wrapper.
#### 3. Storage Boundary: Two-Stage Atomic Relocation
* Because scratch staging (`/data/staging`) and destination libraries (`/media/movies`) reside on separate storage mounts, file moves across devices require a copy-and-delete.
* To prevent media servers from indexing in-flight transfers:
1. **Transfer Stage**: Media and subtitle files are copied from `/data/staging/<job_id>/` to `/media/movies/.staging_<job_id>/` using Python's `shutil.copy2`.
2. **Atomic Swap Stage**: Once copying is complete and size is verified, `os.replace` atomically renames `/media/movies/.staging_<job_id>/` to the canonical destination directory `/media/movies/<Title> (<Year>) [imdbid-<IMDbID>]/`.
* Because the staging folder and final directory reside on the **same target filesystem**, `os.replace` is an instant, atomic metadata pointer update.
#### 4. Container Path Alignment
* Transmission and Worker mount the staging directory to the identical absolute path (`/data/staging`). This eliminates container path translation logic when dispatching RPC download commands.
#### 5. Authoritative Metadata Verification via TMDB API
* Media verification uses the official **The Movie Database (TMDB) API** (`/find/{imdb_id}?external_source=imdb_id`) via `httpx`.
* Scraping libraries (Cinemagoer) are rejected to eliminate fragile HTML parsing and IP blocking.
* Verified movie titles and release years must have positive normalized token overlap with the torrent payload name before organizing; zero overlap aborts the job to `FAILED`.
#### 6. Lifecycle Cleanup & Timeout Guarantees
* When a job reaches a terminal state (`COMPLETED` or `FAILED`):
* The scratch directory `/data/staging/<job_id>/` is purged immediately.
* The torrent session is removed from Transmission daemon via RPC `remove_torrent(id, delete_data=True)` to prevent memory leaks and tracker retention.
* If a torrent makes zero progress (0 bytes downloaded or unretrieved magnet metadata) for 15 consecutive minutes, the job transitions to `FAILED` with reason `"Download stalled: no seeds or metadata timeout"`.
---
## Pros and Cons of the Options
### Option 1: Direct Exposed Torrent Client with Script Hooks
* Good, because minimal initial code is needed.
* Bad, because exposes Transmission's attack surface to the internet; error handling in post-processing bash scripts is brittle and lacks transaction safety or audit logs.
### Option 2: Monolithic FastAPI Application
* Good, because single process to deploy.
* Bad, because CPU/disk I/O from torrent piece verification blocks Python async event loops; web vulnerabilities directly expose filesystem permissions; crashing the API kills ongoing torrent swarms.
### Option 3: Decoupled BFF + Private Worker + Two-Stage Relocation (Adopted)
* Good, because complete isolation of untrusted network traffic from disk-writing engines; unified API serves both web UI and extension; atomic move eliminates race conditions with Jellyfin/Plex.
* Bad, because cross-volume copying temporarily doubles disk usage during the `ORGANIZING` phase; requires an external TMDB API key.
---
## Consequences
### Positive Consequences
* Media library scanners (Jellyfin/Plex) never lock or ingest corrupted, partially written files.
* Single-origin web UI eliminates CORS configuration for standard users, while Pydantic aliases maintain 100% backward compatibility with the browser extension.
* Transmission daemon is entirely insulated from public network access.
* Staging directories and Transmission sessions are cleanly reclaimed on both success and failure.
### Negative Consequences & Accepted Trade-offs
* Requires storage capacity on `/media/movies` to accommodate temporary copy staging (`.staging_<job_id>`) for the largest single feature film before atomic swap.
* Worker requires outbound internet access to query TMDB API over HTTPS.
---
## More Information
* **Canonical Architecture**: [`docs/architecture.md`](../architecture.md)
* **Deployment & Networking Spec**: [`docs/deployment.md`](../deployment.md)
* **Browser Extension Reference**: Companion extension proof-of-concept located at `magnetflix-extension`.
@@ -0,0 +1,83 @@
---
type: decision
status: accepted
project: MagNetFlix
date: 2026-10-29
tags: [architecture, security, storage, metadata, recovery, concurrency, sso, bff]
---
# ADR 002: Pipeline Invariants, Two-Stage Metadata, and Active Reconciliation
## Context and Problem Statement
Following the initial architectural baseline established in [ADR 001](001-pipeline-safety-and-bff-dual-client.md) and the implementation of the SQLite WAL engine, an interactive architectural review identified critical engineering gaps across several core subsystems:
1. **Protobuf Packaging & Build Reproducibility (`GAP-1`)**: The stubs emitted by `buf` produced `ModuleNotFoundError: No module named 'magnetflix'` when imported due to nested package output paths, and generated stubs were excluded from git and static type checks.
2. **Active-Job Concurrency (`GAP-2`)**: Concurrent submissions for the same movie could race past application-level checks and insert duplicate active downloads due to the absence of a database-level uniqueness constraint.
3. **Sanitizer Boundary Policy (`GAP-3`)**: A documented contradiction existed between *purging* non-media files versus *aborting* the entire job if non-allowlisted files exist. Because ~95% of real-world torrents contain `.nfo` or `.txt` clutter, strict rejection causes widespread false-positive failures, while pure whitelisting ignores symlink/executable hazards.
4. **Metadata Resolution Timing (`GAP-5`)**: Fetching TMDB metadata only after download completion leaves the UI live dashboard blank during 30–60 minute downloads and wastes tens of gigabytes of bandwidth on invalid IMDb IDs.
5. **Subtitle Relocation Collisions (`GAP-4`)**: Hardcoding target subtitles to `<Title> (<Year>).en.srt` corrupts non-SRT formats (`.ass`, `.vtt`) and causes silent overwrite collisions when multiple tracks exist.
6. **Crash Recovery & Daemon State (`GAP-6`)**: Simply marking SQLite rows as `FAILED` on worker restart leaves orphaned torrent sessions actively downloading in the Transmission container and abandons scratch disks.
7. **Async Concurrency & Blocking I/O (`GAP-7`)**: Calling multi-gigabyte `shutil.copy2` transfers or synchronous `transmission-rpc` requests directly on Python's async event loop freezes gRPC RPCs and SSE streaming connections.
8. **Pluggable SSO & Search Boundaries (`GAP-8`)**: Hardcoding Authelia headers tightly coupled MagNetFlix to specific homelab infrastructure, and client-side scraping of undocumented IMDb endpoints created browser CORS and fragility risks.
---
## Decision Outcome & Invariants
### 1. Dedicated Workspace Contracts Package (`DEC-1`)
- Stubs are generated once into a shared workspace package `services/contracts` (`module-name = "magnetflix"`).
- Both `worker` and `bff` depend on `magnetflix-contracts` via `{ workspace = true }`, allowing native `from magnetflix.v1 import pipeline_pb2, pipeline_pb2_grpc` imports.
- Generated stubs and `docs/api_spec.md` are committed to Git, enabling reproducible offline test and Docker builds.
### 2. Database Partial Unique Index & Info-Hash Column (`DEC-2`)
- Add an indexed column `info_hash` to `download_jobs`.
- Add a partial unique index in SQLite:
```sql
CREATE UNIQUE INDEX uq_download_jobs_active_imdb_id
ON download_jobs (imdb_id)
WHERE state NOT IN ('COMPLETED', 'FAILED');
```
- Guaranteed engine-level deduplication: concurrent duplicate submissions fail with `IntegrityError`, mapped cleanly to `grpc.StatusCode.ALREADY_EXISTS`.
### 3. Two-Tier Sanitization Policy (`DEC-3`)
- **Tier 1 (Hard Security Rejection)**: Immediate job abort to `FAILED` if the payload contains symbolic links (`os.path.islink`), hard links (`st_nlink > 1`), path traversal (`..`), special device nodes, or dangerous extensions (`.exe`, `.bat`, `.cmd`, `.sh`, `.scr`, `.vbs`, `.ps1`, `.lnk`, `.iso`, `.zip`, `.rar`, `.7z`).
- **Tier 2 (Allowlist Extraction & Safe Discard)**: Extract allowlisted video (`.mkv`, `.mp4`, `.avi`, `.webm`) and subtitles (`.srt`, `.vtt`, `.sub`, `.ass`). Safely ignore benign clutter (`.nfo`, `.txt`, `.jpg`, `.sfv`). Discard samples (`< 100MB` or `"sample"`). Select the single largest remaining video file as the feature film.
### 4. Two-Stage Metadata Lifecycle (`DEC-4`)
- **Stage 1 (Early Ingestion)**: Query TMDB API `/find/{imdb_id}?external_source=imdb_id` at job submission/queueing time. Verify valid movie entity type; persist `title` and `year` to SQLite immediately. Live UI and SSE streams display movie metadata from second 1.
- **Stage 2 (Post-Download Token Check)**: Compare cached `(title, year)` tokens against primary video filename completely offline from SQLite without external network dependencies.
### 5. Multi-Track Subtitle Preservation & Two-Stage Atomic Swap (`DEC-5`)
- Retain native subtitle extensions (`.srt`, `.vtt`, `.ass`).
- Parse language and forced tags from filenames; append disambiguation indices (`<Title> (<Year>).en.1.srt`) when multiple subtitles share tags to prevent overwrites.
- Copy verified files across storage boundaries to `/media/movies/.staging_<job_id>/`. Pre-check destination existence, then atomically swap via `os.replace`.
### 6. Active Reconciliation & Stalled Timeout (`DEC-6`)
- On worker startup, query all non-terminal SQLite jobs: transition state to `FAILED`, actively call Transmission RPC `remove_torrent(info_hash, delete_data=True)`, and purge scratch directories `/data/staging/<job_id>/` and `/media/movies/.staging_<job_id>/`.
- Monitor swarm progress during `DOWNLOADING`: auto-fail jobs with 0 progress for 15 consecutive minutes.
### 7. Thread Offloading & In-Memory SSE Fan-Out (`DEC-7`)
- Dispatch all blocking disk copies (`shutil.copy2`), synchronous RPC calls (`transmission-rpc`), and directory scans to a bounded `ThreadPoolExecutor(max_workers=4)`.
- Database sessions are strictly short-lived (committed and closed before long I/O).
- Broadcast progress and state change events via an internal `asyncio.Queue` pub/sub broker to connected gRPC/SSE streams.
### 8. Pluggable Identity Adapter & Server-Side Search (`DEC-8`)
- FastAPI BFF middleware reads identity headers via configurable environment variables (`AUTH_ENABLED`, `AUTH_HEADER_USER`, `AUTH_HEADER_EMAIL`) with a safe dev fallback (`local_user`).
- Expose `GET /api/v1/movies/search?q=...` proxying TMDB movie search server-side to eliminate CORS issues and undocumented third-party scraping.
- Mount dual route bindings (`POST /api/v1/downloads` and `POST /download`) with Pydantic aliases (`magnet`/`magnet_uri`, `imdbid`/`imdb_id`).
---
## Consequences
### Positive Consequences
- Guarantees 100% reproducible builds and eliminates `ModuleNotFoundError` across all environments.
- Protects the host and media library from malicious torrent payloads, path traversal, and partial writes.
- Eliminates zombie torrents and leaked staging disk space across container restarts.
- Maintains responsive gRPC and SSE streaming performance during multi-gigabyte disk transfers.
- Decouples MagNetFlix from specific reverse proxy or identity provider implementations.
### Accepted Tradeoffs & Operational Costs
- Requires outbound TMDB API key access on both BFF (for movie search) and Worker (for metadata resolution).
- Requires temporary disk space on `/media/movies` to hold `.staging_<job_id>/` during cross-volume copying.
+243
View File
@@ -0,0 +1,243 @@
# Protocol Documentation
<a name="top"></a>
## Table of Contents
- [magnetflix/v1/pipeline.proto](#magnetflix_v1_pipeline-proto)
- [GetJobRequest](#magnetflix-v1-GetJobRequest)
- [GetJobResponse](#magnetflix-v1-GetJobResponse)
- [JobStatus](#magnetflix-v1-JobStatus)
- [ListJobsRequest](#magnetflix-v1-ListJobsRequest)
- [ListJobsResponse](#magnetflix-v1-ListJobsResponse)
- [StreamJobStatusRequest](#magnetflix-v1-StreamJobStatusRequest)
- [StreamJobStatusResponse](#magnetflix-v1-StreamJobStatusResponse)
- [SubmitDownloadRequest](#magnetflix-v1-SubmitDownloadRequest)
- [SubmitDownloadResponse](#magnetflix-v1-SubmitDownloadResponse)
- [JobState](#magnetflix-v1-JobState)
- [PipelineService](#magnetflix-v1-PipelineService)
- [Scalar Value Types](#scalar-value-types)
<a name="magnetflix_v1_pipeline-proto"></a>
<p align="right"><a href="#top">Top</a></p>
## magnetflix/v1/pipeline.proto
<a name="magnetflix-v1-GetJobRequest"></a>
### GetJobRequest
Request to fetch a specific job by ID.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| job_id | [string](#string) | | Unique job identifier. |
<a name="magnetflix-v1-GetJobResponse"></a>
### GetJobResponse
Response containing the status of the requested job.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| job | [JobStatus](#magnetflix-v1-JobStatus) | | The retrieved job details. |
<a name="magnetflix-v1-JobStatus"></a>
### JobStatus
Full status information for a download job.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| job_id | [string](#string) | | Unique job ID. |
| imdb_id | [string](#string) | | IMDb ID. |
| title | [string](#string) | | Resolved movie title from TMDB (if available). |
| year | [int32](#int32) | | Resolved release year from TMDB (if available). |
| requested_by | [string](#string) | | User who requested the download. |
| state | [JobState](#magnetflix-v1-JobState) | | Current state in the pipeline. |
| progress_pct | [float](#float) | | Download progress percentage (0.0 to 100.0). |
| download_rate_bytes | [int64](#int64) | | Download speed in bytes per second. |
| error_message | [string](#string) | | Detailed error message if the job failed. |
| created_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | Timestamp when the job was enqueued. |
| updated_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | Timestamp when the job status or progress was last updated. |
| completed_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | Timestamp when terminal processing finished (COMPLETED or FAILED). |
<a name="magnetflix-v1-ListJobsRequest"></a>
### ListJobsRequest
Request to list jobs with pagination and state filtering.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| page_size | [int32](#int32) | | Maximum number of jobs to return per page (default: 20, max: 100). |
| page_token | [string](#string) | | Page token received from a previous ListJobsResponse next_page_token. |
| state_filter | [JobState](#magnetflix-v1-JobState) | | Optional filter by job state. |
<a name="magnetflix-v1-ListJobsResponse"></a>
### ListJobsResponse
Paginated response containing a list of download jobs.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| jobs | [JobStatus](#magnetflix-v1-JobStatus) | repeated | List of matching jobs for the current page. |
| next_page_token | [string](#string) | | Token to retrieve the next page of results, or empty if no more results. |
<a name="magnetflix-v1-StreamJobStatusRequest"></a>
### StreamJobStatusRequest
Request to stream job updates.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| job_id | [string](#string) | | Optional job ID to filter updates for a single job; if empty, streams all active jobs. |
<a name="magnetflix-v1-StreamJobStatusResponse"></a>
### StreamJobStatusResponse
Real-time job status event stream frame.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| job | [JobStatus](#magnetflix-v1-JobStatus) | | Current job status update. |
<a name="magnetflix-v1-SubmitDownloadRequest"></a>
### SubmitDownloadRequest
Request to submit a new movie download.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| magnet_uri | [string](#string) | | Magnet URI of the torrent to fetch. |
| imdb_id | [string](#string) | | IMDb ID of the movie (e.g., &#34;tt1375666&#34;). |
| requested_by | [string](#string) | | Username of the user requesting the download (from Authelia Remote-User). |
<a name="magnetflix-v1-SubmitDownloadResponse"></a>
### SubmitDownloadResponse
Response acknowledging the job submission.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| job_id | [string](#string) | | Unique identifier for the created job. |
| message | [string](#string) | | Human-readable message. |
<a name="magnetflix-v1-JobState"></a>
### JobState
State enumeration of a download job lifecycle.
| Name | Number | Description |
| ---- | ------ | ----------- |
| JOB_STATE_UNSPECIFIED | 0 | |
| JOB_STATE_QUEUED | 1 | |
| JOB_STATE_DOWNLOADING | 2 | |
| JOB_STATE_SCANNING | 3 | |
| JOB_STATE_VERIFYING_METADATA | 4 | |
| JOB_STATE_ORGANIZING | 5 | |
| JOB_STATE_COMPLETED | 6 | |
| JOB_STATE_FAILED | 7 | |
<a name="magnetflix-v1-PipelineService"></a>
### PipelineService
PipelineService coordinates movie download jobs, safety scans, and library relocation.
| Method Name | Request Type | Response Type | Description |
| ----------- | ------------ | ------------- | ------------|
| SubmitDownload | [SubmitDownloadRequest](#magnetflix-v1-SubmitDownloadRequest) | [SubmitDownloadResponse](#magnetflix-v1-SubmitDownloadResponse) | SubmitDownload enqueues a new movie download job. Rejects duplicate submissions if an active job for the same IMDb ID exists or if already in library. |
| GetJob | [GetJobRequest](#magnetflix-v1-GetJobRequest) | [GetJobResponse](#magnetflix-v1-GetJobResponse) | GetJob retrieves the current status and metadata of a specific job. |
| StreamJobStatus | [StreamJobStatusRequest](#magnetflix-v1-StreamJobStatusRequest) | [StreamJobStatusResponse](#magnetflix-v1-StreamJobStatusResponse) stream | StreamJobStatus streams real-time status updates. Semantics: Emits an immediate snapshot of matching active jobs upon connection, followed by subsequent state and progress change events. |
| ListJobs | [ListJobsRequest](#magnetflix-v1-ListJobsRequest) | [ListJobsResponse](#magnetflix-v1-ListJobsResponse) | ListJobs returns a paginated list of download jobs. |
## Scalar Value Types
| .proto Type | Notes | C++ | Java | Python | Go | C# | PHP | Ruby |
| ----------- | ----- | --- | ---- | ------ | -- | -- | --- | ---- |
| <a name="double" /> double | | double | double | float | float64 | double | float | Float |
| <a name="float" /> float | | float | float | float | float32 | float | float | Float |
| <a name="int32" /> int32 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required) |
| <a name="int64" /> int64 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead. | int64 | long | int/long | int64 | long | integer/string | Bignum |
| <a name="uint32" /> uint32 | Uses variable-length encoding. | uint32 | int | int/long | uint32 | uint | integer | Bignum or Fixnum (as required) |
| <a name="uint64" /> uint64 | Uses variable-length encoding. | uint64 | long | int/long | uint64 | ulong | integer/string | Bignum or Fixnum (as required) |
| <a name="sint32" /> sint32 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required) |
| <a name="sint64" /> sint64 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s. | int64 | long | int/long | int64 | long | integer/string | Bignum |
| <a name="fixed32" /> fixed32 | Always four bytes. More efficient than uint32 if values are often greater than 2^28. | uint32 | int | int | uint32 | uint | integer | Bignum or Fixnum (as required) |
| <a name="fixed64" /> fixed64 | Always eight bytes. More efficient than uint64 if values are often greater than 2^56. | uint64 | long | int/long | uint64 | ulong | integer/string | Bignum |
| <a name="sfixed32" /> sfixed32 | Always four bytes. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required) |
| <a name="sfixed64" /> sfixed64 | Always eight bytes. | int64 | long | int/long | int64 | long | integer/string | Bignum |
| <a name="bool" /> bool | | bool | boolean | boolean | bool | bool | boolean | TrueClass/FalseClass |
| <a name="string" /> string | A string must always contain UTF-8 encoded or 7-bit ASCII text. | string | String | str/unicode | string | string | string | String (UTF-8) |
| <a name="bytes" /> bytes | May contain any arbitrary sequence of bytes. | string | ByteString | str | []byte | ByteString | string | String (ASCII-8BIT) |
+97 -54
View File
@@ -1,6 +1,6 @@
# 🏛️ MagNetFlix — Architecture & System Design # 🏛️ MagNetFlix — System Architecture & Component Design
MagNetFlix uses a **Backend-For-Frontend (BFF)** pattern paired with an internal **gRPC Worker** pipeline service to decouple public web endpoints from disk I/O and media processing. MagNetFlix uses a **Backend-For-Frontend (BFF)** pattern paired with an internal **gRPC Pipeline Worker** service to decouple public web endpoints from disk I/O, BitTorrent network activity, and media processing.
--- ---
@@ -8,23 +8,24 @@ MagNetFlix uses a **Backend-For-Frontend (BFF)** pattern paired with an internal
```mermaid ```mermaid
flowchart TB flowchart TB
subgraph Edge ["🌐 Public Edge (Protected)"] subgraph Edge ["🌐 Public Edge (Protected Gateway)"]
Browser["User Browser"] -->|HTTPS| Traefik["Traefik Reverse Proxy"] Browser["User Browser\n(Web UI Dashboard)"] -->|HTTPS| Proxy["Reverse Proxy\n(Traefik / Nginx / Caddy)"]
Traefik <-->|Forward Auth| Authelia["Authelia SSO"] Extension["Browser Extension\n(One-Click Magnet Interceptor)"] -->|HTTPS| Proxy
Proxy <-->|Auth Forward / Bearer| SSO["Identity Provider / SSO\n(Authelia / Authentik / OAuth2-Proxy)"]
end end
subgraph InternalServices ["🛡️ Internal Services (Docker Network)"] subgraph InternalServices ["🛡️ Internal Service Tier (Docker Bridge)"]
Traefik -->|HTTP + Remote-User| BFF["FastAPI BFF Gateway"] Proxy -->|HTTP + Identity Headers| BFF["FastAPI BFF Gateway\n(Pluggable Auth Adapter & SSE Stream)"]
subgraph WorkerApp ["Worker Service"] subgraph WorkerApp ["Worker Service Tier"]
BFF -->|gRPC / Stream| Worker["gRPC Pipeline Server"] BFF -->|gRPC / Status Stream| Worker["gRPC Pipeline Worker"]
Worker --> DB[("SQLite 3 (WAL Mode)\nAudit & State Store")] Worker --> DB[("SQLite 3 (WAL Mode)\nJobs & Audit Store")]
Worker --> Sanitizer["Media Sanitizer & Allowlist"] Worker --> MetaService["TMDB Metadata Client\n(Early Resolution & Token Check)"]
Worker --> MetaService["TMDB Metadata Client"] Worker --> Sanitizer["Media Sanitizer & Allowlist\n(Two-Tier Security Boundary)"]
Worker --> StorageMgr["Library Relocator & Renamer"] Worker --> StorageMgr["Library Relocator & Renamer\n(Two-Stage Atomic Relocation)"]
end end
Worker --> Torrent["Transmission Daemon"] Worker -->|Offloaded RPC| Torrent["Transmission Daemon"]
end end
subgraph Volumes ["💾 Storage Mounts"] subgraph Volumes ["💾 Storage Mounts"]
@@ -33,9 +34,13 @@ flowchart TB
end end
``` ```
> **Design Decisions & Tradeoffs:**
> - [ADR 001: Pipeline Safety, Storage Boundaries, and BFF Dual-Client Architecture](adr/001-pipeline-safety-and-bff-dual-client.md)
> - [ADR 002: Pipeline Invariants, Two-Stage Metadata, and Active Reconciliation](adr/002-pipeline-invariants-and-active-reconciliation.md)
--- ---
## 🔄 Job State Machine & Lifecycle Rules ## 🔄 Job State Machine & Lifecycle Invariants
The pipeline worker operates strictly as a finite state machine with terminal failure handling. The pipeline worker operates strictly as a finite state machine with terminal failure handling.
@@ -44,74 +49,112 @@ stateDiagram-v2
[*] --> QUEUED: SubmitDownload() [*] --> QUEUED: SubmitDownload()
QUEUED --> DOWNLOADING: Transmission starts torrent QUEUED --> DOWNLOADING: Transmission starts torrent
DOWNLOADING --> SCANNING: Torrent reaches 100% DOWNLOADING --> SCANNING: Torrent reaches 100%
DOWNLOADING --> FAILED: Torrent error / stalled timeout DOWNLOADING --> FAILED: Torrent error / 15-min stall timeout
SCANNING --> VERIFYING_METADATA: Sanitizer validates payload SCANNING --> VERIFYING_METADATA: Two-Tier Sanitizer validates payload
SCANNING --> FAILED: Disallowed files / no valid video SCANNING --> FAILED: Security threat (symlink/traversal/exe) / no valid video
VERIFYING_METADATA --> ORGANIZING: TMDB match verified VERIFYING_METADATA --> ORGANIZING: Token overlap matches TMDB cache
VERIFYING_METADATA --> FAILED: Title/year mismatch or lookup failed VERIFYING_METADATA --> FAILED: Title/year token mismatch
ORGANIZING --> COMPLETED: Files relocated & renamed ORGANIZING --> COMPLETED: Files relocated & atomic swap complete
ORGANIZING --> FAILED: Disk full / permission error ORGANIZING --> FAILED: Target collision / disk full / permission error
COMPLETED --> [*] COMPLETED --> [*]
FAILED --> [*] FAILED --> [*]
``` ```
### Transition & Failure Invariants ### Transition & Concurrency Invariants
1. **Linear Progression**: `QUEUED` ➔ `DOWNLOADING` ➔ `SCANNING` ➔ `VERIFYING_METADATA` ➔ `ORGANIZING` ➔ `COMPLETED`. 1. **Linear Progression**: `QUEUED` ➔ `DOWNLOADING` ➔ `SCANNING` ➔ `VERIFYING_METADATA` ➔ `ORGANIZING` ➔ `COMPLETED`.
2. **Terminal Failure**: Any failure at any phase transitions the job directly to `FAILED` with a populated `error_message`. 2. **Terminal Failure**: Any failure at any phase transitions the job directly to `FAILED` with a populated `error_message`. Terminal states (`COMPLETED`, `FAILED`) are immutable.
3. **Crash & Restart Recovery**: Upon worker startup, any orphaned non-terminal jobs (`QUEUED`, `DOWNLOADING`, `SCANNING`, `VERIFYING_METADATA`, `ORGANIZING`) in the SQLite database are automatically transitioned to `FAILED` with reason `"Worker restarted during execution"`. Retrying requires a new submission. 3. **Active-Job Idempotency (`DEC-2`)**:
4. **Duplicate Rejection (Idempotency)**: - Submissions are rejected if a non-terminal job for the same `imdb_id` is currently active in SQLite.
- A submission is rejected if a non-terminal job for the same `imdb_id` is currently active in the database. - Enforced by a partial unique index: `uq_download_jobs_active_imdb_id ON download_jobs (imdb_id) WHERE state NOT IN ('COMPLETED', 'FAILED')`.
- A submission is rejected if `/media/movies/*[imdbid-{imdb_id}]` already exists in the destination library. - Submissions are rejected if `/media/movies/*[imdbid-{imdb_id}]` already exists in the destination library.
4. **Stalled Download Timeout (`DEC-6`)**: If a torrent achieves zero progress (0 bytes downloaded or unresolved magnet metadata) for 15 consecutive minutes, the job transitions to `FAILED` with reason `"Download stalled: no seeds or metadata timeout"`.
5. **Active Startup Crash Recovery (`DEC-6`)**: Upon worker startup, an active reconciliation sweep queries all orphaned non-terminal jobs:
- Transitions their SQLite state to `FAILED` with reason `"Worker restarted during execution"`.
- Actively signals Transmission via RPC to remove the torrent session via `info_hash` (`delete_data=True`).
- Purges scratch directories `/data/staging/<job_id>/` and `/media/movies/.staging_<job_id>/`.
--- ---
## 🛡️ Security & Media Sanitizer Specification ## 🛡️ Security & Media Sanitizer Specification (`DEC-3`)
The sanitizer enforces a strict file-system boundary before files are touched or moved: The sanitizer enforces a strict two-tier security boundary on untrusted torrent payloads before files are processed:
1. **Path Traversal & Symlink Check**: Rejects any archive or torrent payload containing symbolic links, hard links, or paths escaping the staging root (`..`). ### Tier 1: Hard-Fail Security Threats (Immediate Abort to `FAILED`)
2. **File Allowlist**: - **Filesystem Traversal**: Rejects any file or directory path that resolves outside `/data/staging/<job_id>/` or contains relative escaping elements (`..`).
- **Allowed Video**: `.mkv`, `.mp4`, `.avi`, `.webm` - **Links & Special Nodes**: Rejects any symbolic links (`os.path.islink`), hard links (`st_nlink > 1`), FIFOs, sockets, or device nodes.
- **Allowed Subtitles**: `.srt`, `.vtt`, `.sub`, `.ass` - **Dangerous Extensions**: Rejects any payload containing executable binaries, scripts, or disk images:
- **Forbidden / Quarantine**: `.exe`, `.bat`, `.cmd`, `.sh`, `.scr`, `.vbs`, `.lnk`, `.iso`, `.zip`, `.rar`, etc. `.exe`, `.bat`, `.cmd`, `.sh`, `.scr`, `.vbs`, `.ps1`, `.lnk`, `.iso`, `.zip`, `.rar`, `.7z`.
3. **Multiple Video Selection (Largest File Rule)**:
- Files containing `sample` in the filename or with size `< 100MB` are discarded. ### Tier 2: Allowlist Extraction & Safe Discard
- If multiple video files remain, the **single largest video file** is selected as the primary feature film. A warning is logged listing ignored video files. - **Allowed Video**: `.mkv`, `.mp4`, `.avi`, `.webm`
- If 0 eligible video files remain, the job transitions to `FAILED`. - **Allowed Subtitles**: `.srt`, `.vtt`, `.sub`, `.ass`
- **Harmless Clutter**: Benign non-media clutter (`.nfo`, `.txt`, `.jpg`, `.sfv`) is safely ignored during extraction and cleaned up when the scratch directory is purged.
- **Sample Discard**: Files containing `sample` in the filename or with size `< 100MB` are discarded.
- **Primary Video Selection**: The single largest remaining video file is selected as the feature film. If 0 eligible video files remain, the job transitions to `FAILED`.
--- ---
## 🎬 Metadata Authority & Verification Criteria ## 🎬 Metadata Authority & Two-Stage Lifecycle (`DEC-4`)
- **Authority**: **The Movie Database (TMDB) API** using the `/find/{imdb_id}?external_source=imdb_id` endpoint. - **Authority**: **The Movie Database (TMDB) API** using `/find/{imdb_id}?external_source=imdb_id`.
- **Verification Criteria**: - **Stage 1 (Early Ingestion Resolution)**:
- The canonical title and release year are fetched from TMDB. - Validates `imdb_id` format (`^tt\d{7,10}$`) and queries TMDB at submission/queueing time.
- A normalized token comparison is performed between the TMDB movie title/year and the torrent folder name / primary video filename. - Verifies the entity is a valid movie (rejects non-existent IDs and TV shows before downloading).
- If there is zero token overlap between the metadata title/year and the torrent name, the job transitions to `FAILED` (`"Torrent payload does not appear to match TMDB metadata"`). - Persists canonical `title` and `year` to `DownloadJob`, immediately populating live UI dashboards and SSE status frames.
- **Stage 2 (Post-Download Token Verification)**:
- Once the torrent completes, the worker compares cached `(title, year)` tokens against the primary video filename and torrent folder name.
- Executed entirely offline from the SQLite database cache without outbound network dependencies.
- Zero token overlap aborts the job to `FAILED` (`"Torrent payload does not appear to match TMDB metadata"`).
--- ---
## 📂 Storage Paths & Naming Convention ## 📂 Storage Architecture & Two-Stage Atomic Relocation (`DEC-5`)
- **Canonical Staging Path**: `/data/staging/<job_id>/` - **Canonical Staging Path**: `/data/staging/<job_id>/` (fast local scratch storage).
- **Canonical Library Destination**: - **Canonical Library Destination**:
```text ```text
/media/movies/<Title> (<Year>) [imdbid-<IMDbID>]/<Title> (<Year>).<ext> /media/movies/<Title> (<Year>) [imdbid-<IMDbID>]/<Title> (<Year>).<ext>
/media/movies/<Title> (<Year>) [imdbid-<IMDbID>]/<Title> (<Year>).en.srt /media/movies/<Title> (<Year>) [imdbid-<IMDbID>]/<Title> (<Year>).en.srt
/media/movies/<Title> (<Year>) [imdbid-<IMDbID>]/<Title> (<Year>).en.forced.srt
/media/movies/<Title> (<Year>) [imdbid-<IMDbID>]/<Title> (<Year>).ja.ass
``` ```
- **Cleanup**: The `/data/staging/<job_id>/` folder is purged immediately upon successful completion or terminal failure. - **Two-Stage Atomic Relocation (Cross-Volume Safe)**:
1. *Transfer Stage*: Validated video and subtitles are copied from `/data/staging/<job_id>/` to temporary staging on the destination mount: `/media/movies/.staging_<job_id>/` using `shutil.copy2`. Subtitles preserve native formats (`.srt`, `.vtt`, `.ass`) and parse language/forced tags with disambiguation indices (`.en.1.srt`) to prevent overwrites.
2. *Pre-check & Atomic Swap*: The worker verifies that `/media/movies/<Title> (<Year>) [imdbid-<IMDbID>]/` does not already exist. It then uses `os.replace` to atomically rename `.staging_<job_id>/` to the final path. This prevents media servers (Jellyfin/Plex) from indexing partially-copied media files.
- **Cleanup Invariant**:
- Scratch `/data/staging/<job_id>/` and any temporary `.staging_<job_id>/` are purged immediately upon `COMPLETED` or `FAILED`.
- Transmission session is removed via RPC `remove_torrent(info_hash, delete_data=True)` to prevent memory or tracker leaks.
--- ---
## 🔐 Security Boundaries & Health Endpoints ## ⚡ Async Concurrency & Thread Offloading (`DEC-7`)
### Authentication Trust Boundary - **Non-Blocking Worker Event Loop**:
- The FastAPI BFF trusts `Remote-User` and `Remote-Email` headers **strictly because it is reachable exclusively through the authenticated Traefik reverse proxy**. Direct ingress from outside the Docker network is prohibited. - The worker coordinates jobs using Python `asyncio` (`grpc.aio`, `aiosqlite`, `httpx`).
- All blocking operations (multi-gigabyte `shutil.copy2` transfers, synchronous `transmission-rpc` HTTP calls, and recursive filesystem scans) are dispatched to a dedicated bounded `ThreadPoolExecutor(max_workers=4)`.
- Database sessions are strictly short-lived; transactions are committed before long I/O operations and closed immediately.
- **In-Memory Pub/Sub Event Streaming**:
- An internal `asyncio.Queue` pub/sub broker broadcasts progress and state change events to connected `StreamJobStatus` gRPC streams without polling SQLite in tight loops.
- Graceful shutdown handles `SIGINT`/`SIGTERM` via `server.stop(grace=5)`.
### Health & Readiness Probes ---
- **BFF**: `GET /healthz` (Verifies FastAPI liveness + gRPC worker channel connectivity).
- **Worker**: gRPC standard health checking protocol (`grpc.health.v1.Health`) + Transmission RPC ping. ## 🌐 Pluggable Identity Adapter & Dual-Client BFF (`DEC-8`)
- **Pluggable Identity Adapter**:
- FastAPI middleware reads authenticated identity from upstream reverse proxies via configurable environment variables:
- `AUTH_ENABLED`: boolean (default: `true`; if `false`, defaults to `local_user` for offline/local development).
- `AUTH_HEADER_USER`: header name (default: `"Remote-User"`, configurable for Authentik, OAuth2-Proxy, etc.).
- `AUTH_HEADER_EMAIL`: header name (default: `"Remote-Email"`).
- **Server-Side Movie Search Proxy**:
- BFF exposes `GET /api/v1/movies/search?q=...` proxying official TMDB movie search queries server-side using `TMDB_API_KEY`.
- Eliminates client-side scraping of undocumented APIs and prevents browser CORS issues.
- **Dual Client Routes & Schemas**:
- Supports both the hosted Web UI dashboard and the companion browser extension (`magnetflix-extension`):
- `POST /api/v1/downloads` (canonical) and `POST /download` (extension alias).
- Pydantic validation aliases accept `magnet` / `magnet_uri` and `imdbid` / `imdb_id`.
- Real-time Server-Sent Events (SSE) route at `GET /api/v1/movies/events`.
+39 -23
View File
@@ -1,16 +1,16 @@
# 🚀 MagNetFlix — Deployment & Traefik Integration # 🚀 MagNetFlix — Deployment & Runtime Topology
This guide details how **MagNetFlix** integrates into the home server stack at `/home/kiskaadee/Deployments/` with **Traefik Reverse Proxy** and **Authelia SSO**. This guide details the container deployment architecture, storage boundaries, and reverse proxy / SSO integration for **MagNetFlix**.
--- ---
## 🐳 Docker Compose Architecture ## 🐳 Docker Compose Architecture
MagNetFlix runs as a multi-container stack attached to the shared `traefik_network`: MagNetFlix runs as an isolated multi-container stack connected to an internal service bridge, with public ingress routed through a reverse proxy (e.g. Traefik, Nginx, or Caddy) supporting forward-auth or OIDC proxy headers.
```yaml ```yaml
services: services:
# 1. FastAPI Web Gateway & Form UI # 1. FastAPI Web Gateway & BFF Dashboard
bff: bff:
build: build:
context: . context: .
@@ -19,12 +19,16 @@ services:
environment: environment:
- GRPC_WORKER_HOST=worker:50051 - GRPC_WORKER_HOST=worker:50051
- APP_ENV=production - APP_ENV=production
- AUTH_ENABLED=true
- AUTH_HEADER_USER=Remote-User
- AUTH_HEADER_EMAIL=Remote-Email
- TMDB_API_KEY=${TMDB_API_KEY}
networks: networks:
- traefik_network - traefik_network
- magnetflix_internal - magnetflix_internal
labels: labels:
- "traefik.enable=true" - "traefik.enable=true"
- "traefik.http.routers.magnetflix.rule=Host(`addmovie.arch-services.mywire.org`)" - "traefik.http.routers.magnetflix.rule=Host(`addmovie.roadtotech.me`)"
- "traefik.http.routers.magnetflix.entrypoints=websecure" - "traefik.http.routers.magnetflix.entrypoints=websecure"
- "traefik.http.routers.magnetflix.tls.certresolver=letsencrypt" - "traefik.http.routers.magnetflix.tls.certresolver=letsencrypt"
- "traefik.http.routers.magnetflix.middlewares=authelia@docker" - "traefik.http.routers.magnetflix.middlewares=authelia@docker"
@@ -39,16 +43,17 @@ services:
environment: environment:
- TRANSMISSION_HOST=transmission - TRANSMISSION_HOST=transmission
- TRANSMISSION_PORT=9091 - TRANSMISSION_PORT=9091
- DATABASE_URL=sqlite:////data/magnetflix.sqlite3 - DATABASE_URL=sqlite+aiosqlite:////data/magnetflix.sqlite3
- STAGING_DIR=/data/staging - STAGING_DIR=/data/staging
- MEDIA_DIR=/media/movies - MEDIA_DIR=/media/movies
- TMDB_API_KEY=${TMDB_API_KEY}
volumes: volumes:
- ./data:/data - ./data:/data
- /mnt/storage/media/movies:/media/movies - /mnt/storage/media/movies:/media/movies
networks: networks:
- magnetflix_internal - magnetflix_internal
# 3. Transmission Torrent Daemon # 3. Isolated Transmission Torrent Daemon
transmission: transmission:
image: lscr.io/linuxserver/transmission:latest image: lscr.io/linuxserver/transmission:latest
restart: unless-stopped restart: unless-stopped
@@ -58,7 +63,7 @@ services:
- TZ=America/Chicago - TZ=America/Chicago
volumes: volumes:
- ./config/transmission:/config - ./config/transmission:/config
- ./data/staging:/downloads - ./data/staging:/data/staging
networks: networks:
- magnetflix_internal - magnetflix_internal
@@ -71,23 +76,34 @@ networks:
--- ---
## 🔐 Authelia SSO Integration ## 🔐 Pluggable SSO / Reverse Proxy Identity Adapter (`DEC-8`)
When a user visits `addmovie.arch-services.mywire.org`: MagNetFlix does not couple its internal application logic to any specific identity provider. Instead, the FastAPI BFF operates an **Identity Adapter** extracting authenticated identity from upstream gateway headers:
1. Traefik triggers the `authelia@docker` forward-auth middleware.
2. If unauthenticated, Authelia redirects the user to the login portal. | Environment Variable | Default | Purpose |
3. Upon authentication, Authelia injects headers into the forwarded request: | :--- | :--- | :--- |
- `Remote-User`: Username of the logged-in user. | `AUTH_ENABLED` | `true` | If `false`, identity falls back to `local_user` for offline testing or standalone development. |
- `Remote-Email`: Email address. | `AUTH_HEADER_USER` | `Remote-User` | Name of the incoming HTTP header containing the verified username (e.g. Authelia, Authentik `X-authentik-username`, or OAuth2-Proxy `X-Forwarded-User`). |
- `Remote-Groups`: Group memberships (e.g. `admins`, `family`). | `AUTH_HEADER_EMAIL` | `Remote-Email` | Name of the HTTP header containing the user's verified email address. |
4. FastAPI extracts `request.headers.get("Remote-User")` and passes it to the gRPC worker for audit logging.
### Upstream Authentication Workflow
1. Client sends request to `addmovie.roadtotech.me`.
2. Reverse proxy executes forward-auth against the identity provider (Authelia, Authentik, etc.).
3. If valid, the proxy injects the configured identity header (`Remote-User`) and forwards the request to the BFF on `traefik_network`.
4. BFF extracts the verified identity and forwards it across the private gRPC boundary to the Worker for persistent audit logging.
--- ---
## 📂 Storage Volumes Configuration ## 📂 Storage Volume Invariants
| Mount Path | Type | Purpose | | Container Mount | Host Target | Filesystem Type | Purpose |
| :--- | :--- | :--- | | :--- | :--- | :--- | :--- |
| `/data/magnetflix.sqlite3` | Persistent Volume | SQLite DB with WAL mode for jobs and audit log. | | `/data/magnetflix.sqlite3` | Local persistent disk (`./data`) | Local SQLite (WAL Mode) | Job audit logs and pipeline state machine records. **Never place on NFS/SMB network shares.** |
| `/data/staging` | Fast Scratch Disk | Staging folder where Transmission downloads files. | | `/data/staging` | Fast scratch disk (`./data/staging`) | Fast local storage | Transmission scratch directory where torrent pieces land. Shared strictly between `worker` and `transmission`. |
| `/media/movies` | Media Storage | Final target destination mounted to Jellyfin/Plex. | | `/media/movies` | Media storage pool (`/mnt/storage/...`) | Media pool (ZFS/ext4) | Final Jellyfin/Plex target directory and temporary cross-volume staging (`.staging_<job_id>`). |
### Cross-Volume Publication & Atomic Swap (`DEC-5`)
Because `/data/staging` and `/media/movies` reside on distinct filesystems, cross-volume transfers cannot use filesystem hard-links (`EXDEV` error):
1. Files are copied across volumes to `/media/movies/.staging_<job_id>/` using `shutil.copy2`.
2. Once transfer and file sizes are verified, `os.replace` executes an instant atomic directory rename on the **same target filesystem** from `.staging_<job_id>/` to `/media/movies/<Title> (<Year>) [imdbid-<IMDbID>]/`.
3. Jellyfin and Plex library watchers will never detect, lock, or index partially transferred media files.
@@ -0,0 +1,61 @@
# 📜 Phase A Current-State Architectural Audit & Review Ledger
This historical record captures the findings, gap analysis, and architectural reconciliation conducted during the Phase A and Phase B review of **MagNetFlix** on 2026-10-30.
---
## 1. Initial State Inventory
- **Toolchain**: `uv` workspace with `services/worker` and `services/bff`, packaged via `uv_build`. Nix hermetic devShell in `flake.nix`.
- **Database**: SQLite WAL engine in `services/worker/src/worker/db/engine.py` with strict pragmas (`journal_mode=WAL; foreign_keys=ON; synchronous=NORMAL; busy_timeout=5000`). Initial Alembic migration `234da461ab5b_create_download_jobs_table.py` created the `download_jobs` table.
- **Protobuf**: Contract defined in `proto/magnetflix/v1/pipeline.proto`.
- **Tests**: 5 unit tests in `tests/test_db.py` verifying SQLite pragmas, CRUD operations, state transitions, and idempotency queries.
---
## 2. Identified Discrepancies & Defect Register
During read-only inspection of the repository and its runtime behavior, 8 concrete architectural gaps were validated:
1. **`GAP-1` (Protobuf Package Layout & Broken Imports)**:
- Generated stubs in `services/worker/src/worker/magnetflix/v1/pipeline_pb2_grpc.py` emitted `from magnetflix.v1 import pipeline_pb2`.
- Importing failed with `ModuleNotFoundError: No module named 'magnetflix'`.
- Masked because `pyproject.toml` excluded `services/**/magnetflix/` from `pyright` and `ruff`.
- Generated stubs were gitignored, and Dockerfiles omitted `buf generate` and Alembic migration scripts.
2. **`GAP-2` (Active Job Concurrency & Idempotency)**:
- `imdb_id` had only a non-unique index; application-level check-then-insert was vulnerable to TOCTOU races under concurrent submissions.
- `DownloadJob` had no `info_hash` column to track BitTorrent hashes.
3. **`GAP-3` (Sanitizer Policy Contradiction)**:
- Documentation contradicted whether to purge non-media clutter (`.nfo`, `.txt`, `.jpg`) or fail the entire job. Strict rejection failed ~95% of real torrents, while pure whitelisting allowed malicious symlinks and traversal payloads.
4. **`GAP-4` (Subtitle Selection & Relocation Collisions)**:
- Sanitizer accepted `.srt`, `.vtt`, `.sub`, `.ass`, but relocator spec forced `<Title> (<Year>).en.srt`, corrupting non-SRT formats and overwriting multi-track subtitles.
5. **`GAP-5` (Metadata Resolution Timing)**:
- Querying TMDB only after download left UI live dashboard titles blank during downloads and wasted gigabytes on invalid IDs.
6. **`GAP-6` (Crash Recovery & Daemon State)**:
- Marking DB rows `FAILED` on restart left Transmission actively downloading torrents and abandoned staging disks.
7. **`GAP-7` (Async Concurrency & Blocking Disk I/O)**:
- Synchronous `shutil.copy2` on 30GB files and synchronous `transmission-rpc` blocked Python's single async event loop, freezing gRPC and SSE streams.
8. **`GAP-8` (SSO Decoupling & Movie Search)**:
- Hardcoded Authelia headers tightly coupled the app to specific homelab infrastructure. Prototype extension queried undocumented IMDb APIs directly from the browser.
---
## 3. Accepted Architectural Decisions Summary
| Decision ID | Area | Accepted Resolution |
| :--- | :--- | :--- |
| **`DEC-1`** | Protobuf Packaging | Dedicated `services/contracts` workspace package (`magnetflix` module); commit stubs and docs to Git; update Dockerfiles. |
| **`DEC-2`** | Database Hardening | Add SQLite partial unique index `uq_download_jobs_active_imdb_id` (`WHERE state NOT IN ('COMPLETED', 'FAILED')`) and indexed `info_hash` column. |
| **`DEC-3`** | Sanitizer Boundary | Two-tier sanitizer: hard-fail on symlinks, hard links, traversal, special files, executables/archives; ignore benign clutter; extract allowlisted media; select largest primary video. |
| **`DEC-4`** | TMDB Metadata | Two-stage lifecycle: resolve TMDB `(title, year)` early on ingestion to validate ID and populate UI; verify token overlap post-download offline from SQLite cache. |
| **`DEC-5`** | Subtitle Relocation | Multi-track format preservation: retain `.srt`/`.vtt`/`.ass` extensions, parse language/forced tags with disambiguation indices (`.en.1.srt`), safe two-stage atomic directory swap. |
| **`DEC-6`** | Crash Recovery | Active startup reconciliation sweep: auto-fail orphaned DB jobs, purge staging directories, remove torrents from Transmission via `info_hash`; enforce 15-min stall timeout. |
| **`DEC-7`** | Async Concurrency | Bounded `ThreadPoolExecutor(max_workers=4)` for blocking disk I/O and RPCs; short-lived DB sessions; in-memory `asyncio.Queue` pub/sub broadcaster for SSE. |
| **`DEC-8`** | Pluggable Auth & Search | Configurable SSO identity adapter middleware (`AUTH_HEADER_USER`); server-side TMDB search proxy (`GET /api/v1/movies/search`); dual route bindings (`POST /api/v1/downloads` & `POST /download`). |
---
## 4. Portfolio Engineering Assessment
- **Key Competencies**: Clean separation of concerns (BFF + gRPC Worker + Transmission daemon); defense-in-depth security boundary; cross-volume filesystem atomicity (`EXDEV` safe); SQLite WAL concurrency; non-blocking async architecture.
- **Scope Discipline**: Explicitly designed as a robust single-node self-hosted pipeline; BitTorrent daemon boundary respected; no speculative microservice bloat.
+2 -2
View File
@@ -31,14 +31,14 @@ sequenceDiagram
participant Engine as Transmission Daemon participant Engine as Transmission Daemon
participant Media as Jellyfin / Plex Library participant Media as Jellyfin / Plex Library
User->>Traefik: GET addmovie.arch-services.mywire.org User->>Traefik: GET addmovie.roadtotech.me
Traefik->>User: Renders MagNetFlix Web Form Traefik->>User: Renders MagNetFlix Web Form
User->>Traefik: Submit form (magnet URI + IMDb ID: tt1375666) User->>Traefik: Submit form (magnet URI + IMDb ID: tt1375666)
Traefik->>BFF: POST /api/v1/downloads (includes Remote-User header) Traefik->>BFF: POST /api/v1/downloads (includes Remote-User header)
BFF->>Worker: gRPC SubmitDownload(magnet, imdb_id, user) BFF->>Worker: gRPC SubmitDownload(magnet, imdb_id, user)
Worker-->>BFF: Acknowledged (Job ID: job-42) Worker-->>BFF: Acknowledged (Job ID: job-42)
BFF-->>User: Enqueued! Showing live progress BFF-->>User: Enqueued! Showing live progress
Worker->>Engine: Start torrent download in /tmp/staging/job-42 Worker->>Engine: Start torrent download in /data/staging/job-42
Engine-->>Worker: Download Completed Engine-->>Worker: Download Completed
Worker->>Worker: Run Security Whitelist Scan (Purge .exe/.bat) Worker->>Worker: Run Security Whitelist Scan (Purge .exe/.bat)
Worker->>Worker: Verify IMDb metadata & rename files Worker->>Worker: Verify IMDb metadata & rename files
+111 -54
View File
@@ -1,73 +1,130 @@
# 🗺️ MagNetFlix — Development Roadmap # 🗺️ MagNetFlix — Reconciled Implementation Roadmap
This roadmap breaks down the construction of **MagNetFlix** into clear, incremental milestones with testing embedded in each stage. This roadmap breaks down the completion of **MagNetFlix** into clear, dependency-ordered milestones. Each milestone includes explicit prerequisites, work items, and verifiable exit criteria.
--- ---
## 🎯 Milestones Overview ## 🎯 Milestones Dependency Graph
```mermaid ```mermaid
gantt flowchart TD
title MagNetFlix Implementation Phases M1["Milestone 1: Contracts, Toolchain & DB Hardening\n(GAP-1, GAP-2, TD-1, TD-2, TD-3)"]
dateFormat YYYY-MM-DD M2["Milestone 2: Pipeline Domain Engine & Filesystem Safety\n(GAP-3, GAP-4, GAP-5)"]
section Phase 1 M3["Milestone 3: Transmission Integration & Worker Coordinator\n(GAP-6, GAP-7)"]
Workspace & Protobuf Contract :p1, 2026-09-01, 2d M4["Milestone 4: FastAPI BFF Gateway, SSE & Web UI\n(GAP-8)"]
section Phase 2 M5["Milestone 5: Multi-Container Stack & Deployment Verification\n(Traefik, SSO, Compose)"]
Worker Engine & Pipeline Modules :p2, after p1, 4d
Worker Unit & Component Tests :p2_test, after p2, 2d M1 --> M2
section Phase 3 M2 --> M3
FastAPI BFF & Web UI (SSE) :p3, after p2_test, 3d M3 --> M4
BFF & gRPC Integration Tests :p3_test, after p3, 2d M4 --> M5
section Phase 4
Traefik SSO & Docker Compose :p4, after p3_test, 2d
End-to-End Verification :p4_test, after p4, 1d
``` ```
--- ---
## 📌 Phase 1: Repository Foundation & Protobuf Contracts ## 📌 Milestone 1: Contracts, Toolchain & Database Hardening
- [x] Initialize `uv` workspace with `services/bff` and `services/worker`. - **Objective:** Fix broken gRPC stub imports, ensure 100% reproducible offline container builds, eliminate the active-job deduplication race, and establish database schema invariants.
- [x] Configure `buf.yaml` and `buf.gen.yaml` with Python & gRPC stubs generation. - **Dependencies:** None.
- [x] Define `proto/magnetflix/v1/pipeline.proto` with pagination, `updated_at`, and streaming snapshot semantics. - **Requirements Satisfied:** `REQ-1`, `REQ-2`.
- [x] Create developer guidelines (`AGENTS.md` and `CLAUDE.md`). - **Work Items:**
- [ ] `M1.1`: Create `services/contracts` workspace package (`pyproject.toml`, `module-name = "magnetflix"`).
- [ ] `M1.2`: Reconfigure `buf.gen.yaml` to output stubs into `services/contracts/src`; generate and track stubs + `docs/api_spec.md` in Git (`DEC-1`).
- [ ] `M1.3`: Update dependencies in `services/worker` and `services/bff` to include `magnetflix-contracts = { workspace = true }`.
- [ ] `M1.4`: Update `pyproject.toml` to include `tests/` in `pyright`, remove exclusions that masked broken imports, and add `test:` target to `Makefile`.
- [ ] `M1.5`: Update `services/worker/Dockerfile` and `services/bff/Dockerfile` to copy `services/contracts`, and include `alembic.ini` and `alembic/` in the Worker image.
- [ ] `M1.6`: Create Alembic migration `002_add_info_hash_and_partial_unique_index.py` adding `info_hash` column and `uq_download_jobs_active_imdb_id` index (`DEC-2`).
- [ ] `M1.7`: Update `DownloadJob` model and add unit tests in `tests/test_db.py` verifying duplicate active insertion rejection.
- **Verifiable Exit Criteria:**
- `uv run python -c "from magnetflix.v1 import pipeline_pb2, pipeline_pb2_grpc"` succeeds with 0 errors.
- `uv run ruff check .` and `uv run pyright` pass cleanly across the entire workspace including contracts and tests.
- `uv run pytest tests/test_db.py` passes all tests including partial unique index verification.
--- ---
## 📌 Phase 2: Pipeline Worker & Security Engine ## 📌 Milestone 2: Pipeline Domain Engine & Filesystem Safety
- [ ] Set up SQLite with WAL mode via SQLAlchemy 2.0 and Alembic migrations. - **Objective:** Implement core business logic and security boundary modules: untrusted payload sanitization, metadata verification, and cross-volume publication.
- [ ] Implement Transmission daemon RPC client wrapper. - **Dependencies:** Milestone 1.
- [ ] Implement isolated scratch staging (`/data/staging/<job_id>`). - **Requirements Satisfied:** `REQ-3`, `REQ-4`, `REQ-5`.
- [ ] Build **Media Sanitizer & Allowlist**: - **Work Items:**
- Symlink & path traversal blocker. - [ ] `M2.1`: Implement Media Sanitizer (`services/worker/src/worker/sanitizer.py`) adhering to `DEC-3`:
- Video & subtitle extension whitelist. - Hard-fail on symlinks, hard links, `..` traversal, special files, and dangerous extensions (`.exe`, `.bat`, `.sh`, `.iso`, `.zip`).
- Sample file discard (<100MB / "sample") & largest video file selector. - Safely ignore benign clutter (`.nfo`, `.txt`, `.jpg`, `.sfv`).
- [ ] Build **TMDB Metadata Verifier**: Fetch title/year from TMDB via IMDb ID and perform token overlap verification. - Discard samples (`< 100MB` or containing `sample`); select largest primary video and allowlisted subtitles (`.srt`, `.vtt`, `.ass`).
- [ ] Build **Library Relocator**: Move verified video and `.srt` files into final Jellyfin/Plex structure. - [ ] `M2.2`: Write unit tests in `tests/test_sanitizer.py` verifying all security, allowlist, and sample discard rules.
- [ ] **Phase 2 Tests**: - [ ] `M2.3`: Implement TMDB Client & Token Verifier (`services/worker/src/worker/metadata.py`) adhering to `DEC-4`:
- `tests/test_sanitizer.py`: Unit tests for allowlist, traversal, and largest video file selection. - Early resolution via `GET /find/{imdb_id}?external_source=imdb_id` using `httpx.AsyncClient`.
- `tests/test_metadata.py`: Unit tests for TMDB client and token matching logic. - Validates IMDb ID format, validates movie entity type, extracts `(title, year)`.
- `tests/test_state_machine.py`: Unit tests for linear transitions, failure transitions, and restart recovery. - Post-download normalized token comparison between cached `(title, year)` and primary video filename.
- `tests/test_transmission.py`: Mocked Transmission RPC client tests. - [ ] `M2.4`: Write unit tests in `tests/test_metadata.py` with mocked TMDB HTTP responses (match, 404, non-movie, mismatch).
- [ ] `M2.5`: Implement Library Relocator (`services/worker/src/worker/relocator.py`) adhering to `DEC-5`:
- Multi-track subtitle format preservation (`.srt`, `.vtt`, `.ass`) with language and disambiguation tags.
- Two-stage copy-and-swap: copy to `/media/movies/.staging_<job_id>/`, pre-check destination directory existence, and atomically swap via `os.replace`.
- [ ] `M2.6`: Write unit tests in `tests/test_relocator.py` asserting destination file layout and atomic swap error handling.
- **Verifiable Exit Criteria:**
- `uv run pytest tests/test_sanitizer.py tests/test_metadata.py tests/test_relocator.py` passes 100%.
- Zero filesystem breakout vulnerabilities possible under synthetic traversal fixtures.
--- ---
## 📌 Phase 3: BFF Gateway & Live Dashboard ## 📌 Milestone 3: Transmission Integration & Worker Coordinator
- [ ] Build FastAPI application with Pydantic v2 schemas. - **Objective:** Wrap Transmission RPC, coordinate the pipeline finite state machine, implement startup crash recovery, and expose the gRPC service.
- [ ] Add Authelia SSO header middleware (`Remote-User`, `Remote-Email`). - **Dependencies:** Milestone 2.
- [ ] Implement gRPC client wrapper in BFF. - **Requirements Satisfied:** `REQ-6`, `REQ-7`, `REQ-8`.
- [ ] Build clean HTML form (PicoCSS / Tailwind) for adding movies. - **Work Items:**
- [ ] Implement Server-Sent Events (SSE) route `/api/v1/movies/events` connected to gRPC streaming updates. - [ ] `M3.1`: Implement Transmission RPC Client Wrapper (`services/worker/src/worker/transmission.py`) adhering to `DEC-6`:
- [ ] Build live progress dashboard showing active and completed downloads. - `add_torrent(magnet_uri, download_dir=/data/staging/<job_id>)`.
- [ ] **Phase 3 Tests**: - `get_progress(info_hash)` returning progress percentage and download speed.
- `tests/test_bff_routes.py`: FastAPI route and header extraction tests. - `remove_torrent(info_hash, delete_data=True)` for terminal cleanup.
- `tests/test_grpc_integration.py`: End-to-end gRPC communication between BFF and Worker. - [ ] `M3.2`: Write unit tests in `tests/test_transmission.py` with mocked RPC client.
- `tests/test_sse_stream.py`: SSE stream snapshot and event emission tests. - [ ] `M3.3`: Implement Pipeline Coordinator & State Machine (`services/worker/src/worker/pipeline.py`) adhering to `DEC-6` & `DEC-7`:
- State progression: `QUEUED` $\rightarrow$ `DOWNLOADING` $\rightarrow$ `SCANNING` $\rightarrow$ `VERIFYING_METADATA` $\rightarrow$ `ORGANIZING` $\rightarrow$ `COMPLETED`.
- 15-minute stalled torrent timeout.
- Startup crash recovery: query orphaned jobs, fail DB rows, purge staging directories, remove torrents from Transmission.
- Dedicated bounded `ThreadPoolExecutor(max_workers=4)` for offloading disk I/O and synchronous Transmission calls.
- In-memory `asyncio.Queue` broadcaster for real-time status streaming.
- [ ] `M3.4`: Implement gRPC Server Servicer (`services/worker/src/worker/service.py` & `main.py`) adhering to `pipeline.proto`:
- Implements `SubmitDownload`, `GetJob`, `ListJobs`, and `StreamJobStatus`.
- Maps application errors to proper gRPC status codes (`ALREADY_EXISTS`, `NOT_FOUND`, `INVALID_ARGUMENT`).
- [ ] `M3.5`: Write integration tests in `tests/test_pipeline.py` and `tests/test_grpc_service.py`.
- **Verifiable Exit Criteria:**
- `uv run pytest tests/test_pipeline.py tests/test_grpc_service.py` passes 100%.
- Worker process cleanly starts, handles startup reconciliation, and shuts down gracefully with `SIGTERM`.
--- ---
## 📌 Phase 4: Containerization & Traefik Integration ## 📌 Milestone 4: FastAPI BFF Gateway, SSE & Web UI
- [ ] Create multi-stage `Dockerfile` for `bff` and `worker`. - **Objective:** Implement the user-facing web gateway, pluggable SSO identity adapter, server-side TMDB search proxy, real-time SSE stream, and single-origin UI.
- [ ] Create production-ready `docker-compose.yml` including Transmission daemon and shared volumes. - **Dependencies:** Milestone 3.
- [ ] Configure Traefik labels for `addmovie.arch-services.mywire.org` with Authelia middleware. - **Requirements Satisfied:** `REQ-9`, `REQ-10`.
- [ ] Configure health and readiness probes (`/healthz`, gRPC health service). - **Work Items:**
- [ ] **Phase 4 Tests**: Full end-to-end dry-run with a public domain torrent. - [ ] `M4.1`: Implement Pluggable Identity Adapter Middleware in FastAPI (`DEC-8`):
- Configurable via `AUTH_ENABLED`, `AUTH_HEADER_USER`, `AUTH_HEADER_EMAIL`, with safe dev fallback (`local_user`).
- [ ] `M4.2`: Implement BFF gRPC Client Wrapper (`services/bff/src/bff/grpc_client.py`):
- Channels calls to Worker (`SubmitDownload`, `GetJob`, `ListJobs`, `StreamJobStatus`).
- [ ] `M4.3`: Implement REST Endpoints & Schemas (`services/bff/src/bff/main.py`):
- Dual route bindings: `POST /api/v1/downloads` and `POST /download` with Pydantic aliases (`magnet`/`magnet_uri`, `imdbid`/`imdb_id`).
- Server-side TMDB movie search proxy: `GET /api/v1/movies/search?q=...`.
- Server-Sent Events stream: `GET /api/v1/movies/events`.
- [ ] `M4.4`: Embed Hosted Web UI (`services/bff/src/bff/templates/` & `static/`):
- Clean, responsive dashboard (adapted from extension prototype `app.html`/`app.css`).
- Movie search autocomplete with poster previews, magnet input, and live progress bars.
- [ ] `M4.5`: Write API tests in `tests/test_bff_routes.py` covering auth extraction, dual routes, search proxy, and SSE streams.
- **Verifiable Exit Criteria:**
- `uv run pytest tests/test_bff_routes.py` passes 100%.
- BFF connects to gRPC worker, serves Web UI, and streams live download progress without browser CORS errors.
---
## 📌 Milestone 5: Multi-Container Stack & Deployment Verification
- **Objective:** Deliver production-ready containerization, Docker Compose stack, Traefik integration, and end-to-end slice verification.
- **Dependencies:** Milestone 4.
- **Requirements Satisfied:** `REQ-11`.
- **Work Items:**
- [ ] `M5.1`: Finalize `services/worker/Dockerfile` and `services/bff/Dockerfile`.
- [ ] `M5.2`: Author canonical `docker-compose.yml` defining `bff`, `worker`, and `transmission` services, volume mounts (`./data`, `/media/movies`), and internal/external networks.
- [ ] `M5.3`: Configure health probes: BFF `GET /healthz`, Worker gRPC standard health check.
- [ ] `M5.4`: Execute end-to-end integration test with a small public domain/legal torrent:
- Verify full lifecycle: Form submission $\rightarrow$ Transmission download $\rightarrow$ Sanitizer scan $\rightarrow$ Metadata token check $\rightarrow$ Two-stage atomic relocation into Jellyfin/Plex format $\rightarrow$ Live SSE completion update.
- **Verifiable Exit Criteria:**
- `docker compose build` succeeds with zero errors from a fresh checkout.
- Full end-to-end vertical slice runs to completion with media appearing in `/media/movies/<Title> (<Year>) [imdbid-<IMDbID>]/`.
+13 -4
View File
@@ -16,20 +16,29 @@ dev = [
"mypy-protobuf>=5.1.0", "mypy-protobuf>=5.1.0",
"pyright>=1.1.411", "pyright>=1.1.411",
"pytest>=8.0.0", "pytest>=8.0.0",
"pytest-asyncio>=0.24.0",
"ruff>=0.16.5", "ruff>=0.16.5",
] ]
[tool.pyright] [tool.pyright]
venvPath = "." venvPath = "."
venv = ".venv" venv = ".venv"
extraPaths = ["services/bff/src", "services/worker/src"] extraPaths = ["services/bff/src", "services/worker/src", "services/contracts/src"]
include = ["services"] include = ["services/bff", "services/worker", "tests"]
exclude = ["**/__pycache__", "services/**/magnetflix/"] exclude = ["**/__pycache__"]
reportIncompatibleVariableOverride = "none"
[tool.ruff] [tool.ruff]
line-length = 88 line-length = 88
target-version = "py312" target-version = "py312"
extend-exclude = ["services/**/magnetflix/"] extend-exclude = ["services/contracts/src/magnetflix/v1/"]
[tool.ruff.lint] [tool.ruff.lint]
select = ["E", "F", "I"] select = ["E", "F", "I"]
[tool.pytest.ini_options]
asyncio_mode = "auto"
asyncio_default_fixture_loop_scope = "function"
testpaths = ["tests"]
pythonpath = ["services/bff/src", "services/worker/src", "services/contracts/src"]
+3
View File
@@ -0,0 +1,3 @@
# MagNetFlix BFF
FastAPI Backend-for-Frontend and Web Gateway for MagNetFlix.
+9
View File
@@ -11,8 +11,17 @@ dependencies = [
"protobuf>=7.36.1", "protobuf>=7.36.1",
"pydantic>=2.10.0", "pydantic>=2.10.0",
"uvicorn[standard]>=0.32.0", "uvicorn[standard]>=0.32.0",
"magnetflix-contracts",
] ]
[build-system] [build-system]
requires = ["uv_build>=0.12.5,<0.13.0"] requires = ["uv_build>=0.12.5,<0.13.0"]
build-backend = "uv_build" build-backend = "uv_build"
[tool.uv.build-backend]
module-name = "bff"
module-root = "src"
[tool.uv.sources]
magnetflix-contracts = { workspace = true }
+3
View File
@@ -0,0 +1,3 @@
# MagNetFlix Contracts
Shared Protobuf and gRPC stubs generated from `proto/` definitions for the MagNetFlix workspace.
+18
View File
@@ -0,0 +1,18 @@
[project]
name = "magnetflix-contracts"
version = "0.1.0"
description = "Protobuf and gRPC schemas and stubs for MagNetFlix"
readme = "README.md"
requires-python = ">=3.12"
dependencies = [
"grpcio>=1.83.1",
"protobuf>=7.36.2",
]
[build-system]
requires = ["uv_build>=0.12.5,<0.13.0"]
build-backend = "uv_build"
[tool.uv.build-backend]
module-name = "magnetflix"
module-root = "src"
@@ -0,0 +1,3 @@
"""Shared Protobuf and gRPC schemas and stubs for MagNetFlix."""
__version__ = "0.1.0"
@@ -0,0 +1,57 @@
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# NO CHECKED-IN PROTOBUF GENCODE
# source: magnetflix/v1/pipeline.proto
# Protobuf Python Version: 7.36.2
"""Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_pool
from google.protobuf import runtime_version as _runtime_version
from google.protobuf import symbol_database as _symbol_database
from google.protobuf.internal import builder as _builder
_runtime_version.ValidateProtobufRuntimeVersion(
_runtime_version.Domain.PUBLIC,
7,
36,
2,
'',
'magnetflix/v1/pipeline.proto'
)
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1cmagnetflix/v1/pipeline.proto\x12\rmagnetflix.v1\x1a\x1fgoogle/protobuf/timestamp.proto\"r\n\x15SubmitDownloadRequest\x12\x1d\n\nmagnet_uri\x18\x01 \x01(\tR\tmagnetUri\x12\x17\n\x07imdb_id\x18\x02 \x01(\tR\x06imdbId\x12!\n\x0crequested_by\x18\x03 \x01(\tR\x0brequestedBy\"I\n\x16SubmitDownloadResponse\x12\x15\n\x06job_id\x18\x01 \x01(\tR\x05jobId\x12\x18\n\x07message\x18\x02 \x01(\tR\x07message\"&\n\rGetJobRequest\x12\x15\n\x06job_id\x18\x01 \x01(\tR\x05jobId\"<\n\x0eGetJobResponse\x12*\n\x03job\x18\x01 \x01(\x0b\x32\x18.magnetflix.v1.JobStatusR\x03job\"/\n\x16StreamJobStatusRequest\x12\x15\n\x06job_id\x18\x01 \x01(\tR\x05jobId\"E\n\x17StreamJobStatusResponse\x12*\n\x03job\x18\x01 \x01(\x0b\x32\x18.magnetflix.v1.JobStatusR\x03job\"\x89\x01\n\x0fListJobsRequest\x12\x1b\n\tpage_size\x18\x01 \x01(\x05R\x08pageSize\x12\x1d\n\npage_token\x18\x02 \x01(\tR\tpageToken\x12:\n\x0cstate_filter\x18\x03 \x01(\x0e\x32\x17.magnetflix.v1.JobStateR\x0bstateFilter\"\xe4\x03\n\tJobStatus\x12\x15\n\x06job_id\x18\x01 \x01(\tR\x05jobId\x12\x17\n\x07imdb_id\x18\x02 \x01(\tR\x06imdbId\x12\x14\n\x05title\x18\x03 \x01(\tR\x05title\x12\x12\n\x04year\x18\x04 \x01(\x05R\x04year\x12!\n\x0crequested_by\x18\x05 \x01(\tR\x0brequestedBy\x12-\n\x05state\x18\x06 \x01(\x0e\x32\x17.magnetflix.v1.JobStateR\x05state\x12!\n\x0cprogress_pct\x18\x07 \x01(\x02R\x0bprogressPct\x12.\n\x13\x64ownload_rate_bytes\x18\x08 \x01(\x03R\x11\x64ownloadRateBytes\x12#\n\rerror_message\x18\t \x01(\tR\x0c\x65rrorMessage\x12\x39\n\ncreated_at\x18\n \x01(\x0b\x32\x1a.google.protobuf.TimestampR\tcreatedAt\x12\x39\n\nupdated_at\x18\x0b \x01(\x0b\x32\x1a.google.protobuf.TimestampR\tupdatedAt\x12=\n\x0c\x63ompleted_at\x18\x0c \x01(\x0b\x32\x1a.google.protobuf.TimestampR\x0b\x63ompletedAt\"h\n\x10ListJobsResponse\x12,\n\x04jobs\x18\x01 \x03(\x0b\x32\x18.magnetflix.v1.JobStatusR\x04jobs\x12&\n\x0fnext_page_token\x18\x02 \x01(\tR\rnextPageToken*\xd9\x01\n\x08JobState\x12\x19\n\x15JOB_STATE_UNSPECIFIED\x10\x00\x12\x14\n\x10JOB_STATE_QUEUED\x10\x01\x12\x19\n\x15JOB_STATE_DOWNLOADING\x10\x02\x12\x16\n\x12JOB_STATE_SCANNING\x10\x03\x12 \n\x1cJOB_STATE_VERIFYING_METADATA\x10\x04\x12\x18\n\x14JOB_STATE_ORGANIZING\x10\x05\x12\x17\n\x13JOB_STATE_COMPLETED\x10\x06\x12\x14\n\x10JOB_STATE_FAILED\x10\x07\x32\xe8\x02\n\x0fPipelineService\x12]\n\x0eSubmitDownload\x12$.magnetflix.v1.SubmitDownloadRequest\x1a%.magnetflix.v1.SubmitDownloadResponse\x12\x45\n\x06GetJob\x12\x1c.magnetflix.v1.GetJobRequest\x1a\x1d.magnetflix.v1.GetJobResponse\x12\x62\n\x0fStreamJobStatus\x12%.magnetflix.v1.StreamJobStatusRequest\x1a&.magnetflix.v1.StreamJobStatusResponse0\x01\x12K\n\x08ListJobs\x12\x1e.magnetflix.v1.ListJobsRequest\x1a\x1f.magnetflix.v1.ListJobsResponseb\x06proto3')
_globals = globals()
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'magnetflix.v1.pipeline_pb2', _globals)
if not _descriptor._USE_C_DESCRIPTORS:
DESCRIPTOR._loaded_options = None
_globals['_JOBSTATE']._serialized_start=1227
_globals['_JOBSTATE']._serialized_end=1444
_globals['_SUBMITDOWNLOADREQUEST']._serialized_start=80
_globals['_SUBMITDOWNLOADREQUEST']._serialized_end=194
_globals['_SUBMITDOWNLOADRESPONSE']._serialized_start=196
_globals['_SUBMITDOWNLOADRESPONSE']._serialized_end=269
_globals['_GETJOBREQUEST']._serialized_start=271
_globals['_GETJOBREQUEST']._serialized_end=309
_globals['_GETJOBRESPONSE']._serialized_start=311
_globals['_GETJOBRESPONSE']._serialized_end=371
_globals['_STREAMJOBSTATUSREQUEST']._serialized_start=373
_globals['_STREAMJOBSTATUSREQUEST']._serialized_end=420
_globals['_STREAMJOBSTATUSRESPONSE']._serialized_start=422
_globals['_STREAMJOBSTATUSRESPONSE']._serialized_end=491
_globals['_LISTJOBSREQUEST']._serialized_start=494
_globals['_LISTJOBSREQUEST']._serialized_end=631
_globals['_JOBSTATUS']._serialized_start=634
_globals['_JOBSTATUS']._serialized_end=1118
_globals['_LISTJOBSRESPONSE']._serialized_start=1120
_globals['_LISTJOBSRESPONSE']._serialized_end=1224
_globals['_PIPELINESERVICE']._serialized_start=1447
_globals['_PIPELINESERVICE']._serialized_end=1807
# @@protoc_insertion_point(module_scope)
@@ -0,0 +1,327 @@
"""
@generated by mypy-protobuf. Do not edit manually!
isort:skip_file
"""
from collections import abc as _abc
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import timestamp_pb2 as _timestamp_pb2
from google.protobuf.internal import containers as _containers
from google.protobuf.internal import enum_type_wrapper as _enum_type_wrapper
import builtins as _builtins
import sys
import typing as _typing
if sys.version_info >= (3, 11):
from typing import TypeAlias as _TypeAlias, Never as _Never
else:
from typing_extensions import TypeAlias as _TypeAlias, Never as _Never
DESCRIPTOR: _descriptor.FileDescriptor
class _JobState:
ValueType = _typing.NewType("ValueType", _builtins.int)
V: _TypeAlias = ValueType # noqa: Y015
class _JobStateEnumTypeWrapper(_enum_type_wrapper._EnumTypeWrapper[_JobState.ValueType], _builtins.type):
DESCRIPTOR: _descriptor.EnumDescriptor
JOB_STATE_UNSPECIFIED: _JobState.ValueType # 0
JOB_STATE_QUEUED: _JobState.ValueType # 1
JOB_STATE_DOWNLOADING: _JobState.ValueType # 2
JOB_STATE_SCANNING: _JobState.ValueType # 3
JOB_STATE_VERIFYING_METADATA: _JobState.ValueType # 4
JOB_STATE_ORGANIZING: _JobState.ValueType # 5
JOB_STATE_COMPLETED: _JobState.ValueType # 6
JOB_STATE_FAILED: _JobState.ValueType # 7
class JobState(_JobState, metaclass=_JobStateEnumTypeWrapper):
"""State enumeration of a download job lifecycle."""
JOB_STATE_UNSPECIFIED: JobState.ValueType # 0
JOB_STATE_QUEUED: JobState.ValueType # 1
JOB_STATE_DOWNLOADING: JobState.ValueType # 2
JOB_STATE_SCANNING: JobState.ValueType # 3
JOB_STATE_VERIFYING_METADATA: JobState.ValueType # 4
JOB_STATE_ORGANIZING: JobState.ValueType # 5
JOB_STATE_COMPLETED: JobState.ValueType # 6
JOB_STATE_FAILED: JobState.ValueType # 7
Global___JobState: _TypeAlias = JobState # noqa: Y015
@_typing.final
class SubmitDownloadRequest(_message.Message):
"""Request to submit a new movie download."""
DESCRIPTOR: _descriptor.Descriptor
MAGNET_URI_FIELD_NUMBER: _builtins.int
IMDB_ID_FIELD_NUMBER: _builtins.int
REQUESTED_BY_FIELD_NUMBER: _builtins.int
magnet_uri: _builtins.str
"""Magnet URI of the torrent to fetch."""
imdb_id: _builtins.str
"""IMDb ID of the movie (e.g., "tt1375666")."""
requested_by: _builtins.str
"""Username of the user requesting the download (from Authelia Remote-User)."""
def __init__(
self,
*,
magnet_uri: _builtins.str = ...,
imdb_id: _builtins.str = ...,
requested_by: _builtins.str = ...,
) -> None: ...
_HasFieldArgType: _TypeAlias = _Never # noqa: Y015
def HasField(self, field_name: _HasFieldArgType) -> _builtins.bool: ...
_ClearFieldArgType: _TypeAlias = _typing.Literal["imdb_id", b"imdb_id", "magnet_uri", b"magnet_uri", "requested_by", b"requested_by"] # noqa: Y015
def ClearField(self, field_name: _ClearFieldArgType) -> None: ...
def WhichOneof(self, oneof_group: _Never) -> None: ...
Global___SubmitDownloadRequest: _TypeAlias = SubmitDownloadRequest # noqa: Y015
@_typing.final
class SubmitDownloadResponse(_message.Message):
"""Response acknowledging the job submission."""
DESCRIPTOR: _descriptor.Descriptor
JOB_ID_FIELD_NUMBER: _builtins.int
MESSAGE_FIELD_NUMBER: _builtins.int
job_id: _builtins.str
"""Unique identifier for the created job."""
message: _builtins.str
"""Human-readable message."""
def __init__(
self,
*,
job_id: _builtins.str = ...,
message: _builtins.str = ...,
) -> None: ...
_HasFieldArgType: _TypeAlias = _Never # noqa: Y015
def HasField(self, field_name: _HasFieldArgType) -> _builtins.bool: ...
_ClearFieldArgType: _TypeAlias = _typing.Literal["job_id", b"job_id", "message", b"message"] # noqa: Y015
def ClearField(self, field_name: _ClearFieldArgType) -> None: ...
def WhichOneof(self, oneof_group: _Never) -> None: ...
Global___SubmitDownloadResponse: _TypeAlias = SubmitDownloadResponse # noqa: Y015
@_typing.final
class GetJobRequest(_message.Message):
"""Request to fetch a specific job by ID."""
DESCRIPTOR: _descriptor.Descriptor
JOB_ID_FIELD_NUMBER: _builtins.int
job_id: _builtins.str
"""Unique job identifier."""
def __init__(
self,
*,
job_id: _builtins.str = ...,
) -> None: ...
_HasFieldArgType: _TypeAlias = _Never # noqa: Y015
def HasField(self, field_name: _HasFieldArgType) -> _builtins.bool: ...
_ClearFieldArgType: _TypeAlias = _typing.Literal["job_id", b"job_id"] # noqa: Y015
def ClearField(self, field_name: _ClearFieldArgType) -> None: ...
def WhichOneof(self, oneof_group: _Never) -> None: ...
Global___GetJobRequest: _TypeAlias = GetJobRequest # noqa: Y015
@_typing.final
class GetJobResponse(_message.Message):
"""Response containing the status of the requested job."""
DESCRIPTOR: _descriptor.Descriptor
JOB_FIELD_NUMBER: _builtins.int
@_builtins.property
def job(self) -> Global___JobStatus:
"""The retrieved job details."""
def __init__(
self,
*,
job: Global___JobStatus | None = ...,
) -> None: ...
_HasFieldArgType: _TypeAlias = _typing.Literal["job", b"job"] # noqa: Y015
def HasField(self, field_name: _HasFieldArgType) -> _builtins.bool: ...
_ClearFieldArgType: _TypeAlias = _typing.Literal["job", b"job"] # noqa: Y015
def ClearField(self, field_name: _ClearFieldArgType) -> None: ...
def WhichOneof(self, oneof_group: _Never) -> None: ...
Global___GetJobResponse: _TypeAlias = GetJobResponse # noqa: Y015
@_typing.final
class StreamJobStatusRequest(_message.Message):
"""Request to stream job updates."""
DESCRIPTOR: _descriptor.Descriptor
JOB_ID_FIELD_NUMBER: _builtins.int
job_id: _builtins.str
"""Optional job ID to filter updates for a single job; if empty, streams all active jobs."""
def __init__(
self,
*,
job_id: _builtins.str = ...,
) -> None: ...
_HasFieldArgType: _TypeAlias = _Never # noqa: Y015
def HasField(self, field_name: _HasFieldArgType) -> _builtins.bool: ...
_ClearFieldArgType: _TypeAlias = _typing.Literal["job_id", b"job_id"] # noqa: Y015
def ClearField(self, field_name: _ClearFieldArgType) -> None: ...
def WhichOneof(self, oneof_group: _Never) -> None: ...
Global___StreamJobStatusRequest: _TypeAlias = StreamJobStatusRequest # noqa: Y015
@_typing.final
class StreamJobStatusResponse(_message.Message):
"""Real-time job status event stream frame."""
DESCRIPTOR: _descriptor.Descriptor
JOB_FIELD_NUMBER: _builtins.int
@_builtins.property
def job(self) -> Global___JobStatus:
"""Current job status update."""
def __init__(
self,
*,
job: Global___JobStatus | None = ...,
) -> None: ...
_HasFieldArgType: _TypeAlias = _typing.Literal["job", b"job"] # noqa: Y015
def HasField(self, field_name: _HasFieldArgType) -> _builtins.bool: ...
_ClearFieldArgType: _TypeAlias = _typing.Literal["job", b"job"] # noqa: Y015
def ClearField(self, field_name: _ClearFieldArgType) -> None: ...
def WhichOneof(self, oneof_group: _Never) -> None: ...
Global___StreamJobStatusResponse: _TypeAlias = StreamJobStatusResponse # noqa: Y015
@_typing.final
class ListJobsRequest(_message.Message):
"""Request to list jobs with pagination and state filtering."""
DESCRIPTOR: _descriptor.Descriptor
PAGE_SIZE_FIELD_NUMBER: _builtins.int
PAGE_TOKEN_FIELD_NUMBER: _builtins.int
STATE_FILTER_FIELD_NUMBER: _builtins.int
page_size: _builtins.int
"""Maximum number of jobs to return per page (default: 20, max: 100)."""
page_token: _builtins.str
"""Page token received from a previous ListJobsResponse next_page_token."""
state_filter: Global___JobState.ValueType
"""Optional filter by job state."""
def __init__(
self,
*,
page_size: _builtins.int = ...,
page_token: _builtins.str = ...,
state_filter: Global___JobState.ValueType = ...,
) -> None: ...
_HasFieldArgType: _TypeAlias = _Never # noqa: Y015
def HasField(self, field_name: _HasFieldArgType) -> _builtins.bool: ...
_ClearFieldArgType: _TypeAlias = _typing.Literal["page_size", b"page_size", "page_token", b"page_token", "state_filter", b"state_filter"] # noqa: Y015
def ClearField(self, field_name: _ClearFieldArgType) -> None: ...
def WhichOneof(self, oneof_group: _Never) -> None: ...
Global___ListJobsRequest: _TypeAlias = ListJobsRequest # noqa: Y015
@_typing.final
class JobStatus(_message.Message):
"""Full status information for a download job."""
DESCRIPTOR: _descriptor.Descriptor
JOB_ID_FIELD_NUMBER: _builtins.int
IMDB_ID_FIELD_NUMBER: _builtins.int
TITLE_FIELD_NUMBER: _builtins.int
YEAR_FIELD_NUMBER: _builtins.int
REQUESTED_BY_FIELD_NUMBER: _builtins.int
STATE_FIELD_NUMBER: _builtins.int
PROGRESS_PCT_FIELD_NUMBER: _builtins.int
DOWNLOAD_RATE_BYTES_FIELD_NUMBER: _builtins.int
ERROR_MESSAGE_FIELD_NUMBER: _builtins.int
CREATED_AT_FIELD_NUMBER: _builtins.int
UPDATED_AT_FIELD_NUMBER: _builtins.int
COMPLETED_AT_FIELD_NUMBER: _builtins.int
job_id: _builtins.str
"""Unique job ID."""
imdb_id: _builtins.str
"""IMDb ID."""
title: _builtins.str
"""Resolved movie title from TMDB (if available)."""
year: _builtins.int
"""Resolved release year from TMDB (if available)."""
requested_by: _builtins.str
"""User who requested the download."""
state: Global___JobState.ValueType
"""Current state in the pipeline."""
progress_pct: _builtins.float
"""Download progress percentage (0.0 to 100.0)."""
download_rate_bytes: _builtins.int
"""Download speed in bytes per second."""
error_message: _builtins.str
"""Detailed error message if the job failed."""
@_builtins.property
def created_at(self) -> _timestamp_pb2.Timestamp:
"""Timestamp when the job was enqueued."""
@_builtins.property
def updated_at(self) -> _timestamp_pb2.Timestamp:
"""Timestamp when the job status or progress was last updated."""
@_builtins.property
def completed_at(self) -> _timestamp_pb2.Timestamp:
"""Timestamp when terminal processing finished (COMPLETED or FAILED)."""
def __init__(
self,
*,
job_id: _builtins.str = ...,
imdb_id: _builtins.str = ...,
title: _builtins.str = ...,
year: _builtins.int = ...,
requested_by: _builtins.str = ...,
state: Global___JobState.ValueType = ...,
progress_pct: _builtins.float = ...,
download_rate_bytes: _builtins.int = ...,
error_message: _builtins.str = ...,
created_at: _timestamp_pb2.Timestamp | None = ...,
updated_at: _timestamp_pb2.Timestamp | None = ...,
completed_at: _timestamp_pb2.Timestamp | None = ...,
) -> None: ...
_HasFieldArgType: _TypeAlias = _typing.Literal["completed_at", b"completed_at", "created_at", b"created_at", "updated_at", b"updated_at"] # noqa: Y015
def HasField(self, field_name: _HasFieldArgType) -> _builtins.bool: ...
_ClearFieldArgType: _TypeAlias = _typing.Literal["completed_at", b"completed_at", "created_at", b"created_at", "download_rate_bytes", b"download_rate_bytes", "error_message", b"error_message", "imdb_id", b"imdb_id", "job_id", b"job_id", "progress_pct", b"progress_pct", "requested_by", b"requested_by", "state", b"state", "title", b"title", "updated_at", b"updated_at", "year", b"year"] # noqa: Y015
def ClearField(self, field_name: _ClearFieldArgType) -> None: ...
def WhichOneof(self, oneof_group: _Never) -> None: ...
Global___JobStatus: _TypeAlias = JobStatus # noqa: Y015
@_typing.final
class ListJobsResponse(_message.Message):
"""Paginated response containing a list of download jobs."""
DESCRIPTOR: _descriptor.Descriptor
JOBS_FIELD_NUMBER: _builtins.int
NEXT_PAGE_TOKEN_FIELD_NUMBER: _builtins.int
next_page_token: _builtins.str
"""Token to retrieve the next page of results, or empty if no more results."""
@_builtins.property
def jobs(self) -> _containers.RepeatedCompositeFieldContainer[Global___JobStatus]:
"""List of matching jobs for the current page."""
def __init__(
self,
*,
jobs: _abc.Iterable[Global___JobStatus] | None = ...,
next_page_token: _builtins.str = ...,
) -> None: ...
_HasFieldArgType: _TypeAlias = _Never # noqa: Y015
def HasField(self, field_name: _HasFieldArgType) -> _builtins.bool: ...
_ClearFieldArgType: _TypeAlias = _typing.Literal["jobs", b"jobs", "next_page_token", b"next_page_token"] # noqa: Y015
def ClearField(self, field_name: _ClearFieldArgType) -> None: ...
def WhichOneof(self, oneof_group: _Never) -> None: ...
Global___ListJobsResponse: _TypeAlias = ListJobsResponse # noqa: Y015
@@ -0,0 +1,216 @@
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
"""Client and server classes corresponding to protobuf-defined services."""
import grpc
from magnetflix.v1 import pipeline_pb2 as magnetflix_dot_v1_dot_pipeline__pb2
class PipelineServiceStub:
"""PipelineService coordinates movie download jobs, safety scans, and library relocation.
"""
def __init__(self, channel):
"""Constructor.
Args:
channel: A grpc.Channel.
"""
self.SubmitDownload = channel.unary_unary(
'/magnetflix.v1.PipelineService/SubmitDownload',
request_serializer=magnetflix_dot_v1_dot_pipeline__pb2.SubmitDownloadRequest.SerializeToString,
response_deserializer=magnetflix_dot_v1_dot_pipeline__pb2.SubmitDownloadResponse.FromString,
_registered_method=True)
self.GetJob = channel.unary_unary(
'/magnetflix.v1.PipelineService/GetJob',
request_serializer=magnetflix_dot_v1_dot_pipeline__pb2.GetJobRequest.SerializeToString,
response_deserializer=magnetflix_dot_v1_dot_pipeline__pb2.GetJobResponse.FromString,
_registered_method=True)
self.StreamJobStatus = channel.unary_stream(
'/magnetflix.v1.PipelineService/StreamJobStatus',
request_serializer=magnetflix_dot_v1_dot_pipeline__pb2.StreamJobStatusRequest.SerializeToString,
response_deserializer=magnetflix_dot_v1_dot_pipeline__pb2.StreamJobStatusResponse.FromString,
_registered_method=True)
self.ListJobs = channel.unary_unary(
'/magnetflix.v1.PipelineService/ListJobs',
request_serializer=magnetflix_dot_v1_dot_pipeline__pb2.ListJobsRequest.SerializeToString,
response_deserializer=magnetflix_dot_v1_dot_pipeline__pb2.ListJobsResponse.FromString,
_registered_method=True)
class PipelineServiceServicer:
"""PipelineService coordinates movie download jobs, safety scans, and library relocation.
"""
def SubmitDownload(self, request, context):
"""SubmitDownload enqueues a new movie download job.
Rejects duplicate submissions if an active job for the same IMDb ID exists or if already in library.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def GetJob(self, request, context):
"""GetJob retrieves the current status and metadata of a specific job.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def StreamJobStatus(self, request, context):
"""StreamJobStatus streams real-time status updates.
Semantics: Emits an immediate snapshot of matching active jobs upon connection,
followed by subsequent state and progress change events.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def ListJobs(self, request, context):
"""ListJobs returns a paginated list of download jobs.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def add_PipelineServiceServicer_to_server(servicer, server):
rpc_method_handlers = {
'SubmitDownload': grpc.unary_unary_rpc_method_handler(
servicer.SubmitDownload,
request_deserializer=magnetflix_dot_v1_dot_pipeline__pb2.SubmitDownloadRequest.FromString,
response_serializer=magnetflix_dot_v1_dot_pipeline__pb2.SubmitDownloadResponse.SerializeToString,
),
'GetJob': grpc.unary_unary_rpc_method_handler(
servicer.GetJob,
request_deserializer=magnetflix_dot_v1_dot_pipeline__pb2.GetJobRequest.FromString,
response_serializer=magnetflix_dot_v1_dot_pipeline__pb2.GetJobResponse.SerializeToString,
),
'StreamJobStatus': grpc.unary_stream_rpc_method_handler(
servicer.StreamJobStatus,
request_deserializer=magnetflix_dot_v1_dot_pipeline__pb2.StreamJobStatusRequest.FromString,
response_serializer=magnetflix_dot_v1_dot_pipeline__pb2.StreamJobStatusResponse.SerializeToString,
),
'ListJobs': grpc.unary_unary_rpc_method_handler(
servicer.ListJobs,
request_deserializer=magnetflix_dot_v1_dot_pipeline__pb2.ListJobsRequest.FromString,
response_serializer=magnetflix_dot_v1_dot_pipeline__pb2.ListJobsResponse.SerializeToString,
),
}
generic_handler = grpc.method_handlers_generic_handler(
'magnetflix.v1.PipelineService', rpc_method_handlers)
server.add_generic_rpc_handlers((generic_handler,))
server.add_registered_method_handlers('magnetflix.v1.PipelineService', rpc_method_handlers)
# This class is part of an EXPERIMENTAL API.
class PipelineService:
"""PipelineService coordinates movie download jobs, safety scans, and library relocation.
"""
@staticmethod
def SubmitDownload(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(
request,
target,
'/magnetflix.v1.PipelineService/SubmitDownload',
magnetflix_dot_v1_dot_pipeline__pb2.SubmitDownloadRequest.SerializeToString,
magnetflix_dot_v1_dot_pipeline__pb2.SubmitDownloadResponse.FromString,
options,
channel_credentials,
insecure,
call_credentials,
compression,
wait_for_ready,
timeout,
metadata,
_registered_method=True)
@staticmethod
def GetJob(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(
request,
target,
'/magnetflix.v1.PipelineService/GetJob',
magnetflix_dot_v1_dot_pipeline__pb2.GetJobRequest.SerializeToString,
magnetflix_dot_v1_dot_pipeline__pb2.GetJobResponse.FromString,
options,
channel_credentials,
insecure,
call_credentials,
compression,
wait_for_ready,
timeout,
metadata,
_registered_method=True)
@staticmethod
def StreamJobStatus(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_stream(
request,
target,
'/magnetflix.v1.PipelineService/StreamJobStatus',
magnetflix_dot_v1_dot_pipeline__pb2.StreamJobStatusRequest.SerializeToString,
magnetflix_dot_v1_dot_pipeline__pb2.StreamJobStatusResponse.FromString,
options,
channel_credentials,
insecure,
call_credentials,
compression,
wait_for_ready,
timeout,
metadata,
_registered_method=True)
@staticmethod
def ListJobs(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(
request,
target,
'/magnetflix.v1.PipelineService/ListJobs',
magnetflix_dot_v1_dot_pipeline__pb2.ListJobsRequest.SerializeToString,
magnetflix_dot_v1_dot_pipeline__pb2.ListJobsResponse.FromString,
options,
channel_credentials,
insecure,
call_credentials,
compression,
wait_for_ready,
timeout,
metadata,
_registered_method=True)
@@ -0,0 +1,109 @@
"""
@generated by mypy-protobuf. Do not edit manually!
isort:skip_file
"""
from collections import abc as _abc
from grpc import aio as _aio
from magnetflix.v1 import pipeline_pb2 as _pipeline_pb2
import abc as _abc_1
import grpc as _grpc
import sys
import typing as _typing
if sys.version_info >= (3, 11):
from typing import Self as _Self
else:
from typing_extensions import Self as _Self
_T = _typing.TypeVar("_T")
class _MaybeAsyncIterator(_abc.AsyncIterator[_T], _abc.Iterator[_T], metaclass=_abc_1.ABCMeta): ...
class _ServicerContext(_grpc.ServicerContext, _aio.ServicerContext): # type: ignore[misc, type-arg]
...
GRPC_GENERATED_VERSION: str
GRPC_VERSION: str
class PipelineServiceStub:
"""PipelineService coordinates movie download jobs, safety scans, and library relocation."""
@_typing.overload
def __new__(cls, channel: _grpc.Channel) -> _Self: ...
@_typing.overload
def __new__(cls, channel: _aio.Channel) -> PipelineServiceAsyncStub: ...
SubmitDownload: _grpc.UnaryUnaryMultiCallable[_pipeline_pb2.SubmitDownloadRequest, _pipeline_pb2.SubmitDownloadResponse]
"""SubmitDownload enqueues a new movie download job.
Rejects duplicate submissions if an active job for the same IMDb ID exists or if already in library.
"""
GetJob: _grpc.UnaryUnaryMultiCallable[_pipeline_pb2.GetJobRequest, _pipeline_pb2.GetJobResponse]
"""GetJob retrieves the current status and metadata of a specific job."""
StreamJobStatus: _grpc.UnaryStreamMultiCallable[_pipeline_pb2.StreamJobStatusRequest, _pipeline_pb2.StreamJobStatusResponse]
"""StreamJobStatus streams real-time status updates.
Semantics: Emits an immediate snapshot of matching active jobs upon connection,
followed by subsequent state and progress change events.
"""
ListJobs: _grpc.UnaryUnaryMultiCallable[_pipeline_pb2.ListJobsRequest, _pipeline_pb2.ListJobsResponse]
"""ListJobs returns a paginated list of download jobs."""
@_typing.type_check_only
class PipelineServiceAsyncStub(PipelineServiceStub):
"""PipelineService coordinates movie download jobs, safety scans, and library relocation."""
def __init__(self, channel: _aio.Channel) -> None: ...
SubmitDownload: _aio.UnaryUnaryMultiCallable[_pipeline_pb2.SubmitDownloadRequest, _pipeline_pb2.SubmitDownloadResponse] # type: ignore[assignment]
"""SubmitDownload enqueues a new movie download job.
Rejects duplicate submissions if an active job for the same IMDb ID exists or if already in library.
"""
GetJob: _aio.UnaryUnaryMultiCallable[_pipeline_pb2.GetJobRequest, _pipeline_pb2.GetJobResponse] # type: ignore[assignment]
"""GetJob retrieves the current status and metadata of a specific job."""
StreamJobStatus: _aio.UnaryStreamMultiCallable[_pipeline_pb2.StreamJobStatusRequest, _pipeline_pb2.StreamJobStatusResponse] # type: ignore[assignment]
"""StreamJobStatus streams real-time status updates.
Semantics: Emits an immediate snapshot of matching active jobs upon connection,
followed by subsequent state and progress change events.
"""
ListJobs: _aio.UnaryUnaryMultiCallable[_pipeline_pb2.ListJobsRequest, _pipeline_pb2.ListJobsResponse] # type: ignore[assignment]
"""ListJobs returns a paginated list of download jobs."""
class PipelineServiceServicer(metaclass=_abc_1.ABCMeta):
"""PipelineService coordinates movie download jobs, safety scans, and library relocation."""
@_abc_1.abstractmethod
def SubmitDownload(
self,
request: _pipeline_pb2.SubmitDownloadRequest,
context: _ServicerContext,
) -> _typing.Union[_pipeline_pb2.SubmitDownloadResponse, _abc.Awaitable[_pipeline_pb2.SubmitDownloadResponse]]:
"""SubmitDownload enqueues a new movie download job.
Rejects duplicate submissions if an active job for the same IMDb ID exists or if already in library.
"""
@_abc_1.abstractmethod
def GetJob(
self,
request: _pipeline_pb2.GetJobRequest,
context: _ServicerContext,
) -> _typing.Union[_pipeline_pb2.GetJobResponse, _abc.Awaitable[_pipeline_pb2.GetJobResponse]]:
"""GetJob retrieves the current status and metadata of a specific job."""
@_abc_1.abstractmethod
def StreamJobStatus(
self,
request: _pipeline_pb2.StreamJobStatusRequest,
context: _ServicerContext,
) -> _typing.Union[_abc.Iterator[_pipeline_pb2.StreamJobStatusResponse], _abc.AsyncIterator[_pipeline_pb2.StreamJobStatusResponse]]:
"""StreamJobStatus streams real-time status updates.
Semantics: Emits an immediate snapshot of matching active jobs upon connection,
followed by subsequent state and progress change events.
"""
@_abc_1.abstractmethod
def ListJobs(
self,
request: _pipeline_pb2.ListJobsRequest,
context: _ServicerContext,
) -> _typing.Union[_pipeline_pb2.ListJobsResponse, _abc.Awaitable[_pipeline_pb2.ListJobsResponse]]:
"""ListJobs returns a paginated list of download jobs."""
def add_PipelineServiceServicer_to_server(servicer: PipelineServiceServicer, server: _typing.Union[_grpc.Server, _aio.Server]) -> None: ...
+3
View File
@@ -0,0 +1,3 @@
# MagNetFlix Worker
gRPC Pipeline Worker and Transmission coordinator for MagNetFlix.
+41
View File
@@ -0,0 +1,41 @@
# A generic, single database configuration for worker container/package.
[alembic]
script_location = %(here)s/alembic
prepend_sys_path = src
path_separator = os
sqlalchemy.url = sqlite+aiosqlite:///data/magnetflix.sqlite3
[loggers]
keys = root,sqlalchemy,alembic
[handlers]
keys = console
[formatters]
keys = generic
[logger_root]
level = WARN
handlers = console
qualname =
[logger_sqlalchemy]
level = WARN
handlers =
qualname = sqlalchemy.engine
[logger_alembic]
level = INFO
handlers =
qualname = alembic
[handler_console]
class = StreamHandler
args = (sys.stderr,)
level = NOTSET
formatter = generic
[formatter_generic]
format = %(levelname)-5.5s [%(name)s] %(message)s
datefmt = %H:%M:%S
+1
View File
@@ -0,0 +1 @@
Generic single-database configuration with an async dbapi.
+84
View File
@@ -0,0 +1,84 @@
import asyncio
import os
from logging.config import fileConfig
from pathlib import Path
from alembic import context
from sqlalchemy import pool
from sqlalchemy.engine import Connection
from sqlalchemy.ext.asyncio import create_async_engine
from worker.db.engine import normalize_database_url
from worker.db.models import Base
config = context.config
if config.config_file_name is not None:
fileConfig(config.config_file_name)
target_metadata = Base.metadata
def get_url() -> str:
"""Retrieve normalized async database URL."""
env_url = os.getenv("DATABASE_URL")
ini_url = config.get_main_option("sqlalchemy.url")
chosen = env_url or ini_url or "sqlite+aiosqlite:///data/magnetflix.sqlite3"
url = normalize_database_url(chosen)
prefix = "sqlite+aiosqlite:///"
if url.startswith(prefix):
raw_path = url[len(prefix) :]
if raw_path and raw_path != ":memory:":
Path(raw_path).resolve().parent.mkdir(parents=True, exist_ok=True)
return url
def run_migrations_offline() -> None:
"""Run migrations in 'offline' mode."""
url = get_url()
context.configure(
url=url,
target_metadata=target_metadata,
literal_binds=True,
dialect_opts={"paramstyle": "named"},
render_as_batch=True,
)
with context.begin_transaction():
context.run_migrations()
def do_run_migrations(connection: Connection) -> None:
"""Configure migration context on active connection."""
context.configure(
connection=connection,
target_metadata=target_metadata,
render_as_batch=True,
)
with context.begin_transaction():
context.run_migrations()
async def run_async_migrations() -> None:
"""Run migrations asynchronously using an AsyncEngine."""
connectable = create_async_engine(
get_url(),
poolclass=pool.NullPool,
)
async with connectable.connect() as connection:
await connection.run_sync(do_run_migrations)
await connectable.dispose()
def run_migrations_online() -> None:
"""Run migrations in 'online' mode."""
asyncio.run(run_async_migrations())
if context.is_offline_mode():
run_migrations_offline()
else:
run_migrations_online()
+28
View File
@@ -0,0 +1,28 @@
"""${message}
Revision ID: ${up_revision}
Revises: ${down_revision | comma,n}
Create Date: ${create_date}
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
${imports if imports else ""}
# revision identifiers, used by Alembic.
revision: str = ${repr(up_revision)}
down_revision: Union[str, Sequence[str], None] = ${repr(down_revision)}
branch_labels: Union[str, Sequence[str], None] = ${repr(branch_labels)}
depends_on: Union[str, Sequence[str], None] = ${repr(depends_on)}
def upgrade() -> None:
"""Upgrade schema."""
${upgrades if upgrades else "pass"}
def downgrade() -> None:
"""Downgrade schema."""
${downgrades if downgrades else "pass"}
@@ -0,0 +1,64 @@
"""create download_jobs table
Revision ID: 234da461ab5b
Revises:
Create Date: 2026-10-13 07:11:05.259836
"""
from typing import Sequence, Union
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision: str = '234da461ab5b'
down_revision: Union[str, Sequence[str], None] = None
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
def upgrade() -> None:
"""Upgrade schema."""
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('download_jobs',
sa.Column('id', sa.String(length=36), nullable=False),
sa.Column('imdb_id', sa.String(length=32), nullable=False),
sa.Column('title', sa.String(length=255), nullable=True),
sa.Column('year', sa.Integer(), nullable=True),
sa.Column('magnet_uri', sa.Text(), nullable=False),
sa.Column('requested_by', sa.String(length=128), nullable=False),
sa.Column('state', sa.String(length=32), nullable=False),
sa.Column('progress_pct', sa.Float(), nullable=False),
sa.Column('download_rate_bytes', sa.BigInteger(), nullable=False),
sa.Column('error_message', sa.Text(), nullable=False),
sa.Column('created_at', sa.DateTime(timezone=True), nullable=False),
sa.Column('updated_at', sa.DateTime(timezone=True), nullable=False),
sa.Column('completed_at', sa.DateTime(timezone=True), nullable=True),
sa.PrimaryKeyConstraint('id')
)
with op.batch_alter_table('download_jobs', schema=None) as batch_op:
batch_op.create_index(
batch_op.f('ix_download_jobs_imdb_id'), ['imdb_id'], unique=False
)
batch_op.create_index(
batch_op.f('ix_download_jobs_requested_by'),
['requested_by'],
unique=False,
)
batch_op.create_index(
batch_op.f('ix_download_jobs_state'), ['state'], unique=False
)
# ### end Alembic commands ###
def downgrade() -> None:
"""Downgrade schema."""
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('download_jobs', schema=None) as batch_op:
batch_op.drop_index(batch_op.f('ix_download_jobs_state'))
batch_op.drop_index(batch_op.f('ix_download_jobs_requested_by'))
batch_op.drop_index(batch_op.f('ix_download_jobs_imdb_id'))
op.drop_table('download_jobs')
# ### end Alembic commands ###
+10 -1
View File
@@ -7,14 +7,23 @@ requires-python = ">=3.12"
dependencies = [ dependencies = [
"aiosqlite>=0.20.0", "aiosqlite>=0.20.0",
"alembic>=1.14.0", "alembic>=1.14.0",
"cinemagoer>=2023.5.1", "httpx>=0.28.0",
"grpcio>=1.83.1", "grpcio>=1.83.1",
"protobuf>=7.36.1", "protobuf>=7.36.1",
"pydantic>=2.10.0", "pydantic>=2.10.0",
"sqlalchemy>=2.0.36", "sqlalchemy>=2.0.36",
"transmission-rpc>=7.0.11", "transmission-rpc>=7.0.11",
"magnetflix-contracts",
] ]
[build-system] [build-system]
requires = ["uv_build>=0.12.5,<0.13.0"] requires = ["uv_build>=0.12.5,<0.13.0"]
build-backend = "uv_build" build-backend = "uv_build"
[tool.uv.build-backend]
module-name = "worker"
module-root = "src"
[tool.uv.sources]
magnetflix-contracts = { workspace = true }
+33
View File
@@ -0,0 +1,33 @@
"""Database module for MagNetFlix worker service."""
from worker.db.engine import (
DEFAULT_DATABASE_URL,
configure_sqlite_pragmas,
create_engine,
get_db_session,
get_engine,
get_session_factory,
normalize_database_url,
verify_wal_mode,
)
from worker.db.models import (
ALLOWED_TRANSITIONS,
Base,
DownloadJob,
JobStateEnum,
)
__all__ = [
"ALLOWED_TRANSITIONS",
"Base",
"DEFAULT_DATABASE_URL",
"DownloadJob",
"JobStateEnum",
"configure_sqlite_pragmas",
"create_engine",
"get_db_session",
"get_engine",
"get_session_factory",
"normalize_database_url",
"verify_wal_mode",
]
+134
View File
@@ -0,0 +1,134 @@
"""SQLAlchemy async database engine and session management with SQLite WAL mode."""
from __future__ import annotations
import os
from collections.abc import AsyncGenerator
from contextlib import asynccontextmanager
from pathlib import Path
from typing import Any
from sqlalchemy import event, text
from sqlalchemy.ext.asyncio import (
AsyncEngine,
AsyncSession,
async_sessionmaker,
create_async_engine,
)
DEFAULT_DATABASE_URL = "sqlite+aiosqlite:///data/magnetflix.sqlite3"
def normalize_database_url(url: str | None = None) -> str:
"""Normalize database URL to use async aiosqlite driver for SQLite.
If given 'sqlite:////path', converts to 'sqlite+aiosqlite:////path'.
"""
raw_url = url or os.getenv("DATABASE_URL") or DEFAULT_DATABASE_URL
if raw_url.startswith("sqlite://") and not raw_url.startswith("sqlite+aiosqlite://"):
return raw_url.replace("sqlite://", "sqlite+aiosqlite://", 1)
return raw_url
def _ensure_sqlite_parent_dir(db_url: str) -> None:
"""Ensure parent directory exists for file-based SQLite database."""
if not db_url.startswith("sqlite"):
return
prefix = "sqlite+aiosqlite:///"
if db_url.startswith(prefix):
raw_path = db_url[len(prefix) :]
if raw_path and raw_path != ":memory:":
db_file = Path(raw_path).resolve()
db_file.parent.mkdir(parents=True, exist_ok=True)
def configure_sqlite_pragmas(engine: AsyncEngine) -> None:
"""Register SQLite PRAGMAs for WAL mode, foreign keys, and synchronous=NORMAL."""
@event.listens_for(engine.sync_engine, "connect")
def set_sqlite_pragma(dbapi_connection: Any, connection_record: Any) -> None:
cursor = dbapi_connection.cursor()
cursor.execute("PRAGMA journal_mode=WAL;")
cursor.execute("PRAGMA foreign_keys=ON;")
cursor.execute("PRAGMA synchronous=NORMAL;")
cursor.execute("PRAGMA busy_timeout=5000;")
cursor.close()
def create_engine(
url: str | None = None, echo: bool = False
) -> tuple[AsyncEngine, async_sessionmaker[AsyncSession]]:
"""Create an AsyncEngine and async sessionmaker configured with WAL pragmas."""
normalized_url = normalize_database_url(url)
_ensure_sqlite_parent_dir(normalized_url)
engine = create_async_engine(
normalized_url,
echo=echo,
future=True,
)
if normalized_url.startswith("sqlite"):
configure_sqlite_pragmas(engine)
session_factory = async_sessionmaker(
bind=engine,
class_=AsyncSession,
expire_on_commit=False,
autocommit=False,
autoflush=False,
)
return engine, session_factory
# Module-level default singleton engine and sessionmaker
_engine: AsyncEngine | None = None
_session_factory: async_sessionmaker[AsyncSession] | None = None
def get_engine() -> AsyncEngine:
"""Retrieve or initialize the global AsyncEngine instance."""
global _engine, _session_factory
if _engine is None:
_engine, _session_factory = create_engine()
return _engine
def get_session_factory() -> async_sessionmaker[AsyncSession]:
"""Retrieve or initialize the global async_sessionmaker instance."""
global _engine, _session_factory
if _session_factory is None:
_engine, _session_factory = create_engine()
return _session_factory
@asynccontextmanager
async def get_db_session() -> AsyncGenerator[AsyncSession, None]:
"""Provide a transactional async database session context."""
factory = get_session_factory()
async with factory() as session:
try:
yield session
await session.commit()
except Exception:
await session.rollback()
raise
async def verify_wal_mode(session: AsyncSession) -> dict[str, Any]:
"""Inspect and return active SQLite pragmas.
Queries journal_mode, foreign_keys, synchronous, and busy_timeout.
"""
jm_res = await session.execute(text("PRAGMA journal_mode;"))
fk_res = await session.execute(text("PRAGMA foreign_keys;"))
sync_res = await session.execute(text("PRAGMA synchronous;"))
busy_res = await session.execute(text("PRAGMA busy_timeout;"))
return {
"journal_mode": jm_res.scalar(),
"foreign_keys": fk_res.scalar(),
"synchronous": sync_res.scalar(),
"busy_timeout": busy_res.scalar(),
}
+256
View File
@@ -0,0 +1,256 @@
"""SQLAlchemy ORM models for MagNetFlix download jobs and audit trail."""
from __future__ import annotations
import uuid
from datetime import datetime, timezone
from enum import Enum
from typing import Any
from google.protobuf.timestamp_pb2 import Timestamp
from magnetflix.v1 import pipeline_pb2
from sqlalchemy import BigInteger, DateTime, Float, Integer, String, Text
from sqlalchemy.orm import DeclarativeBase, Mapped, mapped_column
class Base(DeclarativeBase):
"""Base declarative class for SQLAlchemy ORM models."""
pass
class JobStateEnum(str, Enum):
"""Enumeration of valid lifecycle states for a download job."""
QUEUED = "QUEUED"
DOWNLOADING = "DOWNLOADING"
SCANNING = "SCANNING"
VERIFYING_METADATA = "VERIFYING_METADATA"
ORGANIZING = "ORGANIZING"
COMPLETED = "COMPLETED"
FAILED = "FAILED"
# Valid forward state transitions in the pipeline
ALLOWED_TRANSITIONS: dict[str, set[str]] = {
JobStateEnum.QUEUED.value: {
JobStateEnum.DOWNLOADING.value,
JobStateEnum.FAILED.value,
},
JobStateEnum.DOWNLOADING.value: {
JobStateEnum.SCANNING.value,
JobStateEnum.FAILED.value,
},
JobStateEnum.SCANNING.value: {
JobStateEnum.VERIFYING_METADATA.value,
JobStateEnum.FAILED.value,
},
JobStateEnum.VERIFYING_METADATA.value: {
JobStateEnum.ORGANIZING.value,
JobStateEnum.FAILED.value,
},
JobStateEnum.ORGANIZING.value: {
JobStateEnum.COMPLETED.value,
JobStateEnum.FAILED.value,
},
JobStateEnum.COMPLETED.value: set(),
JobStateEnum.FAILED.value: set(),
}
PROTO_STATE_MAP = {
JobStateEnum.QUEUED.value: pipeline_pb2.JOB_STATE_QUEUED,
JobStateEnum.DOWNLOADING.value: pipeline_pb2.JOB_STATE_DOWNLOADING,
JobStateEnum.SCANNING.value: pipeline_pb2.JOB_STATE_SCANNING,
JobStateEnum.VERIFYING_METADATA.value: pipeline_pb2.JOB_STATE_VERIFYING_METADATA,
JobStateEnum.ORGANIZING.value: pipeline_pb2.JOB_STATE_ORGANIZING,
JobStateEnum.COMPLETED.value: pipeline_pb2.JOB_STATE_COMPLETED,
JobStateEnum.FAILED.value: pipeline_pb2.JOB_STATE_FAILED,
}
def _datetime_to_timestamp(dt: datetime | None) -> Timestamp:
"""Convert Python datetime to Google Protobuf Timestamp."""
ts = Timestamp()
if dt is not None:
ts.FromDatetime(dt if dt.tzinfo else dt.replace(tzinfo=timezone.utc))
return ts
def utc_now() -> datetime:
"""Return timezone-aware current UTC datetime."""
return datetime.now(timezone.utc)
class DownloadJob(Base):
"""ORM model representing an acquisition and relocation pipeline job."""
__tablename__ = "download_jobs"
id: Mapped[str] = mapped_column(
String(36),
primary_key=True,
default=lambda: str(uuid.uuid4()),
doc="Unique UUID primary key",
)
imdb_id: Mapped[str] = mapped_column(
String(32),
nullable=False,
index=True,
doc="IMDb identifier (e.g. tt1375666)",
)
title: Mapped[str | None] = mapped_column(
String(255),
nullable=True,
doc="Canonical movie title resolved from TMDB",
)
year: Mapped[int | None] = mapped_column(
Integer,
nullable=True,
doc="Release year resolved from TMDB",
)
magnet_uri: Mapped[str] = mapped_column(
Text,
nullable=False,
doc="BitTorrent magnet URI",
)
requested_by: Mapped[str] = mapped_column(
String(128),
nullable=False,
index=True,
doc="Authenticated user from Remote-User SSO header",
)
state: Mapped[str] = mapped_column(
String(32),
nullable=False,
default=JobStateEnum.QUEUED.value,
index=True,
doc="Current pipeline lifecycle state",
)
progress_pct: Mapped[float] = mapped_column(
Float,
nullable=False,
default=0.0,
doc="Download progress percentage (0.0 to 100.0)",
)
download_rate_bytes: Mapped[int] = mapped_column(
BigInteger,
nullable=False,
default=0,
doc="Download rate in bytes/sec",
)
error_message: Mapped[str] = mapped_column(
Text,
nullable=False,
default="",
doc="Terminal error description if state is FAILED",
)
created_at: Mapped[datetime] = mapped_column(
DateTime(timezone=True),
nullable=False,
default=utc_now,
doc="UTC timestamp when job was enqueued",
)
updated_at: Mapped[datetime] = mapped_column(
DateTime(timezone=True),
nullable=False,
default=utc_now,
onupdate=utc_now,
doc="UTC timestamp when job status was last updated",
)
completed_at: Mapped[datetime | None] = mapped_column(
DateTime(timezone=True),
nullable=True,
doc="UTC timestamp when job transitioned to terminal COMPLETED or FAILED",
)
def __init__(self, **kwargs: Any) -> None:
"""Initialize DownloadJob with default field values."""
if "id" not in kwargs:
kwargs["id"] = str(uuid.uuid4())
if "state" not in kwargs:
kwargs["state"] = JobStateEnum.QUEUED.value
if "progress_pct" not in kwargs:
kwargs["progress_pct"] = 0.0
if "download_rate_bytes" not in kwargs:
kwargs["download_rate_bytes"] = 0
if "error_message" not in kwargs:
kwargs["error_message"] = ""
if "created_at" not in kwargs:
kwargs["created_at"] = utc_now()
if "updated_at" not in kwargs:
kwargs["updated_at"] = utc_now()
super().__init__(**kwargs)
@property
def is_terminal(self) -> bool:
"""Return True if the job is in a terminal state (COMPLETED or FAILED)."""
return self.state in (JobStateEnum.COMPLETED.value, JobStateEnum.FAILED.value)
def transition_to(
self,
new_state: JobStateEnum | str,
error_message: str | None = None,
) -> None:
"""Safely transition job state following the state machine invariants.
Raises:
ValueError: If the requested state transition is invalid.
"""
target = new_state.value if isinstance(new_state, JobStateEnum) else new_state
allowed = ALLOWED_TRANSITIONS.get(self.state, set())
if target not in allowed:
raise ValueError(
f"Invalid state transition from '{self.state}' to '{target}'. "
f"Allowed transitions: {allowed}"
)
self.state = target
self.updated_at = utc_now()
if error_message is not None:
self.error_message = error_message
if self.is_terminal and self.completed_at is None:
self.completed_at = utc_now()
def to_proto(self) -> pipeline_pb2.JobStatus:
"""Convert ORM model instance into a Protobuf JobStatus message."""
proto_state = PROTO_STATE_MAP.get(
self.state, pipeline_pb2.JOB_STATE_UNSPECIFIED
)
return pipeline_pb2.JobStatus(
job_id=self.id,
imdb_id=self.imdb_id,
title=self.title or "",
year=self.year or 0,
requested_by=self.requested_by,
state=proto_state,
progress_pct=self.progress_pct,
download_rate_bytes=self.download_rate_bytes,
error_message=self.error_message,
created_at=_datetime_to_timestamp(self.created_at),
updated_at=_datetime_to_timestamp(self.updated_at),
completed_at=_datetime_to_timestamp(self.completed_at),
)
def to_dict(self) -> dict[str, Any]:
"""Convert ORM model to dictionary."""
return {
"id": self.id,
"imdb_id": self.imdb_id,
"title": self.title,
"year": self.year,
"magnet_uri": self.magnet_uri,
"requested_by": self.requested_by,
"state": self.state,
"progress_pct": self.progress_pct,
"download_rate_bytes": self.download_rate_bytes,
"error_message": self.error_message,
"created_at": (self.created_at.isoformat() if self.created_at else None),
"updated_at": (self.updated_at.isoformat() if self.updated_at else None),
"completed_at": (
self.completed_at.isoformat() if self.completed_at else None
),
}
+44
View File
@@ -0,0 +1,44 @@
"""Unit and contract seam tests for generated Protobuf and gRPC stubs."""
from __future__ import annotations
def test_protobuf_and_grpc_stubs_importable():
"""Verify that both pipeline_pb2 and pipeline_pb2_grpc import cleanly."""
from magnetflix.v1 import pipeline_pb2, pipeline_pb2_grpc
assert pipeline_pb2.JOB_STATE_QUEUED == 1
assert pipeline_pb2.JOB_STATE_DOWNLOADING == 2
assert hasattr(pipeline_pb2_grpc, "PipelineServiceServicer")
assert hasattr(pipeline_pb2_grpc, "PipelineServiceStub")
def test_proto_job_status_creation():
"""Verify that JobStatus protobuf message instantiates and serializes."""
from google.protobuf.timestamp_pb2 import Timestamp
from magnetflix.v1 import pipeline_pb2
ts = Timestamp()
ts.GetCurrentTime()
status = pipeline_pb2.JobStatus(
job_id="test-job-123",
imdb_id="tt1375666",
title="Inception",
year=2010,
requested_by="alice",
state=pipeline_pb2.JOB_STATE_QUEUED,
progress_pct=0.0,
download_rate_bytes=0,
error_message="",
created_at=ts,
)
assert status.job_id == "test-job-123"
assert status.title == "Inception"
serialized = status.SerializeToString()
assert len(serialized) > 0
deserialized = pipeline_pb2.JobStatus()
deserialized.ParseFromString(serialized)
assert deserialized.imdb_id == "tt1375666"
+214
View File
@@ -0,0 +1,214 @@
"""Unit tests for SQLite WAL engine, ORM models, and CRUD operations."""
from __future__ import annotations
import tempfile
from pathlib import Path
import pytest
from magnetflix.v1 import pipeline_pb2
from sqlalchemy import select
from worker.db import (
Base,
DownloadJob,
JobStateEnum,
create_engine,
verify_wal_mode,
)
@pytest.fixture
async def temp_db():
"""Create a temporary SQLite database file with WAL pragmas."""
with tempfile.TemporaryDirectory() as tmpdir:
db_path = Path(tmpdir) / "test_magnetflix.sqlite3"
db_url = f"sqlite+aiosqlite:///{db_path}"
engine, session_factory = create_engine(db_url)
async with engine.begin() as conn:
await conn.run_sync(Base.metadata.create_all)
yield session_factory, engine
await engine.dispose()
@pytest.mark.asyncio
async def test_sqlite_wal_pragmas(temp_db):
"""Verify that SQLite engine automatically configures WAL mode and pragmas."""
session_factory, _ = temp_db
async with session_factory() as session:
pragmas = await verify_wal_mode(session)
assert pragmas["journal_mode"].lower() == "wal"
assert pragmas["foreign_keys"] == 1
assert pragmas["synchronous"] == 1 # 1 = NORMAL
assert pragmas["busy_timeout"] == 5000
@pytest.mark.asyncio
async def test_download_job_crud(temp_db):
"""Test creating, reading, and updating a DownloadJob in SQLite."""
session_factory, _ = temp_db
# 1. Create Job
job = DownloadJob(
imdb_id="tt1375666",
magnet_uri="magnet:?xt=urn:btih:dummy123",
requested_by="alice",
)
async with session_factory() as session:
session.add(job)
await session.commit()
job_id = job.id
assert job_id is not None
# 2. Read Job
async with session_factory() as session:
result = await session.execute(
select(DownloadJob).where(DownloadJob.id == job_id)
)
saved = result.scalar_one()
assert saved.imdb_id == "tt1375666"
assert saved.magnet_uri == "magnet:?xt=urn:btih:dummy123"
assert saved.requested_by == "alice"
assert saved.state == JobStateEnum.QUEUED.value
assert saved.progress_pct == 0.0
assert saved.download_rate_bytes == 0
assert saved.error_message == ""
assert saved.title is None
assert saved.year is None
assert saved.created_at is not None
assert saved.updated_at is not None
assert saved.completed_at is None
assert saved.is_terminal is False
@pytest.mark.asyncio
async def test_download_job_to_proto(temp_db):
"""Test converting a DownloadJob ORM model to a Protobuf JobStatus message."""
session_factory, _ = temp_db
job = DownloadJob(
imdb_id="tt1375666",
title="Inception",
year=2010,
magnet_uri="magnet:?xt=urn:btih:dummy123",
requested_by="alice",
progress_pct=42.5,
download_rate_bytes=5242880,
)
async with session_factory() as session:
session.add(job)
await session.commit()
proto = job.to_proto()
assert isinstance(proto, pipeline_pb2.JobStatus)
assert proto.job_id == job.id
assert proto.imdb_id == "tt1375666"
assert proto.title == "Inception"
assert proto.year == 2010
assert proto.requested_by == "alice"
assert proto.state == pipeline_pb2.JOB_STATE_QUEUED
assert abs(proto.progress_pct - 42.5) < 0.01
assert proto.download_rate_bytes == 5242880
assert proto.error_message == ""
assert proto.created_at.seconds > 0
@pytest.mark.asyncio
async def test_download_job_state_transitions(temp_db):
"""Test state machine progression and terminal state invariants."""
session_factory, _ = temp_db
job = DownloadJob(
imdb_id="tt0111161",
magnet_uri="magnet:?xt=urn:btih:shawshank",
requested_by="bob",
)
# 1. Valid Linear Progression:
# QUEUED -> DOWNLOADING -> SCANNING -> VERIFYING_METADATA -> ORGANIZING -> COMPLETED
job.transition_to(JobStateEnum.DOWNLOADING)
assert job.state == JobStateEnum.DOWNLOADING.value
assert job.completed_at is None
job.transition_to(JobStateEnum.SCANNING)
assert job.state == JobStateEnum.SCANNING.value
job.transition_to(JobStateEnum.VERIFYING_METADATA)
assert job.state == JobStateEnum.VERIFYING_METADATA.value
job.transition_to(JobStateEnum.ORGANIZING)
assert job.state == JobStateEnum.ORGANIZING.value
job.transition_to(JobStateEnum.COMPLETED)
assert job.state == JobStateEnum.COMPLETED.value
assert job.is_terminal is True
assert job.completed_at is not None
# 2. Cannot transition out of terminal COMPLETED
with pytest.raises(ValueError, match="Invalid state transition"):
job.transition_to(JobStateEnum.DOWNLOADING)
# 3. Direct failure transition from non-terminal state
job_failing = DownloadJob(
imdb_id="tt0068646",
magnet_uri="magnet:?xt=urn:btih:godfather",
requested_by="charlie",
)
job_failing.transition_to(JobStateEnum.FAILED, error_message="Tracker timed out")
assert job_failing.state == JobStateEnum.FAILED.value
assert job_failing.error_message == "Tracker timed out"
assert job_failing.is_terminal is True
assert job_failing.completed_at is not None
@pytest.mark.asyncio
async def test_active_job_idempotency_query(temp_db):
"""Test querying active non-terminal jobs for duplicate rejection."""
session_factory, _ = temp_db
active_job = DownloadJob(
imdb_id="tt1375666",
magnet_uri="magnet:?xt=urn:btih:inception",
requested_by="alice",
state=JobStateEnum.DOWNLOADING.value,
)
completed_job = DownloadJob(
imdb_id="tt0111161",
magnet_uri="magnet:?xt=urn:btih:shawshank",
requested_by="bob",
state=JobStateEnum.COMPLETED.value,
)
async with session_factory() as session:
session.add_all([active_job, completed_job])
await session.commit()
# Query for active job with tt1375666
terminal_states = [JobStateEnum.COMPLETED.value, JobStateEnum.FAILED.value]
stmt = (
select(DownloadJob)
.where(DownloadJob.imdb_id == "tt1375666")
.where(DownloadJob.state.not_in(terminal_states))
)
res = await session.execute(stmt)
found_active = res.scalar_one_or_none()
assert found_active is not None
assert found_active.id == active_job.id
# Query for active job with tt0111161 (should be None because it's COMPLETED)
stmt_comp = (
select(DownloadJob)
.where(DownloadJob.imdb_id == "tt0111161")
.where(DownloadJob.state.not_in(terminal_states))
)
res_comp = await session.execute(stmt_comp)
found_completed = res_comp.scalar_one_or_none()
assert found_completed is None
+37 -19
View File
@@ -1,20 +1,38 @@
(A) Create SQLAlchemy async engine with SQLite WAL mode pragmas in services/worker/src/worker/db/engine.py +db @worker # Milestone 1: Contracts, Toolchain & Database Hardening (Prerequisites & Blockers)
(A) Define DownloadJob ORM model in services/worker/src/worker/db/models.py (id, imdb_id, title, year, magnet_uri, requested_by, status, progress_pct, download_rate_bytes, error_message, created_at, updated_at, completed_at) +db @worker (A) Create services/contracts workspace package with pyproject.toml (module-name = 'magnetflix') +contracts @workspace
(A) Initialize Alembic in services/worker/ and create initial migration for download_jobs table +db @worker (A) Reconfigure buf.gen.yaml to output stubs into services/contracts/src, generate stubs + docs/api_spec.md, and track in Git +proto @contracts
(A) Write unit tests for DB connection, WAL pragma verification, and CRUD operations in tests/test_db.py +test @worker (A) Update services/worker and services/bff to depend on magnetflix-contracts via workspace dependency +deps @workspace
(B) Implement symlink & path-traversal blocker in services/worker/src/worker/sanitizer.py +sanitizer @worker (A) Update pyproject.toml to include tests/ in pyright, remove exclusions masking broken imports, and add test rule to Makefile +ci @workspace
(B) Implement file allowlist filtering (video: .mkv, .mp4, .avi, .webm; subtitles: .srt, .vtt, .sub, .ass) +sanitizer @worker (A) Update services/worker/Dockerfile and services/bff/Dockerfile to copy services/contracts, and copy alembic/ into worker image +docker @deploy
(B) Implement sample discard (<100MB / 'sample' keyword) and largest primary video selector in sanitizer.py +sanitizer @worker (A) Create Alembic migration 002_add_info_hash_and_partial_unique_index.py adding info_hash column and uq_download_jobs_active_imdb_id index +db @worker
(B) Write comprehensive unit tests in tests/test_sanitizer.py covering allowlist, symlinks, sample filtering, and largest video selection +test @worker (A) Update DownloadJob ORM model and write unit tests in tests/test_db.py verifying duplicate active insertion rejection +test @worker
(B) Implement async TMDB client querying /find/{imdb_id}?external_source=imdb_id in services/worker/src/worker/metadata.py +metadata @worker
(B) Implement normalized token overlap verification between TMDB title/year and torrent/file names in metadata.py +metadata @worker # Milestone 2: Pipeline Domain Engine & Filesystem Safety
(B) Write unit tests with mocked TMDB responses in tests/test_metadata.py verifying successful match and mismatch rejection +test @worker (B) Implement Two-Tier Media Sanitizer in services/worker/src/worker/sanitizer.py (hard-fail on symlinks/traversal/executables, ignore .txt/.nfo, sample discard, largest video selector) +sanitizer @worker
(C) Implement Transmission client wrapper in services/worker/src/worker/transmission.py (add_torrent to /data/staging/<job_id>, poll progress, remove_torrent) +transmission @worker (B) Write comprehensive unit tests in tests/test_sanitizer.py covering allowlist, traversal, sample filtering, and largest video selection +test @worker
(B) Implement TMDB Client & Token Verifier in services/worker/src/worker/metadata.py (early ingestion resolution via /find/{imdb_id} and post-download token overlap check) +metadata @worker
(B) Write unit tests with mocked TMDB responses in tests/test_metadata.py verifying match, 404, non-movie rejection, and token overlap +test @worker
(B) Implement Multi-Track Library Relocator in services/worker/src/worker/relocator.py (format preservation for .srt/.vtt/.ass, language/disambiguation tagging, two-stage atomic directory swap) +relocator @worker
(B) Write unit tests in tests/test_relocator.py testing destination directory formatting, subtitle moving, and atomic swap cleanup +test @worker
# Milestone 3: Transmission Integration & Worker Coordinator
(C) Implement Transmission client wrapper in services/worker/src/worker/transmission.py (add_torrent to /data/staging/<job_id>, poll progress, remove_torrent with delete_data) +transmission @worker
(C) Write unit tests with mocked transmission-rpc client in tests/test_transmission.py +test @worker (C) Write unit tests with mocked transmission-rpc client in tests/test_transmission.py +test @worker
(C) Implement directory creator and atomic file mover in services/worker/src/worker/relocator.py (/media/movies/<Title> (<Year>) [imdbid-<IMDbID>]/) +relocator @worker (C) Implement pipeline state machine coordinator in services/worker/src/worker/pipeline.py (linear transitions, 15-min stall timeout, bounded ThreadPoolExecutor offloading, in-memory pub/sub queues) +pipeline @worker
(C) Implement subtitle renaming and staging cleanup in relocator.py +relocator @worker (C) Implement startup active reconciliation sweep in pipeline.py (auto-fail orphaned jobs, remove Transmission torrents, purge staging disks) +pipeline @worker
(C) Write unit tests in tests/test_relocator.py testing destination directory formatting, subtitle moving, and scratch cleanup +test @worker (C) Implement gRPC PipelineServiceServicer in services/worker/src/worker/service.py and entrypoint worker/main.py (SubmitDownload, GetJob, StreamJobStatus, ListJobs) +grpc @worker
(D) Implement pipeline state machine coordinator (QUEUED -> DOWNLOADING -> SCANNING -> VERIFYING_METADATA -> ORGANIZING -> COMPLETED/FAILED) in services/worker/src/worker/pipeline.py +pipeline @worker (C) Write integration tests in tests/test_grpc_service.py verifying duplicate rejection, job submission, status querying, and pagination +test @worker
(D) Implement startup crash recovery to auto-fail orphaned non-terminal jobs on worker start in pipeline.py +pipeline @worker
(D) Implement gRPC PipelineServiceServicer in services/worker/src/worker/service.py (SubmitDownload, GetJob, StreamJobStatus, ListJobs) +grpc @worker # Milestone 4: FastAPI BFF Gateway, SSE & Web UI
(D) Write integration tests in tests/test_grpc_service.py verifying duplicate rejection, job submission, status querying, and pagination +test @worker (D) Implement Pluggable Identity Adapter Middleware in FastAPI BFF (env-driven header extraction with local_user dev fallback) +auth @bff
(D) Implement BFF gRPC client wrapper in services/bff/src/bff/grpc_client.py connecting to Worker service +grpc @bff
(D) Implement REST endpoints in services/bff/src/bff/main.py (dual routes POST /api/v1/downloads and POST /download with Pydantic aliases, GET /api/v1/movies/search TMDB proxy) +api @bff
(D) Implement Server-Sent Events stream GET /api/v1/movies/events connected to gRPC StreamJobStatus +sse @bff
(D) Embed single-origin HTML Web UI dashboard in services/bff/src/bff/templates/ and static/ with movie search autocomplete, poster previews, and live progress bars +ui @bff
(D) Write API tests in tests/test_bff_routes.py covering auth extraction, dual routes, search proxy, and SSE streams +test @bff
# Milestone 5: Multi-Container Stack & Deployment Verification
(E) Finalize services/worker/Dockerfile and services/bff/Dockerfile multi-stage production builds +docker @deploy
(E) Author canonical production-ready docker-compose.yml including bff, worker, transmission, volume mounts, and network bridges +compose @deploy
(E) Configure Traefik routing labels, health probes (/healthz and gRPC health), and verify container communication +traefik @deploy
(E) Execute end-to-end integration test with public domain torrent verifying full acquisition, organization, and SSE reporting lifecycle +e2e @test
Generated
+78 -137
View File
@@ -1,10 +1,11 @@
version = 1 version = 1
revision = 3 revision = 5
requires-python = ">=3.12" requires-python = ">=3.12"
[manifest] [manifest]
members = [ members = [
"magnetflix-bff", "magnetflix-bff",
"magnetflix-contracts",
"magnetflix-worker", "magnetflix-worker",
"magnetflix-workspace", "magnetflix-workspace",
] ]
@@ -65,11 +66,11 @@ wheels = [
[[package]] [[package]]
name = "certifi" name = "certifi"
version = "2026.7.22" version = "2026.10.23"
source = { registry = "https://pypi.org/simple" } source = { registry = "https://pypi.org/simple" }
sdist = { url = "https://files.pythonhosted.org/packages/a3/c2/24167ea9858356b47a87a50d39908bfdb72ceeefe0041586e704e5376b3a/certifi-2026.7.22.tar.gz", hash = "sha256:741e2c3b351ddf169a738da9f2c048608ff7f2c5cc02f1ebc6b118bb090d5d55", size = 138112, upload-time = "2026-07-22T03:35:12.644Z" } sdist = { url = "https://files.pythonhosted.org/packages/fd/11/b524cbd9bbdaca58608e4cf4053fd463417549e1959fa8d3aa18319f9555/certifi-2026.10.23.tar.gz", hash = "sha256:a9895e6e2758b371e0545e321a3a8fd1fcfd9829ada8824a936dfb16aaaf36cd", size = 136225, upload-time = "2026-10-23T11:36:16.478Z" }
wheels = [ wheels = [
{ url = "https://files.pythonhosted.org/packages/0b/a7/71ac2cff56fec219ed242bb11b8efb69fcc4bec75db06fb7bfe35de520e6/certifi-2026.7.22-py3-none-any.whl", hash = "sha256:62f22742b58a1a33014a2b6b706588a8d7e2a88ae7bd1a6ebe8c992928483775", size = 136983, upload-time = "2026-07-22T03:35:11.276Z" }, { url = "https://files.pythonhosted.org/packages/32/d1/a3652fe2c19134d0d15922177821d863cbd7e842d53a21bbe7e8e3a1b5ac/certifi-2026.10.23-py3-none-any.whl", hash = "sha256:e9b54de76e530bb6cf0ccd036787103acb58fd42ba930ea8bf948ddbaa2f61d1", size = 135082, upload-time = "2026-10-23T11:36:14.763Z" },
] ]
[[package]] [[package]]
@@ -203,18 +204,6 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/cc/61/d01fc49b8dea277640b55a9e15960dbca9fdc8c9fde18e572d39c59f4019/charset_normalizer-3.5.1-py3-none-any.whl", hash = "sha256:6df0ec430f9a831772c23ca5a224cba36517a58a84bb32c32bb59a9fa67c47f6", size = 68658, upload-time = "2026-08-15T08:20:43.306Z" }, { url = "https://files.pythonhosted.org/packages/cc/61/d01fc49b8dea277640b55a9e15960dbca9fdc8c9fde18e572d39c59f4019/charset_normalizer-3.5.1-py3-none-any.whl", hash = "sha256:6df0ec430f9a831772c23ca5a224cba36517a58a84bb32c32bb59a9fa67c47f6", size = 68658, upload-time = "2026-08-15T08:20:43.306Z" },
] ]
[[package]]
name = "cinemagoer"
version = "2026.8.20"
source = { registry = "https://pypi.org/simple" }
dependencies = [
{ name = "lxml" },
]
sdist = { url = "https://files.pythonhosted.org/packages/0f/ba/47ff38d8c97e803f2a0e17d6a98d7d963cad6a542221c811483f5fb96b18/cinemagoer-2026.8.20.tar.gz", hash = "sha256:99b99fe30582ddbfb08db0dd8af712bd55c11da7c3155e07a19ac6b5ecd677aa", size = 143867, upload-time = "2026-08-20T16:26:29.625Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/bf/f0/7c5cd3aa1648348c009f12b84c67959ec0c54a9b989d045b668673551676/cinemagoer-2026.8.20-py3-none-any.whl", hash = "sha256:4b4a031515107709a281629395ba300e9060f584b17fe343b480062ffd0f713b", size = 188733, upload-time = "2026-08-20T16:26:28.192Z" },
]
[[package]] [[package]]
name = "click" name = "click"
version = "8.5.0" version = "8.5.0"
@@ -409,6 +398,19 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/04/4b/29cac41a4d98d144bf5f6d33995617b185d14b22401f75ca86f384e87ff1/h11-0.16.0-py3-none-any.whl", hash = "sha256:63cf8bbe7522de3bf65932fda1d9c2772064ffb3dae62d55932da54b31cb6c86", size = 37515, upload-time = "2025-04-24T03:35:24.344Z" }, { url = "https://files.pythonhosted.org/packages/04/4b/29cac41a4d98d144bf5f6d33995617b185d14b22401f75ca86f384e87ff1/h11-0.16.0-py3-none-any.whl", hash = "sha256:63cf8bbe7522de3bf65932fda1d9c2772064ffb3dae62d55932da54b31cb6c86", size = 37515, upload-time = "2025-04-24T03:35:24.344Z" },
] ]
[[package]]
name = "httpcore"
version = "1.0.9"
source = { registry = "https://pypi.org/simple" }
dependencies = [
{ name = "certifi" },
{ name = "h11" },
]
sdist = { url = "https://files.pythonhosted.org/packages/06/94/82699a10bca87a5556c9c59b5963f2d039dbd239f25bc2a63907a05a14cb/httpcore-1.0.9.tar.gz", hash = "sha256:6e34463af53fd2ab5d807f399a9b45ea31c3dfa2276f15a2c3f00afff6e176e8", size = 85484, upload-time = "2025-04-24T22:06:22.219Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/7e/f5/f66802a942d491edb555dd61e3a9961140fd64c90bce1eafd741609d334d/httpcore-1.0.9-py3-none-any.whl", hash = "sha256:2d400746a40668fc9dec9810239072b40b4484b640a8c38fd654a024c7a1bf55", size = 78784, upload-time = "2025-04-24T22:06:20.566Z" },
]
[[package]] [[package]]
name = "httptools" name = "httptools"
version = "0.8.0" version = "0.8.0"
@@ -445,6 +447,21 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/48/63/b906c01e53f50d432c0defe43ce52764a111dc1bdd028bafbeb54dcfd008/httptools-0.8.0-cp314-cp314t-win_amd64.whl", hash = "sha256:384c17174464c8e873398b7af24f0b1f44d992c820328413951a625323155d77", size = 108209, upload-time = "2026-05-25T22:17:39.473Z" }, { url = "https://files.pythonhosted.org/packages/48/63/b906c01e53f50d432c0defe43ce52764a111dc1bdd028bafbeb54dcfd008/httptools-0.8.0-cp314-cp314t-win_amd64.whl", hash = "sha256:384c17174464c8e873398b7af24f0b1f44d992c820328413951a625323155d77", size = 108209, upload-time = "2026-05-25T22:17:39.473Z" },
] ]
[[package]]
name = "httpx"
version = "0.28.1"
source = { registry = "https://pypi.org/simple" }
dependencies = [
{ name = "anyio" },
{ name = "certifi" },
{ name = "httpcore" },
{ name = "idna" },
]
sdist = { url = "https://files.pythonhosted.org/packages/b1/df/48c586a5fe32a0f01324ee087459e112ebb7224f646c0b5023f5e79e9956/httpx-0.28.1.tar.gz", hash = "sha256:75e98c5f16b0f35b567856f597f06ff2270a374470a5c2392242528e3e3e42fc", size = 141406, upload-time = "2024-12-06T15:37:23.222Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/2a/39/e50c7c3a983047577ee07d2a9e53faf5a69493943ec3f6a384bdc792deb2/httpx-0.28.1-py3-none-any.whl", hash = "sha256:d909fcccc110f8c7faf814ca82a9a4d816bc5a6dbfea25d6591d6985b8ba59ad", size = 73517, upload-time = "2024-12-06T15:37:21.509Z" },
]
[[package]] [[package]]
name = "idna" name = "idna"
version = "3.19" version = "3.19"
@@ -475,116 +492,6 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/62/a1/3d680cbfd5f4b8f15abc1d571870c5fc3e594bb582bc3b64ea099db13e56/jinja2-3.1.6-py3-none-any.whl", hash = "sha256:85ece4451f492d0c13c5dd7c13a64681a86afae63a5f347908daf103ce6d2f67", size = 134899, upload-time = "2025-03-05T20:05:00.369Z" }, { url = "https://files.pythonhosted.org/packages/62/a1/3d680cbfd5f4b8f15abc1d571870c5fc3e594bb582bc3b64ea099db13e56/jinja2-3.1.6-py3-none-any.whl", hash = "sha256:85ece4451f492d0c13c5dd7c13a64681a86afae63a5f347908daf103ce6d2f67", size = 134899, upload-time = "2025-03-05T20:05:00.369Z" },
] ]
[[package]]
name = "lxml"
version = "6.1.2"
source = { registry = "https://pypi.org/simple" }
sdist = { url = "https://files.pythonhosted.org/packages/ad/a9/970b8fa0ecc4fbf1dfaed0d89bbc1fc1421b25ec26a2038c91e872dc6c8e/lxml-6.1.2.tar.gz", hash = "sha256:1055241852f2b02068af4a625a5d32c087db193c12251928af2562ecd2239f18", size = 4210626, upload-time = "2026-08-19T04:58:15.341Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/ee/a4/55eb54507073089ab27743c5da2113c84f0d0b1715b33175fdd943c9652d/lxml-6.1.2-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:7d506bdba580ecb1a6ad2e2b5c49445e66d3e1f95894885739094393a1aad237", size = 8602111, upload-time = "2026-08-19T04:58:28.017Z" },
{ url = "https://files.pythonhosted.org/packages/bc/bf/6332f45d78da385bb01d5cac3fe4acda19f025d1307cbc7ad538355fecbb/lxml-6.1.2-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:12acd337d2821cb8b9247dfe4b7aa2f2769a3df5ae8511b7e550df42b8f4d3c3", size = 4638376, upload-time = "2026-08-19T04:58:41.181Z" },
{ url = "https://files.pythonhosted.org/packages/68/e0/21fba0fe74d417fbe976903ae6bc77e92cdce01aae7b636abd87756f4588/lxml-6.1.2-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:5078ff51e6316c0f75ea8127c2cd24374747fb351f62fb93d1761f8ae5a04a40", size = 4939689, upload-time = "2026-08-19T04:58:48.526Z" },
{ url = "https://files.pythonhosted.org/packages/de/e5/ce3e885264fdd0bdcb6b49c1ea1842f94281b39e4ff956099e8d57532c60/lxml-6.1.2-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:9477e14217c212e6023c994a71a1a349db19b0e10fd5bf189666b281ae63b1fd", size = 5105185, upload-time = "2026-08-19T04:59:15.533Z" },
{ url = "https://files.pythonhosted.org/packages/e6/b6/990a8446c488c70fa25681e150de94b7bf2eaaf387e374d195ab3c8faafb/lxml-6.1.2-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:261d98065326676d7253882db0198d0aa06748d7ee0443367acf10b148273f99", size = 5011863, upload-time = "2026-08-19T04:59:50.58Z" },
{ url = "https://files.pythonhosted.org/packages/bb/6a/f70f41363dae27e3bfd6224b128f5ba150874bd32ca4938552930ffa33b0/lxml-6.1.2-cp312-cp312-manylinux_2_26_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:0666943ee1576fa890a6dc6316ef42e8241b5dd56f67bc5475acb2ac298c6ca9", size = 5638234, upload-time = "2026-08-19T05:00:00.802Z" },
{ url = "https://files.pythonhosted.org/packages/3d/e0/a65b64f34d556925faef2c4f14167d58c571bc15a3e1f2bba71138830562/lxml-6.1.2-cp312-cp312-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:04cf9e3f4ee9cab9d9ba05401bef8668840fa9620fcd4d8e85a2d2fd0b0fa960", size = 5244532, upload-time = "2026-08-19T05:00:07.516Z" },
{ url = "https://files.pythonhosted.org/packages/c6/a9/471552e015e954fc9d960aa27c3d67ebf489683d03f033399a790417c67c/lxml-6.1.2-cp312-cp312-manylinux_2_28_i686.whl", hash = "sha256:9429d2371d406344ed1da5b5686d9412e74137c07b0171278368ff704f470ed5", size = 5358194, upload-time = "2026-08-19T05:00:22.747Z" },
{ url = "https://files.pythonhosted.org/packages/d7/0f/bc6248fbec2cc416f102b1267f1567e07510f6fa909bbe8cd2a22d6fb78e/lxml-6.1.2-cp312-cp312-manylinux_2_31_armv7l.whl", hash = "sha256:eff128ffdc093cc6317955934ad9751105d37ed8dbca3ff4ccd751af6be37185", size = 4704432, upload-time = "2026-08-19T05:00:51.115Z" },
{ url = "https://files.pythonhosted.org/packages/a9/3f/cec859f50e63f1fa338fab43d2362d7543e1237f2475960d8ab0769de0eb/lxml-6.1.2-cp312-cp312-manylinux_2_38_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:ba58574d710b82ead7cbedea01cac3e110bc3ef82d4731519b74a2c11f7cf5e9", size = 5255038, upload-time = "2026-08-19T05:00:58.895Z" },
{ url = "https://files.pythonhosted.org/packages/7c/d9/2ced0cf2967115f92a1b8b3ae6bd18763abc3ebef88c98cf25145fda396c/lxml-6.1.2-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:52f6d4dff133c9778a24e9a2cfc1608930b15869866171aacc5131b5a418a003", size = 5054481, upload-time = "2026-08-19T05:01:10.096Z" },
{ url = "https://files.pythonhosted.org/packages/d5/f5/4f07386d3c88673daeec3b8cc09a2a4d39fa01c1fc49009791b0746d97fa/lxml-6.1.2-cp312-cp312-musllinux_1_2_armv7l.whl", hash = "sha256:8807998c1023d1e9d60e02500f90e85a0752dbc0b670989806bba87b82dd5b42", size = 4785535, upload-time = "2026-08-19T05:01:18.909Z" },
{ url = "https://files.pythonhosted.org/packages/9a/5a/f4fe3ecbc189f48fba2547c5db5c940a10151d3e86b856a60a533a77e816/lxml-6.1.2-cp312-cp312-musllinux_1_2_ppc64le.whl", hash = "sha256:2170d0a280c877b6e2dc6738217db947be35dd8cf09ca458b355aa1bab2a9e70", size = 5655337, upload-time = "2026-08-19T05:01:41.324Z" },
{ url = "https://files.pythonhosted.org/packages/92/c4/f586aa1bf27bfbace2dfdbb704da5c52f0bdece8ee440c8fb4946c940b2e/lxml-6.1.2-cp312-cp312-musllinux_1_2_riscv64.whl", hash = "sha256:c67f3c1278f942e97d8665c2a690324aaea5137de16f056583a21f0ac706177f", size = 5245778, upload-time = "2026-08-19T05:01:45.227Z" },
{ url = "https://files.pythonhosted.org/packages/18/a1/677494bbaef4d6db5e4633af817414f478865850b55c03ae4bf70fa7b8ca/lxml-6.1.2-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:093fbf547d0f3ca02705381f795a050fbb58988be4aac7f79f99f280c4082313", size = 5267274, upload-time = "2026-08-19T05:01:57.687Z" },
{ url = "https://files.pythonhosted.org/packages/5a/71/b71425b8764d4cb7c92eb970483be7d5610dce2a6316242b5aaae7d260be/lxml-6.1.2-cp312-cp312-win32.whl", hash = "sha256:be365ce8d2d411cf2fb573747684b4fd470fa6224e0094d9d5a21155acc369d3", size = 3602563, upload-time = "2026-08-19T05:02:01.837Z" },
{ url = "https://files.pythonhosted.org/packages/1b/fb/909584e16d2148c1a252cc2c32dd99fe0e2682459c586d3d7a192e74a0ae/lxml-6.1.2-cp312-cp312-win_amd64.whl", hash = "sha256:b97153ca609b434b712ddfb92cd6af101a7045a7724c542258bd4727a344472f", size = 4005965, upload-time = "2026-08-19T05:02:07.157Z" },
{ url = "https://files.pythonhosted.org/packages/5f/8d/41207c9212caad0b52749e34739fb9bfab67486729f52a8fe9bd9266fee6/lxml-6.1.2-cp312-cp312-win_arm64.whl", hash = "sha256:7feb72424f19a893ae4f3373c7aae821b1aacb6076b708915c651f0683a97c49", size = 3666641, upload-time = "2026-08-19T05:02:11.3Z" },
{ url = "https://files.pythonhosted.org/packages/61/2a/e9651f47a31a60b5cae031abc23391ed9aa30c8fc07571d1a38f58d6d770/lxml-6.1.2-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:351318f5c0eb7fcab5b4fdb507c6f88fb2c4b5e67784c7e5911448c91fffb5d4", size = 8590165, upload-time = "2026-08-19T04:58:40.489Z" },
{ url = "https://files.pythonhosted.org/packages/61/87/a8098abaf35118767d1703b84c98940a5d833064e0eca39a00ecfe9840ab/lxml-6.1.2-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:c0edde95e4b4278dcc0175eda06dc8aa2631ad9f83ae5dbdbc4f0925e200b0b0", size = 4632474, upload-time = "2026-08-19T04:58:47.465Z" },
{ url = "https://files.pythonhosted.org/packages/93/cc/fe74d1def7f4fb967c4a825608a074d4dbdbb871b0d6bd59c6ed07d67868/lxml-6.1.2-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:a8326e24ae6c3a6bfb03fa8b4793f9a5d804c125228aa067f652b0428e31b87c", size = 4936196, upload-time = "2026-08-19T04:59:03.477Z" },
{ url = "https://files.pythonhosted.org/packages/b7/ad/b96e6ca926e26726a99aa643602aac7411ecc1731ddb1b25af8cc57edfcd/lxml-6.1.2-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:7c534ed898413f439b048130011e99a4245ee13d62d431f6b4f7f2484d02a93a", size = 5093290, upload-time = "2026-08-19T04:59:17.498Z" },
{ url = "https://files.pythonhosted.org/packages/d2/84/616f5d3b7cd086fcfba3e5add6fccda67f976c1c753ae9ed7bbd317cb9be/lxml-6.1.2-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:2e37fe49fe2d5aa40a2cb1cc8176673ad7de0d124e6f4a509d9318f5979c7871", size = 4998767, upload-time = "2026-08-19T04:59:28.385Z" },
{ url = "https://files.pythonhosted.org/packages/80/88/d5b453a8d083483c9442ad7f5ac5c560796022eb5c80d60b65d75e449236/lxml-6.1.2-cp313-cp313-manylinux_2_26_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:9b52ea73a37fc64aa3357ff8607801d46dd170506d3cf8253a91a1d91639d4f9", size = 5626717, upload-time = "2026-08-19T04:59:40.045Z" },
{ url = "https://files.pythonhosted.org/packages/71/45/31e5aa4d4bae024908ba1d03480c7425cf027a28b7e5c88d1b7202bd80cc/lxml-6.1.2-cp313-cp313-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:e8b9a92652e75e7731309ea51db5dee892eef414ce70a6ec3441e5d36bf5189f", size = 5232330, upload-time = "2026-08-19T04:59:46.175Z" },
{ url = "https://files.pythonhosted.org/packages/f5/5a/2627912420df8b2d31ba3014da5539f15ec85add01d42048864ffefda516/lxml-6.1.2-cp313-cp313-manylinux_2_28_i686.whl", hash = "sha256:9088da25ecd609965f838d89fda0465a905b48f4dd90331db9845518f2177372", size = 5347054, upload-time = "2026-08-19T04:59:52.762Z" },
{ url = "https://files.pythonhosted.org/packages/16/86/54ac0f529b22a8f12313726dd49e12961bb46471d9028cc28d2a29408f0b/lxml-6.1.2-cp313-cp313-manylinux_2_31_armv7l.whl", hash = "sha256:0349321a0537d4fdbebb2af06dd1b64676132c72e2ae250de8cdb58f8c43019c", size = 4707275, upload-time = "2026-08-19T05:00:04.836Z" },
{ url = "https://files.pythonhosted.org/packages/3a/42/ffcdc6e4519be90df907cdae7e88409efb25d823ae4de8846f737dae1884/lxml-6.1.2-cp313-cp313-manylinux_2_38_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:b20440e578d269c5e8a722ab602ddd0f0cedb8b080006b3f936da9991a593d3b", size = 5240071, upload-time = "2026-08-19T05:00:19.604Z" },
{ url = "https://files.pythonhosted.org/packages/68/49/5b1d7ab35f013f1127ec48f3108319f58b65b00d5cb26f215adbe86eadfb/lxml-6.1.2-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:7766e525282dd38fd89567311323e441996eb958e8e816d16b38f782e3aecd2a", size = 5050356, upload-time = "2026-08-19T05:00:27.968Z" },
{ url = "https://files.pythonhosted.org/packages/b0/57/1cf049d054189b55c8fe8012269234f6602256949b69cd3ba80608a88219/lxml-6.1.2-cp313-cp313-musllinux_1_2_armv7l.whl", hash = "sha256:9221442682c27417f10fe11184ea4cce174b25ab52465570b1f3ee3f85f320fa", size = 4780394, upload-time = "2026-08-19T05:00:39.047Z" },
{ url = "https://files.pythonhosted.org/packages/d5/ad/064488a8fa60e639fd773e421a18bf17541d02a95fbf36238ad7c65f69d4/lxml-6.1.2-cp313-cp313-musllinux_1_2_ppc64le.whl", hash = "sha256:75530642d8471327e691ab9b0513a5f9c77f38871014ceda40f51bb51765c0a1", size = 5645854, upload-time = "2026-08-19T05:03:42.697Z" },
{ url = "https://files.pythonhosted.org/packages/85/bb/120e56f3cf1c149bb3b014278fb86d0a6dd552403981081f0ee0a0a57be7/lxml-6.1.2-cp313-cp313-musllinux_1_2_riscv64.whl", hash = "sha256:678e35f1cbca98f55107511ee21a60568535c950f3c2371819bd64504c980d20", size = 5231132, upload-time = "2026-08-19T05:03:45.466Z" },
{ url = "https://files.pythonhosted.org/packages/b1/2c/7d49aab893c128671a3276580074cce4c002896145b8dd2893da79633bca/lxml-6.1.2-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:5c2bae42b3a09f977330a08f4a8fe72aec58c4bdb89069d3fe7272a71d885881", size = 5256076, upload-time = "2026-08-19T05:03:48.092Z" },
{ url = "https://files.pythonhosted.org/packages/72/28/ddea3aa1fa9acfd384fe34d4a2a93eecc07541dd2d922fa9b140c60d8014/lxml-6.1.2-cp313-cp313-win32.whl", hash = "sha256:5848f3de6a8de8a93cff9f068134393ff5fa69ac2a04399f7d49cd67c61c348c", size = 3602177, upload-time = "2026-08-19T05:03:50.571Z" },
{ url = "https://files.pythonhosted.org/packages/1b/7a/96bac167538748cae2544335855f812fa33e49a9a67bc8b8520dcbd592bd/lxml-6.1.2-cp313-cp313-win_amd64.whl", hash = "sha256:6cb0c87421946030b92b558be416852780a912454e3dcba0998e4497c9c588d5", size = 4004117, upload-time = "2026-08-19T05:03:53.074Z" },
{ url = "https://files.pythonhosted.org/packages/0a/24/9498fa3c84135956e5ef55ea4d8bd11e999e381f7f210fb6f8c6a980ef03/lxml-6.1.2-cp313-cp313-win_arm64.whl", hash = "sha256:648861c19b775b89ebefa14586f85090b10163367476d77f242c4131c835ce73", size = 3665412, upload-time = "2026-08-19T05:03:55.621Z" },
{ url = "https://files.pythonhosted.org/packages/27/b5/728b0578791b397ace8d1b101c8b3fe10f36043542f7bb85f82d8bdc3f50/lxml-6.1.2-cp314-cp314-macosx_10_15_universal2.whl", hash = "sha256:d50a44113fe6800dcc8a859332b823a4735b1e6ae1b0063882e4cca569ec3e29", size = 8609651, upload-time = "2026-08-19T04:58:42.42Z" },
{ url = "https://files.pythonhosted.org/packages/3c/6b/49209fa6225c15c48a30061f03d3aba75e3c19634813b88bf83b88c525ed/lxml-6.1.2-cp314-cp314-macosx_10_15_x86_64.whl", hash = "sha256:fa813b0247d0543a563b993ac3dba6168eef59e3a61448432cf5453300c2412b", size = 4639588, upload-time = "2026-08-19T04:59:01.501Z" },
{ url = "https://files.pythonhosted.org/packages/20/86/80bae4e8bc2eed9d6f017701a3d86fdea56936218efa738911d0b76aa7f4/lxml-6.1.2-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:d858e718b94033ab4b67e4a58fe3114c65bae01ae2314a62fb39ae8897ed4324", size = 4964846, upload-time = "2026-08-19T04:59:08.59Z" },
{ url = "https://files.pythonhosted.org/packages/70/ce/4782caee7a22959c1ac67cb46495e03912c22a4ba7d20c163496a519e815/lxml-6.1.2-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:3e3b666f57a5d81562f38c766c762416b0f6eb58a00590546911514b48412abd", size = 5099288, upload-time = "2026-08-19T04:59:18.649Z" },
{ url = "https://files.pythonhosted.org/packages/32/21/f120967cc43b54e05512dff0c39726b832c836195d30f41f88733ef36ac8/lxml-6.1.2-cp314-cp314-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:26ff164c6629e5c4d11c9e55d5ea3d6eed0be2a420eee1f55cbce6e2c23e231a", size = 5036837, upload-time = "2026-08-19T04:59:47.217Z" },
{ url = "https://files.pythonhosted.org/packages/61/ba/8005e9f47598e3ec5c18312c77f94e889580027616678848405c6aeba5de/lxml-6.1.2-cp314-cp314-manylinux_2_26_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:962c12b51d0b164f12569af225dea57568477e24a845b96eaccbef6c07e4cc03", size = 5658569, upload-time = "2026-08-19T04:59:54.078Z" },
{ url = "https://files.pythonhosted.org/packages/6a/ba/add33b3c7ce51462cf7a4637bcfec2eaa258364d6015b989dd7d1216e6a6/lxml-6.1.2-cp314-cp314-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:47e367dfe341521426692819803e260d0673899c0ff611f14af978d725e2c999", size = 5246003, upload-time = "2026-08-19T04:59:59.764Z" },
{ url = "https://files.pythonhosted.org/packages/05/b3/a43012748fb861c914c5eac1c1a3bad44282e767499cd02280d4d1edf092/lxml-6.1.2-cp314-cp314-manylinux_2_28_i686.whl", hash = "sha256:92c2b366028ac01e90399e6d17734ce6e4f4aeddd8ba75fbaf80ea11d6c6d645", size = 5354047, upload-time = "2026-08-19T05:00:21.657Z" },
{ url = "https://files.pythonhosted.org/packages/8b/cb/813021d9a445713b8d758b9e5eae2ed392cd598d9f119d9b053b37c2ab93/lxml-6.1.2-cp314-cp314-manylinux_2_31_armv7l.whl", hash = "sha256:7e81fc065ede5d58dd0bf0912025aee1bd04c52c2affd61fdb93226a97ce2fc6", size = 4704382, upload-time = "2026-08-19T05:00:47.067Z" },
{ url = "https://files.pythonhosted.org/packages/17/c9/1155299f4577bebf3c280497534a73e4b8ad8cab3b96074731ad10949d4e/lxml-6.1.2-cp314-cp314-manylinux_2_38_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:633ac039cb32366dd5935868e041e385875c017b8cd54ea56aeee3fe29ca5935", size = 5258530, upload-time = "2026-08-19T05:01:14.893Z" },
{ url = "https://files.pythonhosted.org/packages/25/6e/d76e58384b378b877e140e25b9a9835da00035f81ff70cbe943a3749bf27/lxml-6.1.2-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:2f3194777c0d05945ac91d8594be25d2679d1d826e01e1fc90bae568ff3a547b", size = 5089919, upload-time = "2026-08-19T05:01:33.602Z" },
{ url = "https://files.pythonhosted.org/packages/f3/b7/898013c0f8891481d0624ab3bd5dd8c8ff827232dfee2a5d1f8bf970a7cc/lxml-6.1.2-cp314-cp314-musllinux_1_2_armv7l.whl", hash = "sha256:1133bd969f2bfcc6b0c0cf7cdf5f2631e62b23fa2471ee8bd44f6ab73554ee9a", size = 4741972, upload-time = "2026-08-19T05:01:38.18Z" },
{ url = "https://files.pythonhosted.org/packages/c3/47/efb53c4d7b655831c03317a450d9da439b0829c61f34d9d4fe7c863445d6/lxml-6.1.2-cp314-cp314-musllinux_1_2_ppc64le.whl", hash = "sha256:1edca8f4a92b94e873093df959f141d388f2141fcad0c47598442fb4730ef57a", size = 5683241, upload-time = "2026-08-19T05:02:00.731Z" },
{ url = "https://files.pythonhosted.org/packages/da/0a/0ff36a584cbba14a71326ee8a5300694400f0b97927d1f90a87d95b17d4a/lxml-6.1.2-cp314-cp314-musllinux_1_2_riscv64.whl", hash = "sha256:8512b3775d68994dd1d6d533161e0a214f2ad9c634659d34a99c98e86c6c3d68", size = 5245892, upload-time = "2026-08-19T05:02:06.108Z" },
{ url = "https://files.pythonhosted.org/packages/8f/9e/303717a1aa56d4bd775c91936717d3c9e8d999a8e8b68b00979c4c1f93d0/lxml-6.1.2-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:a5005c0c9e4d749a76a2ff8bd5918a8bb248df8e08e73a55654b9f79c9cd1e2b", size = 5269528, upload-time = "2026-08-19T05:02:09.883Z" },
{ url = "https://files.pythonhosted.org/packages/ad/c2/2ae7cb97089eb86bf0689516db3cf280a007b6145853d2a0235a1f01683d/lxml-6.1.2-cp314-cp314-win32.whl", hash = "sha256:e17e2c30e27f56da5551e7a425888b45f013e940b99ab07d125a1c33f77a4605", size = 3662743, upload-time = "2026-08-19T05:03:02.513Z" },
{ url = "https://files.pythonhosted.org/packages/77/13/a3d483230a09201e211ceb1aa208b1374d27d23b8b180d74dba14b30f6b3/lxml-6.1.2-cp314-cp314-win_amd64.whl", hash = "sha256:87e9673cd8a3445024fe38e7f91b55fa3428437eec9b7a7ff7d81979520c0d2d", size = 4073942, upload-time = "2026-08-19T05:03:04.864Z" },
{ url = "https://files.pythonhosted.org/packages/1c/f1/c1445d4b6ad7c51e39d4e2ebbf015a4880f5b297a4ab0e77e4d0e5b70110/lxml-6.1.2-cp314-cp314-win_arm64.whl", hash = "sha256:878e7c8ada8f92c52f13f35a2ab98ef0adf7fd0211d164fc2af589e4c3cfed63", size = 3749235, upload-time = "2026-08-19T05:03:07.239Z" },
{ url = "https://files.pythonhosted.org/packages/9d/eb/598c76f4ce19a67c635e86a46d880cc854f308f39a6f1fdf13bbb01813ec/lxml-6.1.2-cp314-cp314t-macosx_10_15_universal2.whl", hash = "sha256:94162456ed0a64fb1c06915df5bd06af4675ae3966d6048fcb73b0906e0e0222", size = 8860315, upload-time = "2026-08-19T05:02:14.39Z" },
{ url = "https://files.pythonhosted.org/packages/da/c7/1f9fac7b566a86ad0da13dcc0259164266469c0ad86744c740ccd5c2a081/lxml-6.1.2-cp314-cp314t-macosx_10_15_x86_64.whl", hash = "sha256:4b0fa7109b1d0bc1747d8241a0853e135eefb1c978685241b544c46937383efd", size = 4755176, upload-time = "2026-08-19T05:02:18.705Z" },
{ url = "https://files.pythonhosted.org/packages/3e/1b/cfda9307388d496e7eeb7493d9455896b8137ed95f51f3d6ae6ddcc14a47/lxml-6.1.2-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:604f4778632588d7c000e7e19430639dc12fca58b5b6e99edffba7631725ef0e", size = 4979444, upload-time = "2026-08-19T05:02:21.262Z" },
{ url = "https://files.pythonhosted.org/packages/e5/71/f732c8919c45b7f29acf443288c6e90036877a67bfeeb1acceb0fffa011b/lxml-6.1.2-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:5a096d6a5f96b776a5b020cb45c17c545effd2a3b6639e6fa97bc95537600923", size = 5115887, upload-time = "2026-08-19T05:02:23.62Z" },
{ url = "https://files.pythonhosted.org/packages/30/00/121d52b944f41e33ea86c62875f902d24982842dc7231ab154ac5a6c6593/lxml-6.1.2-cp314-cp314t-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:6454d184d556eaf4cb3d6f69e405d21602d6fdcf08b8d57796824275986c6595", size = 5032418, upload-time = "2026-08-19T05:02:26.114Z" },
{ url = "https://files.pythonhosted.org/packages/70/19/cadb73c7fe48c7563dc8ab62ea53d5b920c8911bfb808507a6daa82e78d2/lxml-6.1.2-cp314-cp314t-manylinux_2_26_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:8b68f2548259bb04e0b3d5df0c397abe8b0080f5e1ffe4019fb7a8bf01a9339e", size = 5603304, upload-time = "2026-08-19T05:02:28.694Z" },
{ url = "https://files.pythonhosted.org/packages/13/32/9de126a14d5a5db8c371c5ec869178417db226707b62a47273a95ae6df7f/lxml-6.1.2-cp314-cp314t-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:6c9cc4b6532abe154dbdebb42aaba8d52c852919591e45067f5b7d46a0405e88", size = 5228938, upload-time = "2026-08-19T05:02:30.99Z" },
{ url = "https://files.pythonhosted.org/packages/ff/9b/22dd9e843629ed04652591fb220eb2bf2394d97be3be377d60d8083405d7/lxml-6.1.2-cp314-cp314t-manylinux_2_28_i686.whl", hash = "sha256:57188e441ab24f906bd5a5c14eb55363ab51aa6c0de549f3dd320043721cc118", size = 5317790, upload-time = "2026-08-19T05:02:33.301Z" },
{ url = "https://files.pythonhosted.org/packages/2c/2c/b12a1dc121f81c280635c721c7bcaa341441fcbe37397f60b8915048aece/lxml-6.1.2-cp314-cp314t-manylinux_2_31_armv7l.whl", hash = "sha256:d0bfd719c254bbe60ea022cff0e6ffb799a6fa7d4d72852cebe0257957b32d68", size = 4646468, upload-time = "2026-08-19T05:02:35.504Z" },
{ url = "https://files.pythonhosted.org/packages/57/41/fd87a41edc531e7969c25ab1d6b52b5b041eb108b88f6394d6afb4374396/lxml-6.1.2-cp314-cp314t-manylinux_2_38_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:be6f87cd224254a8f81324e34cc655508b83f1d70458a1a39857ad2aa9925852", size = 5240607, upload-time = "2026-08-19T05:02:37.805Z" },
{ url = "https://files.pythonhosted.org/packages/6e/30/713ba813b6e6673c6dc34733746516017efcd17949b767b154cc50bccf20/lxml-6.1.2-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:074a88f70a7360a4a0c5be5d898062cd26f898c25b459efb1bdd43ae700c5a1a", size = 5086495, upload-time = "2026-08-19T05:02:40.099Z" },
{ url = "https://files.pythonhosted.org/packages/33/f8/6532ce0fecd9c326d06b08274ee075cc28dbc9f5e9285355db8504689114/lxml-6.1.2-cp314-cp314t-musllinux_1_2_armv7l.whl", hash = "sha256:9031f5f01452681abf39fdd65f84a70cb01a7572a1bbf570042e826b1232d07b", size = 4758801, upload-time = "2026-08-19T05:02:45.434Z" },
{ url = "https://files.pythonhosted.org/packages/74/b6/5a1f7833ebaa0dd33c28f6f9755ec6ff3891bf63f097634b44e6da1bb65e/lxml-6.1.2-cp314-cp314t-musllinux_1_2_ppc64le.whl", hash = "sha256:cfeac14425fc7a6fca7864b774d4ee63547926158f4a18c67d77b2c9a948acf1", size = 5626977, upload-time = "2026-08-19T05:02:48.092Z" },
{ url = "https://files.pythonhosted.org/packages/e6/20/6ae0fc1b45e20877cdcfb1168ceeaf9abb0fba5ed36bd639a260e7b2101e/lxml-6.1.2-cp314-cp314t-musllinux_1_2_riscv64.whl", hash = "sha256:8ec111ff8067325f85c08aa9c2b26179ec0537bb89c003fde31127139f85f82d", size = 5235036, upload-time = "2026-08-19T05:02:50.726Z" },
{ url = "https://files.pythonhosted.org/packages/47/b4/2bc7b37fbb990ccfb7d30393660741592177224a94e07d842c8da70638e8/lxml-6.1.2-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:48e912f37c99a297175ba955f55a47c0e1c834b506ef162e52a6e4fe276e6e45", size = 5252270, upload-time = "2026-08-19T05:02:53.454Z" },
{ url = "https://files.pythonhosted.org/packages/4d/0b/07fb8e1dee29a78e2c5fa5c6c914218be76a6406baff27907429566e90ec/lxml-6.1.2-cp314-cp314t-win32.whl", hash = "sha256:7c444c3a6e8e75334879980eed96568f0e12064c8b1913424eac1805e976736b", size = 3902666, upload-time = "2026-08-19T05:02:55.607Z" },
{ url = "https://files.pythonhosted.org/packages/58/ab/3371527bd9820aae6f511697c93032ed197b0d8dab0f17818f18d3099637/lxml-6.1.2-cp314-cp314t-win_amd64.whl", hash = "sha256:7f35ba7667004ecdafebbe08da7c9fa06ee6195275bb7ef7a29ee1901e69519c", size = 4401011, upload-time = "2026-08-19T05:02:57.899Z" },
{ url = "https://files.pythonhosted.org/packages/e6/bb/e6de9b2546a4e6df4fb52fb18921906a8b7a041aba06570995759a4d6d8b/lxml-6.1.2-cp314-cp314t-win_arm64.whl", hash = "sha256:d117f39b28ab8a330a74abdbe61c2255b51973b238db25fd6c2448de1eb2a02d", size = 3823384, upload-time = "2026-08-19T05:03:00.371Z" },
{ url = "https://files.pythonhosted.org/packages/0e/83/7ff98683e14a148191278728d11ba782c3d5137886d49fd95ab4036efa1b/lxml-6.1.2-cp315-cp315-macosx_10_15_universal2.whl", hash = "sha256:1e3c67b817867c484794d7fe0d73045d7d0c67460c78a0a1249a9e92266e6a0e", size = 8609183, upload-time = "2026-08-19T04:58:32.19Z" },
{ url = "https://files.pythonhosted.org/packages/24/39/c39f05e8240e98009dd3d4ceb248319d0f36467babc5f90a909ed0c5b68a/lxml-6.1.2-cp315-cp315-macosx_10_15_x86_64.whl", hash = "sha256:d3e97ac4353cca3fbbfa829bc0c6a913771573d1c6d46932d4335c46f2b7796a", size = 4639898, upload-time = "2026-08-19T04:58:39.017Z" },
{ url = "https://files.pythonhosted.org/packages/c5/bf/25e26b089510940a0777ab334357874569255e50930224c8159cd649e754/lxml-6.1.2-cp315-cp315-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:827438bf6c8292d22a409bb7990d7cffce410f33e7664e46ca74d2ecc26975ef", size = 5037527, upload-time = "2026-08-19T04:58:46.224Z" },
{ url = "https://files.pythonhosted.org/packages/65/6d/aed3a58a3d662f7367a537fabe8c549f1446dbd043719e0ae8cd53f47819/lxml-6.1.2-cp315-cp315-manylinux_2_26_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:c470d192e27f97842a068cf12a1c1296b20ca716c56a9249715c6654bc192d19", size = 5661918, upload-time = "2026-08-19T04:59:02.534Z" },
{ url = "https://files.pythonhosted.org/packages/a5/ca/706d32b6957c0c2e005a9833e8fc528449196b38d5cfcf9e0fd86a96fb00/lxml-6.1.2-cp315-cp315-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:ef0b8ba6e13597f681b2b4924ca9c4e8c88420bf0e21d9a9006c757f2fc39d1f", size = 5249359, upload-time = "2026-08-19T05:04:01.956Z" },
{ url = "https://files.pythonhosted.org/packages/ac/e9/445ff43f56fcffa06f6f3a7189920c216f3eacef68ef834d4111cdbd86ba/lxml-6.1.2-cp315-cp315-manylinux_2_31_armv7l.whl", hash = "sha256:65c32ddc5d0750129c7b119fb57d48192b76d334c21e6b690d19dfb06b34af79", size = 4704548, upload-time = "2026-08-19T05:04:04.57Z" },
{ url = "https://files.pythonhosted.org/packages/69/78/20b8b7e79a1b1d9cd4465c332d62962858562b446692f16a27068fa54b85/lxml-6.1.2-cp315-cp315-manylinux_2_38_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:0aa07065497f191ad26c4b587ce5dbb5a7105285a3789aafd0661750e8bac537", size = 5261170, upload-time = "2026-08-19T05:04:07.336Z" },
{ url = "https://files.pythonhosted.org/packages/54/ca/84a0e1148bf511e12e0d99732a4e136a3bf1b91622f0a1b197796e2ff984/lxml-6.1.2-cp315-cp315-musllinux_1_2_aarch64.whl", hash = "sha256:cde6b8db7d2e5135129eb5e74b7b44dd2053aa767cd5023541fccedddc262453", size = 5090576, upload-time = "2026-08-19T05:04:09.968Z" },
{ url = "https://files.pythonhosted.org/packages/6f/f8/1ef6fc7070bed8753315f2e4ea66bc0d37620e1444d014db7f0267b8faaf/lxml-6.1.2-cp315-cp315-musllinux_1_2_armv7l.whl", hash = "sha256:b28842b30c4bc2e6afe137d98a5d2071a62589471e76d053bea55b0e53298af9", size = 4744614, upload-time = "2026-08-19T05:04:12.717Z" },
{ url = "https://files.pythonhosted.org/packages/87/f6/3a4824cd1c1b81d996d2d75bbd176ba13fbe9b5d89489290d93ff9558486/lxml-6.1.2-cp315-cp315-musllinux_1_2_ppc64le.whl", hash = "sha256:11f529062255209a421ae4de5b1bb36b2f0a2e1a700745e675a4bf4084d13c00", size = 5685792, upload-time = "2026-08-19T05:04:15.367Z" },
{ url = "https://files.pythonhosted.org/packages/64/9a/f133bf16a67149e00ca5d8a8f1ae662c30a86c303aa242693b67f8e19856/lxml-6.1.2-cp315-cp315-musllinux_1_2_riscv64.whl", hash = "sha256:f8b89b3be75a37509602b03f9cfa1a28298d4eed4625748148307aeb907901b7", size = 5248972, upload-time = "2026-08-19T05:04:18.491Z" },
{ url = "https://files.pythonhosted.org/packages/50/63/273e7e8a73a5d183d8552dfdaa131dfda0292ddab7bcddc5a66a0ae525d8/lxml-6.1.2-cp315-cp315-musllinux_1_2_x86_64.whl", hash = "sha256:1a2331da06dd55a8184985306eb2afd72d708283ce7e85d67bba77317b785060", size = 5271809, upload-time = "2026-08-19T05:04:21.448Z" },
{ url = "https://files.pythonhosted.org/packages/49/eb/614117c36a28909e79ff7cdec87008f0bd996478f35cf72309189cf398b1/lxml-6.1.2-cp315-cp315-win32.whl", hash = "sha256:442766b326d9892585a64e8c6c4b5ab81d0e6c0538c9f0fc11a84dc101a5d97f", size = 3662854, upload-time = "2026-08-19T05:05:07.141Z" },
{ url = "https://files.pythonhosted.org/packages/5c/e9/06aee6107cf8e7b870f10f82539f366cba10dc6053144cca80e838caf8c8/lxml-6.1.2-cp315-cp315-win_amd64.whl", hash = "sha256:a7fd1dd6faa3df9dcd8f1765237362cd885ca62cdf77a7c5f5ea383ae5b6048b", size = 4074590, upload-time = "2026-08-19T05:05:09.697Z" },
{ url = "https://files.pythonhosted.org/packages/84/bf/dad9b6baf9b26d79584834e15cef2a5dd0a13c7b1df08831e8f18244b494/lxml-6.1.2-cp315-cp315-win_arm64.whl", hash = "sha256:054175250531a5fb102d485743ff16412279c93add12385b3b1c3d7b16d8deaa", size = 3749336, upload-time = "2026-08-19T05:05:12.334Z" },
{ url = "https://files.pythonhosted.org/packages/5f/9d/cd0c43d45e2eb52df7735c6558f24054ca633499191899b0cb9040fbbc3c/lxml-6.1.2-cp315-cp315t-macosx_10_15_universal2.whl", hash = "sha256:84a2a46b93b789d8acb44cfcb3d967ce9dbe29884ddb93fbb1a33f0e0c8fcd86", size = 8857688, upload-time = "2026-08-19T05:04:24.648Z" },
{ url = "https://files.pythonhosted.org/packages/0b/26/27093dc1a9edbdd8a54652f237a387f7e63ec0192efe708bc2576d8a1383/lxml-6.1.2-cp315-cp315t-macosx_10_15_x86_64.whl", hash = "sha256:4aced3284e0353c798b060fe2c175eb81410e99b9a7e2ae6951be5333732b111", size = 4754422, upload-time = "2026-08-19T05:04:27.645Z" },
{ url = "https://files.pythonhosted.org/packages/2c/ee/502f7c93507f57eb496744a64da8f4ca86855cf88e48d14584342f1bfd92/lxml-6.1.2-cp315-cp315t-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:47c92dc5167de16e27ace8332454f12ba172dcab04f7a78a9eae14e2e41b6a41", size = 5033396, upload-time = "2026-08-19T05:04:30.054Z" },
{ url = "https://files.pythonhosted.org/packages/bf/72/c4cbbe72f951650f2afe43a70e51687e111d82b9bec46e3310ea76419d46/lxml-6.1.2-cp315-cp315t-manylinux_2_26_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:40366c23a938008a3bedfcfd80709b3a857c188b4d710b083e978ef5d2c1c715", size = 5615298, upload-time = "2026-08-19T05:04:32.752Z" },
{ url = "https://files.pythonhosted.org/packages/14/83/a3df966d6d7b6513e9dfb6fbfb041c0619642170359c1b36ab20a83e59eb/lxml-6.1.2-cp315-cp315t-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:1c4c6dc1b2485aaa4adfb6ed754f90dddcb2b96a66bbebc9e1ac242b5ce5e818", size = 5236282, upload-time = "2026-08-19T05:04:35.762Z" },
{ url = "https://files.pythonhosted.org/packages/4f/85/8692ec8173c9f8d295735b9bf410d202317e7b3ed11141e80a30f421f409/lxml-6.1.2-cp315-cp315t-manylinux_2_31_armv7l.whl", hash = "sha256:3a698fad6f122a9b3e2dc2fb598c1de7329c74a67c7a334c9109a440de2508e5", size = 4650647, upload-time = "2026-08-19T05:04:38.396Z" },
{ url = "https://files.pythonhosted.org/packages/11/e7/dbe3cece28a5bf82997a091d9dbb0fc49e725a5fa86550897ee2cf6412e6/lxml-6.1.2-cp315-cp315t-manylinux_2_38_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:14879fa5eb2b793c040bbfcb62011aa3015c65d6c9875e063ea98ce2029d51fb", size = 5243387, upload-time = "2026-08-19T05:04:41.247Z" },
{ url = "https://files.pythonhosted.org/packages/99/a9/81a2d27640db0d27200b2f32339a54e74c36d58feb5ad528b87d52a59ecc/lxml-6.1.2-cp315-cp315t-musllinux_1_2_aarch64.whl", hash = "sha256:b631174cd2e4d9f8a94ef17f911c6ded10ede93b5e7860dee7bbf85961d321e9", size = 5092624, upload-time = "2026-08-19T05:04:43.919Z" },
{ url = "https://files.pythonhosted.org/packages/cb/f4/0b0304c70c087f618d95b0306738b070bd556afd09c2c92589b78dbe5eb0/lxml-6.1.2-cp315-cp315t-musllinux_1_2_armv7l.whl", hash = "sha256:ceafa5e0536c62a5cd9f65327fa0b57d6f0b0e3435daf2c98a78d0dde7ecbae1", size = 4758742, upload-time = "2026-08-19T05:04:46.615Z" },
{ url = "https://files.pythonhosted.org/packages/a2/ec/f9fc45f1d01b632b673e11880e75292dff9953db9f426d1a38201b8eb5f5/lxml-6.1.2-cp315-cp315t-musllinux_1_2_ppc64le.whl", hash = "sha256:7c482e87cc86bed78a50462560675bc2c348ef72c47596f9b933346d5a8e920e", size = 5649540, upload-time = "2026-08-19T05:04:49.777Z" },
{ url = "https://files.pythonhosted.org/packages/6a/0b/d65e0458c2bcce0df68d5cc29ad0006e76446f02d9e50caf188fd1fb8bae/lxml-6.1.2-cp315-cp315t-musllinux_1_2_riscv64.whl", hash = "sha256:b1c0d2dde8a50520efc51644587f0fc4810e3af7d3e029d7af0be93bf39e2b5c", size = 5234869, upload-time = "2026-08-19T05:04:52.972Z" },
{ url = "https://files.pythonhosted.org/packages/ee/62/1fee828238badd3bfe9544f5cc9ce6ded421ef38e9634030445dedd78b36/lxml-6.1.2-cp315-cp315t-musllinux_1_2_x86_64.whl", hash = "sha256:dd7ea3fa47154b9fff90591b961e41b3718bd7fcd5bc2d9bb47e9845c8ace088", size = 5259992, upload-time = "2026-08-19T05:04:56.028Z" },
{ url = "https://files.pythonhosted.org/packages/20/18/35fb14dd6baccbffa6daeb2369802f04a94e3f73db3c7bb405dbab009729/lxml-6.1.2-cp315-cp315t-win32.whl", hash = "sha256:87534cec6ea325435e4adf2326b0cf3110eee9a47abf73652eb155db639c08c6", size = 3901151, upload-time = "2026-08-19T05:04:58.671Z" },
{ url = "https://files.pythonhosted.org/packages/f0/b6/07530896ca062bc3d2f09d5cb8a48e799c05b12c496205db03159ba13b6c/lxml-6.1.2-cp315-cp315t-win_amd64.whl", hash = "sha256:4e220a9c297e5d36895d489a08c9a3f1f6193b6414e702c5fb751e4a3767f8d0", size = 4395355, upload-time = "2026-08-19T05:05:01.651Z" },
{ url = "https://files.pythonhosted.org/packages/31/a8/237d8de1d77085cfd41d0c6049a044d8d01886f3afb7f1eda2f43d900a96/lxml-6.1.2-cp315-cp315t-win_arm64.whl", hash = "sha256:f16a407766bac51c65d605b06d900821751a79aa20e12185f273f14a17180e7b", size = 3822823, upload-time = "2026-08-19T05:05:04.63Z" },
]
[[package]] [[package]]
name = "magnetflix-bff" name = "magnetflix-bff"
version = "0.1.0" version = "0.1.0"
@@ -593,6 +500,7 @@ dependencies = [
{ name = "fastapi" }, { name = "fastapi" },
{ name = "grpcio" }, { name = "grpcio" },
{ name = "jinja2" }, { name = "jinja2" },
{ name = "magnetflix-contracts" },
{ name = "protobuf" }, { name = "protobuf" },
{ name = "pydantic" }, { name = "pydantic" },
{ name = "uvicorn", extra = ["standard"] }, { name = "uvicorn", extra = ["standard"] },
@@ -603,11 +511,27 @@ requires-dist = [
{ name = "fastapi", specifier = ">=0.115.0" }, { name = "fastapi", specifier = ">=0.115.0" },
{ name = "grpcio", specifier = ">=1.83.1" }, { name = "grpcio", specifier = ">=1.83.1" },
{ name = "jinja2", specifier = ">=3.1.4" }, { name = "jinja2", specifier = ">=3.1.4" },
{ name = "magnetflix-contracts", editable = "services/contracts" },
{ name = "protobuf", specifier = ">=7.36.1" }, { name = "protobuf", specifier = ">=7.36.1" },
{ name = "pydantic", specifier = ">=2.10.0" }, { name = "pydantic", specifier = ">=2.10.0" },
{ name = "uvicorn", extras = ["standard"], specifier = ">=0.32.0" }, { name = "uvicorn", extras = ["standard"], specifier = ">=0.32.0" },
] ]
[[package]]
name = "magnetflix-contracts"
version = "0.1.0"
source = { editable = "services/contracts" }
dependencies = [
{ name = "grpcio" },
{ name = "protobuf" },
]
[package.metadata]
requires-dist = [
{ name = "grpcio", specifier = ">=1.83.1" },
{ name = "protobuf", specifier = ">=7.36.2" },
]
[[package]] [[package]]
name = "magnetflix-worker" name = "magnetflix-worker"
version = "0.1.0" version = "0.1.0"
@@ -615,8 +539,9 @@ source = { editable = "services/worker" }
dependencies = [ dependencies = [
{ name = "aiosqlite" }, { name = "aiosqlite" },
{ name = "alembic" }, { name = "alembic" },
{ name = "cinemagoer" },
{ name = "grpcio" }, { name = "grpcio" },
{ name = "httpx" },
{ name = "magnetflix-contracts" },
{ name = "protobuf" }, { name = "protobuf" },
{ name = "pydantic" }, { name = "pydantic" },
{ name = "sqlalchemy" }, { name = "sqlalchemy" },
@@ -627,8 +552,9 @@ dependencies = [
requires-dist = [ requires-dist = [
{ name = "aiosqlite", specifier = ">=0.20.0" }, { name = "aiosqlite", specifier = ">=0.20.0" },
{ name = "alembic", specifier = ">=1.14.0" }, { name = "alembic", specifier = ">=1.14.0" },
{ name = "cinemagoer", specifier = ">=2023.5.1" },
{ name = "grpcio", specifier = ">=1.83.1" }, { name = "grpcio", specifier = ">=1.83.1" },
{ name = "httpx", specifier = ">=0.28.0" },
{ name = "magnetflix-contracts", editable = "services/contracts" },
{ name = "protobuf", specifier = ">=7.36.1" }, { name = "protobuf", specifier = ">=7.36.1" },
{ name = "pydantic", specifier = ">=2.10.0" }, { name = "pydantic", specifier = ">=2.10.0" },
{ name = "sqlalchemy", specifier = ">=2.0.36" }, { name = "sqlalchemy", specifier = ">=2.0.36" },
@@ -647,6 +573,7 @@ dev = [
{ name = "mypy-protobuf" }, { name = "mypy-protobuf" },
{ name = "pyright" }, { name = "pyright" },
{ name = "pytest" }, { name = "pytest" },
{ name = "pytest-asyncio" },
{ name = "ruff" }, { name = "ruff" },
] ]
@@ -659,6 +586,7 @@ dev = [
{ name = "mypy-protobuf", specifier = ">=5.1.0" }, { name = "mypy-protobuf", specifier = ">=5.1.0" },
{ name = "pyright", specifier = ">=1.1.411" }, { name = "pyright", specifier = ">=1.1.411" },
{ name = "pytest", specifier = ">=8.0.0" }, { name = "pytest", specifier = ">=8.0.0" },
{ name = "pytest-asyncio", specifier = ">=0.24.0" },
{ name = "ruff", specifier = ">=0.16.5" }, { name = "ruff", specifier = ">=0.16.5" },
] ]
@@ -779,17 +707,17 @@ wheels = [
[[package]] [[package]]
name = "protobuf" name = "protobuf"
version = "7.36.1" version = "7.36.2"
source = { registry = "https://pypi.org/simple" } source = { registry = "https://pypi.org/simple" }
sdist = { url = "https://files.pythonhosted.org/packages/86/73/f66c748df06e7fe24e658eddd600d19c4b40bad836c97ce2d0ad9851fb6b/protobuf-7.36.1.tar.gz", hash = "sha256:d0f6470f0ce2b84e3feaea2d4b816378b37ba4d4aa08a274305373de93e2d524", size = 512499, upload-time = "2026-08-31T22:40:04.667Z" } sdist = { url = "https://files.pythonhosted.org/packages/d9/89/5b8517baa72f84a67b8a307ba953c91057af618bf40bf676f3c03551f8f0/protobuf-7.36.2.tar.gz", hash = "sha256:497d0463ff3316681da6c0b9e8d06cb465d61abce00b613ab42226175644d1bb", size = 512737, upload-time = "2026-09-17T20:07:59.326Z" }
wheels = [ wheels = [
{ url = "https://files.pythonhosted.org/packages/f7/6c/3a54a58f2948b0f485df9ecdd06590f15d0a7abf46a89d50c3de709ff4ff/protobuf-7.36.1-cp310-abi3-macosx_10_9_universal2.whl", hash = "sha256:3cf2ee25d006cee57294a1196ea43b37feb78e0dcd1e8af5c1aeddb777655aca", size = 456046, upload-time = "2026-08-31T22:39:56.865Z" }, { url = "https://files.pythonhosted.org/packages/32/72/98342feb672507c8f3a69e34b4fa8961f608edba5c1a48a6f47156d92cb5/protobuf-7.36.2-cp310-abi3-macosx_10_9_universal2.whl", hash = "sha256:cbc70b17ee27e28894c7fee8bb04be1abead49e936bc70eb60052531eee2079e", size = 456039, upload-time = "2026-09-17T20:07:51.542Z" },
{ url = "https://files.pythonhosted.org/packages/6e/08/9f9548793c771095245c0eeaf0c84b76b16a5ef26158043d456f551344a0/protobuf-7.36.1-cp310-abi3-manylinux2014_aarch64.whl", hash = "sha256:43d3d37b1eb24c113b9b7d02008cac44e423f00b611b7781ae998d7623972969", size = 344226, upload-time = "2026-08-31T22:39:58.263Z" }, { url = "https://files.pythonhosted.org/packages/b6/ea/91fdf7c2b8bbd49cde056f00a9df6773532987e1c00fe2830b895af95c7e/protobuf-7.36.2-cp310-abi3-manylinux2014_aarch64.whl", hash = "sha256:e11e1f0180583a2af89db6a2ecd9e8dc40aa6d2988ca175bfd0e6d12ea72d74e", size = 344219, upload-time = "2026-09-17T20:07:52.914Z" },
{ url = "https://files.pythonhosted.org/packages/fe/51/1bdbd612fa3c51e42ea6f45d05e84dc748ddcd2663e1aa1e89a00a33facd/protobuf-7.36.1-cp310-abi3-manylinux2014_s390x.whl", hash = "sha256:39c518c05586c016d7874ff6079ee115bcec1ea5fbb1d177fbf7867ef4c67e44", size = 357229, upload-time = "2026-08-31T22:39:59.198Z" }, { url = "https://files.pythonhosted.org/packages/17/ab/5fd5f8ece73fad885c5a09aa849b32d70472f954ba3a92d3bb5974ea953b/protobuf-7.36.2-cp310-abi3-manylinux2014_s390x.whl", hash = "sha256:f4fee11ec330d238b34a05c9b675f693c20415d1c5bd7d5320cc2f8a798eb9cf", size = 357223, upload-time = "2026-09-17T20:07:53.985Z" },
{ url = "https://files.pythonhosted.org/packages/22/df/c799fe7a05ef16ba853a59db01f3a2c5f7d0676469589ccc4874f76a2a88/protobuf-7.36.1-cp310-abi3-manylinux2014_x86_64.whl", hash = "sha256:97198b77e369a0abd8e262b8f6c7266c55ddb796a3a12c76d7b8881188ed83aa", size = 343228, upload-time = "2026-08-31T22:40:00.179Z" }, { url = "https://files.pythonhosted.org/packages/db/f3/3996583dd2906297a637af12114deddf7658af6e683fedb83be061983fb5/protobuf-7.36.2-cp310-abi3-manylinux2014_x86_64.whl", hash = "sha256:89f23aa53c24553a2416fd4fd1ec06f74fa42b14b546d8883128813f775bbfd2", size = 343223, upload-time = "2026-09-17T20:07:54.931Z" },
{ url = "https://files.pythonhosted.org/packages/3d/33/d4724ec5d86d496fe4108e220618aa0837ad3423a7af7ccdd9684ccc77c8/protobuf-7.36.1-cp310-abi3-win32.whl", hash = "sha256:0b53ce95272aad50ad25d7ff03373743209822e8ba42ea7fad27d2bee1547d00", size = 443002, upload-time = "2026-08-31T22:40:01.32Z" }, { url = "https://files.pythonhosted.org/packages/fc/1b/dcc64f358fcb51811b58ae40b3d28f820725f116d86487cc20bd4b130701/protobuf-7.36.2-cp310-abi3-win32.whl", hash = "sha256:912c1221170e16c08d1f086762f563dd61ff83c18b5fa6652952dfaded66f728", size = 442998, upload-time = "2026-09-17T20:07:55.826Z" },
{ url = "https://files.pythonhosted.org/packages/db/37/155788a0d8daded960375af604202805308169f9b859419ea0aa370946e2/protobuf-7.36.1-cp310-abi3-win_amd64.whl", hash = "sha256:51139351435d9b43d88a55eaa49fb6f737fbb478fb0cbf2cf694d1a04a9d3363", size = 456518, upload-time = "2026-08-31T22:40:02.494Z" }, { url = "https://files.pythonhosted.org/packages/8a/55/b77bda4e5e5f5971fb51b07663694690e9afdb9402136c16a522bd621cad/protobuf-7.36.2-cp310-abi3-win_amd64.whl", hash = "sha256:a300819d441e078a5608c0d3c709796bb548136058fda017ae51d425b44fd353", size = 456514, upload-time = "2026-09-17T20:07:57.188Z" },
{ url = "https://files.pythonhosted.org/packages/39/ca/c47f91d3cab175b01fd8c4f0d80fdf8613be876cc616e66ad281a59c5ddf/protobuf-7.36.1-py3-none-any.whl", hash = "sha256:7d951e46b3f963d6c264c367c437921de9d5aedd9c3f9612b9077736b4e3ad5c", size = 179813, upload-time = "2026-08-31T22:40:03.54Z" }, { url = "https://files.pythonhosted.org/packages/e4/04/d52c7016b04b6c5108f26691f9d33ec82a9b65d041f1a9c771137693d618/protobuf-7.36.2-py3-none-any.whl", hash = "sha256:bdb3a345d48db958e6ce1f18e508beb0cc981d64f24088427549c866cd039f1e", size = 179806, upload-time = "2026-09-17T20:07:58.211Z" },
] ]
[[package]] [[package]]
@@ -920,6 +848,19 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/24/25/1de2678b631f5a49215c6c96fff41ba892b0a34df68d6d80292b1b48aa7f/pytest-9.1.1-py3-none-any.whl", hash = "sha256:37a86b45efb9a47a61a36449063e8e18d0cab3161329fc099eb21783169c4f0c", size = 386536, upload-time = "2026-06-19T10:58:31.347Z" }, { url = "https://files.pythonhosted.org/packages/24/25/1de2678b631f5a49215c6c96fff41ba892b0a34df68d6d80292b1b48aa7f/pytest-9.1.1-py3-none-any.whl", hash = "sha256:37a86b45efb9a47a61a36449063e8e18d0cab3161329fc099eb21783169c4f0c", size = 386536, upload-time = "2026-06-19T10:58:31.347Z" },
] ]
[[package]]
name = "pytest-asyncio"
version = "1.4.0"
source = { registry = "https://pypi.org/simple" }
dependencies = [
{ name = "pytest" },
{ name = "typing-extensions", marker = "python_full_version < '3.13'" },
]
sdist = { url = "https://files.pythonhosted.org/packages/43/7c/d36d04db312ecf4298932ef77e6e4a9e8ad017906e24e34f0b0c361a2473/pytest_asyncio-1.4.0.tar.gz", hash = "sha256:c6c0d2259945122819f171a32ecea2c349ead889ee28176caaf492143424be42", size = 58514, upload-time = "2026-05-26T09:56:04.083Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/03/e2/08a497ef684b88559c9cc5f4ad53a37e7b99e727094a86d6ea32536d5d3c/pytest_asyncio-1.4.0-py3-none-any.whl", hash = "sha256:933ca923a23075a87fb7070c0ec272a6848489824d887c85c812670932835aa1", size = 16930, upload-time = "2026-05-26T09:56:02.576Z" },
]
[[package]] [[package]]
name = "python-dotenv" name = "python-dotenv"
version = "1.2.3" version = "1.2.3"