Skip to content

feat(cesium): situation scenes with milsymbol, station fleet and heat worker - #72

Merged
Jerry-CodeHub merged 3 commits into
refactor/top-nav-shellfrom
feat/cesium-situation-scenes
Oct 19, 2026
Merged

Jerry-CodeHub merged 3 commits into
refactor/top-nav-shellfrom
feat/cesium-situation-scenes

Conversation

@parker-super

Copy link
Copy Markdown
Collaborator

Stacked on #71 (refactor/top-nav-shell) — the scene shell imports its routeNav. Merge #71 first; retarget this PR to master afterwards (or let GitHub do it when the base branch is deleted).

What

  • Situation rebuilt on a deterministic maritime/air model (situationModel.ts: core/warning/watch zones, six formation templates, 61 tracks, offline zone enter/exit events streamed live): MIL-STD-2525C symbols via milsymbol, shared affiliation palette, keyframe camera tour; TimeDeck binds all six scenes to viewer.clock (play/pause, speed, scrub)
  • GeoHash: synthetic 8000-station fleet (34 provincial clusters, fixed seed); Heatmap: field computed in a Web Worker, rendered as an ImageData LUT with d3-contour isolines, main-thread fallback if the worker fails to load; Trajectory: Apache-2.0 glTF patrol aircraft with billboard fallback
  • Basemap chain without an ion token: graded ("night") OSM → pixel-checked cartocdn upgrade → AMap last fallback; failures observed per current provider with network- and HTTP-level signals de-duplicated into one threshold; banner only when all three fail. CSP: *.basemaps.cartocdn.com in img-src/connect-src across all four deployment copies
  • Six pages rewritten on the shared SceneStage/onReady lifecycle; /map/cesium becomes an in-page scene shell (Segmented + Outlet, third menu level dissolved); deps: milsymbol 3.0.4, mgrs 2.2.0

Review context

Reviewed by a multi-dimension agent pass + adversarial verification, then a fix round (recorded as the "Review fixes (2026-10-19)" CHANGELOG section): 41/45 findings fixed here, including GeoHash's dead click-flyTo (stale onReady closure), Direction targets vanishing past 1200 s (now analytic CallbackPositionProperty), stretched milsymbol canvases and invalid SIDC affiliations, the AMap fallback being unobservable, and the false failure banner when carto had taken over. Known follow-ups (not blocking): first-paint race where a late successful layer swap doesn't clear the banner, no 429/5xx tolerance in the basemap e2e all-200 assertion, one "East Sea" wording in en-US/pages.ts, no direct unit test for the two-viewer fetch-patch refcount.

Budget

publicMB 4 → 4.5: public measured 3.82 MB with the 586 KB glTF, over the old 3.8 MB headroom line; rationale recorded in size-budget.json.

Tests

  • New unit tests: symbols (SIDC validity + real canvas dimensions), fieldModel (row orientation contract, cos(lat) distance vs haversine), situationModel (enter/exit pairing, determinism), stationFleet (weight proportionality, tiny counts), routeNav, palette/GroupNav/a11y; lifecycle.test.tsx covers the provider host filter and HTTP-level provider errors
  • e2e: basemap failure branch also blocks *.autonavi.com; fixtures whitelist cartocdn console noise

… worker

- Situation rebuilt on a deterministic maritime/air model (zones, six
  formation templates, 61 tracks, offline zone events streamed live):
  MIL-STD-2525C symbols via milsymbol, shared affiliation palette,
  keyframe camera tour; TimeDeck binds all six scenes to viewer.clock
- GeoHash gains a synthetic 8000-station fleet (34 provincial clusters,
  fixed seed); Heatmap computes the field in a Web Worker and renders
  an ImageData LUT with d3-contour isolines; Trajectory flies an
  Apache-2.0 glTF patrol aircraft with a billboard fallback
- basemap chain without an ion token: graded ("night") OSM default,
  pixel-checked probe upgrades to CartoDB Dark Matter, AMap raster as
  the last fallback; failures observed per current provider with
  network- and HTTP-level signals de-duplicated into one threshold
- six pages rewritten on the shared SceneStage/onReady lifecycle;
  /map/cesium becomes an in-page scene shell (Segmented + Outlet);
  deps: milsymbol 3.0.4, mgrs 2.2.0
- add https://*.basemaps.cartocdn.com to img-src and connect-src in
  config/csp.ts (single source) and the nginx, vercel and
  Cloudflare-style _headers copies, which the consistency test
  compares directive by directive
- sync the provenance comments to the token-less basemap chain:
  graded OSM -> carto probe upgrade -> AMap fallback, so the nginx
  copy no longer claims "only HTTPS OSM without a token"
