Skip to content

test(night): cover the window and briefing on clock-change nights (#222) - #248

Merged
juancguerrerodev merged 6 commits into
DojoCodingLabs:mainfrom
saurabhbhoir456:test/night-dst-222
Dec 6, 2026
Merged

juancguerrerodev merged 6 commits into
DojoCodingLabs:mainfrom
saurabhbhoir456:test/night-dst-222

Conversation

@saurabhbhoir456

@saurabhbhoir456 saurabhbhoir456 commented Dec 6, 2026 •

Copy link
Copy Markdown
Contributor

Closes #222

The night shift runs inside a window like 23:00 to 05:00 and sends its morning briefing at a set time (HM-NIGHT-01,
US-NIGHT-01). packages/night/src/settings.ts does that math with localMinutes, localInstant, inWindow,
briefingDate, briefingTime and nextWindowStart, but every existing test uses America/Costa_Rica, which has no
daylight saving time, so nothing checked the nights when the clock moves.

What this PR does

  • Adds a describe block to packages/night/test/settings.test.ts for the clock-change nights, building instants with
    Date.UTC(...) and writing the local time each one stands for in a comment. Tests only: settings.ts is unchanged.

Tests

  • America/New_York in 2026, window 23:00 to 05:00: inWindow is true at local 01:30 and 03:30 on both the March 8
    spring night and the November 1 autumn night (including both instants that read 01:30), and false at local 05:30.
    briefingTime("2026-03-08", "07:00", zone) and briefingTime("2026-11-01", "07:00", zone) give 07:00 local with that
    morning's offset (11:00 UTC and 12:00 UTC). nextWindowStart from local noon on each change day gives 23:00 local
    that evening, with that evening's offset. localMinutes at the two instants that both read 01:30 on November 1 gives
    90 for both.
  • America/Santiago in 2026, same window: inWindow at local 23:30 and 02:00 on the night of April 4 to 5 (including
    the repeated 23:30) and on the night of September 5 to 6, briefingDate for instants inside the window, and
    briefingTime for 07:00 the next morning.

No result was wrong, so no bug report was needed: the briefing does not fire an hour early on either change night in
either zone.

How to check

pnpm --filter @hermit/night test test/settings.test.ts
pnpm --filter @hermit/night test
pnpm --filter @hermit/night typecheck

Keep in mind

  • Tests only. The window and briefing rules themselves do not change here.
  • A start time inside the skipped hour (like 00:30 in Santiago on September 6) is left out of this issue, as agreed
    there: what should happen then is a product question.
  • No em or en dashes in test names.

Pull request template

What and why

Closes #222.

Adds clock-change-night tests for the night shift window and briefing math.

Vision fit

Principle 7, small, typed and tested: the window and briefing rules now have cases where the clock moves, US and Chile included.

Non-negotiables

  • This keeps every non-negotiable in AGENTS.md as it is.
  • Or it changes one, and this is the accepted RFC: n/a

Checklist

  • It closes one issue, linked above, or it's a small fix (a typo, a broken link, a wrong comment). A feature has an accepted proposal.
  • I wrote the failing test first. It fails without this change and passes with it. Tests were added for the existing math; a broken expectation (an hour early) was checked to fail during development.
  • These pass: pnpm check:privacy, pnpm typecheck, pnpm lint, pnpm test and node scripts/guard/check.mjs --patterns scripts/guard/patterns.txt. Gate note: privacy and guard pass on this checkout today; the rest was run per package as listed under AI agents, not as one root gate on this Windows machine, where unrelated pre-existing failures appear in the site badges, the devices table and mobile source scans.
  • No new network call, telemetry, analytics, ads or crash reporting. (A new request in an app adapter is explained below, with its host, skill and risk.)
  • No new dependency, or the reason for each one is below.
  • Every UI string is in packages/copy, in es-419 and en, with matching keys and placeholders, and no em or en dashes.
  • Tests, fixtures and screenshots use made-up data only.

Model path

  • This doesn't touch the model path: packages/model, agent, skills or eval, the prompt, the router, tool descriptions, normalizers, examples or the model file.
  • It does. The eval numbers from before and after are below, run as docs/evals.md says. No held-out case was tuned on.

Screenshots

  • No UI change.
  • UI change. Each changed screen is below, in both themes and both languages, with made-up data.

New dependencies and network calls

None. No new dependency and no new network call.

AI agents

  • No AI agent wrote any part of this.
  • An AI agent helped. Which one, and what it did: Tinsel Alpha, an AI coding agent running in OpenCode, drafted the change and this description and ran the checks below, in a session directed by the author, who reviewed each step's report before it was pushed.
  • I read and ran everything in this pull request, and I can explain it.

What was run: pnpm --filter @hermit/night exec vitest run test/settings.test.ts (19/19); full @hermit/night test at the time; typecheck; eslint.

@juancguerrerodev

Copy link
Copy Markdown
Contributor

Ready to merge once the pull request template is filled in, including the "I read and ran everything" box (details on #234). 🦀

@juancguerrerodev
juancguerrerodev merged commit 3800c4c into DojoCodingLabs:main Dec 6, 2026
4 checks passed
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.

Night shift: test the window and the briefing on the nights the clock changes

3 participants