Skip to content

strictNullChecks slice 3: chart widgets + autopilot (#6)#211

Open
mairas wants to merge 1 commit into
mainfrom
feat/strictnullchecks-charts
Open

strictNullChecks slice 3: chart widgets + autopilot (#6)#211
mairas wants to merge 1 commit into
mainfrom
feat/strictnullchecks-charts

Conversation

@mairas

@mairas mairas commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Slice 3 of the strictNullChecks migration (#6) — the least-mechanical remainder. Four Sonnet agents on disjoint files under hard guardrails, this round told to flag any behaviour change the honest typing surfaces rather than change it silently (the discipline slices 1–2's reviews taught). I reconciled, scanned every diff, and reviewed the flagged candidates.

Fixed (385 issues, betterer baseline 574 → 189 — cumulative 80% of #6)

  • widget-data-chart (164 → 0) — null/undefined equivalence verified against Chart.js source; IDataSetRow.{x,y} kept number | null to preserve Chart.js's null-coordinate = line-gap rendering (not coerced to 0).
  • widget-windtrends-chart (100 → 0)
  • widget-autopilot (65 → 0) — required widening IAutopilotConfig.apiVersion to | null to match its already-nullable siblings (instanceId, pluginId, modes) and the widget's own if (!apiVersion) handling. No spillover to select-autopilot (already uses a nullable signal).
  • minichart (33 → 0), widget-history-chart-dialog (23 → 0)

Null/empty history is a normal runtime state (Skip ships no history provider), so chart data is widened and passed through, not defaulted.

Behaviour deltas (flagged, not silently changed)

  • widget-autopilot — the V1 legacy mode-path patch is a write, so it can't be optional-chained. On a config missing the autopilotMode entry (only reachable via a malformed config — DEFAULT_CONFIG always defines it) it now warns and keeps the configured path instead of throwing. Normal configs are byte-identical. Affects the mode display subscription, not commands.
  • widget-windtrends-chart — theme-null guards in the Chart.js draw hooks skip a frame instead of throwing (matches the sibling gauge widgets); also removed 9 pre-existing non-null assertions, replacing them with real narrowing (agent verified identical output — worth an equivalence check).
  • widget-data-chart / minichart / history-dialog — no forced behaviour changes; the agents verified their guards are unreachable dead-code paths via call-graph tracing.

Verified clean

No any/!/@ts-ignore/eslint-disable added; as unknown as counts unchanged (windtrends consolidated the file's existing chart-scale cast idiom); the retyped IChartColors/IDataSetRow/AnnPlugin interfaces are local to each chart file. No file regressed vs the baseline.

Coverage

All 5 touched files have specs (25 tests, passing). Validated via AOT build (strictTemplates over the widened chart types), lint, and betterer:ci (189).

Remaining under #6

~189 issues across smaller components/widgets (dashboard.component 36, widget-ais-radar 12, and a long tail) — a final cleanup slice.

Refs #6

Slice 3 of #6: the least-mechanical remainder — trend charts, minichart, the
history-chart dialog, and the autopilot control widget. 385 issues fixed,
betterer baseline 574 -> 189. Honest widening only; no `!`, casts, or
suppressions. Widened `IAutopilotConfig.apiVersion` to `| null` to match its
already-nullable siblings and the widget's own `if (!apiVersion)` handling.

Null/empty history is a normal runtime state (Skip ships no history provider),
so chart data is widened and passed through, not defaulted. Notably
`IDataSetRow.{x,y}` stay `number | null` to preserve Chart.js's null-coordinate
= line-gap rendering rather than coercing to 0.

Behaviour deltas the honest typing surfaced (flagged, not silently changed):
- widget-autopilot: the V1 legacy mode-path patch is a write, so it can't be
  optional-chained; on a config missing the `autopilotMode` entry (only via a
  malformed config — DEFAULT_CONFIG always defines it) it now warns and keeps
  the configured path instead of throwing. Normal configs are byte-identical.
- widget-windtrends-chart: theme-null guards in the Chart.js draw hooks skip a
  frame instead of throwing (matches the sibling gauge widgets); also removed 9
  pre-existing non-null assertions, replacing them with real narrowing.

These widgets' unit specs pass (25 tests across the 5 touched files); validated
via AOT build (strictTemplates), lint, and betterer. No file regressed.

Refs #6
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