|
| 1 | +--- |
| 2 | +phase: 66.3.1-owner-local-dates-and-unit-whitespace |
| 3 | +plan: 13 |
| 4 | +subsystem: verification / ship |
| 5 | +tags: [p_today, chrome, pr, perfect-pr, edge-functions, deploy] |
| 6 | +requires: ["66.3.1-12"] |
| 7 | +provides: |
| 8 | + - the owner-local day checked in the real app against the migrated production database |
| 9 | + - PR #1154 merged to main as 34af21437 |
| 10 | + - export-report and generate-pdf live with resolveOwnerToday and p_today |
| 11 | +affects: ["66.4 (branches from this main)"] |
| 12 | +tech-stack: |
| 13 | + added: [] |
| 14 | + patterns: ["merge commit pinned to the reviewed head sha; Edge deploy from main with explicit slugs, checked with get_edge_function"] |
| 15 | +key-files: |
| 16 | + created: |
| 17 | + - src/lib/__tests__/unit-suite-timezone.test.ts |
| 18 | + - src/hooks/api/query-keys/__tests__/lease-expiring-owner-day.test.ts |
| 19 | + - src/lib/templates/__tests__/lease-template-dates.test.ts |
| 20 | + modified: |
| 21 | + - vitest.config.ts |
| 22 | + - src/hooks/api/query-keys/lease-keys.ts |
| 23 | + - src/components/dashboard/expiring-leases-widget.tsx |
| 24 | + - src/lib/templates/lease-template.ts |
| 25 | + - src/app/(owner)/reports/generate/components/report-types.ts |
| 26 | + - src/components/documents/documents-vault.client.tsx |
| 27 | + - tests/integration/rls/rent-ledger-append-only.test.ts |
| 28 | +decisions: |
| 29 | + - "The unit suite runs in America/Chicago, pinned in vitest.config.ts's main process. vi.stubEnv('TZ') inside a threads worker never reached Date, so four owner-day tests passed only on a Central-time host" |
| 30 | + - "Owner's call: formatDate printing timestamptz values on their UTC day (about 27 files) is a follow-up phase, not this PR" |
| 31 | + - "Owner's call: the in-body generate_lease_rent_charges comment ('up to 6 hours early') stays as applied; correcting it needs a production write" |
| 32 | + - "Owner's call: one more review cycle, then merge with no P0/P1; the second consecutive clean cycle was waived" |
| 33 | +metrics: |
| 34 | + completed: 2026-12-03 |
| 35 | + tasks: 4 |
| 36 | +--- |
| 37 | + |
| 38 | +# Phase 66.3.1 Plan 13: Verify and ship Summary |
| 39 | + |
| 40 | +The phase is merged and live. Owner RPCs, reversals, the two report Edge Functions and the dashboard's expiring-leases widget all use the owner's local day. Unit numbers and property names are stored trimmed. |
| 41 | + |
| 42 | +## Task 1: Chrome check |
| 43 | + |
| 44 | +The check ran on :3050 against production at 20:39 CST on 2026-12-02. The local day was 12-02 and the UTC day was 12-03. |
| 45 | +- Every owner-day request on 10 pages carried `p_today: "2026-12-02"`. |
| 46 | +- Reports > Expenses reads "Nothing spent Jan 1 to Dec 2, 2025". |
| 47 | + |
| 48 | +Details are in `66.3.1-13-CHROME.md`. The 320px layout could not be measured: the window resize did not apply. |
| 49 | + |
| 50 | +## Task 2: PR |
| 51 | + |
| 52 | +PR #1154 was opened from `gsd/phase-66.3.1-owner-local-dates` on the owner's go-ahead. |
| 53 | + |
| 54 | +## Task 3: CI and review |
| 55 | + |
| 56 | +Four review cycles ran. Every finding was fixed on the branch: |
| 57 | + |
| 58 | +| Cycle finding | Fix | |
| 59 | +|---------------|-----| |
| 60 | +| `checks` failed on four owner-day tests that depend on the timezone | `process.env.TZ = "America/Chicago"` in `vitest.config.ts`, a guard test, and removal of 26 dead `vi.stubEnv("TZ")` lines | |
| 61 | +| The `/reports/generate` file name and the documents zip name used the UTC day | `formatLocalYmd` plus local time; `documentsZipFilename` tested | |
| 62 | +| The expiring-leases widget bounded `end_date` by a UTC instant | `leaseQueries.expiringEnriched(today)` keys on and bounds by the owner's day | |
| 63 | +| The lease template's dates were the UTC day of module load | `createDefaultContext` computes the local day on each call | |
| 64 | +| The reversal-date integration test depended on whether a run crossed UTC midnight | It accepts either day only when the UTC day changed during the run | |
| 65 | +| Comments overstated what the code does | Corrected (A1 header date, Edge headers, tax-year comment, hook docs, cache-buster history) | |
| 66 | + |
| 67 | +The final cycle found no P0 or P1. The owner waived the second consecutive clean cycle. |
| 68 | + |
| 69 | +The final head was `2e06999f3`, with 17 checks passing and 2 skipped. All three required checks passed: checks, e2e-smoke and rls-security. migration-replay, the 9 mutation-sweep shards, CodeQL and gitleaks also passed. |
| 70 | + |
| 71 | +## Task 4: Merge and deploy |
| 72 | + |
| 73 | +| Step | Result | |
| 74 | +|------|--------| |
| 75 | +| Merge | At 10:21 CST on 2026-12-03 via `gh api … /pulls/1154/merge` (merge commit, sha-pinned to `2e06999f3`). The merge commit is `34af21437` | |
| 76 | +| Edge deploy | `bun scripts/deploy-edge-functions.ts export-report generate-pdf` from main: export-report **v154** and generate-pdf **v149**, both ACTIVE | |
| 77 | +| Edge verify | `get_edge_function` shows each version with `verify_jwt: false`, and `resolveOwnerToday`, `p_today` and `_shared/owner-today.ts` are in each bundle | |
| 78 | +| Vercel | Production deployment `dpl_At7bHda5hHtRdYfzeDChUEaT4bUF` for `34af21437` is READY | |
| 79 | + |
| 80 | +## Follow-ups (not in this phase) |
| 81 | + |
| 82 | +1. `formatDate` prints timestamptz values on their UTC day across about 27 files (tenants, inspections, applications, work orders). |
| 83 | +2. The comment inside `generate_lease_rent_charges`'s applied body says next month's charge can appear "up to 6 hours early". Through the 05:00 UTC cron it is at most 1 hour early for Central owners. |
| 84 | +3. V-2 accepts `{ p_today: undefined }` as passing the day (P3). |
| 85 | +4. These remain as documented in the PR: |
| 86 | + - timestamptz-to-owner-day comparisons still cut at UTC midnight; |
| 87 | + - `start_lease_ledger` uses the UTC month. |
| 88 | + |
| 89 | +## Self-Check: PASSED |
| 90 | + |
| 91 | +- `git log main --oneline -1` is `34af21437 fix: owner-local dates and trimmed unit numbers (#1154)`. |
| 92 | +- Both Edge Functions report the versions above through `get_edge_function`. |
0 commit comments