Skip to content

Run CI on full matrix: ubuntu (with and without TZ), macOS and English and non-English windows - #62

Closed
jeremy-morren wants to merge 2 commits into
evoleen:masterfrom
jeremy-morren:ci-test-matrix
Closed

jeremy-morren wants to merge 2 commits into
evoleen:masterfrom
jeremy-morren:ci-test-matrix

Conversation

@jeremy-morren

Copy link
Copy Markdown

Depends on the Windows time zone #61 (fix-windows-local-timezone).

CI only ran on Ubuntu in UTC, so it never saw platform-specific local time zone problems, such as Windows detecting UTC. This runs each way the local zone is found:

Leg What it covers
Ubuntu The /etc/localtime symlink
Ubuntu, TZ=Australia/Sydney The TZ variable, and a zone with DST
Windows (English) AUS Eastern Standard Time: the Windows ID mapped through CLDR, with DST
Windows (non-English) W. Europe Standard Time with German display names (Mitteleuropäische Zeit)
macOS Paused: GitHub's macOS arm64 runners are at capacity, and jobs were cancelled before starting ("not acquired by Runner"). It's left in the workflow as a comment so it can be re-enabled.

The non-English Windows leg

  • The limitation: GitHub has no non-English Windows runners, and language packs can't be installed on them in reasonable time. In experiments on GitHub's runners, Install-Language de-DE hung until the 45-minute timeout, and Add-WindowsCapability for the basic language capability alone took 11.5 minutes and would still need a reboot to change the display language.
  • The workaround: this leg sets the current zone's display names with SetDynamicTimeZoneInformation (.github/scripts/set-windows-time-zone-names.ps1). The zone ID, which is the registry key name, stays English, exactly as on localized Windows.
  • Confirmed by experiment: Dart's DateTime.timeZoneName then reports Mitteleuropäische Zeit / Mitteleuropäische Sommerzeit, while TimeZoneKeyName stays W. Europe Standard Time.
  • The guard: the TIME_MACHINE_EXPECT_LOCALIZED_WINDOWS=1 guard test, added in the Windows PR, fails the leg if Dart doesn't report the localized names. So the leg can't silently test English.

Test results and coverage

All of this uses existing actions; nothing is hand-rolled.

  • Each leg:
    • Collects LCOV coverage of lib/ and dart test JSON results for both the main suite and the TZDB compiler suite.
    • Writes a coverage summary to its own job summary, using danielpalme/ReportGenerator-GitHub-Action.
    • Uploads the results as an artifact.
  • A final job combines all the legs:
    • EnricoMi/publish-unit-test-result-action publishes a job summary, a "Test Results" check, and one PR comment for all platforms.
    • ReportGenerator merges the legs' coverage. Lines covered on any platform count, so Windows-only and Unix-only code paths are both included. The merged report becomes a job summary, an HTML artifact, and one PR comment (marocchino/sticky-pull-request-comment).
    • Both comments are updated in place on later pushes.
  • PRs from forks have a read-only token, so they get the job summaries but no comments.
  • Triggers: CI now runs on pull requests as well as pushes.
  • First live run: "All 10 216 tests pass", 41,680 runs across the four legs and both suites, 31 skipped, 0 failed. Merged coverage was 89.3% of lib/, higher than any single leg.

Also

  • The TZDB compiler's tests (tool/tzdb_compiler/test) now run in CI. Previously nothing ran them.
  • dart pub publish --dry-run runs on every leg. It passes with 0 warnings on Windows as well as Ubuntu.

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

Comment thread .github/workflows/sanity.yaml Resolved
Comment thread lib/src/platforms/unix_time_zone.dart Resolved
@jeremy-morren
jeremy-morren force-pushed the ci-test-matrix branch 2 times, most recently from 80c4268 to 18378f1 Compare November 6, 2026 20:01
@jeremy-morren

Copy link
Copy Markdown
Author

@cursor review

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

if (failureScore < lowestFailureScore) {
lowestFailureScore = failureScore;
bestZone = candidate;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Zone guesser rejects perfect matches

Low Severity

lowestFailureScore is initialized to 30% of the instant count using integer division, and a candidate is accepted only when its failureScore is strictly less than that threshold. When there are fewer than four instants the threshold becomes 0, so a perfect match (failureScore of 0) is never accepted and the function returns null despite the documented 70% rule.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 18378f1. Configure here.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not applicable in practice. This is a line-for-line port of Noda Time's GuessZoneIdByTransitionsUncached, threshold included. The instants are every zone-interval start of every candidate over five years, which is hundreds of instants for the TZDB zones, so the threshold is never 0.

…luding non-English)

On Windows, DateTimeZone.local was UTC on most systems: detection matched
DateTime.timeZoneName (a Windows display name, localized on non-English
Windows) against a hard-coded table of English names, and fell back to UTC.
Six tests failed on Windows machines outside UTC as a result.

