Repository navigation
fix(console): « 2 h ago » across midnight, and the Sites spec reads moments on a fixed clock (FRU-270) - #314
Merged
Conversation
…oments on a fixed clock (FRU-270) The last note of a site read « Yesterday » two hours after it came, when midnight was between: ago() counted by the day of the calendar from the first hour. It now says hours for the 24 hours before, and only then « Yesterday » and « 3 days ago » by the calendar. The Sites spec counted its moments from the clock of the machine, so its « 2 h ago » failed between midnight and two in the morning: the moments are now counted back from noon of a fixed day, on a clock of the browser set there, and a case at half past midnight holds the rule. It fails with the rule of before (« Yesterday »). Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
Score de confiance : 4/5 ·
Niveau lite · anthropic/claude-haiku-5.5 · 0,002 $ · Le résumé, le diagramme et la liste des constats sont à la fin de la description de la PR.
Contributor
Author
|
Reply to the lite review of « Le nouveau défaut de since() peut faire échouer des specs qui ne fixent pas l'horloge » (P2): no spec reads a moment without the clock fixed. Nothing changed.
|
This was referenced Oct 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Not critical: one helper of the console and one spec. Follow-up of #302. Urgent:
e2e/console-sites.spec.tsfails onmainbetween 00:00 and 02:00 (expected « 2 h ago », received « Yesterday »).Two causes, both fixed
NOON). The test that reads moments sets the clock of the browser there (page.clock.setFixedTime).ago()counted by the day of the calendar from the first hour. A note of 22:30 read at 00:30 said « Yesterday ». The rule now, the more natural one: hours for the 24 hours before (« 2 h ago » … « 23 h ago »), then by the day of the calendar (« Yesterday », « 3 days ago » for the week, then the date).Proof
ago.tsofmainit fails (received « Yesterday »).ago.test.ts: 22:30 at 00:30 is « 2 h ago », 01:00 the day before is « 23 h ago », past 24 hours is « Yesterday » or « 2 days ago » by the calendar.console-sites18 passed, console unit tests 117 passed.No sentence is added: « {count} h ago », « Yesterday » and « {count} days ago » are on
mainwith their French.#313 (the Notes page, stacked on #306) carries the same fix to the clock of the spec. I will put it on top of this once this is merged.
🤖 Generated with Claude Code
Sakuga Review · Score de confiance : 4/5
Le changement de logique dans ago.ts est correct et peut être fusionné ; un risque de test à vérifier avant fusion, car le nouveau défaut de since() peut faire échouer des specs qui ne fixent pas l'horloge.
Constats
e2e/console-sites.spec.ts:46since() calcule désormais à partir de NOON (13 oct. 2026) au lieu de Date.now(). Un test qui appelle since() sans page.clock.setFixedTime affiche des moments relatifs à l'horloge réelle, bien plus tard que NOON : une note de 12 minutes s'affiche alors en jours ou en date, et une assertion « 12 min ago » échoue. Le diff ne montre pas les autres tests du fichier, donc je ne peux pas confirmer. Correction : Fixer l'horloge dans chaque test qui lit un moment, ou revenir à Date.now() comme défaut de since() et ne passer NOON qu'aux tests qui fixent l'horloge.
Résumé
Le changement affiche les heures pour les 24 dernières heures, puis compte les jours calendaires, et corrige « Hier » passé minuit. J'ai vérifié les bornes de ago.ts (moins de 24 h, un jour calendaire, plus de sept jours, moment futur) : elles sont correctes. Le spec e2e fixe l'horloge du navigateur pour les nouveaux cas, mais since() prend désormais NOON par défaut, ce qui peut casser des tests qui ne fixent pas l'horloge.
Non relu
Revues (1) · Dernier commit relu : fix(console): « 2 h ago » across midnight, and ... · Niveau
lite·anthropic/claude-haiku-5.5· 0,002 $