Skip to content

Restructure ORM: normalize Manifest / ManifestEntry / Archive#7

Open
iparask wants to merge 2 commits into
feat/testsfrom
feat/ORM
Open

Restructure ORM: normalize Manifest / ManifestEntry / Archive#7
iparask wants to merge 2 commits into
feat/testsfrom
feat/ORM

Conversation

@iparask

@iparask iparask commented Jul 13, 2026

Copy link
Copy Markdown
Member

Replaces the single ArchiveQueue table (which pickled the whole manifest into a PickleType column) with three real tables — Manifest, ManifestEntry, and Archive (renamed from ArchiveQueue) — wired by real foreign keys with cascade deletes and a 1:1
ManifestArchive link. The in-memory DTO formerly named Archive is renamed ArchiveJob to free up the name. Schema style follows the sibling Librarian codebase (db. namespace, column docstrings, locked dequeue via with_for_update(skip_locked=True) filtering
both consumed and completed).

The consumers are cut over to the new shape: the /archive route builds a Manifest via get_or_create plus ManifestEntry rows and one Archive job in a single commit, and the worker rebuilds the manifest dict from item.manifest.entries (eager-loaded) instead of unpickling a blob, snapshots archive_root/archive_path per row, and takes a session_maker parameter while returning bool — two seams that let a future task-based runner drop in. Alembic is introduced with a single baseline revision stamping the three tables;

create_all() is retained for the test suite.

🤖 Assisted by Claude Sonnet 5 and Opus 4.8

@iparask iparask requested review from JBorrow and tskisner July 13, 2026 17:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant