Skip to content

fix(oauth): serialize version-guard date in slack fan-out sql#5737

Merged
TheodoreSpeaks merged 1 commit into
stagingfrom
fix/slack-fanout-date-param
Jul 17, 2026
Merged

fix(oauth): serialize version-guard date in slack fan-out sql#5737
TheodoreSpeaks merged 1 commit into
stagingfrom
fix/slack-fanout-date-param

Conversation

@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator

Summary

  • The version-guarded Slack fan-out (fix(oauth): coalesce slack token refresh per installation and preserve provider refresh errors #5723) passed a bare `Date` as a raw sql parameter; raw fragments skip drizzle's column mapping and the driver rejects Date instances (`The "string" argument must be of type string or an instance of Buffer...`), failing every guarded fan-out at runtime
  • Serialize the guard timestamp to ISO explicitly in the fragment
  • Caught in staging testing (run failed with the generic refresh error; CloudWatch showed the failed query). Verified end-to-end against a real database: guard timestamp keeps ms precision and the guarded fan-out updates all installation rows

Type of Change

  • Bug fix

Testing

Local repro script against a real Postgres reproduced the driver error pre-fix and passes post-fix (guarded fan-out writes all rows, chainVersion keeps millisecond precision). Unit suites pass.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel

vercel Bot commented Jul 17, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Jul 17, 2026 7:19pm

Request Review

@cursor

cursor Bot commented Jul 17, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Single-parameter serialization fix in an existing guard clause; no change to fan-out logic or OAuth flow beyond fixing the broken SQL binding.

Overview
Fixes a runtime failure in version-guarded Slack token fan-out when ifChainUnchangedSince is set (refresh coalescing path).

The NOT EXISTS guard compared sibling.updated_at to a raw SQL parameter that was a bare Date. Drizzle does not map types inside sql fragments, so the driver rejected the value and every guarded fan-out failed. The guard timestamp is now passed as since.toISOString(), with a short comment explaining why.

Connect-time fan-out (no guard) is unchanged; only refresh paths that pass ifChainUnchangedSince were affected.

Reviewed by Cursor Bugbot for commit 16344b0. Bugbot is set up for automated code reviews on this repo. Configure here.

@greptile-apps

greptile-apps Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes the Slack token fan-out version guard.

  • Serializes the guard timestamp as an ISO string.
  • Prevents raw SQL from passing an unsupported Date parameter to the driver.
  • Preserves the existing guarded updated_at comparison.

Confidence Score: 5/5

This looks safe to merge.

  • No blocking issues found in the changed code.
  • Guarded refresh callers provide valid database-derived dates.
  • ISO serialization retains the timestamp precision available through JavaScript Date.

Important Files Changed

Filename Overview
apps/sim/lib/oauth/slack.ts Serializes the database-derived guard timestamp before binding it in the raw Slack fan-out SQL.

Reviews (1): Last reviewed commit: "fix(oauth): serialize version-guard date..." | Re-trigger Greptile

@TheodoreSpeaks
TheodoreSpeaks merged commit c9399f8 into staging Jul 17, 2026
20 checks passed
@waleedlatif1
waleedlatif1 deleted the fix/slack-fanout-date-param branch July 18, 2026 05:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant