Prove the import against a copy of the real library (#25) #33
Reference in New Issue
Block a user
Delete Branch "feat/prove-import-real-library"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #25.
Retires the biggest risk in #18 — losing the owner's reading history — on a copy, before production is anywhere near it.
What was run
A throwaway generator (python3 stdlib
sqlite3, ~20 lines, not committed) read a copy ofbookmarks-20260807-213515.dband emitted plain SQL: 29 distinct Series first, then 29 Bookmarks referencing them, eachINSERT ... SELECT id FROM ownerso the reader id is resolved rather than hardcoded. The target was a scratch Postgres whose schema and owner Reader were built by the real binary (go run .against a throwaway container), not by hand-written DDL. Production was not touched.Verified
(site, series_id)count in the sourceGET /bookmarksover the real read pathTRUNCATE bookmarks, series;then re-applyThe spot-check the ticket asked for was widened to a full row-by-row comparison — 29 rows is small enough that sampling was the more expensive option.
What is committed
CUTOVER.mdonly, plus two cross-links fromREDEPLOY.md. The generator stays out of the repository: its output is the owner's reading history, and it reads SQLite, which the backend module dropped in ADR-0001. So the runbook specifies the transformation — column mapping, ordering, nullability, quoting, the temp-table ownership trick — rather than shipping a script.backend/go.modgains nothing.Review
Two-axis review ran on the diff; six findings applied, all in the runbook:
title,series_url,cover,last_chapter,last_chapter_url,last_chapter_num) are nullable in SQLite butNOT NULLin Postgres and must be coalesced — the opposite oflatest_chapter_num, the one column whereNULLis meaningful. The 2026-08-07 export had none; a fresh one is not promised the same.CREATE TEMP TABLE ... ON COMMIT DROPmust sit inside the transaction, or psql's autocommit drops it instantly.ORDER BY id LIMIT 1was true by construction and could never fail.ORDER BY updated_at DESC LIMIT 5.git pull --ff-onlybeforeup -d --build, or a pre-cutover server rebuilds the SQLite image.python3andjqnamed as prerequisites; column count corrected to sixteen.Every query in the runbook was executed against the scratch database as written.
go vet,CGO_ENABLED=0 go build ./...andgo test ./...all pass — no Go code changed.