feat(quality): make GPU id namespaces a compile-time contract (#1958)
* feat(quality): make GPU id namespaces a compile-time contract (#1956) The PR #1944 review showed that every cross-namespace GPU id bug was of a class tooling can reject. Three deterministic layers: Branded LiveGpuId. Live ids are minted only where samples enter the app (useHardwareEventListener) and where stored intent is restored; every live map, the shared selection, and the identity helpers are typed with the brand. Writing an inventory id into the selection or indexing a live map with one is now a type error - the exact shape of the shipped classic-card bug. An InventoryGpuId brand is deliberately omitted: a plain string already fails every LiveGpuId position, and no inventory-keyed map exists for it to protect. The brand immediately caught one more shipped bug: the classic card's per-GPU VRAM row indexed the live memory map with an inventory id, so the usage part of "used / total" could never resolve on real hardware. It now resolves through the toLiveGpuId name join. Fixture-realism test. GPU_FIXTURES must keep inventory and live ids distinct and non-overlapping, the way every platform does, so a future simplification cannot re-flatten the namespaces and silently re-certify cross-namespace joins. Ownership test. selectedGpuIdAtom may only be imported by the allowlisted resolution owners; anything else must consume useGpuAdapters or the derived atoms. Verified to fail on a violation and to flag stale allowlist entries. * fix(quality): require both sides of the VRAM name join, close the atom bypass Three review findings, all confirmed. The classic card's per-GPU VRAM row joined through toLiveGpuId, which only checks uniqueness on the live side. Two identically named inventory rows would therefore both resolve to the single reporting adapter and show its usage twice - the same both-sides omission already fixed in InstrumentStrip. The row now refuses when the inventory name is ambiguous. The ownership test matched only named imports, so a file could reach the atom through a namespace import and pass. It now looks for any reference to the identifier after stripping comments, which covers namespace member access while still letting gpuIdentity.ts document the contract in prose. Verified failing on both a named and a namespace leak, and passing on a comment-only mention. The minting comment claimed the payload was the only place ids are branded. The stored intent and the toLiveGpuId fallback also mint; the comment now names the monitor-payload boundary and lists the other two sites.
S
shm committed
b85c56950627d1f97d812b7501f8d931f86689aa
Parent: b81c43b
Committed by GitHub <noreply@github.com>
on 8/22/2026, 3:48:53 AM