A drag whose save fails is silent, and the canvas keeps showing a position the server does not have #1423

Closed
opened 2026-11-11 04:57:00 +00:00 by jaylouisw · 0 comments
Owner

web/app.js reports nearly every failure: api() records the failed call (so it reaches a bug report) and rethrows, and the caller shows the reason in a toast, a hint or the status bar. One caller does not:

PFCanvas.on.move = async function (id, x, y) {
  if (!topo.layout) topo.layout = {};
  topo.layout[id] = { x: x, y: y };
  try { await api('POST', '/topologies/' + TOPO + '/layout', { positions: { [id]: { x, y } } }); } catch (e) {}
};

Drag a device while the server refuses the position (a refusal is now a real possibility - #1421 bounds a position to the canvas's world) or is simply not there, and:

  • the box stays where it was dropped, so the canvas shows a lab that is not the lab on disk;
  • the next reload - or another tab's next broadcast - moves it back with no explanation;
  • a device that had no position at all gets an invented one, locally only;
  • the only trace is in recentErrors, i.e. in a bug report the person has not opened.

The nearest thing to a guard is test/ui-render.test.js, which loads web/app.js in a stub DOM but never makes an API call fail.

What should be true

  1. a user action whose save fails is reported, in the server's own words, in the toast and the status bar;
  2. the canvas goes back to the position the server has - it must not display a state that was refused, and a failed first drag must leave no position behind;
  3. and the class is closed: every catch in web/*.js that wraps a call to api() reaches the user, or carries a /* silent-ok: <reason> */ marker a reviewer has to read;
  4. console.error alone does not count - the person who clicked does not read the console, which was the finding of #20.

Found while sweeping

The palette's "someone already asked for this" markers were emptied when the forge was slow:

api('GET', '/requests').then(...).catch(function () { openRequests = []; });

which is not "the palette is unchanged" (the comment above it) - it is losing what it had, for the duration of a slow forge.

`web/app.js` reports nearly every failure: `api()` records the failed call (so it reaches a bug report) and rethrows, and the caller shows the reason in a toast, a hint or the status bar. One caller does not: ```js PFCanvas.on.move = async function (id, x, y) { if (!topo.layout) topo.layout = {}; topo.layout[id] = { x: x, y: y }; try { await api('POST', '/topologies/' + TOPO + '/layout', { positions: { [id]: { x, y } } }); } catch (e) {} }; ``` Drag a device while the server refuses the position (a refusal is now a real possibility - #1421 bounds a position to the canvas's world) or is simply not there, and: - the box stays where it was dropped, so **the canvas shows a lab that is not the lab on disk**; - the next reload - or another tab's next broadcast - moves it back with no explanation; - a device that had no position at all gets an invented one, locally only; - the only trace is in `recentErrors`, i.e. in a bug report the person has not opened. The nearest thing to a guard is `test/ui-render.test.js`, which loads `web/app.js` in a stub DOM but never makes an API call fail. ### What should be true 1. a user action whose save fails is **reported**, in the server's own words, in the toast and the status bar; 2. the canvas **goes back** to the position the server has - it must not display a state that was refused, and a failed first drag must leave no position behind; 3. and the class is closed: every `catch` in `web/*.js` that wraps a call to `api()` reaches the user, or carries a `/* silent-ok: <reason> */` marker a reviewer has to read; 4. `console.error` alone does not count - the person who clicked does not read the console, which was the finding of #20. ### Found while sweeping The palette's "someone already asked for this" markers were **emptied** when the forge was slow: ```js api('GET', '/requests').then(...).catch(function () { openRequests = []; }); ``` which is not "the palette is unchanged" (the comment above it) - it is losing what it had, for the duration of a slow forge.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
jaylouisw/packetforge#1423
No description provided.