beads/internal/storage/sqlbuild
Julian Knutsen bdd16d6383
fix(sqlbuild): bind time bounds as their UTC instant (#7655)
* fix(sqlbuild): bind time bounds as their UTC instant

BuildIssueFilterClauses bound every time bound (created/updated/closed/
started/defer/due, after and before) as tc.v.Format(time.RFC3339), which
keeps the value's offset. The columns hold UTC wall clock, and an engine
whose timestamp column carries no zone reads a literal's wall clock and
drops the offset, so a bound spelled +02:00 would compare two hours late.
Bind tc.v.UTC().Format(time.RFC3339): the same instant, spelled in UTC, at
whole seconds. Dolt already converts an offset literal to UTC and bd's
client resolves bounds to UTC, so no answer changes on any backend here;
this keeps the shared builder correct for every engine.

TestTimeBoundsBindTheUTCInstant pins all twelve bounds to the UTC spelling
of a +02:00 instant with a sub-second remainder.

Also correct the AfterCreatedAt comment, which justified the time.Time
cursor binding by a SQLite backend that no longer exists.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(sqlbuild): bind the keyset cursor as its UTC instant too

Review fixups on #7655.

BuildIssueFilterClauses bound IssueFilter.AfterCreatedAt as the caller's
time.Time, unconverted. The embedded Dolt driver sends a time.Time as its
wall clock with no zone (vitess BuildBindVariable formats it as
"2006-01-02 15:04:05.000000"), and the columns hold UTC wall clock, so a
cursor in another zone paged from the wrong position there: the keyset
walk with +02:00 cursors re-delivers rows on embedded Dolt.
go-sql-driver/mysql converts to the connection's zone (UTC) first, so
server Dolt was unaffected. Bind filter.AfterCreatedAt.UTC(), still a
time.Time, and reword the comment, which claimed the driver carries the
instant. TestKeysetCursorBindsTheUTCInstant pins the cursor args of both
orders.

The httpapi query.timestamp comment and the
TestListFilterTimeBoundsAreNormalizedToUTC doc justified the route's UTC
normalization by the old sink behavior (formatting a bound in its own
zone). They now say sqlbuild binds every range bound in UTC and the
route's normalization is its own guard in front of that.

The CHANGELOG bullet gets a bold lead, covers the cursor, and drops the
blank line that made the Fixed list loose.

Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: Eddie the Engineer <338826946+gascity-eddie[bot]@users.noreply.github.com>
2026-10-17 16:19:50 +00:00
..
BUILD.bazel ci(bazel): split //scripts:scripts_test by what it reads; partition //:repo_files (#7414) 2026-10-09 05:13:07 +00:00
counts.go feat(workapi,storage): opt-in Brief projection for the list and ready pages (#5554) 2026-08-10 10:45:23 -07:00
descendants.go perf(ready): recurse the --parent descendant walk off indexed base tables (#6130) 2026-09-30 20:22:43 -07:00
descendants_test.go perf(ready): recurse the --parent descendant walk off indexed base tables (#6130) 2026-09-30 20:22:43 -07:00
filter.go fix(sqlbuild): bind time bounds as their UTC instant (#7655) 2026-10-17 16:19:50 +00:00
filter_test.go fix(sqlbuild): bind time bounds as their UTC instant (#7655) 2026-10-17 16:19:50 +00:00
imports_boundary_test.go refactor(storage): extract shared SQL builders into internal/storage/sqlbuild (bd-6dnrw.46) 2026-06-12 15:56:23 -04:00
keyset_test.go feat(httpapi): serve bd list's order with sort on listIssues (#5666) 2026-08-27 09:21:12 -07:00
labels.go feat(stale,blocked): add label filtering to bd stale and bd blocked (#5822) 2026-08-20 15:12:04 -07:00
labels_test.go feat(stale,blocked): add label filtering to bd stale and bd blocked (#5822) 2026-08-20 15:12:04 -07:00
ready.go fix(storage): include custom active-category statuses in bd ready (#5831) (#5918) 2026-09-02 18:11:45 -07:00
reclaim.go feat(reclaim): scope filters --label/--label-any/--exclude-label/--assignee/--id (wy-jpd3.3) 2026-07-24 05:31:23 -07:00
reclaim_test.go feat(reclaim): scope filters --label/--label-any/--exclude-label/--assignee/--id (wy-jpd3.3) 2026-07-24 05:31:23 -07:00
sort.go perf(storage): SearchIssueSummaries narrow-projection foundation (be-nu4.3) (#3458) 2026-10-01 01:19:24 -07:00
sqlbuild.go fix(storage): stop reporting a broken wisp plane as an empty one in search (re-land of #5805) (#5932) 2026-08-21 16:58:43 -07:00
sqlbuild_test.go perf(storage): SearchIssueSummaries narrow-projection foundation (be-nu4.3) (#3458) 2026-10-01 01:19:24 -07:00