Local zone detection now follows Noda Time, which maps .NET's
TimeZoneInfo.Local.Id:

- Windows: the Windows zone ID from GetDynamicTimeZoneInformation (via
  dart:ffi), mapped with CLDR data embedded in tzdb.bin. The ID is the
  same in every display language. With automatic DST adjustment turned
  off, the guess below is used instead.
- Linux/macOS: the IANA ID found as .NET finds it: TZ (empty means UTC,
  ':' prefix ignored, absolute paths are zoneinfo files), else the
  /etc/localtime symlink target, else the zoneinfo file with the same
  contents. Android: persist.sys.timezone.
- TZ on Windows follows Python's tzlocal and Node.js (.NET and Noda Time
  ignore it): an IANA ID, a Windows zone ID (mapped with CLDR) or a path to
  a zone file is used; empty or unrecognised values (e.g. POSIX rules)
  leave Windows' own zone.
- Otherwise: a port of Noda Time's guess by transitions, then a fixed
  zone at the current offset (no longer UTC). On Windows with automatic
  DST adjustment off, the guess uses the zone's standard offset as Windows
  reports it, not Dart's DateTime (whose C runtime applies TZ).
The abbreviation heuristic and its hard-coded name table are removed.

Embedded CLDR Windows mapping (enabling the existing compiler port):
- Check in CLDR windowsZones.xml for every version Noda Time has (21 to
  49), from unicode-org/cldr release tags; the compiler picks the newest
  suitable file and validates it against the TZDB data.
- Fix the ported CLDR parser (root element, otherVersion, splitting IDs,
  version from the file name) and MergeWindowsZones (identity-keyed map).
- NameIdMappingSupport: Russia TZ 3/10/11 and Türkiye.

Public API matching Noda Time's TzdbDateTimeZoneSource: defaultSource,
tzdbVersion, canonicalIdMap, aliases, windowsMapping, windowsToTzdbIds,
tzdbToWindowsIds and validate(); MapZone and WindowsZones are exported.

Tests: ports of Noda Time's TzdbDateTimeZoneSourceTest, MapZoneTest,
WindowsZonesTest, CldrWindowsZonesParserTest, NameIdMappingSupportTest and
ProgramTest; Windows registry and local zone tests; Unix and TZ
behaviour tests (including child processes with TZ set).

Also: version 0.15.0 (0.14.0 is already published), with a CHANGELOG
entry; require archive ^4.6.0 (XZDecoder); NOTICE references Noda Time
3.3.0, copyright to 2026.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jeremy-morren

Copy link
Copy Markdown
Author

@cursor review

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

@jeremy-morren
jeremy-morren force-pushed the ci-test-matrix branch 2 times, most recently from 7a6b1f6 to 4357689 Compare November 6, 2026 20:52
…ndows; publish test results and coverage

CI only ran on Ubuntu in UTC, so it never saw platform-specific local time
zone problems (such as Windows detecting UTC). Matrix legs:

- Ubuntu: the /etc/localtime symlink.
- Ubuntu with TZ=Australia/Sydney: the TZ environment variable, with DST.
- Windows (English): the Windows zone ID mapped with CLDR, in
  AUS Eastern Standard Time (with DST).
- Windows (non-English): W. Europe Standard Time with German display
  names, as on German Windows. GitHub has no non-English runners and
  language packs can't be installed on them in reasonable time, so the
  zone's display names are set with SetDynamicTimeZoneInformation; the
  zone ID stays English, exactly as on localized Windows. A guard test
  (TIME_MACHINE_EXPECT_LOCALIZED_WINDOWS=1) fails the leg if Dart doesn't
  report the localized names.
- macOS is paused: GitHub's macOS arm64 runners are at capacity.

Also runs the TZDB compiler's tests and validates the package on every
leg, and publishes results with existing actions:

- Each leg collects LCOV coverage (lib/ only) and JSON test results,
  writes a coverage summary to its job summary (ReportGenerator) and
  uploads them as an artifact.
- A final job combines all legs: EnricoMi/publish-unit-test-result-action
  publishes a job summary, a "Test Results" check run and one PR comment
  for all platforms; ReportGenerator merges coverage into a job summary
  and an HTML artifact, posted as one PR comment
  (marocchino/sticky-pull-request-comment). Both comments are updated in
  place. Fork PRs get the job summaries only (read-only token).
- Runs on pull requests as well as pushes.

A pana job checks pub.dev platform support: it fails if pana stops
reporting any of the tags for everywhere Dart runs (the six platforms,
native AOT/JIT and web runtimes, WebAssembly, Dart and Flutter SDKs).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jeremy-morren

Copy link
Copy Markdown
Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

1 issue from previous review remains unresolved.

Fix All in Cursor

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit dfc90c7. Configure here.

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