Skip to content

fix(quotes): open the note editor right after citing - #628

Merged
nixuuu merged 1 commit into
devfrom
fix/quotes-auto-open-note
Nov 13, 2026
Merged

nixuuu merged 1 commit into
devfrom
fix/quotes-auto-open-note

Conversation

@nixuuu

@nixuuu nixuuu commented Nov 13, 2026 •

Copy link
Copy Markdown
Member

Cite inserts an inline citation at the saved composer caret and immediately opens its existing editor, focused on the optional comment. The same insertion path covers the floating action, selection menu, keyboard shortcut and PR panel citations. Restored drafts and pasted citations do not open the editor.

Enter saves from the comment field; Shift+Enter adds a line, and Cmd/Ctrl+Enter also saves from the passage field. Escape, Cancel and outside dismissal keep the citation and discard unsaved edits. Closing returns the caret after the citation; Jump to source keeps its navigation behavior. Saving the note does not submit the enclosing message form.

The editor stays horizontally anchored to the new chip and clears the whole composer text field vertically. An opt-in Popover motion follower keeps it attached while the composer grows or moves. The existing top-layer surface, motion tokens and reduced-motion behavior remain in use.

Fixes: #591

The parent of 5af512dbe opened QuoteCommentPopover from Cite and saved with unmodified Enter. #591 removed that opening step when introducing inline tokens. #594 added PR citations afterwards. Mobile still opens QuoteEditor before insertion for transcript and PR citations; it did not lose the note editor, so no native change is needed.

Verification

  • Passed with nice -n 19: install, generated-code check, final-head typecheck, lint, formatting and web build. CI is green on 78bba15c98c8800019224c908c21bef348e2cebe, including all four test shards and their temporary-directory checks. The local full check:tmp --timeout 60000 finished with 2687 pass, 166 skip, 12 fail across 505 files; its temporary-directory check passed. All 12 failures are in the unchanged tests/integration/computer-moves.test.ts (peer reachability/synchronization and HTTP/2 connection errors). The same file passed completely in CI, including all 20 repeated thread-move cases; the local cause is not established. The first default-timeout test run hit 5-second release-script timeouts under host load; it was stopped and its temporary directory was clean.
  • Manual Chromium review: light/dark, 1440×900 desktop and 390×844 phone widths; short (2 characters), typical (173 characters), long multiline (~2,000 characters) and maximum (20,000 characters) passages; 1–6 citations in the same message. Verified floating Cite, Alt+Q and the desktop selection menu; comment autofocus, Enter/Shift+Enter/Cmd+Enter, Escape/outside dismissal, editing an existing note and the Save button without sending the message. Outside dismissal retains the citation and restores the composer caret after it.
  • A 25-frame opening sample kept exactly 6 px between the popover and the text field throughout the composer animation. The panel starts at opacity 0 in its positioned location. No horizontal overflow at phone width. Reviewed the existing reduced-motion token and CSS path; no new animation timings.
  • The requested review host already had two review environments, so review used a private local gateway/database/BFF on non-reserved ports. The private servers and database were removed and the browser tab closed. Mobile transcript and PR paths were inspected in code; no native device review or PR panel account fixture was used.
  • No UI test suite added. No user-facing text changed; the copy audit is not applicable. Documentation describes the restored note editor and keyboard behavior.

@nixuuu
nixuuu force-pushed the fix/quotes-auto-open-note branch from eca013f to 78bba15 Compare November 13, 2026 10:01
@nixuuu
nixuuu marked this pull request as ready for review November 13, 2026 10:15
@nixuuu
nixuuu merged commit cfb9846 into dev Nov 13, 2026
14 checks passed
@nixuuu
nixuuu deleted the fix/quotes-auto-open-note branch November 13, 2026 10:38
nixuuu added a commit that referenced this pull request Nov 13, 2026
Opening an inactive thread currently waits for message catch-up. This
layer adds owner-scoped head signals to the existing overview stream and
a finite sequence reader for bounded cache warming.

- Additive protobuf fields: at most 32 head IDs per overview; one scalar
probe every two seconds, emitting changed heads only. Qualified IDs
advertise the committed mirror checkpoint.
- Background reads resume per-thread seq, return at most four
64-record/64-KiB batches, and use the existing bounded recent window for
absent, distant or invalid checkpoints. Older history remains pageable.
- Linked homes without THREAD_RANGES cannot fall back to full-history
reads. The Polish API documentation describes the contract.

