Skip to content

tests: one injected FakeClock for the tend fakes (Refs #5200) - #5201

Merged
EHotwagner merged 1 commit into
mainfrom
routine/5200-tend-fake-clock
Nov 1, 2026
Merged

EHotwagner merged 1 commit into
mainfrom
routine/5200-tend-fake-clock

Conversation

@EHotwagner

Copy link
Copy Markdown
Contributor

Refs #5200

Root cause

V2TendProposeTests "an uncertain post is never repeated, and the next run finds it by its run marker" (from #5161) fixed TendFakeGitHub.Now = "2026-11-01T12:00:00Z" (the comment's createdAt) while the tend context ran on Clock = TimeProvider.System. V2TendPropose.findPosted only accepts a comment whose createdAt is within a minute of the pending post's recorded time (the run clock). From 12:00Z on 2026-11-01 the real clock is past the fixture, so the posted comment looked older than the post and the run returned uncertain instead of verified. Red on main and every PR running coord-engine change-completeness and coord-github edge.

Change (tests only, no source change)

  • TendFakeGitHub.fs: new FakeClock (a TimeProvider that never reads the system clock; UtcNow and the monotonic timestamp follow one settable instant). Board takes it (Board() keeps working on the anchor 2026-11-01T12:00Z), stamps proposal comments from it, and exposes it as board.Clock. The fixed Now string is gone.
  • V2TendProposeTests.fs, V2TendWriteTests.fs: the tend Context Clock and Pacer use board.Clock. Sweep fixes: the other fixed 2026-11-01T12:00Z literal (someone-else comment) now derives from the clock; UpdatedAt = DateTimeOffset.UtcNow in the S3 deciding-PR test now uses the fake clock; the snapshot and plan ObservedAt use FakeClock.Anchor. The Pacer now runs on the fake monotonic timestamp instead of Stopwatch.
  • New regression Theory: the uncertain-then-verified scenario at injected instants 11:59:59, 12:00:00, 12:00:01, 2027-02-28 and 2099-12-31.

Sweep result

V2TendReadsTests, V2TendTests and cli-join TendApplicationTests pass an explicit observed and compare no fixed fixture time to a real clock (TendApplicationTests uses TimeProvider.System only against an empty fake board with no timestamps compared). The projection migration tests use UtcNow relative offsets, not fixed-vs-real; not tend and unchanged.

Fixture clocks (lifecycle-contract fixture rule)

Every tend fixture time derives from the injected FakeClock (anchor 2026-11-01T12:00:00Z unless a test passes another); none reads the system clock.

Checks run locally

  • Before: the test fails on main at 12:50Z (verified).
  • dotnet test tests/coord-board-v2-projection: 307 passed (incl. the new Theory).
  • dotnet test tests/coord-board-v2-cli-join: 103 passed.
  • The system clock itself cannot be faked in this environment (no libfaketime or compiler; time namespaces move only the monotonic clock), so independence is shown by the injected-instant Theory (before, at, just after the old cutover and in 2099) plus the absence of any system-clock read in the tend fixtures.

🤖 Generated with Claude Code

…depends on the wall clock (Refs #5200)

V2TendProposeTests 'an uncertain post is never repeated' fixed the fake GitHub's
comment time at 2026-11-01T12:00:00Z but ran the tend with TimeProvider.System, so
after 12:00Z the posted comment looked older than the post and the run stayed
uncertain. The fake GitHub now stamps comments from the same FakeClock the tend
context reads (Clock and Pacer), and the write tests use it too.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@EHotwagner

Copy link
Copy Markdown
Contributor Author

Root/fdev review: APPROVE c90edd2c.

Proportionate review for a test-only fix to a red main. Merging. Refs #5200

@EHotwagner
EHotwagner merged commit 9d761f9 into main Nov 1, 2026
27 checks passed
@EHotwagner
EHotwagner deleted the routine/5200-tend-fake-clock branch November 1, 2026 13:04
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