refactor(street-level): remove the remaining duplicated code and fakes

A duplicate scan of every module the PR adds (repeated 4-line blocks,
normalised) after gekh's dedup round left these:

- glyphs.js: the cone, ring and position glyphs share cachedGlyph(), wedge(),
  ring() and dot(). Checked with a recording canvas: all 20 draw calls keep
  the same path and fill/stroke state, so the glyphs are pixel-identical.
- panelPositionControls.js: one placeAt() for the three places that pin a
  panel's top-left corner as a fixed window.
- tiles.js: one warn() for the three background-failure logs.
- Tests: src/testSupport/streetLevelFakes.mjs holds the provider snapshot
  (uiState + presentation tests), the stand-in provider (core + controls
  tests) and one real-ray pinhole camera (view + coverage tests, which had
  each written their own). The coverage line-of-sight test still fails when
  refresh() stops passing its focus.
- qa-street-level.mjs: one waitForCoverage() for the five copies of the
  "on, drawn, settled, not key-gated" wait.

No behaviour change: unit 5862 pass, fixture gate 16/16, panel gate 5/5.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Said TurkseverandClaude Opus 5.5 committed 2026-10-06 14:27:58 +01:00
1 parent d70f468781
commit c2f1b54d00
12 files changed
+281 -345

No files matched your search

+8 -12
View File
@@ -20,6 +20,11 @@ import {
mapillaryToken,
} from './constants.js';
/** Log a background failure without its stack (never the token: none is in scope). */
function warn(what, error) {
console.warn(`[Mapillary Proxy] ${what}:`, error?.message || error);
}
/** Thrown for a request this proxy refuses before contacting Mapillary. */
export class TileRequestError extends Error {
constructor(message, status = 400) {
@@ -224,10 +229,7 @@ function writeDisk(address, bytes, at = null) {
})
.catch(async (error) => {
await fsp.rm(tmp, { force: true }).catch(() => {});
console.warn(
'[Mapillary Proxy] tile cache write failed:',
error?.message || error,
);
warn('tile cache write failed', error);
})
.finally(() => {
if (newest()) _diskWrites.delete(file);
@@ -248,10 +250,7 @@ function scheduleSweep(root) {
.catch((error) => {
if (_sweepWarned) return;
_sweepWarned = true;
console.warn(
'[Mapillary Proxy] tile cache sweep failed:',
error?.message || error,
);
warn('tile cache sweep failed', error);
})
.finally(() => {
if (_sweeping === tracked) _sweeping = null;
@@ -417,10 +416,7 @@ function trim(address, bytes) {
try {
return stripTileLayers(bytes, address.dropLayers);
} catch (error) {
console.warn(
'[Mapillary Proxy] tile trim failed, serving raw:',
error?.message || error,
);
warn('tile trim failed, serving raw', error);
return bytes;
}
}