Skip to content

improvement(audits): skip the sql-date-binding parse for files without drizzle-orm - #6554

Merged
waleedlatif1 merged 1 commit into
stagingfrom
perf/audit-runtime
Aug 11, 2026
Merged

improvement(audits): skip the sql-date-binding parse for files without drizzle-orm#6554
waleedlatif1 merged 1 commit into
stagingfrom
perf/audit-runtime

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • check:sql-date-binding Babel-parsed all 13,941 source files under apps, packages, and scripts. A violation can only come from an sql tag resolved through a drizzle-orm import, and both the static (collectSqlBindings) and dynamic (isDrizzleImportCall) resolvers match the specifier as a string literal — so a file that never names the module cannot bind the tag and cannot violate.
  • Only ~590 of those files name it. Skip the parse for the other 92% of bytes.
  • Audit goes ~4.5s → ~0.8s (5.7x), dropping out of the four slowest audits. check:audits goes 6.0s → 5.3s wall, 38.0s → 32.9s serial.
  • Output is unchanged.

Type of Change

  • Improvement (performance)

Testing

Tested manually:

  • Clean tree before/after both report ✓ 13941 files bind every sql-template Date through a column encoder, warm timings 4.38s/4.63s → 0.82s/0.76s.
  • Planted a real violation (sql\... ${aDate}`in a file importingsqlfromdrizzle-orm`) and confirmed it is still reported with exit 1.
  • bun run check:audits and bunx biome check 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

vercelBot commented Aug 11, 2026

Copy link
Copy Markdown

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

ProjectDeploymentActionsUpdated (UTC)
docsReadyReadyPreviewAug 11, 2026 7:16pm

Request Review

@cursor

cursorBot commented Aug 11, 2026

Copy link
Copy Markdown

PR Summary

Cursor Bugbot is generating a summary for commit 38d5b01. Configure here.

…t drizzle-orm
check:sql-date-binding Babel-parsed all 13,941 source files in apps, packages,
and scripts. A violation can only come from an `sql` tag resolved through a
`drizzle-orm` import, and both the static and dynamic resolvers match the
specifier as a string literal, so a file that never names the module cannot
produce one. Only ~590 files do.
Skipping the parse for the other 92% of bytes takes the audit from ~4.5s to
~0.8s and drops it out of the four slowest audits, taking check:audits from
6.0s to 5.3s wall and 38.0s to 32.9s serial. Output is unchanged.
@waleedlatif1

Copy link
Copy Markdown
CollaboratorAuthor

@greptile

@waleedlatif1

Copy link
Copy Markdown
CollaboratorAuthor

@cursor review

@greptile-apps

greptile-appsBot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR accelerates the SQL Date-binding audit by parsing only source files whose raw text names drizzle-orm.

  • Adds a lightweight mayBindDrizzleSql prefilter.
  • Reuses each file’s loaded source when invoking the existing analyzer.
  • Preserves violation detection for all current Drizzle imports in the repository.

Confidence Score: 5/5

The PR appears safe to merge because the new prefilter retains every currently reachable Drizzle SQL-binding analysis path.

The raw substring check includes all existing drizzle-orm import spellings in the repository, while skipped files cannot currently bind the audited SQL tag.

Important Files Changed

FilenameOverview
scripts/check-sql-date-binding.tsAdds a conservative source-text prefilter before Babel parsing; no actionable defect was established for the repository’s current sources.

Reviews (2): Last reviewed commit: "improvement(audits): skip the sql-date-b..." | Re-trigger Greptile

@waleedlatif1
waleedlatif1 merged commit 440a68b into stagingAug 11, 2026
22 of 23 checks passed
@waleedlatif1
waleedlatif1 deleted the perf/audit-runtime branch August 11, 2026 19:11

@cursorcursorBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 0ee302b. Configure here.

Sign up for freeto 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

@waleedlatif1