An action that fails says so, and the canvas stops lying about it (#1423) #1424
No reviewers
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
jaylouisw/packetforge!1424
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/ui-says-what-failed"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #1423.
web/app.jsreports nearly every failure -api()records the call so it reaches a bug report and rethrows, and the caller shows the reason - except the drag:Drag a device while the position is refused (now a real possibility: #1421 bounds a position to the canvas's world) or the server is gone, and the box stays where it was dropped — the canvas shows a lab that is not the lab on disk — the next reload puts it back with no explanation, and a device that had no position gets an invented one. The only trace was in a bug report nobody had opened.
Fixed
openRequests = []) — that is not "the palette is unchanged", it is losing what it had.The class, pinned
test/ui-action-failures.test.jsscansweb/*.jswith a small brace-matched scan (a regex cannot answer "what is inside this catch block") and requires everycatchwhose try block callsapi()to reach the user —toast,setStatus,setLinkHint,recordError, writing into the page, or a rethrow — or to carry/* silent-ok: <reason> */.console.erroralone does not count: the person who clicked does not read the console, which was the finding of #20.Six deliberate escapes carry markers with their reasons: the bug report's own version field, the two link-validation fall-throughs, and the enrichment path.
Evidence — 13 checks
POST /layoutwent out, nothing complained about;{100,100}, the toast says Position not saved and repeats the server's message, the status bar agrees, and a first drag that fails leaves nolayoutentry;{"x":700,"y":500}still on the canvas after a failed save,no toast element,{"d1":{"x":50,"y":60}}invented;catch (e) {}around anapi()call fails the static check by line number (app.js:2974 -> {}).test/requests-panel.test.jspinned the old source text; it now pins the intent (a failed call does not blank the request list) — the assertion was even named "leaves the palette alone" while the code emptied it.Suite: 212 suites, 8,078 assertions, 0 failed; syntax 280 files OK. Docs:
docs/ARCHITECTURE.md, "An action that fails says so".web/app.js reports nearly every failure: api() records the 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 did not: PFCanvas.on.move = async function (id, x, y) { topo.layout[id] = { x, y }; try { await api('POST', '.../layout', ...) } catch (e) {} }; Drag a device while the server refuses the position - or is simply not there - and the box stays where it was dropped: the canvas is showing a lab that is not the lab on disk, and the next reload, or another tab's next broadcast, moves it back with no explanation. The error reached the bug report and nobody else. Fixed: the position goes back and the reason is shown, in the server's own words, in the toast and the status bar. And the class is pinned. test/ui-action-failures.test.js scans web/*.js with a small brace-matched scan (a regex cannot say what is inside a catch block) and requires every catch whose try block calls api() to reach the user - toast, setStatus, setLinkHint, recordError, writing into the page, or a rethrow - or to carry a /* silent-ok: <reason> */ marker, which is a sentence a reviewer has to read. console.error alone does not count: the person who clicked does not read the console, which was the finding of #20. The sweep found one more silence of the same shape and fixed it: the palette's 'someone already asked for this' markers were emptied when the forge was slow (openRequests = []), which is not leaving the palette alone - it is losing what it had. Six deliberate escapes now carry markers, each with its reason: the bug report's own version field, the two link-validation fall-throughs, and the enrichment path. Evidence: 13 checks. With the drag fix reverted, 6 of them fail - including the old defect exactly ({"x":700,"y":500} still on the canvas after a failed save, no toast, an invented position left behind). Planting a new 'catch (e) {}' around an api() call fails the static check by line number. Suite: 212 suites, 8,078 assertions, 0 failed; syntax 280 files OK.