René's URL Explorer Experiment


Title: fix(db): encode Date binds in raw sql, document the fetch_types contract by TheodoreSpeaks · Pull Request #6040 · simstudioai/sim · GitHub

Open Graph Title: fix(db): encode Date binds in raw sql, document the fetch_types contract by TheodoreSpeaks · Pull Request #6040 · simstudioai/sim

X Title: fix(db): encode Date binds in raw sql, document the fetch_types contract by TheodoreSpeaks · Pull Request #6040 · simstudioai/sim

Description: Summary Follow-up to #6035 and the fetch_types audit. Last night's staging cleanup run failed one layer deeper: statements 1–2 of pruneLargeValueMetadata now succeed, and statement 3 (tombstones) — which had never executed before because every prior run died earlier — failed with ERR_INVALID_ARG_TYPE. Root cause: a Date bound into a raw drizzle sql template has no encoder, so postgres-js's unsafe path receives the Date object and dies in Buffer.byteLength. This is a Node-side failure, independent of fetch_types (reproduced under both settings), and sql.param(date) without an encoder fails identically. The repo already had the correct idiom with a comment describing this exact failure (lib/global-work/summary.ts): bind through the matching column, sql.param(date, table.timestampColumn) Fixed the tombstone prune (deleted_at < ${sql.param(deletedBefore, executionLargeValues.deletedAt)}) Fixed the same class in v1 logs cursor pagination (app/api/v1/logs/filters.ts — both ${cursorDate} binds): any cursor-paginated GET /api/v1/logs request throws. Reproduced end-to-end through a query builder against staging; zero prod occurrences in 3 days, so the path is apparently unexercised — but it's a live public-API bug dating to ~v0.4.8 Rewrote the packages/db/db.ts fetch_types docstring: the old text ("builds array parsers only", "the one behavior this changes") is what misled #6010 into shipping broken — it now states both directions, all array types, the safe forms, and points at the pinning test Added a comment to packages/db/scripts/migrate.ts documenting why it must not inherit fetch_types: false: script migrations bind JS arrays through postgres-js's own tag, and copying the app's pool options there fails every script migration and blocks startup on every deploy and fresh self-hosted install Hardened the shared testing mock: encoderless sql.param(array) and sql.param(date) now throw with pointers to the safe forms, turning every mocked sql site's tests into detectors for both classes Strengthened the render tests: prune-metadata-sql.test.ts now asserts every bind is a scalar (no arrays, no Dates); added the missing scalar-params assertion to live-paused-statuses-sql.test.ts; new config-sql.test.ts renders the polling key-removal expression for real (its existing test passed against both previously-broken forms) Type of Change Bug fix Testing Executed the real pruneLargeValueMetadata end-to-end against local Postgres with the exact production client options (prepare: false, fetch_types: false): all 3 statements ran with real DELETEs, and a seeded 60-day-old tombstone was actually pruned (tombstonesDeleted: 1) EXPLAINed all 3 rendered statements against staging through the cleanup bouncer: 3 planned, 0 failed, all params scalar strings Reproduced the v1 cursor failure through a real query builder against staging before fixing; mutation-tested the new scalar-params assertion (fails on the bare-Date form, passes on the fix) 124 tests across payloads, polling, v1 logs, cleanup pass; tsc --noEmit clean; lint + full audit suite 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)

Open Graph Description: Summary Follow-up to #6035 and the fetch_types audit. Last night's staging cleanup run failed one layer deeper: statements 1–2 of pruneLargeValueMetadata now succeed, and statement 3 (tombstone...

X Description: Summary Follow-up to #6035 and the fetch_types audit. Last night&#39;s staging cleanup run failed one layer deeper: statements 1–2 of pruneLargeValueMetadata now succeed, and statement 3 (tombs...

Opengraph URL: https://github.com/simstudioai/sim/pull/6040

X: @github

direct link