- e2e: the basemap failure test also blocks *.autonavi.com (the AMap
  fallback answered 200 with permissive CORS, so the failure banner
  never appeared and the test timed out); fixtures' third-party
  console whitelist includes basemaps.cartocdn.com
- size budget: publicMB 4 -> 4.5 with the measured 3.82 MB public
  total and rationale recorded (the 586 KB Apache-2.0 glTF pushed it
  over the old 3.8 MB headroom line); gate script comment updated
- CHANGELOG: record the Cesium situational-scenes batch and the
  2026-10-19 review-fix round; demo-script troubleshooting describes
  the three-level basemap chain instead of "check OSM"
@coderabbitai

coderabbitai Bot commented Oct 19, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 251c4eab-2ca3-49f5-8094-f13cb416db63

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Jerry-CodeHub Jerry-CodeHub left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

叠在 #71 上:#71 合入后记得把 base 改回 master。

  1. 【阻塞】CI check 失败:src/components/CesiumViewer/lifecycle.test.tsx 报 Cannot find module 'Cesium'。原因是 CesiumViewer/index.tsx 新增了顶层 import CesiumNavigation from 'cesium-navigation-es6',vitest 解析的是这个包的 main(UMD 构建),里面写的是 require("Cesium")(大写 C)。macOS 文件系统不区分大小写,能解析到 cesium;Linux CI 不行。master 上只有 Situation.tsx 引用这个包,而且没有测试加载 Situation.tsx,所以以前一直没暴露。修法任选其一:在 lifecycle.test.tsx 里 vi.mock('cesium-navigation-es6', () => ({ default: class { destroy() {} } })),或者在 vitest.config.ts 的 alias 里加 Cesium: 'cesium'。另外,由于 check 失败,build 和 e2e 被跳过,这个 PR 在 CI 上还没真正跑过构建和 e2e。
  2. 【中】OSM 探针违反 OSM 瓦片使用政策:probeTileSane 用的是 fetch(url, { cache: 'no-store' })。按 Fetch 规范,这种缓存模式下浏览器会自动加上 Cache-Control: no-cache 和 Pragma: no-cache 请求头,而 OSMF Tile Usage Policy 明确禁止发送 no-cache 头。并且每创建一个 viewer 就会探测一次 OSM(只有判定不可达后才写缓存)。公开演示站因此有被限流或封禁的风险。建议 OSM 和高德探针改用默认缓存模式;carto 的像素校验已经有 sessionStorage 缓存,不需要 no-store。
  3. 【中】ion 链路的 HTTP 层错误监听实际不生效:有 token 时,Viewer 的默认底图来自 ImageryLayer.fromWorldImagery(),它的 provider 是异步创建的。effect 执行时 imageryLayers.get(0).imageryProvider 还是 undefined,所以 watchProviderErrors 什么也没挂上。token 失效或额度耗尽(endpoint 返回 401/403)属于 provider 创建失败,只会触发 ImageryLayer.errorEvent,而这次改动恰好删掉了对它的监听。结果是「ion 失败 3 次后回落 OSM」覆盖不到 ion 最常见的故障:地球上只剩底色,既不回落也不显示横幅。建议等 layer 的 readyEvent 触发后再挂 provider 的错误监听,并把 layer.errorEvent 直接视为需要换层。
  4. 【中】cesium:osm:dead 判定一次就在整个会话里生效:OSM 探针只要超时一次(5 秒,弱网或首屏抢带宽时很容易发生),就会写入 sessionStorage。之后本会话的所有场景都直接走高德瓦片(GCJ-02,和 WGS-84 业务图层偏差几百米),点「重试底图」也不会重新探测 OSM。建议给这个判定加 TTL,或者连续失败两次才写入;用户点重试时清掉这个缓存。
  5. 【低】 docs/demo/demo-script.md 里的 _.basemaps.cartocdn.com、_.autonavi.com 是 Prettier 把成对的 * 当成强调语法改写成了 _,渲染出来是斜体,通配符也没了。建议用反引号包住:*.basemaps.cartocdn.com。
  6. 【nit】 stageEl.dataset.cesiumSwaps = debug.swaps.join(',') || undefined 在没有换层时会写入字符串 "undefined"。另外,这几处 dataset 诊断镜像注释写的是 dev 用途,但生产环境也会写。

第 1 条修复后 CI 才能继续跑;第 2–4 条建议在本 PR 内一并处理。

@Jerry-CodeHub Jerry-CodeHub left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

批准。上一条 review 里的问题后续跟进。

@Jerry-CodeHub
Jerry-CodeHub merged commit 0c81df4 into refactor/top-nav-shell Oct 19, 2026
3 of 5 checks passed
@parker-super
parker-super deleted the feat/cesium-situation-scenes branch October 19, 2026 07:55
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.

2 participants