You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: repair final 6 integration failures + advisory-lock bug
Five test-side fixes exposed by the now-complete schema / first CI run of the suite:
- EmailVerification: verification tokens are hashed at rest (pkg/tokenhash), so
assert the hash, not the raw token (same as SessionLifecycle).
- OutboxStore: jsonb round-trips through Postgres's canonical form (space after
colon); compare with JSONEq instead of byte equality.
- RLSAudit_SentinelPolicyShape: pg_policies renders parsed expressions with
explicit ::text casts; match that normalized shape in the sentinel fragment.
- TxManager_Reentrant: the inner write used a raw pool.Exec, which grabs its own
connection and commits independently — route it through DBFromContext so it
joins the (re-entrant) transaction and rolls back with the outer.
- RLS_TenantIsolation: newTenantUser built emails from a truncated UUIDv7 prefix;
UUIDv7's leading bits are the ms timestamp, so users minted in the same tick
collided on the unique email. Use the full UUID.
One production fix:
- PartitionManager advisory lock ran pg_try_advisory_lock via pool.QueryRow, so
the session lock landed on an arbitrary pooled connection that was handed
straight back, and pg_advisory_unlock ran on a possibly-different connection
(silent no-op → leaked lock, and re-entrant TRUE for a second caller sharing
the pool). Hold a dedicated pgxpool.Conn for the lock's lifetime, guarded by a
mutex, and unlock+release on that same connection.
0 commit comments