Validation on the final stack: install, gen:check, full typecheck, lint,
format:check and web build passed with nice. Focused check:tmp passed
cache warming 6 tests / 41 assertions, linked mirrors 1/36, schema
23/85, sidebar ordering 5/22 and client diagnostics 9/70, with empty
temp directories. Warming covers head owner scoping, bounded tails,
delta reconnect, persistent mobile restart and recency independent of
sidebar sort/manual order. Current-head CI static checks, web/Linux
build and commitlint passed; all four test shards are still running. A
previous full local attempt was stopped after 1,092 passing tests and
green CI on the preceding stack; it is not a completed local full pass
for these heads.

Stack 624 is based on dev cfb9846, including the merged
sidebar-sorting stack and #628 citations. The generated protobuf was
regenerated from both contracts, preserving ReorderThread,
sidebar_order_key and last_reply_at alongside the warming fields.
Migration 0133 remains in the base; the final layer adds 0134. gh stack
rebase completed and left no rebase state. Current head:
86397a3. All PRs remain draft. Native
measurement and the one-frame target remain unverified in the later
layers.

Copy audit (§8): no product copy changes in this layer. No merge
requested.
nixuuu added a commit that referenced this pull request Nov 13, 2026
Web and the desktop renderer now keep a bounded set of inactive thread
tails current before navigation. The shell warms working threads, unseen
results, pins and the top 12 recent sidebar roots, excluding the
archive.

Recent roots follow the shared Last activity rule (last completed reply,
falling back to creation), regardless of the displayed Created or Custom
order. Project/search filters determine eligible roots; manual ranks and
pin positions cannot displace recent roots. Working/unseen/pinned
threads join independently within the shared cap. Polish performance
docs describe this rule; a real-gateway test reorders threads and
verifies all three display modes and filtering.

One cancelable job fetches only sequence deltas, with a two-second
minimum between starts, coalesced heads and 30-second failure backoff.
The LRU holds at most 32 entries / 32 MiB of encoded payload. Navigation
cancels background work and reserves 500 ms for the visible view.
Hidden/offline clients pause. Cached tails seed the first thread render,
and the visible watch resumes their checkpoint.

Diagnostics adds current-state-visible timing, warm-cache hit ratio,
background request counts and cache payload bytes within the fixed
client metric registry. Polish performance/diagnostics docs describe the
budgets and measurement limits. The benchmark supports isolated named
containers and avoids removing a pre-existing colliding container.

Validation on the final stack: install, gen:check, full typecheck, lint,
format:check and web build passed with nice. Focused check:tmp passed
cache warming 6 tests / 41 assertions, linked mirrors 1/36, schema
23/85, sidebar ordering 5/22 and client diagnostics 9/70, with empty
temp directories. Current-head CI static checks, web/Linux build and
commitlint passed; all four test shards are still running. A previous
local full attempt was stopped after 1,092 passing tests and green CI on
the preceding stack; it is not a completed local full pass for these
heads.

Browser evidence: isolated synthetic stack on the requested second
machine, 1,000 turns and 500 sidebar rows. A loaded-route sample
measured 1,689.5 ms without cache versus 461.1 ms with current cache.
Cold Vite route compilation also produced 4–5 second openings; these are
not comparable to the loaded-route sample. The one-frame tap-to-current
target is not established. The first thread state is seeded from the
cache without waiting for its message watch.

The final-stack loaded-route probe, after completing a synthetic answer
while on the list, had current cache before navigation: first feed rAF
168.9 ms, second rAF 217.9 ms, with the completed answer visible and no
skeleton. This is a single development-mode sample, not a percentile or
a one-frame claim.

The final-stack probe warmed 12 entries with 12 startup reads and
278,630 encoded bytes. One synthetic streamed turn caused 5 additional
background reads over 66.5 seconds, with 283,312 encoded bytes
afterward. The request count then stayed at 17 for another 120 seconds
(zero additional idle reads/minute), with 283,162 encoded bytes. The
browser reported roughly 139 MB total JS heap (coarse, not the cache's
incremental heap). Light/dark at desktop and phone width were inspected;
the Electron application itself was not profiled. The private remote
stack and preview were removed after measurement.

