Skip to content

Type the city-tile envelope; drop the registry any [skip release]#21

Merged
johncarmack1984 merged 1 commit into
mainfrom
audit/type-rigor
Jun 27, 2026
Merged

Type the city-tile envelope; drop the registry any [skip release]#21
johncarmack1984 merged 1 commit into
mainfrom
audit/type-rigor

Conversation

@johncarmack1984

Copy link
Copy Markdown
Owner

From the audit (type-safety lane).

  • CityTileFc — the per-city-tile payload was hand-declared inline in temp.tsx, outside the codegen drift check. Replaced with CityTileFc = FeatureCollection<Point, CityForecast> & { snapshotMs, hours } in weather.ts (mirrors LatticeFc), built from the generated CityForecast/Point so it tracks the Rust contract. The contract's CityTile<G,P> doc-comment already specifies exactly this envelope.
  • Registry anyunknownLAYERS: WeatherLayer<any>[] erased all type safety. WeatherLayer<D> is invariant in D, so a shared array can't hold specific layers directly; a defineLayer<D> existential helper type-checks each layer as its own WeatherLayer<D> (keeping selectbuild sound per layer) and erases only the array's view to unknown. Tighter than any, which would accept a malformed layer.

No runtime/behavior change. tsc, biome, build all pass.

Docs & attribution

  • N/A — internal types, no source/behavior change.

- Add CityTileFc (FeatureCollection<Point, CityForecast> & { snapshotMs, hours })
  in weather.ts, mirroring LatticeFc, and type temp.tsx's explodeCities against
  it — deleting the hand-rolled inline tile shape so the payload tracks the
  generated CityForecast/Point types instead of drifting silently.
- Replace `WeatherLayer<any>[]` with `WeatherLayer<unknown>[]` via a defineLayer
  existential helper: each layer is still type-checked as its own
  WeatherLayer<D> (select→build sound per layer), but the registry no longer
  needs `any`, which would have accepted a malformed layer.
@johncarmack1984 johncarmack1984 merged commit a8c9239 into main Jun 27, 2026
7 checks passed
@johncarmack1984 johncarmack1984 deleted the audit/type-rigor branch June 27, 2026 05:07
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