Repository navigation
fix: restore step toggle, run rename, delete, and print - #97
Merged
Merged
Conversation
|
Sorry @keyurgolani, you've used your own review budget of 250,000 diff characters for the last 7 days. You can request another review in 7 days by commenting |
Reviewer's GuideRestores owner access to run toggle, rename, delete, and print flows by adapting callers to the service’s Sequence diagram for confirmed step toggle and retrysequenceDiagram
actor User
participant Tracker as ChecklistTracker
participant Detail as ChecklistDetailClient
participant API as Toggle route
participant Service as ChecklistService
User->>Tracker: Toggle step
Tracker->>Detail: onToggleTask(stepId)
Detail->>API: PUT /api/checklists/run-1/items/step-1/toggle
API->>Service: getById(runId)
Service-->>API: Result<Instance>
API->>Service: toggleTaskCompletion(runId, stepId)
Service-->>API: task and progress
API-->>Detail: 200 confirmed step state
Detail-->>Tracker: ToggleConfirmation
Tracker-->>User: Announce confirmed state
alt Toggle fails
API-->>Detail: 404 or non-OK response
Detail-->>Tracker: Reject
Tracker-->>User: Show inline error and Retry
User->>Tracker: Retry
Tracker->>Detail: onToggleTask(stepId)
end
Flow diagram for concealed run access and removed syncflowchart TD
Request[Authenticated run request] --> Lookup[ChecklistService.getById]
Lookup --> Found{Run found and owned?}
Found -->|Yes| Operation[Perform GET, PUT, DELETE, or toggle]
Found -->|No| NotFound[404 Checklist not found]
Sync[Signed-in sync request] --> Gone[410 RUN_SYNC_REMOVED]
Anonymous[Anonymous sync request] --> Auth[401 Authentication required]
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
keyurgolani
force-pushed
the
fix/09.1-slice-0
branch
2 times, most recently
from
October 20, 2026 10:44
cd80f49 to
2fa1f20
Compare
Node tests on the structural PocketBase fake, with server-auth mocked, for the toggle route, GET, PUT, and DELETE /api/checklists/[id], and the run print page. At 9019d17 each reads .data.checklist off getById's Result<Instance>, so the owner gets 404 or notFound. A jsdom tracker test: a failed toggle must show an inline error with Retry and announce nothing, and only a confirmed change is announced. At 9019d17 the tracker announces "marked as complete" for a toggle that was never confirmed and shows nothing when one fails.
A jsdom test of the run page with fetch answering 404. At 9019d17 the page logs the failure and the tracker still announces "marked as complete", with no Retry.
getById returns Result<Instance>, but the toggle route, GET, PUT, and DELETE /api/checklists/[id], and the run print page read .data.checklist off it, so the owner got 404 or notFound in every image since c53d6ea. Read the run from .data. The print page now resolves the template title the way the run page does, which drops its ts-ignore and any casts. A failed step toggle now shows an inline error with Retry under the step and announces nothing. The run page rejects when the route fails or answers without the step, and resolves with the state the server confirmed. The tracker announces only that confirmed state and keeps the error until a retry succeeds. The run page's context menu called the toggle directly, so its failures were silent. The tracker now adds Mark Complete itself and sends it through the same path as the checkbox.
The theme sets a 14px root font, so rem sizing left Retry 39px tall. Use pixel minimums. Point the step's aria-describedby at the error message alone, so screen readers don't read the Retry label twice.
… toggle GET already answers 404 for a run the caller doesn't own. PUT, DELETE, and the step toggle now give the same 404 body as a missing run instead of 403, matching the concealing NOT_FOUND in #30.
Drop a failure once the step reaches the state it was aiming for some other way, such as a realtime update or the bulk bar, so Retry can't flip the step the opposite way from its label. Retry stays focusable while it runs and hands focus back to the step when the retry is confirmed. It sends nothing while steps are being selected.
…ilures The tracker hid a failure once its step reached the target state some other way but kept the entry, so a later uncheck brought the same error and Retry back. Prune entries during render whenever the steps change: when the step reaches its target state or leaves the run. A toggle can save the step and then fail on the run's progress. The next toggle of a failed step now passes the state it aims for, and the run page reads the saved step first. When the step is already there, the page confirms it without sending another flip. The progress write itself stays as it is until SetStepState. Log one console.error per failed toggle with the step id and response status only, never step content.
The next toggle after a failure now retries the state that failure aimed for, instead of the opposite of what the step shows. A toggle that fails after a realtime update already saved its step records no failure, so a checked step can't show a stale error whose Retry would uncheck it.
keyurgolani
force-pushed
the
fix/09.1-slice-0
branch
from
October 20, 2026 10:45
2fa1f20 to
322fcc5
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements CHECKMATE-09.1 · slice 0
Refs #53
Since
c53d6ea,getByIdreturnsResult<Instance>, but the toggle route,GET,PUT, andDELETE /api/checklists/[id], and the run print page still read.data.checklistoff it. The owner got 404 ornotFound()from all five. The run page only logged the toggle's 404, and the tracker announced "marked as complete" anyway..data, so toggle, rename, delete, and print work for the owner again. The print page finds the template title the way the run page does, which drops its@ts-ignoreandanycasts.console.errorwith the step id and status, never step content.SetStepStatemakes the step and progress one transaction.CHANGELOG.mdrecords both fixes.Decisions:
src/app/api/checklists/[id]/route.ts, and [CHECKMATE-09.1] Redesign run execution around one focused next step #53 lets stub removal merge first. This needs a rebase ontonextonce fix: remove the run sync stub and its success-shaped UI #96 merges.SetStepState's and is unchanged.PUT,DELETE, and the toggle thatGETand a missing run get, instead of 403. That's [CHECKMATE-01.2] Specify command and projection authority for every actor type #30's concealingNOT_FOUND.InlineErroradds the one announcement through [CHECKMATE-21.1] Define shared responsive, focus, target-size, and motion primitives #89's announcer.Testing
Test plan item 1 is node tests for the toggle route,
GET,PUT,DELETE, and the print page, on #96's structural PocketBase fake with@/lib/server-authmocked. Item 2 ischecklist-tracker.test.ts(jsdom,React.createElement,@testing-library/react). I addedchecklist-detail-client.test.tstoo, because a tracker test can't catch a run page that swallows the failure, which is the9019d17bug. It also covers the log line and both retry reads.Against a clean
9019d17checkout, 16 of the 24 new tests fail, covering every owner case and every failure, retry, and menu case. The 8 that pass are the another-user and missing-run 404 checks, since everything answered 404 then, and the two confirmed-announcement cases. The last commit adds two tracker tests, one for the retry target and one for a failure that arrives after realtime already showed the step saved. The second fails on the commit before it.Gate on the rebased branch, against
nextwith the gate A fixture:scripts/ci/lint-changed.mjs, with no neweslint-disable. The rebase onto fix: remove the run sync stub and its success-shaped UI #96 and gate A brings the repo to fewer lint errors thannext, since the touched route files drop theiras anycasts.npx tsc --noEmit: 0 errors.npm test: 28 files, 316 tests pass on the PocketBase fixture.npm run buildwith both PocketBase URLs on127.0.0.1:9passes.I also rendered the tracker in
next devwith a toggle that always fails. The error and Retry show under the step from the checkbox, the label, and the context menu, both live regions stay empty, Retry measures 52x44, and nothing overflows at 390px.No migration or events. The run page looks the same until a toggle fails, so the
SHOWCASE.mdrun section and screenshot still match. Rollback is a revert.No owner steps.
Summary by Sourcery
Restore reliable owner run operations and make failed step toggles recoverable without misleading announcements.
Bug Fixes:
Enhancements:
Documentation:
Tests: