fix(replication): correct Postgres epoch constant in replication client#4020
fix(replication): correct Postgres epoch constant in replication client#4020matt-aitken wants to merge 1 commit into
Conversation
The keepalive decode and standby status ack used 946080000000 as the Postgres-to-Unix epoch offset (ms). That value is 1999-12-25, seven days short of the real Postgres epoch (2000-01-01 = 946684800000). Replace both literals with a shared POSTGRES_EPOCH_MS constant matching pgoutput.ts. The affected timestamps are observability-only: the decoded keepalive timestamp is unused by consumers, and the encoded standby-reply timestamp only surfaces as pg_stat_replication.reply_time. WAL feedback is driven by the LSN bytes, so slot advancement is unaffected.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📜 Recent review details⏰ Context from checks skipped due to timeout. (27)
🧰 Additional context used📓 Path-based instructions (4)**/*.{ts,tsx}📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Files:
**/*.{ts,tsx,js,jsx}📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Files:
**/*.ts📄 CodeRabbit inference engine (.cursor/rules/otel-metrics.mdc)
Files:
**/*.{js,ts,tsx,jsx,css,json,md}📄 CodeRabbit inference engine (AGENTS.md)
Files:
🧠 Learnings (8)📚 Learning: 2026-03-22T13:26:12.060ZApplied to files:
📚 Learning: 2026-03-22T19:24:14.403ZApplied to files:
📚 Learning: 2026-05-18T08:21:27.694ZApplied to files:
📚 Learning: 2026-05-18T08:21:27.694ZApplied to files:
📚 Learning: 2026-06-13T19:53:13.759ZApplied to files:
📚 Learning: 2026-06-17T17:13:49.929ZApplied to files:
📚 Learning: 2026-06-04T18:16:35.386ZApplied to files:
📚 Learning: 2026-06-09T17:58:04.699ZApplied to files:
🔇 Additional comments (1)
WalkthroughA 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Closes #4002
Summary
internal-packages/replication/src/client.tsused946080000000as the Postgres→Unix epoch offset (ms) in two places — the keepalive decode and the standby status ack encode.new Date(946080000000)is1999-12-25, seven days short of the real Postgres epoch (2000-01-01=946684800000). The sibling parserpgoutput.tsalready has the correct value.This replaces both literals with a shared
POSTGRES_EPOCH_MSconstant matchingpgoutput.ts.Impact
Observability-only — no behavioral change to replication:
timestampis unused by consumers (both replication services destructure the heartbeat event without it).pg_stat_replication.reply_time.🤖 Generated with Claude Code