Repository navigation
[PR] test: make log-retention generation stamps timezone-faithful - #6763
ranxianglei wants to merge 1 commit into
Conversation
…them
writeGeneration planted head lines as UTC wall-clock strings with the Z
stripped; the coverage reader (STAMP_RE + Date.parse) treats a zone-less
stamp as local time, so in any non-UTC zone the measured span shifted by
the offset. The 40h-vs-48h boundary test ("out-of-order stamps are NOT
evidence of missing history") flipped in UTC+8: the 40h oldest stamp
read back 8h earlier, the span reached the 48h target, and the
targetSpanMet=false assertion failed.
Found while reviewing #6742; pre-existing on master, unrelated to that
PR's diff. Use logTimestamp - the real writer's formatter - so the
planted lines round-trip exactly in every zone. Verified 23/23 under
UTC+8, UTC and America/New_York.
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.10026-pr.6763.22fffd6This exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr6763.tgz
npm install -g packageInstall instructions are refreshed on each push. |
(ai: vllm-qwen/qwen3.8-27b) 查重: 不重复 — 检索 open PR/issue,只有本 PR 触及 log-retention 测试的时间戳时区问题,无并行修复。 Reviewed PR #6763 (test-only: What I verified
CI status (verified live)2 red shards, both in tests unrelated to this PR:
Neither touches Minor observation (optional, non-blocking)
八问
判定:可合 —— 修复正确且已在三个时区实测 23/23,纯测试改动无回归。合入前 rebase 到当前 master(现 |
Found while reviewing #6742 (pre-existing on master, unrelated to that PR's diff).
Problem
writeGenerationintests/log-retention.test.tsplanted head lines as UTC wall-clock strings with theZstripped (new Date(at).toISOString().slice(0, 23)). The coverage reader (STAMP_RE+Date.parseinsrc/log-retention-coverage.ts) treats a zone-less stamp as LOCAL time, so in any non-UTC zone the measured span shifts by the offset.The 40h-vs-48h boundary test ("out-of-order stamps are NOT evidence of missing history",
tests/log-retention.test.ts:185) flips in positive-offset zones ≥ 8h: thenow-40holdest stamp reads back 8h earlier, the span reaches the 48h target, and thetargetSpanMet === falseassertion fails.Repro:
TZ=Asia/Shanghai node --import tsx --test tests/log-retention.test.tson master → 1 failure;TZ=UTC→ 23/23. The real logger (logTimestamp,src/logger.ts:408) writes local wall-clock time with no zone suffix, so the test was fabricating a line shape the logger never produces in a non-UTC zone.Change
Stamp the planted head line with
logTimestamp(new Date(at))— the real writer's own formatter. Planted lines now round-trip exactly in every zone. Test-only: no runtime, wire, config or dependency changes.Verification
tests/log-retention.test.ts23/23 underTZ=UTC+8(local),TZ=UTCandTZ=America/New_Yorknpm run typecheckclean