fix(street-level): review follow-ups — shares judged against the last draw; refused pictures stay refused

From the maintainer review of #1134 (approve with follow-ups):
- lineCoverage: a share is judged against the cap the tile was last drawn
  with, not against later shares that redrew nothing, so small increases
  add up (a retained tile stayed at 100 points after its share grew to
  116). A rebuild's measuring pass no longer counts as a draw.
- photoViewer: a picture refused for its size (bytes, streamed bytes or
  decoded side) is marked `tooLarge`, and the viewer never loads that file
  again by any path; the flat fallback had retried an oversized SD file
  through an <img>, which has no size limit.
- Regressions for both: cumulative share growth below the threshold, and a
  refused SD panorama that is not fetched again as a flat photo.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Said TurkseverandClaude Opus 5.5 committed 2026-10-15 16:08:18 +01:00
1 parent de83e1c17f
commit e3bc431f9a
5 files changed
+129 -16

No files matched your search

+11 -5
View File
@@ -152,9 +152,10 @@ export function createLineCoverage({
/**
* A tile's sequences, filtered then capped: capping first could leave a
* dense tile of newer flat captures with no 360° lines at all.
* dense tile of newer flat captures with no 360° lines at all. `measure`
* only records what the lines need, for a draw that follows.
*/
function drawnSequences(entry) {
function drawnSequences(entry, { measure = false } = {}) {
const drawn = [];
const current = filter();
const selectedId = state.sequence.selectedId ?? null;
@@ -180,7 +181,12 @@ export function createLineCoverage({
}
// What every passing line would take: the budget is shared by it.
entry.pointDemand = demand;
entry.pointsDrawn = points;
if (!measure) {
entry.pointsDrawn = points;
// The cap this draw used: a share is judged against it, not against
// later shares that redrew nothing (small steps add up).
entry.drawnCap = cap;
}
return drawn;
}
@@ -204,7 +210,7 @@ export function createLineCoverage({
const share = left / (byDemand.length - i);
const cap = Math.floor(Math.min(entry.pointDemand || 0, share));
left -= cap;
const before = entry.pointCap ?? perTilePointCap;
const before = entry.drawnCap ?? perTilePointCap;
entry.pointCap = cap;
// Only a change that alters what is drawn, by enough to be worth a
// rebuild: more room for a tile that had lines left out, or well
@@ -899,7 +905,7 @@ export function createLineCoverage({
// What each tile's lines need under the new filter, then the shares,
// then one redraw each.
for (const entry of state.coverage.tiles.values())
if (entry.kind === 'sequence') drawnSequences(entry);
if (entry.kind === 'sequence') drawnSequences(entry, { measure: true });
shareCaps();
for (const entry of state.coverage.tiles.values()) redrawEntry(entry);
requestRender();