Domain: github.com

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf
route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:882d6207-d712-118b-cf9c-8fc8fd708d8d
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idC7A4:FBC06:4F3D2A:6E6170:6AFB3BDB
html-safe-nonceaa243cda584bf378f6abc9f77b1f48b0053d98cdc5221ffb99c53ee103c4ea2a
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDN0E0OkZCQzA2OjRGM0QyQTo2RTYxNzA6NkFGQjNCREIiLCJ2aXNpdG9yX2lkIjoiNTkxNDMwODUyNDAzMTgxODcxNSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmaca642307a4d709fe139bd4fb6157606b53a11b2922b1203b2f6f99c5f8ed888ff
hovercard-subject-tagpull_request:4156649096
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/simstudioai/sim/pull/6040/files
twitter:imagehttps://avatars.githubusercontent.com/u/19564703?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/19564703?s=400&v=4
og:image:altSummary Follow-up to #6035 and the fetch_types audit. Last night's staging cleanup run failed one layer deeper: statements 1–2 of pruneLargeValueMetadata now succeed, and statement 3 (tombstone...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None2169b0dfbef67ed6b128074a5ed45bb7d5d1859783b10178b09a7765ad5f3693
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/simstudioai/sim git https://github.com/simstudioai/sim.git
octolytics-dimension-user_id199344406
octolytics-dimension-user_loginsimstudioai
octolytics-dimension-repository_id912559512
octolytics-dimension-repository_nwosimstudioai/sim
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id912559512
octolytics-dimension-repository_network_root_nwosimstudioai/sim
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release3b4fc8df5ef1c6757e733a23e6b81b6725021823
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/simstudioai/sim/pull/6040/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fsimstudioai%2Fsim%2Fpull%2F6040%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fsimstudioai%2Fsim%2Fpull%2F6040%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=simstudioai%2Fsim
Reloadhttps://github.com/simstudioai/sim/pull/6040/files
Reloadhttps://github.com/simstudioai/sim/pull/6040/files
Reloadhttps://github.com/simstudioai/sim/pull/6040/files
simstudioaihttps://github.com/simstudioai
simhttps://github.com/simstudioai/sim
Codehttps://github.com/simstudioai/sim
Issues129 (129)https://github.com/simstudioai/sim/issues
Pull requests199 (199)https://github.com/simstudioai/sim/pulls
Actionshttps://github.com/simstudioai/sim/actions
Projectshttps://github.com/simstudioai/sim/projects
Security and qualityhttps://github.com/simstudioai/sim/security
Insightshttps://github.com/simstudioai/sim/pulse
Sign up for GitHub https://github.com/signup?return_to=%2Fsimstudioai%2Fsim%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fsimstudioai%2Fsim%2Fissues%2Fnew%2Fchoose
TheodoreSpeakshttps://github.com/TheodoreSpeaks
staginghttps://github.com/simstudioai/sim/tree/staging
fix/raw-sql-date-bindshttps://github.com/simstudioai/sim/tree/fix/raw-sql-date-binds
Conversation 3 https://github.com/simstudioai/sim/pull/6040
Commits 2 https://github.com/simstudioai/sim/pull/6040/commits
Checks 25 https://github.com/simstudioai/sim/pull/6040/checks
Files changed https://github.com/simstudioai/sim/pull/6040/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/6040/files
fix(db): encode Date binds in raw sql, document the fetch_types contract https://github.com/simstudioai/sim/pull/6040/files#top
Show all changes 2 commits https://github.com/simstudioai/sim/pull/6040/files
4930c2c fix(db): encode Date binds in raw sql, document the fetch_types contract TheodoreSpeaks Jul 29, 2026 https://github.com/simstudioai/sim/pull/6040/commits/4930c2cad259ae247a7bf92b76102fac8605829e
fb92941 fix(testing): drop template placeholders from mock error message for … TheodoreSpeaks Jul 29, 2026 https://github.com/simstudioai/sim/pull/6040/commits/fb9294181af5b0c1f40bea62c9eb6fc87aa75a94
Clear filters https://github.com/simstudioai/sim/pull/6040/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/6040/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/6040/files
filters.ts https://github.com/simstudioai/sim/pull/6040/files#diff-9518f5fcafc2d2039affbd0cbf248f06086f8bfcd5e05fb0a81250a4002efca0
large-value-metadata.ts https://github.com/simstudioai/sim/pull/6040/files#diff-d060df08230fd6682a8390d1569679bc14a2d26b6afc49f1c823462bf84a0a32
live-paused-statuses-sql.test.ts https://github.com/simstudioai/sim/pull/6040/files#diff-fb57c747d639b218ab1dd8b471442381a9bdcad3c3f63ecd9d51fbc455cff740
prune-metadata-sql.test.ts https://github.com/simstudioai/sim/pull/6040/files#diff-ad712d50678dc2ce2e08f97567c4d0d6f9fae7cc727f74664c6975028b65261d
config-sql.test.ts https://github.com/simstudioai/sim/pull/6040/files#diff-2f66b8b4f60392c196657ddde52d18e0624fd1db698d4d5d0a5ea5474a472553
db.ts https://github.com/simstudioai/sim/pull/6040/files#diff-65562ec2df68f3735a9b4690adb4f844a74783c9f5c2d7a213a5124a6cd4900a
migrate.ts https://github.com/simstudioai/sim/pull/6040/files#diff-779c3d10c90f2f40f5bde1dbd478e3b67c3f73e6bd798c8e7a8f3eeca3141eeb
database.mock.ts https://github.com/simstudioai/sim/pull/6040/files#diff-859f381ad1b6a93489bef08c44a1044a2c3cc6f9b98b8d973bb5b0ef893ba42b
apps/sim/app/api/v1/logs/filters.tshttps://github.com/simstudioai/sim/pull/6040/files#diff-9518f5fcafc2d2039affbd0cbf248f06086f8bfcd5e05fb0a81250a4002efca0
View file https://github.com/simstudioai/sim/blob/fb9294181af5b0c1f40bea62c9eb6fc87aa75a94/apps/sim/app/api/v1/logs/filters.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/6040/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/6040/files#diff-9518f5fcafc2d2039affbd0cbf248f06086f8bfcd5e05fb0a81250a4002efca0
https://github.com/simstudioai/sim/pull/6040/files#diff-9518f5fcafc2d2039affbd0cbf248f06086f8bfcd5e05fb0a81250a4002efca0
apps/sim/lib/execution/payloads/large-value-metadata.tshttps://github.com/simstudioai/sim/pull/6040/files#diff-d060df08230fd6682a8390d1569679bc14a2d26b6afc49f1c823462bf84a0a32
View file https://github.com/simstudioai/sim/blob/fb9294181af5b0c1f40bea62c9eb6fc87aa75a94/apps/sim/lib/execution/payloads/large-value-metadata.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/6040/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/6040/files#diff-d060df08230fd6682a8390d1569679bc14a2d26b6afc49f1c823462bf84a0a32
https://github.com/simstudioai/sim/pull/6040/files#diff-d060df08230fd6682a8390d1569679bc14a2d26b6afc49f1c823462bf84a0a32
https://github.com/simstudioai/sim/pull/6040/files#diff-d060df08230fd6682a8390d1569679bc14a2d26b6afc49f1c823462bf84a0a32
https://github.com/simstudioai/sim/pull/6040/files#diff-d060df08230fd6682a8390d1569679bc14a2d26b6afc49f1c823462bf84a0a32
https://github.com/simstudioai/sim/pull/6040/files#diff-d060df08230fd6682a8390d1569679bc14a2d26b6afc49f1c823462bf84a0a32
https://github.com/simstudioai/sim/pull/6040/files#diff-d060df08230fd6682a8390d1569679bc14a2d26b6afc49f1c823462bf84a0a32
https://github.com/simstudioai/sim/pull/6040/files#diff-d060df08230fd6682a8390d1569679bc14a2d26b6afc49f1c823462bf84a0a32
apps/sim/lib/execution/payloads/live-paused-statuses-sql.test.tshttps://github.com/simstudioai/sim/pull/6040/files#diff-fb57c747d639b218ab1dd8b471442381a9bdcad3c3f63ecd9d51fbc455cff740
View file https://github.com/simstudioai/sim/blob/fb9294181af5b0c1f40bea62c9eb6fc87aa75a94/apps/sim/lib/execution/payloads/live-paused-statuses-sql.test.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/6040/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/6040/files#diff-fb57c747d639b218ab1dd8b471442381a9bdcad3c3f63ecd9d51fbc455cff740
apps/sim/lib/execution/payloads/prune-metadata-sql.test.tshttps://github.com/simstudioai/sim/pull/6040/files#diff-ad712d50678dc2ce2e08f97567c4d0d6f9fae7cc727f74664c6975028b65261d
View file https://github.com/simstudioai/sim/blob/fb9294181af5b0c1f40bea62c9eb6fc87aa75a94/apps/sim/lib/execution/payloads/prune-metadata-sql.test.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/6040/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/6040/files#diff-ad712d50678dc2ce2e08f97567c4d0d6f9fae7cc727f74664c6975028b65261d
https://github.com/simstudioai/sim/pull/6040/files#diff-ad712d50678dc2ce2e08f97567c4d0d6f9fae7cc727f74664c6975028b65261d
apps/sim/lib/webhooks/polling/config-sql.test.tshttps://github.com/simstudioai/sim/pull/6040/files#diff-2f66b8b4f60392c196657ddde52d18e0624fd1db698d4d5d0a5ea5474a472553
View file https://github.com/simstudioai/sim/blob/fb9294181af5b0c1f40bea62c9eb6fc87aa75a94/apps/sim/lib/webhooks/polling/config-sql.test.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/6040/{{ revealButtonHref }}
packages/db/db.tshttps://github.com/simstudioai/sim/pull/6040/files#diff-65562ec2df68f3735a9b4690adb4f844a74783c9f5c2d7a213a5124a6cd4900a
View file https://github.com/simstudioai/sim/blob/fb9294181af5b0c1f40bea62c9eb6fc87aa75a94/packages/db/db.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/6040/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/6040/files#diff-65562ec2df68f3735a9b4690adb4f844a74783c9f5c2d7a213a5124a6cd4900a
https://github.com/simstudioai/sim/pull/6040/files#diff-65562ec2df68f3735a9b4690adb4f844a74783c9f5c2d7a213a5124a6cd4900a
packages/db/scripts/migrate.tshttps://github.com/simstudioai/sim/pull/6040/files#diff-779c3d10c90f2f40f5bde1dbd478e3b67c3f73e6bd798c8e7a8f3eeca3141eeb
View file https://github.com/simstudioai/sim/blob/fb9294181af5b0c1f40bea62c9eb6fc87aa75a94/packages/db/scripts/migrate.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/6040/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/6040/files#diff-779c3d10c90f2f40f5bde1dbd478e3b67c3f73e6bd798c8e7a8f3eeca3141eeb
https://github.com/simstudioai/sim/pull/6040/files#diff-779c3d10c90f2f40f5bde1dbd478e3b67c3f73e6bd798c8e7a8f3eeca3141eeb
packages/testing/src/mocks/database.mock.tshttps://github.com/simstudioai/sim/pull/6040/files#diff-859f381ad1b6a93489bef08c44a1044a2c3cc6f9b98b8d973bb5b0ef893ba42b
View file https://github.com/simstudioai/sim/blob/fb9294181af5b0c1f40bea62c9eb6fc87aa75a94/packages/testing/src/mocks/database.mock.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/6040/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/6040/files#diff-859f381ad1b6a93489bef08c44a1044a2c3cc6f9b98b8d973bb5b0ef893ba42b
https://github.com/simstudioai/sim/pull/6040/files#diff-859f381ad1b6a93489bef08c44a1044a2c3cc6f9b98b8d973bb5b0ef893ba42b
Please reload this pagehttps://github.com/simstudioai/sim/pull/6040/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.