Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,9 @@
`profiles.is_digital_twin` required; see PipeTooling's `docs/DIGITAL_TWINS_PLAN.md`),
`manage-user` (the CT↔PT user bridge — PipeTooling is the system of record for
people and commands account provisioning/flagging/retirement here over
`X-Bridge-Secret` / `CT_MANAGE_USER_SECRET`; server→server only, never a browser),
`X-Bridge-Secret` / `CT_MANAGE_USER_SECRET`; server→server only, never a browser; since
2026-11-26 its `roster` verb sends `is_overseer` and `is_lead` beside `is_admin`, and
`set_flags` sets a seat's admin, overseer and lead flags, never switching off the last admin),
`import-takeoff` (the agent door for a headless takeoff: an agent POSTs a
`takeoff.json` and the marks land as a normal, twin-owned project; contract in
[TAKEOFF_IMPORT.md](TAKEOFF_IMPORT.md), scorer in takeoff-eval.js);
Expand Down
123 changes: 62 additions & 61 deletions ARCHITECTURE.md

Large diffs are not rendered by default.

61 changes: 61 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,67 @@ expired recovery UX" work occupies that slot).

---

## fix(zoom): a deep zoom is sharp to the edges of the view, and first under the pointer (ZOOM-EDGES, 2026-12-02)

Reported by an estimator on a trackpad: "the change when the cursor is in the center of the
screen is noticable, but not towards the edges of the screen." The change is DEEP-ZOOM's. The
zoom itself was right at every position (the wheel handler holds the point under the pointer);
what lagged was the sharpening after it. Past the canvas budget the full-page base is soft and
pdf-tile-cache.js lays sharp 512 px cells over the view. Measured on the restaurant sheet at
about 3000%, Retina density: the centre was sharp 0.7 s after the zoom, a pointer at a corner
waited 1.6 to 2.9 s, and on a 1728 x 1117 window without `navigator.deviceMemory` (Safari,
Firefox) one corner never stayed sharp while the grid rastered 13 cells every 3 s for good.
The table is in journeys/plans/DEEP-ZOOM.md, "Follow-up: ZOOM-EDGES".

- **The cells fill outward from the pointer.** `ensureTileCoverage` ordered its missing cells by
distance from the view's centre. It now starts at the pointer (`ctx.getFocusPoint`, app.js's
`state.mousePos`, sheet points, which a wheel or pinch zoom leaves under the pointer), measured
to each cell's nearest point so the cell under it is first; a pointer off the view is the
centre, as before.
- **A landed cell asks for the next at once.** It went back through `scheduleCropTile`'s 200 ms
settle, so twelve cells took 2.5 s on a sheet that rasters a cell in 20 ms. Still one raster in
flight at a time, and a commit tile's pending chain still owns the canvas.
- **A cell on screen is never evicted.** `evictTileGridToBudget` dropped the cell farthest from
the centre whenever the grid passed its budget (12 Mpx, or 32 Mpx at 8 GB), even when one
screen of cells was the whole grid: the corner was evicted, wanted again, rastered again. The
budget now bounds only what is kept off screen.
- **The commit's sharp window is kept.** A cold zoom commit rasters the visible window first and
shows it over the stretched old base; when the new base painted, the tile was retired, which is
right for a sharp base and wrong for a clamped one, where the whole view went soft and then
sharpened from the middle. `rebaseCropTile` (called at renderPdf's two paint sites in place of
the clear) re-authors the tile's box in the new base's container units when that base is soft,
and `ensureTileCoverage` fills the grid behind it and composites only when the grid can replace
all of it, or the view has moved off the tile. A sharp base still retires the tile
(commit-tile.spec.js, unchanged).

After, same measurement: sharp everywhere about 0.3 s after the zoom on every window tried
(1512 x 982 to 2560 x 1300), the pointer's corner with the centre, and no raster once the view
is whole. `App.__tileGridStats()` gained `rasters`, `keys` and `budgetPx`. New
[zoom-edges.spec.js](zoom-edges.spec.js) (both tests fail on the code before this change); the
tile, zoom, loupe, pyramid and deep-zoom specs are green. render-pixels.spec.js's
`live-overlay-chromium-darwin.png` is one pixel off on this machine with or without the change
(the local macOS baseline; CI reads the linux one).

Not measured: the estimator's own machine. PUNCHLIST DEEP-ZOOM-CONFIRM already asks for her Save
Status export, whose `display` block says which window and density she is on.

## docs: the hand-kept lists caught up to main at 8d89619 (2026-12-02)

A read of the docs against the two PRs since the pass at ec29abc. #278 (the blank-sheet tour's
Move card in plain words, 2026-09-28) carried its own entry and its guide word. #339
(2026-11-26) changed the `manage-user` Edge Function and wrote nothing down:

- **`manage-user` gained `set_flags`, and `roster` sends two more flags.** `set_flags
{ ct_user_id, is_admin?, is_overseer?, is_lead? }` changes only the flags it is given and
refuses (409) to switch off the last admin; `roster` now sends `is_overseer` and `is_lead`
beside `is_admin` and `is_digital_twin`, so PipeTooling's People screens can show who holds
which role and its person desk can set them. Behind the bridge secret like every verb there.
Per the commit, nothing changes until the function is deployed, and PipeTooling's proxy does
not forward `set_flags` yet. AGENTS.md's Edge Function list says so.
- **ARCHITECTURE.md's pdf-tile-cache.js row** still said the crop tile and the tile grid "stay in
app.js for stage 2" and counted a 13-entry ctx; stage 2 moved both in long ago. Rewritten with
the ZOOM-EDGES change above.

