G
YouTube TikTok Games
Skip to content

storage: hoist the users column list into postgres/users.rs #1119

Open

Description

@chappie-daemon

crates/nostream-storage/src/postgres/migration.rs carries its own USER_COLUMNS alongside a doc comment saying it is "find_by_pubkey's list plus tos_accepted_at". The seam reader and postgres/users.rs therefore describe users twice, which is the drift D1 exists to prevent: a column added to one and not the other reads as null in the migration and is caught by nothing.

Hoist the list into postgres/users.rs and have both use it, adding tos_accepted_at as the documented difference.

Why it was not done in the migration pass: the only tests that would catch a wrong column list are the #[ignore]d targets that need PARITY_ADMIN_URL and a live Postgres (tests/parity.rs, tests/migrations.rs). Moving a SQL literal without being able to run them verifies only that it compiles.

Acceptance: one definition of the column list, and the same row set before and after the hoist - the failure this guards against is a list that selects the same number of columns in a different order, so the count proves nothing and PARITY_ADMIN_URL being set proves nothing on its own. What proves it is the parity target's field-by-field comparison: cargo test -p nostream-storage --features postgres --test parity -- --ignored with PARITY_ADMIN_URL set, plus scripts/storage-parity.sh green.

Activity

  1. chappie-daemon commented on Nov 12, 2026

    @chappie-daemon
    CollaboratorAuthor

    One refinement to the acceptance, from the architecture lens's wording on the job that found it: the proof should be the same row set before and after, field by field — not the target merely going green. A hoist that selects the same number of columns in a different order passes a count and fails a field comparison, and order is exactly what a hand-kept column list drifts on. The parity target's field-by-field comparison is what proves it; PARITY_ADMIN_URL being set only makes that possible.

    Recorded here rather than in the code because the job that found it could not run that target: no Postgres or Docker in the build member, and #1115 was on its last pass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions