Skip to content

test(bots): await linked bot cache reconciliation - #561

Merged
nixuuu merged 1 commit into
devfrom
fix/linked-bot-cache-race
Nov 12, 2026
Merged

nixuuu merged 1 commit into
devfrom
fix/linked-bot-cache-race

Conversation

@nixuuu

@nixuuu nixuuu commented Nov 12, 2026 •

Copy link
Copy Markdown
Member

The linked-bot restart test can fail after the home reconnects even though the mirror has reconciled correctly. ListBots({ includeArchived: true }) and ListBots({}) have separate request cache keys, and each refreshes in the background. An updated inclusive snapshot does not establish that the active-only snapshot has refreshed. The immediate active-list assertion can therefore see a deleted bot and a newly archived bot from its previous snapshot.

Wait for the active-only request to return exactly the expected unarchived bot, with a bounded 15-second deadline. Keep the deletion, preview, mirror and client-error assertions. Production caching and background refresh behavior are unchanged.

Validation

Extracted from the change that passed CI in #546 and removed from that branch. This PR targets the latest dev directly and contains only the 10-line test diff; it can merge independently. Fresh CI runs on this independent branch. No local tests, typecheck, builds or browser were run while the maintainer's performance measurement continues.

History: commit 21baef8c8 (#509) introduced both the linked-bot cache fallback and this test's immediate filtered-list assertion. This is a test synchronization correction, so it uses a context reference rather than a release-hold footer.

Copy audit: not applicable; no user-facing text changes.

Related: #509

The inclusive and active-only lists refresh independent request caches. Wait for the exact active-bot result rather than assuming both refresh together.

Related: #509
@nixuuu
nixuuu marked this pull request as ready for review November 12, 2026 09:09
@nixuuu
nixuuu merged commit 42ad236 into dev Nov 12, 2026
16 of 19 checks passed
@nixuuu
nixuuu deleted the fix/linked-bot-cache-race branch November 12, 2026 09:09
nixuuu added a commit that referenced this pull request Nov 12, 2026
Clicking a bare name such as `violet-bg.jpg` previously tried only the
thread's root and reported a missing file as deleted. Binary bytes were
discarded, so images could not load even with a connected home computer.

This change resolves references on the thread's home worker, including a
separate worktree, and previews text and images on web and mobile.

## Behavior

- Prefer explicit paths mentioned in the source item's turn, then a
direct root file, then an exact basename match from a bounded,
gitignore-aware listing. A unique result opens; multiple matches offer a
path picker. An incomplete search never silently chooses a result.
- Keep reads on the existing computer-link stream with 32 KiB frames and
flow control. Preview bytes are capped at 2 MiB; oversized files have no
mutation hash. Offline/transport errors remain connection errors. The
gateway checks thread ownership before dispatch; workspace traversal and
escaping symlinks are rejected.
- Show raster images with dimensions and size. Hide binary Edit, show a
relative path and home computer below the filename, and use lookup/error
states in place of empty content boxes. Reload, edit and delete use the
resolved path and SHA-256 conflict protection.
- Mobile uses the same recognition, resolution and RPCs with existing
native UI components. It supports path choices, image/text/Markdown
previews, reload, copy, text editing and deletion. Failed saves and
reconnects preserve edits; discarding or closing a dirty draft requires
confirmation. No native code, dependencies, EAS configuration or
lockfile changes.
- Add gateway integration coverage through a real WorkerHost and paired
gateways: nested worktree resolution, ambiguous names and selection,
same-turn hints and isolation, ignored/new files, not found versus
disappeared, linked text/image/other binary transfer, the 2 MiB cap,
owner scoping, traversal/outside paths/escaping symlinks, workspace
aliases, mutation conflicts, and offline worker/link errors.

## Validation

Rebased onto `dev` at `f76cfb2a9453a26e3218c553aad8fcb37e9d55e0`.
Generated contracts were regenerated to preserve the base branch's
additive changes. The independent linked-bot test synchronization
correction was extracted to #561; this branch contains no linked-bot
test or production cache changes.

- Local `bun install` and `bun run gen:check` passed. Focused
`TMPDIR=/var/tmp bun test
tests/integration/thread-file-previews.test.ts` passed on the final
rebased head: 11 tests, 75 assertions, no failures. Web typecheck passed
with zero errors/warnings; changed-file oxfmt and oxlint passed. The
full `check:tmp` was intentionally not repeated locally, as requested;
GitHub CI runs the full shards and required static/build checks.
- Real Chromium review used a disposable paired-gateway fixture and real
home WorkerHost. Confirmed bare-name nested resolution, ambiguous
choices and selection, missing versus deleted after Reload, searched
paths, a 320 × 180 JPG with its 977 B size, no image Edit action, and
workspace-relative path plus home computer subtitles. Checked
short/typical/long paths, image and picker at 1280 px and 390 px, light
and dark, with no horizontal overflow or browser exceptions. The shared
browser disconnected, so review continued in isolated local Chromium.
Screenshots were inspected after transitions completed and with reduced
motion. No browser test suite or artifacts are committed.
- The browser check exposed a Svelte effect repeatedly reading the file
after its own loading/path/hash updates. The effect now tracks only the
viewer target and calls `load()` without tracking mutable viewer state.
The repeated review passed. The final rebase leaves the reviewed
file-viewer and mobile-file components unchanged.
- SDK 58 fingerprints generated through `expo-updates
fingerprint:generate` with `CANOPY_CHANNEL=nightly` are identical for
final head and base, using the same repository path and installed
dependencies: iOS `6ddec9ef559ee0095ac33e94ff9418a942053b17`; Android
`5f6eae3ab278f1cd543e9ed763f923a319b65ec9`. No native code,
dependencies, EAS configuration or lockfile changes.

Fresh CI runs on final head `84b1a71365f817cc104d088cf7fb041100aa6686`;
its result is reported independently of earlier passing runs. All
disposable gateways, worker, database and web processes were stopped
after review; local browser sessions were closed.

## Copy audit — docs/copy.md §8

| Before | After | Reason |
| --- | --- | --- |
| “This file no longer exists.” on an unresolved name | “Couldn't find
{name} in this workspace.” with Reload and “Show searched paths” | Does
not claim deletion without a previous read. |
| Same generic missing-file claim after a previous read | “{name} is no
longer at this path. Check whether it was moved or deleted.” | Reports
the evidence without assuming the cause. |
| No disambiguation | “Several files match this name. Choose a path to
open.” | Names the condition and the next action. |
| No bounded-search status | “The search reached its limit. Open a full
workspace-relative path.” | Makes an incomplete search explicit. |
| Empty image box | “Could not show this image. Reload to try again.” |
Gives an action for image-decoder failure. |
| Dropped binary bytes | “This file exceeds the 2 MB preview limit. Open
a smaller file to preview it.” for truncated binaries | Explains the
bounded preview. |
| Filename repeated in title and subtitle | Filename; workspace-relative
path and computer | Each field adds context; root paths include `./`. |
| “Delete…” | “Delete file” → “Delete file?” | Concrete verb/object;
confirmation names the path/computer and says it cannot be undone. |
| No mobile dirty-editor flow | “Unsaved changes”, “Discard unsaved
changes?”, “Discard changes” | Protects edits and states the action. |

Static audit: English, sentence case, plain glossary terms, verb-led
actions, confirmation verbs agree, and errors explain the event and the
next action. Search diagnostics are disclosed under “Show searched
paths”. Empty states are short and use the existing Reload action.
Title/subtitle supply different information. Computer availability is a
named dependency with reconnect/reload guidance. No humor or ornamental
copy was added. States have text independent of color or icons.

Visual copy audit (§8.9): short, typical and long file names/paths
checked in Chromium at desktop and phone widths, in light and dark.
Titles/subtitles wrap within the dialog, path choices stay compact,
errors show accurate copy and searched-path disclosure, and no overlay
gaps or horizontal overflow appeared. Mobile source copy uses the same
shared lookup messages; no native-device visual review is claimed.

Fixes: #499

Related: #514
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant