From 667e058a774a6dabae8ad03a8cdc94029cec8ac4 Mon Sep 17 00:00:00 2001 From: le king fu Date: Sun, 4 Oct 2026 08:47:30 -0400 Subject: [PATCH] fix(onboarding): apply the three review follow-ups on the stack head - Guide: drop the internal provenance (author, date, issue number) from the BMO status line in the three copies (fr.json, en.json, guide-utilisateur.md). The status now only says the procedure is reconstructed and unconfirmed. - Dashboard: gate `showCompactChecklist` on `budgetReady` so a Base+ profile with the five other items done no longer sees the compact list vanish (5/5 under the fail-closed entitlement) and reappear (5/6) once the licence resolves. - Test: pin TZ=America/Toronto around the `formatLocalDate` tests and assert that `toISOString()` disagrees, so a UTC regression is caught on the UTC CI runner too (measured: the mutation passed 7/7 under TZ=UTC before, fails now). Follow-ups raised by the independent reviews of PRs #381, #378 and #382. Co-Authored-By: Claude Fable 5.1 --- docs/guide-utilisateur.md | 2 +- src/hooks/useImportWizard.test.ts | 16 ++++++++++++++-- src/i18n/locales/en.json | 2 +- src/i18n/locales/fr.json | 2 +- src/pages/DashboardPage.tsx | 6 +++++- 5 files changed, 22 insertions(+), 6 deletions(-) diff --git a/docs/guide-utilisateur.md b/docs/guide-utilisateur.md index d6a47f1..793f38c 100644 --- a/docs/guide-utilisateur.md +++ b/docs/guide-utilisateur.md @@ -183,7 +183,7 @@ Les cartes de crédit n'offrent qu'environ trois mois d'historique. #### BMO -*Procédure reconstituée (fournie par Max le 2026-10-03, d'après une description générale), à confirmer sur un compte réel ; format de fichier non encore reconnu (#371)* +*Procédure reconstituée d'après une description générale, à confirmer sur un compte réel ; format de fichier non encore reconnu* 1. Connectez-vous aux Services bancaires en ligne BMO sur bmo.com (le site, pas l'application) 2. Dans le sommaire, cliquez sur le compte voulu (chèques, épargne ou Mastercard) diff --git a/src/hooks/useImportWizard.test.ts b/src/hooks/useImportWizard.test.ts index 47d16b5..0f29cf3 100644 --- a/src/hooks/useImportWizard.test.ts +++ b/src/hooks/useImportWizard.test.ts @@ -8,7 +8,7 @@ // dispatches), and never touched by an error — which also leaves the scanned // sources exactly as they were. Plus the local-date helper handed to Rust. -import { describe, it, expect, vi } from "vitest"; +import { describe, it, expect, vi, beforeAll, afterAll } from "vitest"; // The hook module imports the import services (→ db → tauri plugins). Stub the // connection so importing the module never touches a real database. @@ -111,11 +111,23 @@ describe("wizardReducer — sampleCreated (#356)", () => { }); describe("formatLocalDate (#356)", () => { + // Pin a timezone west of Greenwich: under TZ=UTC (the CI runner) local and + // UTC dates coincide, so a `toISOString()` regression would pass unnoticed. + const originalTz = process.env.TZ; + beforeAll(() => { + process.env.TZ = "America/Toronto"; + }); + afterAll(() => { + if (originalTz === undefined) delete process.env.TZ; + else process.env.TZ = originalTz; + }); + it("formats the LOCAL calendar date, zero-padded", () => { // Built from local components, so the expectation holds in every timezone — // unlike `toISOString()`, which would shift this evening date to the 6th - // east of Greenwich and to the 4th west of it. + // in Toronto (04:30Z the next day). expect(formatLocalDate(new Date(2026, 0, 5, 23, 30))).toBe("2026-01-05"); + expect(new Date(2026, 0, 5, 23, 30).toISOString().slice(0, 10)).not.toBe("2026-01-05"); expect(formatLocalDate(new Date(2026, 11, 31, 0, 0))).toBe("2026-12-31"); }); }); diff --git a/src/i18n/locales/en.json b/src/i18n/locales/en.json index 73e6abc..d4a91a5 100644 --- a/src/i18n/locales/en.json +++ b/src/i18n/locales/en.json @@ -996,7 +996,7 @@ { "id": "import-bmo", "title": "BMO", - "status": "Procedure reconstructed (provided by Max on 2026-10-03 from a general description), to be confirmed on a real account; file format not recognised yet (#371)", + "status": "Procedure reconstructed from a general description, to be confirmed on a real account; file format not recognised yet", "steps": [ "Sign in to BMO Online Banking at bmo.com (the website, not the app)", "In the summary, click the account you want (chequing, savings or Mastercard)", diff --git a/src/i18n/locales/fr.json b/src/i18n/locales/fr.json index 894c897..a6a00e0 100644 --- a/src/i18n/locales/fr.json +++ b/src/i18n/locales/fr.json @@ -996,7 +996,7 @@ { "id": "import-bmo", "title": "BMO", - "status": "Procédure reconstituée (fournie par Max le 2026-10-03, d'après une description générale), à confirmer sur un compte réel ; format de fichier non encore reconnu (#371)", + "status": "Procédure reconstituée d'après une description générale, à confirmer sur un compte réel ; format de fichier non encore reconnu", "steps": [ "Connectez-vous aux Services bancaires en ligne BMO sur bmo.com (le site, pas l'application)", "Dans le sommaire, cliquez sur le compte voulu (chèques, épargne ou Mastercard)", diff --git a/src/pages/DashboardPage.tsx b/src/pages/DashboardPage.tsx index 13f5c24..f68fecc 100644 --- a/src/pages/DashboardPage.tsx +++ b/src/pages/DashboardPage.tsx @@ -109,7 +109,11 @@ export default function DashboardPage() { ); } - const showCompactChecklist = checklistReady && !onboarding.hidden && !checklist.complete; + // `complete` is computed with the fail-closed entitlement (Budget locked → 5/5) + // until the licence resolves; gate on `budgetReady` so a Base+ profile with the + // five other items done does not see the list vanish, then reappear as 5/6. + const showCompactChecklist = + checklistReady && !onboarding.hidden && !(onboarding.budgetReady && checklist.complete); return (