fix(dashboard): pass nodeMap into Runtime QuotaGroup - #12868
diegosouzapw merged 2 commits into
Conversation
…gment Signed-off-by: Minxi Hou <houminxi@gmail.com>
|
Looked at
One review note asked whether the hook can return No further code change from that note. Lock: |
QuotaGroup is a module-level sibling of RuntimePageClient and was reading nodeMap from the parent's closure. That identifier is not in scope, so a quota monitor with status error/exhausted/alerting throws ReferenceError. Thread the map as a prop. Keep the empty-monitor path green; the new fixture mounts QuotaGroup. Signed-off-by: Minxi Hou <houminxi@gmail.com>
…gment Signed-off-by: Minxi Hou <houminxi@gmail.com>
142e418 to
270fe36
Compare
|
Rebased onto
|
d4d2e68
into
diegosouzapw:release/v3.8.51
) Validado numa worktree combinada com as 16 PRs desta leva sobre `release/v3.8.51`: typecheck:core limpo, check-file-size e check-changelog-integrity OK, complexity 2788/3218 e cognitive 1261/1437 (ambos sob a baseline), ESLint 0 erros nos 152 arquivos alterados, 771 testes unitários focados, 49 de integração e a suíte vitest:ui completa (2149) verdes. O `nodeMap` lido do closure de `RuntimePageClient` por uma função de nível de módulo é uma bomba-relógio silenciosa: só explode quando um monitor entra em error/exhausted/alerting, e o teste existente só alimentava listas vazias. Tirar o arquivo do exclude do vitest vale tanto quanto o fix — confirmei aqui que `tests/unit/ui/runtime-page-client.test.tsx` agora roda na `test:vitest:ui` e passa. A anotação sobre o "内部服务器错误" ser o catálogo RSC da página, e não o crash, poupou o próximo a caçar fantasma.
Bug
/dashboard/runtimethrowsReferenceError: nodeMap is not definedwhen a quota monitor is inerror,exhausted, oralerting.Empty monitor lists never reach that path.
quotaMonitorEnableddefaults to false, so the page stays idle unless monitors are turned on.No upstream issue.
Cause
QuotaGroupis a module-level function inRuntimePageClient.tsx. It readsnodeMap, which only exists insideRuntimePageClient(fromuseProviderNodeMap()). That identifier is not in scope at the module level.Landed in a7ae955 (v3.8.36, #4854). The existing unit file only fed empty monitors, and vitest excluded it (#8618).
The Chinese string "内部服务器错误" on this page is the per-page RSC
publicSystem.errorcatalog. It is not this crash.Fix
Pass
nodeMapas a prop intoQuotaGroupat the exhausted, alerting, and error call sites.useProviderNodeMap()already returnsMap(never undefined).resolveProviderNamealready usesnodeMap?.get.Tests
status: "error"andstatus: "exhausted"mountsQuotaGroup. ThrowsReferenceErrorbefore the prop; green after.ReferenceErroragain.undefinedmap is a valid fallback).tests/unit/ui/runtime-page-client.test.tsxfrom the vitest exclude list.warning→alertingremap is not in this PR.Risk
Small. Empty-monitor path is unchanged. The new prop is the same Map the parent already held.
File-size cap for this file: 1201 → 1222 (prettier wrap on the three call sites).