Stack 624 is based on dev cfb9846, including the merged
sidebar-sorting stack and #628 citations. gh stack rebase completed and
left no rebase state. Current head:
4ed7d54. Measurements above precede
these rebases, the recency-selection adjustment and the offline-mirror
fix. All PRs remain draft.

Copy audit (§8): four new diagnostic labels use sentence case and plain,
distinct meanings: “Thread current state visible”, “Warm cache hit”,
“Background thread requests”, “Thread cache payload”. They add no
buttons, confirmations, empty states or humor; existing layouts were
checked with long synthetic titles. No merge requested.
nixuuu added a commit that referenced this pull request Nov 13, 2026
Mobile now warms its existing persistent thread cache while the
application is foreground and its overview connection is live. Restarted
clients load the durable per-thread checkpoint and fetch only sequence
deltas. Linked thread warming reads the local committed mirror,
including while its source computer is offline.

- At most 16 selected threads, including 10 recent sidebar roots, with
one job and at least five seconds between starts (12 reads/minute
maximum). Working/unseen/pinned threads join the bounded set; the
archive is excluded.
- Navigation, inactive/background state and connection loss cancel
warming. Optional ExpoBattery support pauses in Low Power Mode when the
existing native binary exposes it; no new native dependency or build is
required.
- The memory cache retains at most 16 entries / 24 MiB; existing disk
limits and pairing/certificate fences remain. Mobile diagnostics starts
timing at the tap and records current-state layout/rAF, cache hits,
request counts and encoded bytes. Local thread identity guards keep
retained stack screens from marking another thread's opening current.
- Shared scheduling rotates waiting threads to avoid starvation.
Search/project filters affect the recent set, with debounced search
changes. Recent roots always follow Last activity (last reply, falling
back to creation), independently of Created/Custom display order and pin
positions; working/unseen/pinned threads join within the shared cap. The
sidebar retains its merged manual-order controls. Desktop cache reads
are fenced against late completion after clear/reset. Polish docs
describe these behaviors.
- Migration 0134 retains at most 256 immutable records / 256 KiB per
mirrored thread and epoch, including tombstones. A rebuild also retains
the previous visible epoch. Owner-scoped background reads return at most
four 64-record / 64-KiB batches without contacting the source.
Missing/old suffixes reset only the existing bounded, pageable window.
Unlink removes the suffix through the existing FK cascade. Polish
data-model and retention docs describe the storage limits. Migration
0133_thread_order and its expected schema entry are preserved alongside
0134.

Validation on the final stack: install, gen:check, full typecheck, lint,
format:check and web build passed with nice. Focused check:tmp passed
cache warming 6 tests / 41 assertions, linked mirrors 1/36, schema
23/85, sidebar ordering 5/22 and client diagnostics 9/70, with empty
temp directories. Warming covers head owner scoping, bounded tails,
delta reconnect, persistent mobile restart and recency independent of
display/manual ordering. Current-head CI static checks, web/Linux build
and commitlint passed; all four test shards are still running. A
previous local full attempt was stopped after 1,092 passing tests and
green CI on the preceding stack; it is not a completed local full pass
for these heads.

Native before/after measurements could not run: device discovery failed
twice with “Device list failed: Could not communicate with device
support. Try refreshing devices.” No APK/EAS build was attempted.
Therefore mobile frame time, battery use, requests/minute and native
memory remain unverified; limits are implementation budgets, not
measurements. The one-frame target is not established. Web measurements
and their caveats are recorded on the preceding PR.

Stack 624 is based on dev cfb9846, including the merged
sidebar-sorting stack and #628 citations. The generated protobuf and
schema conflicts retain both behaviors. gh stack rebase completed;
neither gh-stack-rebase-state nor Git's active rebase state remains.
Current head: 7fa1423. All PRs remain
draft. Measurement limitations above remain open.

