Skip to content

Fix two tests that fail for three hours every night - #53

Merged
yt314 merged 3 commits into
mainfrom
tests-that-fail-at-night
Sep 24, 2026
Merged

yt314 merged 3 commits into
mainfrom
tests-that-fail-at-night

Conversation

@yt314

@yt314 yt314 commented Sep 19, 2026 •

Copy link
Copy Markdown
Owner

I ran the suite at 22:25 UTC and two tests failed:

Failed  LessonRequestAnswerTests.Decline_EmailNamesTheDateThatWasRequested
  Assert.Contains() Failure: Sub-string not found
  String:    "בקשת השיעור של תלמידה מבקשת לא אושרה — 25"···
  Not found: "24/09/2026"

Failed  TeacherAnswerNotificationTests.ApprovingAReschedule_TellsTheParentAndTheStudentTheNewTime

Nothing is wrong with the code under test. Both tests check that an email names the right date, and both compare against the UTC date:

Assert.Contains(start.ToString("dd/MM/yyyy"), answer.Subject);

Email subjects are written in Israel time. Between 21:00 and 24:00 UTC — midnight to 03:00 in Israel — that is already the next day there, so the assertion and the email disagree. The email is right; the assertion is not.

$ date -u                     Sat Sep 19 22:25:25 UTC 2026
$ TZ=Asia/Jerusalem date       Sun Sep 20 01:25:25 IDT 2026

So the suite is red for three hours a night, every night, on a correct tree. Anyone whose CI happens to run in that window — or who works late — chases a bug that is not there.

They now compare against EmailTime.Date, the helper the subject itself is built from, so they assert what they mean: the email names this lesson's date, in the timezone the email is written in. The conversion itself is already covered separately by EmailTimeZoneTests.

The third place that formats a date this way, EmailTimeZoneTests:81, already converts to Israel time first and was fine.

Testing

dotnet test — 250 passing, run at 22:25 UTC, inside the window where the two used to fail.

Both assert that an email names the right date, and both compare against the
UTC date:

    Assert.Contains(start.ToString("dd/MM/yyyy"), answer.Subject);

Email subjects are written in Israel time. Between 21:00 and 24:00 UTC that
is already the next day there, so the two disagree and the tests fail:

    Assert.Contains() Failure: Sub-string not found
    String:    "בקשת השיעור של תלמידה מבקשת לא אושרה — 25"···
    Not found: "24/09/2026"

Nothing is wrong with the code under test — the email is correct and the
assertion is not. They now compare against EmailTime.Date, which is what the
subject is built from, so they say what they mean and pass at any hour.

Found while running the suite at 22:25 UTC.
@vercel

vercel Bot commented Sep 19, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
talmidon Ready Ready Preview Sep 24, 2026 1:22pm UTC

Adding a parent or a student creates their account and emails them an
invitation to set a password. That email goes out exactly once, and a send
that fails is only written to the log — AccountProvisioning catches the
exception so the teacher's save does not fail with it.

So a parent who never received it — a failed send, a spam folder, a link
that expired — had no way in, and the teacher had no way to help her and no
way to even know. There was no resend anywhere in the app.

Setting a password from the invitation is what verifies the address, so
EmailConfirmed already says who has come in. That now reaches the lists as
AccountActivated, the students screen marks the ones still waiting, and a
button next to them sends the invitation again.

Refused where it would be wrong: someone who already set a password (409),
a student with no sign-in of her own (409), and another teacher's parent
(404, through the tenant filter).
Let the teacher see who never got in, and send the invitation again
@yt314
yt314 merged commit e67123f into main Sep 24, 2026
7 checks passed

This branch was successfully deployed

1 active deployment
Preview — 1f756137 Deployed Sep 24, 2026 by vercel[bot]
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