test(hubdb): eliminate approval-expiry clock-boundary flake - #306
Conversation
Seed temporal approval controls from PostgreSQL statement time with safe future and expired margins. Assert the database-observed sides and exact ten-minute lifetimes before refusal checks without changing production behavior. GSTACK-Checkpoint: 2026-07-22/approval-expiry-clock#1 Signed-off-by: Gnani Rahul Nutakki <gnani.nutakki@gmail.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
Independent local CodeRabbit review completed twice on the one-file test-only diff: uncommitted pre-signing pass and exact committed-head pass both returned zero findings. The production query, schema, ten-minute lifetime, API, authorization, and audit behavior are unchanged. The fixture now uses PostgreSQL statement time on both sides of the same half-open interval, with safe margins. |
Summary
statement_timestamp()instead of the host clockRoot cause and boundary
The former expired fixture set
approved_atfrom hosttime.Now()exactly ten minutes in the past, makingexpires_atapproximately host now. A slightly slower container database clock could therefore still satisfystatement_timestamp() < expires_atand validly consume the supposedly expired test row.This PR changes only the PostgreSQL integration fixture. Production remains database-clock authoritative and unchanged:
approved_at <= statement_timestamp() AND statement_timestamp() < expires_at. No API, schema, lifetime, authorization, audit, or runtime behavior changes.PostgreSQL documents
statement_timestamp()as the current statement start time: https://www.postgresql.org/docs/current/functions-datetime.html#FUNCTIONS-DATETIME-CURRENTProof
make e2e-isolation: pass, including PostgreSQL 18.4 and two 50,000-execution workspace fuzz campaignsmake ci: pass; zero lint findings and no known Go vulnerabilitiesmake release-check: pass with isolated GOPATH, dual reproducible four-platform archives, SPDX SBOMs, formula, and amd64/arm64 OCI layoutmake e2e-kind: pass in 512.852s across fleet fan-out, OCI, and Argo projection8ce5d0a43032e2864dc0e9785521376416052676README was reviewed; no update is needed because the documented production contract and operator behavior do not change. This adds no runtime or cloud cost.
Closes #304