Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .changeset/adr-0013-renumbering.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
---

docs: renumber the Postgres-to-LMDB record as ADR 0013

`docs/rewrite/decisions/` held two 0012s: the NIP-50 index (job 028, added
2026-11-11) and the Postgres-to-LMDB migration (job 029, added 2026-11-12).
The later arrival takes 0013, so numbering follows the order the records were
written. Seven Rust doc comments follow the rename; the six prose `ADR 0012`
mentions cite the NIP-50 record and keep their number.
6 changes: 3 additions & 3 deletions crates/nostream-cli/src/commands/migrate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//! The seam is `nostream_storage::migration` — a paged read of each source table and an exact
//! write of each row, neither of which the nine repository traits can express. This module owns
//! what the seam's caller owns: the manifest, the checksum, resume, the verification pass and
//! the run's own measurement (`docs/rewrite/decisions/0012-pg-to-lmdb-migration.md`).
//! the run's own measurement (`docs/rewrite/decisions/0013-pg-to-lmdb-migration.md`).
//!
//! The batch commits to the store first and the manifest is replaced atomically second, so a
//! crash between them replays one batch: every write is a put of the source's own key and
Expand Down Expand Up @@ -452,7 +452,7 @@ impl Default for TableEntry {
/// is order-independent, needs constant memory, and composes across a resume
/// (`sum(A ∪ B) = sum(A) + sum(B)`); it detects an added, removed or altered row and is stated
/// as a corruption and completeness check, not as a cryptographic commitment
/// (`docs/rewrite/decisions/0012-pg-to-lmdb-migration.md`, D4).
/// (`docs/rewrite/decisions/0013-pg-to-lmdb-migration.md`, D4).
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
struct RowSum([u64; 4]);

Expand Down Expand Up @@ -506,7 +506,7 @@ impl RowSum {
/// Adds four big-endian words into a 256-bit limb sum, modulo 2^256.
///
/// The manifest documents the checksum as the sum of the row digests modulo 2^256
/// (`docs/rewrite/decisions/0012-pg-to-lmdb-migration.md`). Adding the four words
/// (`docs/rewrite/decisions/0013-pg-to-lmdb-migration.md`). Adding the four words
/// independently is a different number whenever a limb wraps, and an independent checker
/// written from the documentation would compute a checksum this tool calls wrong, so the
/// carry has to cross the word boundary. Limb 3 is the least significant — `to_hex` writes
Expand Down
2 changes: 1 addition & 1 deletion crates/nostream-storage/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
//! trigger-maintained index whose LMDB `tags` database the event write path keeps), and
//! `events.first_seen` is stored but never indexed
//! (`docs/rewrite/decisions/0011-lmdb-backend.md`,
//! `docs/rewrite/decisions/0012-pg-to-lmdb-migration.md`).
//! `docs/rewrite/decisions/0013-pg-to-lmdb-migration.md`).

pub mod backend;
pub mod error;
Expand Down
4 changes: 2 additions & 2 deletions crates/nostream-storage/src/migration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//! This module exists for one caller — `nostream-cli migrate pg-to-lmdb` — and is **not** a
//! general read or write surface. Nothing in the relay, the daemon or the repository traits may
//! use it, and a second caller needs a decision record first
//! (`docs/rewrite/decisions/0012-pg-to-lmdb-migration.md`, D1).
//! (`docs/rewrite/decisions/0013-pg-to-lmdb-migration.md`, D1).
//!
//! It lives here rather than in the CLI because the pieces a copy needs are in this crate: the
//! Postgres row decoders (`crate::postgres::rows`), the event column list, and the LMDB
Expand Down Expand Up @@ -220,7 +220,7 @@ impl MigrationRow {
/// Reads one table of the source, a keyset page at a time.
///
/// The implementation issues no statement but these reads: the migration never writes to the
/// source (`docs/rewrite/decisions/0012-pg-to-lmdb-migration.md`, D12).
/// source (`docs/rewrite/decisions/0013-pg-to-lmdb-migration.md`, D12).
pub trait MigrationSource: Send + Sync {
/// The rows of `table` after `after`, in the table's key order, at most `limit` of them.
///
Expand Down
2 changes: 1 addition & 1 deletion crates/nostream-storage/src/postgres/migration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
//!
//! Nothing here writes. The migration issues no `INSERT`, `UPDATE`, `DELETE` or DDL against the
//! source, and never runs the embedded migrator: a source that has not been migrated fails with
//! the driver's own error (`docs/rewrite/decisions/0012-pg-to-lmdb-migration.md`, D12).
//! the driver's own error (`docs/rewrite/decisions/0013-pg-to-lmdb-migration.md`, D12).

use sqlx::Row;
use sqlx::postgres::PgRow;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# ADR 0012: The Postgres-to-LMDB migration (job 029)
# ADR 0013: The Postgres-to-LMDB migration (job 029)

- **Status:** accepted (job 029, Phase 2)
- **Deciders:** the rewrite team, on the evidence in job 029's recon and spec
Expand Down
Loading