fix(worker): send the Write2/WriteSecured2 time argument as box-local time (#228)
ci / nightly-windev (push) Has been skipped
ci / windows-x86 (push) Successful in 2m28s
ci / portable (push) Failing after 16m55s
ci / java (push) Failing after 17m47s

MXAccess reads the VT_DATE time argument of Write2, WriteSecured2 and their
bulk forms as box-local time and converts it to UTC itself. The worker passed
the proto Timestamp's UTC clock fields (the COM marshaler ignores
DateTime.Kind), so on vd03 (UTC-5) a Write2 sent at 01:33:00Z was stored at
06:33:00Z.

VariantConverter.ConvertToComTimestamp converts a timestamp_value instant with
TimeZoneInfo.ConvertTimeFromUtc into the worker's zone (TimeZoneInfo.Local by
default, DST included; an injectable zone for tests). The executor uses it for
the time argument only: value conversion is unchanged, and the read direction
(MXAccess reports UTC; ToTimestamp treats it as UTC) is unchanged. The one
residual loss is MXAccess-side: the repeated fall-back hour cannot be told
apart in an offset-less VT_DATE.

Tests: VariantConverterTimestampTests (UTC-5, US-Eastern DST both edges,
UTC+05:30, UTC, fall-back ambiguity, value path unchanged); the four executor
forwarding tests inject a fixed UTC-5 zone; the windev live Write2 smoke now
sends a past whole-second timestamp and asserts the stored one when applied.

Claude-Session: https://claude.ai/code/session_01GT67ACmpMR7b9LGRPLijMi
This commit is contained in:
Joseph Doherty
2026-11-12 20:49:41 -05:00
parent 7481b95905
commit 9ef6fc8489
12 changed files with 415 additions and 19 deletions
+7
View File
@@ -1366,6 +1366,13 @@ Known important parity areas from existing captures:
`AuthenticateUser` → `WriteSecured`/`WriteSecured2` path must send
`AdviseSupervisory` for the item before a user id on a plain write is
recorded; otherwise the user id is ignored.
- MXAccess reads the `Write2`/`WriteSecured2` time argument as box-local
time, while it reports source timestamps as UTC. Clients send
`timestamp_value` as a UTC instant; the worker converts it to the box's
local wall-clock time (DST included) before the COM call, so the stored
source timestamp equals the instant sent (#228). In the hour that repeats
when DST ends, the offset-less `VT_DATE` cannot distinguish the two
instants, so MXAccess may store one 1 h off. See `docs/WorkerConversion.md`.
- Writing an array attribute replaces the whole array — it is not an
element-wise patch. To change a subset of elements the caller must send the
full array (unchanged elements included); sending only the changed elements