diff --git a/.planning/phases/08-type-hygiene-conventions/08-CONTEXT.md b/.planning/phases/08-type-hygiene-conventions/08-CONTEXT.md index bfa1a7f..cee75e7 100644 --- a/.planning/phases/08-type-hygiene-conventions/08-CONTEXT.md +++ b/.planning/phases/08-type-hygiene-conventions/08-CONTEXT.md @@ -283,5 +283,33 @@ Out of scope (other phases / other milestones): mobile UAT (deferred to v1.16 pe --- +## Amendments (post-research, 2026-05-16) + +These amendments override the noted CONTEXT decisions based on research findings (08-RESEARCH.md). Phase 7 A1/A2 precedent. + +### A1 — `(window as any).moment` overridden by typed `import { moment } from "obsidian"` (overrides D-08 `window.moment` sub-rule) + +- **Research finding:** `obsidian` exports `moment` directly — `export const moment: typeof Moment` in `node_modules/obsidian/obsidian.d.ts:4415`. The 5 `(window as any).moment` casts (CalendarView.ts:163, 558, 808; EmbeddedCalendarView.ts:224; EmbeddedAgendaView.ts:379) can be replaced with `import { moment } from "obsidian"`, eliminating 5 `any` casts AND 5 dead null-check branches (the typed import is non-nullable). HIGH confidence; matches Phase 7 A2 rule-source-of-truth pattern (rule docs > README). +- **Decision (user-locked):** Use `import { moment } from "obsidian"` at all 5 sites. Drop the per-line `eslint-disable-next-line @typescript-eslint/no-explicit-any` rationale comments — they're no longer needed. +- **Impact on D-08:** The `(window as any).moment` sub-rule of D-08 is **superseded** for the 5 sites. The rest of D-08 (ambient `.d.ts` exclude, jCal narrowing, isValidCache → unknown, cosmetic any → real types) is unchanged. +- **Impact on commits:** The fix joins D-05 commit 2 (`refactor(types): tighten TypeScript hygiene (DIR-09)`). +- **Impact on CONVENTIONS.md `## Directory Compliance`:** The DIR-09 cluster's `any` rule references `import { moment } from "obsidian"` (typed, preferred) as the canonical pattern. The "intentional escape hatch via per-line disable + rationale" convention still applies for the `(dtstart as any).jCal` site (still using `unknown[]` cast), so it's still documented — just not exemplified by the `window.moment` case. + +### A2 — Tighten `ical.d.ts` `getValues()` return type beyond the D-08 lint-exclude default + +- **Research finding:** `getValues()` currently returns `any[]`. The real runtime values are one of `Time | Duration | string` depending on the property; the existing call sites handle each case explicitly. Tightening to `Array