TestProtocol_FieldsRoundTrip fails on any machine whose TZ differs from its
system zone:
roundtrip_test.go:99: field "due_at" = "2099-03-14T23:00:00Z", want prefix "2099-03-15"
roundtrip_test.go💯 field "defer_until" = "2099-01-14T23:00:00Z", want prefix "2099-01-15"
workspace.env() builds a WHITELIST environment for the bd child (PATH, HOME,
GIT_CONFIG_NOSYSTEM, BEADS_TEST_MODE, BD_DISABLE_METRICS, optionally
BEADS_DOLT_PORT and TMPDIR). TZ is not on it, so the child inherits none and its
time.Local falls back to /etc/localtime, while the TEST process uses its own TZ.
The assertion computes its expectation from the PARENT's time.Local:
dueLocal, _ := time.ParseInLocation("2006-01-02", "2099-03-15", time.Local)
assertFieldPrefix(t, issue, "due_at", dueLocal.UTC().Format("2006-01-02"))
and compares it to a value the CHILD produced, so the two disagree whenever the
zones differ. Reproduced on macOS with a Europe/Paris system zone and TZ=UTC:
the parent expects 2099-03-15, the child stores local midnight in Paris and the
UTC form is 2099-03-14T23:00:00Z.
Not a product defect — date-only input parsed as local midnight and stored as
UTC is the documented behavior, and both processes implement it correctly. They
simply disagree about which zone is local. CI does not see it because its
runners have TZ unset AND a UTC system zone, so both sides agree by accident.
Fixed by propagating TZ into the child env, so the two share one notion of
local. Verified on a Europe/Paris system zone: the test fails on main under
TZ=UTC and passes with this change under TZ=UTC, TZ=Europe/Paris and
TZ=America/Los_Angeles (the west-of-UTC case the assertion's comment calls out).