feat(store): migrate channels + channel_pins + coordination to sqlc (T3) - #792
Merged
Merged
Conversation
|
Compass engineering docs preview: https://compass-repo-rig-3034-sqlc-t-56pf.compass-eng-docs.pages.dev Deployed from |
Base automatically changed from
compass-repo/rig-3034-sqlc-t2-accounts
to
main
August 31, 2026 16:29
Migrate the channels, channel_pins, and coordination store domains from
inline pgx SQL to sqlc-generated typed queries (RIG-3034, design record
sqlc-adoption T3), following the T2 recipe exactly. Pool-scoped calls go
through s.q; tx-scoped through s.q.WithTx(tx) / db.New(tx). Every migrated
statement is semantically identical to the inline SQL it replaced (same
columns, WHERE, JOINs, ORDER BY, null-handling); the CTE-based channel and
group visibility reads move into queries/channels.sql with their predicates
inlined per query (sqlc has no fragment composition), textually identical so
the stream-edge single-id checks cannot drift from the list reads.
The DELETE-and-check-rows-affected member removal uses the :execrows kind so
removeMember/SetCoordinationMembersTx keep their RowsAffected semantics. The
coordination per-owner advisory lock pg_advisory_xact_lock(hashtext('coordination:' || $1))
is now a tx-bound LockOwnerCoordination call inside its transaction; the
suffix-search channel-provision loop, the WithTx seam, error wrapping,
domain-type mapping, and the FOR UPDATE lock / cap-check control flow all
stay hand-written. Regenerated internal/store/db (drift-clean) and dropped
the three migrated inline-sql-gate allowlist entries (24 -> 21).
Co-authored-by: Matt Wilkinson <matt@rigel.build>
rigel-mintaka
force-pushed
the
compass-repo/rig-3034-sqlc-t3-channels
branch
from
August 31, 2026 16:35
3baaac3 to
c068b3a
Compare
This was referenced Aug 31, 2026
mattwilkinsonn
approved these changes
Aug 31, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR is part of a stack containing 3 PRs:
mainMigrate the channels, channel_pins, and coordination store domains from
inline pgx SQL to sqlc-generated typed queries (RIG-3034, design record
sqlc-adoption T3), following the T2 recipe exactly. Pool-scoped calls go
through s.q; tx-scoped through s.q.WithTx(tx) / db.New(tx). Every migrated
statement is semantically identical to the inline SQL it replaced (same
columns, WHERE, JOINs, ORDER BY, null-handling); the CTE-based channel and
group visibility reads move into queries/channels.sql with their predicates
inlined per query (sqlc has no fragment composition), textually identical so
the stream-edge single-id checks cannot drift from the list reads.
The DELETE-and-check-rows-affected member removal uses the :execrows kind so
removeMember/SetCoordinationMembersTx keep their RowsAffected semantics. The
coordination per-owner advisory lock pg_advisory_xact_lock(hashtext('coordination:' || $1))
is now a tx-bound LockOwnerCoordination call inside its transaction; the
suffix-search channel-provision loop, the WithTx seam, error wrapping,
domain-type mapping, and the FOR UPDATE lock / cap-check control flow all
stay hand-written. Regenerated internal/store/db (drift-clean) and dropped
the three migrated inline-sql-gate allowlist entries (24 -> 21).
Co-authored-by: Matt Wilkinson matt@rigel.build