Commit Graph
30 Commits
Author SHA1 Message Date
Evan JarrettandClaude Opus 5 11b85e5102 db: fill manifest_key inside its migration, not at runtime
0033 added the column and left the fill to the Jetstream backfill. That is fine
for a running system and wrong for replay: a database several releases behind
runs every pending migration back-to-back at boot, long before any worker
starts. Anything built on top of manifest_key would, on that path, silently
operate on NULLs while working perfectly on a system that had been up for a
while. Establishing a migration's data precondition out-of-band means replay
cannot see it.

The runner now supports a Go step per migration version, running inside the same
transaction as that migration's SQL, after the DDL it depends on and before the
version is recorded. A version is never recorded without its Go half.

0033's step fills manifest_key for every row lacking one. It has to be Go: the
value is a truncated sha256 and SQLite has no hash builtin. It pages through the
table and writes one UPDATE ... CASE per 500 rows, because a statement per row
would be correct and unusably slow against a remote primary.

Verified by unregistering the hook: replay then leaves 3 of 3 seeded manifests
with NULL keys. With it, all three are filled, from a snapshot of the pre-0009
schema forward.

The upserts keep their "OR manifests.manifest_key IS NULL" clause. It is a
self-healing net for rows that somehow arrive without a key rather than the
mechanism anything depends on.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-11 22:30:55 -05:00
Evan JarrettandClaude Opus 5 2abcae95f7 db: warn on schema drift at startup
Migrations can be recorded without being executed. That is not hypothetical:
migration 0009 exists to clean up after 0004, which production recorded but
never applied, leaving eleven columns behind that fresh installs never had.
Nothing reported it at the time; it surfaced later as confusing behavior.

InitDB now compares an existing database against schema.sql after migrations run
and logs one warning per difference. Fresh databases skip the check, since they
were just built from schema.sql and agree by construction.

The comparison works by applying schema.sql to a throwaway in-memory database
and introspecting that, rather than parsing the DDL. SQLite's own resolution of
types, defaults and implicit indexes is exactly what we want to compare against,
and a hand-rolled parser would drift from the engine. The introspection is
shared with TestSchemaMatchesMigrations, so the test exercises the same code
that runs at boot.

Warn-only, never fatal. A database merely ahead of or behind schema.sql is
almost always still able to serve traffic, so refusing to boot would turn a diff
that wants a corrective migration into an outage, during a deploy, which is the
worst possible moment to have one.

The README claimed new tables go in schema.sql only. That is wrong in the
direction that hurts: InitDB skips schema.sql entirely once schema_migrations
has rows, so such a table appears on fresh installs, passes every test, and is
silently absent in production. Documented the real rule along with two others
the test cannot enforce: migrations must not return rows (go-libsql rejects them
with "Execute returned rows"), and rebuild migrations must name columns
explicitly, since column order legitimately differs between fresh and upgraded
databases.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-11 21:11:46 -05:00
Evan Jarrett ab66028151 more labeler improvements. standardize did work between labeler and hold. improve sql race conditions on local-only db 2026-05-02 22:13:53 -05:00
Evan Jarrett 7c6b8945ed improve backfill and jetstream db connections 2026-04-19 18:01:17 -05:00
Evan Jarrett ef0161fb0e update settings page, move admin-panel to tailwind/daisy 2026-02-06 11:23:12 -06:00
Evan Jarrett 834bb8d36c libsql instead of sqlite for turso/bunnydb replicated sqlite 2026-02-05 20:43:04 -06:00
Evan Jarrett 51f6917444 add log shipper begin envvar cleanup 2026-01-08 22:52:32 -06:00
Evan Jarrett af815fbc7d use for range and wg.Go 2026-01-04 22:39:48 -06:00
Evan Jarrett e6bd4c122e fix sql migration bug. add better error logs for auth failures. fix showing incorrect pull commands with helm charts 2026-01-03 17:26:25 -06:00
Evan Jarrett 5f19213e32 better open graph 2025-12-18 12:29:20 -06:00
Evan Jarrett 6ef2aaf709 more test coverage. clean up docs 2025-10-28 20:39:57 -05:00
Evan Jarrett bf93dfba03 slog slog slog slog slog 2025-10-25 13:30:07 -05:00
Evan Jarrett 9eb69e2ea7 more linting fixes 2025-10-24 01:05:19 -05:00
Evan Jarrett abf48407cc clean up db migrations and schema. implement a way to fetch readmes for documentation 2025-10-21 10:28:48 -05:00
Evan Jarrett b155534d1b ui fixes, add ability to warn/hide unreachable manifests from the ui. clean up docs 2025-10-20 11:47:26 -05:00
Evan Jarrett 965e73881b try and support multi-arch manifest types. add more unit tests. add scope for oras blobs for future proofing 2025-10-19 22:26:47 -05:00
Evan Jarrett 70e802764b crazy refactor to start using holds embedded pds for crew/captain validation 2025-10-16 00:05:45 -05:00
Evan Jarrett 08086e5afc begin migration from owner based identification to hold based in appview 2025-10-15 17:09:56 -05:00
Evan Jarrett 3fad473910 use presigned urls for s3 to avoid hold bandwidth 2025-10-10 09:43:26 -05:00
Evan Jarrett 6080e9f0ee backfill cleanup 2025-10-09 17:24:49 -05:00
Evan Jarrett 0f867595c5 fix db migration logic 2025-10-09 10:54:03 -05:00
Evan Jarrett 780c5ad2d5 implement searching. provide read only connection and authorizercallback 2025-10-08 15:31:33 -05:00
Evan Jarrett 6b3223cf04 bugfixes for stars. implement migration schema 2025-10-08 14:49:30 -05:00
Evan Jarrett c77761a52d implement stars UI 2025-10-08 13:24:39 -05:00
Evan Jarrett 454298645c implement stars and pull tracking rename registry -> appview 2025-10-08 12:31:51 -05:00
Evan Jarrett 08d5fce21f move file store cache to sqlite. implement repository page 2025-10-07 21:51:53 -05:00
Evan Jarrett de60510097 add user page, clean up UI. begin label spec implementation 2025-10-07 20:50:40 -05:00
Evan Jarrett 5bcedac3c1 update docker credential helper to remove configure and store devices, not api keys. improve ui, fetch profile image 2025-10-07 19:52:26 -05:00
Evan Jarrett 678a11d1b7 backfill via com.atproto.sync.listReposByCollection 2025-10-06 21:24:46 -05:00
Evan Jarrett 383face791 implement basic web ui 2025-10-06 16:28:58 -05:00