Skip to content

fix: preserve fractional seconds in datetime query parameters - #147

Draft
Kayvan-Zahiri wants to merge 1 commit into
cockroachdb:mainfrom
Kayvan-Zahiri:codex/preserve-datetime-query-precision
Draft

Kayvan-Zahiri wants to merge 1 commit into
cockroachdb:mainfrom
Kayvan-Zahiri:codex/preserve-datetime-query-precision

Conversation

@Kayvan-Zahiri

Copy link
Copy Markdown

Datetime query parameters are currently formatted with time.RFC3339, which omits fractional seconds. This truncates values such as 2026-10-25T12:34:56.123456789Z to 2026-10-25T12:34:56Z.

That changes exclusive audit-log starting_from cursors and pagination as_of_time snapshots. In particular, replaying a fractional audit-log cursor can revisit earlier entries within the same second.

Use time.RFC3339Nano in both the generator template and generated client. Whole-second timestamps retain their existing representation, and timezone offsets are preserved. Add a changelog entry under Unreleased/Fixed.

Eight public-method request cases exercise ListAuditLogs and ListApiKeys with nanoseconds, microseconds, a non-UTC offset, and whole seconds. Each captures the actual query sent through an in-memory HTTP transport and compares the parsed instant with the input. Before the fix, six precision cases fail and two whole-second controls pass.

Validation:

  • Full go test -race ./... -count=1 -v: passes, including all eight new request cases and existing header tests.
  • go vet ./..., make validate, gofmt checks, and git diff --check: pass.

No hosted Cloud API calls or credentials were used. Generator Docker regeneration, shell automation tests, and the platform/Go-version matrix were not run. The template and generated formatter have the same one-line change. Developed with Codex assistance and reproduced locally.

@cockroachlabs-cla-agent

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

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