Copy audit (§8): no additional product labels in this layer; it records
the diagnostics labels introduced by the preceding layer. No merge
requested; keep the entire stack draft until the remaining evidence is
resolved.
nixuuu added a commit that referenced this pull request Nov 13, 2026
Current `dev` already renders ranged citations inline in sent and queued
mobile messages. Share the pure UTF-16 range helper between composer
spans and sent-message Markdown so both paths retain the same model, and
cover it with five regression tests. Legacy quotes without ranges keep
their block presentation until the queue editor applies
`inlineLegacyQuotes`.

The viewer already shows the full, literal note in a scrollable view.
Keep the same chip convention as web, without an additional note
indicator. No native code, dependencies, configuration or web UI
changes.

## Diagnosis and installed bundle

- The parent of #591 unconditionally rendered every quote through
`MessageQuotes` and passed only mention ranges to Markdown. Its older
protobuf schema also lacked citation ranges. That implementation matches
the reported blocks plus raw placeholders. #591 added both the mobile
range model and inline renderer; #612 retained notes in
`CitationViewer`; #628 changed the web note editor only. The inspected
current-dev rendering path and pure protobuf/range/sentinel tests do not
reproduce the reported model failure. Device rendering remains
unverified, so an older installed bundle is the supported explanation,
not a confirmed observation of the user's installation. No `Fixes`
attribution is warranted.
- The first release containing #591 is `v0.2.0-nightly.146`. Publication
is confirmed in [Mobile release
43333842969](https://github.com/itsoltech/canopy/actions/runs/43333842969):
Android OTA group `e48b25a0-804b-417e-a044-a528b9cb526e`, update
`01a1d239-0f22-7654-ad93-bbfc752d4c00`.
- The later [nightly.147
publication](https://github.com/itsoltech/canopy/actions/runs/43342358688)
is also confirmed: Android OTA group
[`1c21f61a-57a6-4dc3-ba1d-43d357c3d3ef`](https://expo.dev/accounts/itsol/projects/canopy-mobile/updates/1c21f61a-57a6-4dc3-ba1d-43d357c3d3ef),
update `01a1d274-0b11-71a1-9aa6-37106c5b9608`, commit
`31c7f87825b9756d8b1adf677f506519f248f770`. Both Android updates target
runtime `5f6eae3ab278f1cd543e9ed763f923a319b65ec9`. A compatible nightly
installation needs to run that OTA or later; a different native runtime
needs a matching build rather than that OTA. Updating desktop alone does
not update the mobile JS bundle.

Related: #591, #612, #628

## Verification

- Passed with `nice -n 19`: install, generated-code check, final-head
typecheck, lint, formatting check, web build, and the full test
inventory through the repository's four `check:tmp` shards: **2753 pass,
166 skip, zero failures**, 513 files, and no test temp leftovers. Shards
1–3 used the standard command; shard 4 passed with `--isolate
--parallel=2`.
- The default local shard 4 twice failed the unchanged startup recovery
test in `prompt-after-turn-end.test.ts` (`backgroundTasks`: expected 2,
received 1). Its entire file passed separately (6 tests), and the full
shard passed with Bun's built-in file isolation. No assertions or
gateway code were changed. The exact interference between files was not
investigated in this mobile change. [Standard GitHub
CI](https://github.com/itsoltech/canopy/actions/runs/43418493981) is
green on `2be705574aeb9b2c6d8785f59af95a81da4211e4`, including all four
default test shards, static checks and builds.
- Tests cover the reported two-note message after protobuf decoding
(including `start: 0`), citation-only and adjacent tokens, reversed
quote order, UTF-16 offsets around emoji and attachments, legacy queue
conversion, truncated labels, and full multiline notes. No UI tests
added.
- `expo-updates fingerprint:generate` before/after JSON comparisons are
empty for both platforms: iOS
`74705db3a68907bc28379bb9b1080a227bc0755b`; Android
`7d38be8f5c9bf842d62060c75820a206f99c87e3` (same local configuration and
environment).
- Device check unavailable: MacStudio returned `Device list failed:
Could not communicate with device support. Try refreshing devices.`
Refreshing once and attempting `device_open` for the requested Android
device returned the same error. No other device session was touched, no
EAS build or OTA was started, and native visual/layout behavior is
unverified.

## Copy audit

No UI copy changed. Existing `Citation`, `Copy quote` and source actions
remain unchanged; labels and notes retain their existing presentation.
The helper tests verify label truncation and unabridged notes, but do
not replace a visual check.
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