Repository navigation
fix(mobile,host): report a refused pin; read each task's due date in its own zone - #1338
Merged
Merged
Conversation
The phone's `setSessionPinned` returned early when the row it was given could not be addressed — no connection, or no `threadId` (a shape a session notice carries as `threadId: ""`). Resolving told the caller the desktop had taken the pin, the action sheet closed, the row did not move and nothing said why. Its two siblings in the same file, `deleteSession` and `setWorkspacePinned`, already refuse with `Session unavailable` / `Workspace unavailable`, and the screen's `runCommand` has always had a `catch` that shows `common.error` — this one path simply never reached it. The guard now throws, so the reader learns the tap did nothing. The later `clientRef`/`catalogEpoch` re-check stays a silent return: that one means the command succeeded and a newer local snapshot owns the list. `store::pin_thread` also marks the catalogue dirty, as `pin_workspace` does. `pinned` rides on the structural side of the session snapshot, so a client cannot patch it from a value; the mark is what tells the publisher the store changed rather than leaving it to a signature it recomputes on its own schedule. Each new assertion was run against the unfixed code first: the two hook tests fail on "promise resolved instead of rejected", the screen test on the missing `common.error`, and the store test on the absent dirty mark.
…ded offset `a_tasks_schedule_uses_its_own_zone` read both tasks' next due date through Asia/Shanghai and hard-coded '09:00 Berlin is 15:00 Shanghai'. That also encodes the offset in force that week: Europe/Berlin is UTC+2 until the last Sunday of October and UTC+1 after it, so a correct schedule reads 15:00 in summer and 16:00 in winter. The next 09:00 Berlin fell after the 2026-10-25 switch, so from that morning the test failed on every machine — including CI, whose last Rust run predated the switch (and whose most recent run skipped the Rust jobs entirely, so nothing had noticed). Each due date is now read in the zone it was written in, which is the invariant the test is about, and the two instants are asserted to differ. Both keep the 'not the host's zone' bite: a schedule computed in the host's zone lands Berlin on Shanghai's instant, which reads 02:00 in Berlin rather than 09:00 — verified by temporarily asserting exactly that, which failed. Task module: 65 passed. fmt and clippy clean under the pinned 1.97 toolchain (PATH-prefixed; bare cargo here is Homebrew 1.96).
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.
What and why
Two independent fixes that landed on
dev-huichen:threadIdalone can go missing: a session notice carriesthreadId: "", and the session id cannot address the desktop's row. On the host side the pin also never announced itself, so the session snapshot was not re-read and re-sent.Commits
fix(mobile,host): report a refused pin instead of swallowing it—setSessionPinnednow throwsSession unavailableinstead of returning early (matchingdeleteSessionandsetWorkspacePinned, whose callers already catch);pin_threadcallsmark_catalog_dirty()exactly asworkspaces::pin_workspacedoes, so the publisher learns about the structural change from the store's own signal. Tests cover both the throw paths and the one-shot dirty flag.fix(host): read each task's due date in its own zone, not one hard-coded offset— the task service resolves each task's due instant in its own time zone instead of applying a fixed offset to all of them.Verification
Run locally at the frozen tip (
5af7159b9) with the repo-pinned toolchain (rustc 1.97.0,clippy 0.1.97) and Node 22 (the CI line):cargo fmt --all -- --check→ cleancargo clippy -p future-host --all-targets -- -D warnings→ cleancargo test -p future-host --lib -- store::threads→ 35 passedcargo test -p future-host --lib -- tasks→ 66 passed, 2 ignorednpx tsc --noEmit(mobile) → cleannpx eslint src/remote/useSessionCatalog.ts src/remote/__tests__/useSessionCatalog.test.ts src/screens/__tests__/SessionsScreen.test.ts→ cleannpx jest --runInBand src/remote/__tests__/useSessionCatalog.test.ts src/screens/__tests__/SessionsScreen.test.ts→ 2 suites / 167 tests passedNotes
useSessionCatalog().setSessionPinnednow rejects instead of resolving when it cannot address the row. Callers must handle the rejection (the existing call sites already catch and show the failure).