## docs: the hand-kept lists caught up to main at ec29abc (2026-10-14)

A read of AGENTS.md, ARCHITECTURE.md, RECONSTITUTE.md, SUPABASE_SETUP.md, FEATURES.md,
Expand Down
15 changes: 8 additions & 7 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -1640,6 +1640,7 @@
isRenderInFlight: () => !!pdfRenderTask,
getLastPaintedPdfPage: () => lastPaintedPdfPage,
getZoomGestureDirection: () => zoomGestureDirection,
getFocusPoint: () => state.mousePos, // ZOOM-EDGES: the tile grid fills outward from the pointer (sheet points)
});
// renderPdf's cache accounting increments .hits/.misses on this shared
// object (never reassigned — a direct reference is safe).
Expand Down Expand Up @@ -1807,9 +1808,9 @@
pdfBitmapCacheStats.hits++;
noteZoomCrispPaint();
// The base at this display zoom just painted: a tile authored against a
// DIFFERENT base zoom is now in the wrong container units — retire it.
{ const ctk = pdfTileCache.getCropTileKey();
if (ctk && ctk.baseZoom !== lastRenderedZoom) clearCropTile(); }
// DIFFERENT base zoom is now in the wrong container units — retire it, or
// where this base is clamped soft re-author its box (rebaseCropTile, ZOOM-EDGES).
pdfTileCache.rebaseCropTile();
renderAnnotations();
schedulePdfBitmapPrefetch();
scheduleCropTile();
Expand Down Expand Up @@ -1930,10 +1931,10 @@
noteZoomCrispPaint();
// The crisp base at this zoom just painted: a commit tile authored
// against the OLD base zoom is now in the wrong container units and no
// longer needed — retire it (the deficit path re-tiles via the
// schedule below when the base is clamped soft).
{ const ctk = pdfTileCache.getCropTileKey();
if (ctk && ctk.baseZoom !== lastRenderedZoom) clearCropTile(); }
// longer needed — retire it. Where the base is clamped soft the tile is
// kept, re-authored, until the grid the schedule below fills can replace
// all of it (rebaseCropTile, ZOOM-EDGES).
pdfTileCache.rebaseCropTile();
renderAnnotations();
schedulePdfBitmapPrefetch();
scheduleCropTile();
Expand Down
36 changes: 36 additions & 0 deletions journeys/plans/DEEP-ZOOM.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,3 +151,39 @@ Live check: see CHANGELOG.md's DEEP-ZOOM entry.
Assumed, Will to confirm: the ceiling is 5000%, and phones and small-cap devices hold 1200%.
Open as PUNCHLIST row DEEP-ZOOM-CONFIRM (2026-10-14), together with the run on Wendi's machine
under Tests above.

## Follow-up: ZOOM-EDGES (2026-12-02)

Wendi, through Robert: "regarding zooming on a trackpad, the change when the cursor is in the
center of the screen is noticable, but not towards the edges of the screen." The change is this
one. Measured on the real app, the restaurant sheet, a wheel zoom to about 3000% at Retina
density, sampling the sharp layer (`#cropCanvas`) across the view every 40 ms:

| window | pointer | sharp at the centre | sharp at the pointer | sharp everywhere |
|---|---|---|---|---|
| 1512 x 982 | centre | 0.7 s | 0.7 s | 1.8 s |
| 1512 x 982 | a corner | 0.7 s | 1.6 s | 2.0 s |
| 1728 x 1117, no `navigator.deviceMemory` | a corner | 0.7 s | 2.9 s | never (13 rasters every 3 s, for good) |

Three causes, all in pdf-tile-cache.js, none in the wheel handler (the zoom itself holds the
point under the pointer at every position):

1. The grid's cells filled outward from the view's centre, one at a time, and each landed cell
went back through the 200 ms settle before the next was asked for. Twelve cells took 2.5 s on
a sheet that rasters in 20 ms a cell, and the pointer's corner was last.
2. The zoom commit paints the whole window sharp first (the commit tile). The moment the soft
full-page base landed under it the tile was dropped, the view went soft, and the grid started
from the centre.
3. One screen of cells at density 2 can pass the grid's budget (12 Mpx without
`navigator.deviceMemory`, which is Safari and Firefox; 32 Mpx at 8 GB). The farthest cell, a
corner, was evicted, rastered again and evicted again while the view stood.

Fixed: the fill starts under the pointer; a landed cell asks for the next at once; a cell on
screen is never evicted; and the commit tile is kept, its box re-authored in the new base's
units, until the grid behind it can replace all of it. After: every row of the table is sharp
everywhere at about 0.3 s, and nothing rasters once the view is whole. Pinned by
zoom-edges.spec.js; the details are in CHANGELOG.md's ZOOM-EDGES entry.

Not measured: Wendi's own machine and browser. If the edges still lag there, her Save Status
export's `display` block (the row DEEP-ZOOM-CONFIRM already asks for) says which case she is in.

Loading
Loading