fix(source-postgres): handle date-only cursor values in PostgresTimestampFieldType#81353
fix(source-postgres): handle date-only cursor values in PostgresTimestampFieldType#81353devin-ai-integration[bot] wants to merge 2 commits into
Conversation
…tampFieldType Add fallback parsing in PgTimestampAccessor.set() and PgTimestampCodec.valueForProtobufEncoding() to handle date-only strings (e.g. '2026-08-12') by catching DateTimeParseException and retrying with LocalDate.parse().atStartOfDay(). This fixes incremental syncs that fail when cursor state was stored in date-only format but the column is resolved as TIMESTAMP type. Co-Authored-By: bot_apk <apk@cognition.ai>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Co-Authored-By: bot_apk <apk@cognition.ai>
👋 Greetings, Airbyte Team Member!Here are some helpful tips and reminders for your convenience. 💡 Show Tips and TricksPR Slash CommandsAirbyte Maintainers (that's you!) can execute the following slash commands on your PR:
📚 Show Repo GuidanceHelpful Resources
|
|
Deploy preview for airbyte-docs ready!
Deployed with vercel-action |
|
|
↪️ Triggering Reason: Draft PR with CI green, linked to Sentry-reported issue. Ready for prove-fix validation. |
|
🟡 No Regression Detected — Fix Not ExercisedConnector: OutcomeThe fix adds defensive date-only cursor parsing ( Regression tests confirmed no regressions (SPEC passed identically on both versions across all attempts). CHECK/DISCOVER/READ were Evidence
Legend: ✅ = no difference (passed), Workflow runs:
Primary Proof: Unit TestsThe PR includes 8 unit tests that directly validate the fix:
Pre-flight Checks
Next Steps
|
|
|
↪️ Triggering Reason: Prove-fix completed (🟡 No Regression — Fix Not Exercised; defensive date-parsing fix). Advancing to AI review. |
Reviewing PR for connector safety and quality.
|
🛡️ AI PR Review Report🟡 Review Action: NO ACTION (INCONCLUSIVE)
🔶 Risk Level: 3/5Logic change to timestamp cursor parsing in source-postgres sync path; defensive fallback only, no existing behavior modified. 📋 PR DetailsConnector(s): 🔍 Gate Evaluation DetailsGate-by-Gate Analysis
Detailed Gate NotesPR Hygiene
Test Coverage
Code Security
Backwards Compatibility
Live / E2E Tests
📚 Evidence ConsultedEvidence
❓ How to RespondProviding Context or JustificationThe Live / E2E Tests gate is UNKNOWN because the Options to resolve:
|
|
AI PR Review Justification: |
|
↪️ Re-triggering Reason: Previous review result was UNKNOWN. PR author posted justification for test coverage. Re-reviewing. |
Reviewing PR for connector safety and quality.
|
🛡️ AI PR Review Report🟢 Review Action: APPROVEDAll 12 gates passed. 🟦 Risk Level: 2/5Defensive date-only cursor parsing fallback in source-postgres; no existing behavior modified, purely additive error handling with unit tests. 📋 PR DetailsConnector(s): 🔍 Gate Evaluation DetailsGate-by-Gate Analysis
Live / E2E Tests — Detailed EvaluationValidation required? Yes — PR title contains "fix" (bug fix category). MCP verification (Priority 1): No pre-release version CI check-runs (Priority 2): Author justification (Comment 12): The PR author provided a justification with verifiable evidence:
Justification assessment: Sufficient — explains why live validation cannot exercise the fix (edge-case-only condition), provides verifiable workflow run links, and the PR includes comprehensive unit test coverage of the changed behavior. PR Hygiene — Evidence
Test Coverage — Evidence
📚 Evidence ConsultedEvidence
|
|
↪️ Triggering Reason: AI review approved (APPROVE). Advancing to final readiness stage. |
Auto-merge evaluation: FAILPreconditions (all must pass)
Change scope (at least one must pass)❌ No matching change scope detected. |
What
Resolves https://github.com/airbytehq/oncall/issues/13026:
Fixes
DateTimeParseExceptionwhen an incremental sync's cursor value is stored in date-only format ("2026-08-12") but the column is resolved asTIMESTAMPtype. This occurs when:How
Added
parseTimestampWithDateFallback()inPostgresTimestampFieldType.ktthat:LocalDateTime.parse(str)(standard path)DateTimeParseException, falls back toLocalDate.parse(str).atStartOfDay()DateTimeParseExceptionnaming the valueBoth
PgTimestampAccessor.set()andPgTimestampCodec.valueForProtobufEncoding()now use this fallback function.Review guide
airbyte-integrations/connectors/source-postgres/src/main/kotlin/.../types/PostgresTimestampFieldType.kt— the fixairbyte-integrations/connectors/source-postgres/src/test/kotlin/.../PostgresTimestampFieldTypeTest.kt— new unit testsUser Impact
Incremental syncs on timestamp columns with date-only cursor state no longer crash with
DateTimeParseException. The date-only value is interpreted as midnight (T00:00:00), which matches PostgreSQL's own implicit behavior for timestamp columns receiving date-only input.Can this PR be safely reverted and rolled back?
Breaking Change Evaluation
Not a breaking change. This is a defensive parsing fix that makes the connector accept a wider set of valid cursor formats — no schema, spec, state, or stream changes.
Declarative-First Evaluation
N/A — this is a Java/Kotlin bulk CDK connector, not a declarative/manifest-only connector.
Test Coverage
Added
PostgresTimestampFieldTypeTestwith 8 unit tests covering:Link to Devin session: https://app.devin.ai/sessions/df064a07ccb34e449cfe64a780a93cb4