Skip to content

fix: hydrate sidebar last-message previews in background on catalog accept - #866

Merged
cassi-volkova merged 20 commits into
masterfrom
cassi/sidebar-preview-hydration-860
Nov 26, 2026
Merged

cassi-volkova merged 20 commits into
masterfrom
cassi/sidebar-preview-hydration-860

Conversation

@cassi-volkova

@cassi-volkova cassi-volkova commented Nov 25, 2026 •

Copy link
Copy Markdown
Member

Part of #853 (subtask 2).

Resolves sidebar last-message previews and timestamps in a bounded background pass as soon as a stream/topic catalog is accepted (or its last_message_uuid changes), before any topic is opened and including inactive expanded streams.

Implementation

  • Bounded, deduplicated background reads for unresolved last_message_uuid values via the existing project-scoped messages endpoint; visible/expanded rows first, the rest of the known catalog makes progress within the budget.
  • Results are reused across foreground loads, warm-slice preload and realtime; owner-scoped disk cache consulted; a transient miss stays retryable.
  • Late-disk-writes outrank network negative memos (this cycle): a network "authoritatively empty" more no longer memoizes a sticky negative while a disk row may still arrive - the negative now buys two deferred disk re-reads (1 s apart) before memoizing.
  • Preview/activity is announced narrowly on the affected stream/topic rows (per the sidebar-preview narrow-announce rule), never via the shared stateChanged notify.
  • Traffic-pinned window case cross-group fallout fixed by opting the warm-yield pin out of the network preview stage per case (setRowPreviewNetworkEnabledForTest(false), precedent [Native] Keep topic history ready and sidebar order stable when switching chats #718 per-case disable), so no group-level env knob was introduced.

Tests

  • native-controller-sidebar group: 137/137 green solo (includes the new async-hydration and late-disk-retry cases).
  • Both regressions found in the previous wave (sidebarPreviewsHydrateFromTheCacheAsynchronously, crossRouteWarmYieldsWhileForegroundLoadIsInFlight) verified green.

Live verification

PASS against workspace.exordos.com through the lane binary (head 4952cb5), full wizard sign-in (native-login, evidence ~/dev/qa/evidence/860/):

  • stage4_workspace.png at +2 s after login: sidebar rows render name-only - catalog accepted, no blocking wait on preview reads.
  • preview_after_hydration.png at ~+20 s: previews and times appear without opening any conversation (e.g. Workspace_ios -> You: f782a / Yesterday; Project-#2131 -> bot preview / Mar 21; E2EE rows show the Key required preview per the encrypted-preview restriction), and the transient "Showing saved chats" state is gone.
  • Behavior matches the reference contract in Hydrate sidebar last-message previews and times in background on catalog accept #860 (bootstrap-primed sidebar from cached message bodies + bounded UUID hydration).

Reference: workspace_ui 0.9.13 contract cited in #853/#860 (messenger-bootstrap.lib.ts L285-329, messenger-last-messages-loader.lib.ts L96-129).

Live verification (refresh @ head 05fa7b2)

PASS at the fix-round head on https://workspace.exordos.com via the live harness (evidence ~/dev/qa/evidence/live-860-t221/):

  • native-login rc=0 on the rebuilt lane binary (fix round makes the previous 9acc000 evidence stale; this supersedes it).
  • stage4_workspace.png vision-gated: signed-in window, folder rail + stream sidebar fully rendered with hydrated row previews and timestamps on the top-ranked rows (first rows show preview text with today's 12:28/10:03/09:28 stamps), the expanded Workspace_ios stream shows per-topic previews (Nov 24), conversation pane loaded, no login/blank/error state.
  • health --repeat 10: p50 7.4 ms, p95 8.3 ms (< 500 ms target).

Perf check

perf_probe --bin <lane build @05fa7b2b> --idle 30: startup_ms 565, steady_rss_mb 462.7 -> verdict PASS vs baseline (~/dev/qa/evidence/perf-lane-860-t221.json). The move-aware model is projection-diff-only: no extra requests, no measurable startup/memory delta.

UX verification

  • Window-layer witnesses on a WM'd display at head 05fa7b2: sidebarHydrationReorderKeepsActiveSidebarDelegates PASS (moving row delegate survives the re-rank with active focus carried, other delegates alive, list contentY unchanged); sidebarHydrationKeepsFocusOnOtherStream PASS; sidebarSearchMatchesTopicsAndParticipants 26/26 PASS (granular-diff search family pins intact).
  • Live matrix @05fa7b2b: hydrated previews/times visible without opening any conversation (stage4_workspace.png, vision-gated PASS); sidebar ordering matches last-message activity with today's stamps ranked above older rows.

@exordy exordy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exo-review: 3 medium, nothing blocking

Intent: Hydrate sidebar previews in the background when catalogs are accepted.

Verify before merge

  • Server authorization for project-scoped message lookups needs the endpoint's permission checks and callers.
  • Cache lease isolation and encrypted preview handling need the cache and projection implementations.
  • Retry timers across session replacement need session lifecycle and request cancellation evidence.
  • Host networking, daemon binds, privileged paths, and guest isolation are absent from the supplied evidence.
Coverage: 3 axes clean · 0 checks run · mode pre-prod

Threat model:

  • Tenants may supply create/update fields and manifests; protect other tenants' resources, traffic, secrets, and quota.
  • Guest frames, a hostile realm root, and L2 peers cross isolation boundaries protecting the host and underlay.
  • Unprivileged local users must not gain access to privileged files, sockets, or control-plane ports.

Clean axes: security pass: Network lookups include the current project ID, and successful responses must match the requested UUID.; Network replies check the current owner and preview fence before storing a result.; Scope: catalog hooks cover streams, foreground topics and inbox topics.; Tests: supplied new case checks shared-pointer deduplication.

0 tool calls · 32s

@exordy exordy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exo-review: 3 medium, nothing blocking · since 4952cb5: 0 fixed, 3 still open, 0 new

Still open from the previous review

  • thread packages/native/src/native-controller.cpp:19749 [medium] The network batch limit does not bound concurrent preview requests.
  • thread packages/native/src/native-controller.cpp:19780 [medium] Transient request failures become a persistent negative preview after retries are exhausted.
  • thread packages/native/src/native-controller.cpp:19750 [medium] The network batch limit does not bound concurrent preview requests.

Verify before merge

  • Server authorization for project-scoped message lookups needs the endpoint's permission checks and callers.
  • Cache lease isolation and encrypted preview handling need the cache and projection implementations.
  • Retry timers across session replacement need session lifecycle and request cancellation evidence.
  • Host networking, daemon binds, privileged paths, and guest isolation are absent from the supplied evidence.
Coverage: 5 axes clean · 0 checks run · mode pre-prod

Clean axes: Security: lookups carry the project ID and validate response UUIDs.; Security: replies check the current owner and preview fence.; Scope: catalog hooks cover streams and both topic catalogs.; Tests: the supplied sidebar case checks shared-pointer deduplication.; Readiness: the new switches are confined to window test scenes.

0 tool calls · 24s

cassi-volkova added a commit that referenced this pull request Nov 25, 2026
… retryable

#866 review round (exordy findings 1/3 and 2):

- The network stage started up to 8 lookups per pump pass and rescheduled
  itself immediately while pending work remained, so a large catalog
  dispatched every unresolved uuid before any reply landed: the batch
  bounded a per-pass start rate, not the total in-flight count. The pump
  now dispatches only into free slots (batch - in-flight) and the pending
  queue is resumed by the completion handler as replies retire their
  slots. The eager self-reschedule is gone.
- A transient failure that exhausts the retry budget no longer stores a
  sticky negative memo. Catalog seeding skips memoized uuids, so the
  sticky empty preview could never recover after the server came back.
  The row keeps the reference empty preview and a later catalog accept
  offers one fresh trial.

Test-first (RED witnesses on the pre-fix build):
- sidebarPreviewNetworkStageCapsTotalInFlight: RED showed
  rowPreviewNetworkIssuedForTest()==12 vs the expected 8 (client-side
  seam because the mock's HTTP/1 pool masks server-side over-dispatch);
  GREEN asserts the cap and drains all 12 previews through it, proving
  the completion-driven resume.
- sidebarPreviewRecoversAfterTransientFailureBudget: RED showed no 4th
  attempt after budget exhaustion (memo blocked the re-seed); GREEN
  recovers after refresh() once the server flips back.

Groups: native-controller-sidebar 139/139 green (was 137, +2 new cases).
@cassi-volkova
cassi-volkova force-pushed the cassi/sidebar-preview-hydration-860 branch from 29a67eb to ca0ec17 Compare November 25, 2026 23:09

@exordy exordy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exo-review: LGTM · since 29a67eb: 3 fixed, 0 still open, 0 new

Verify before merge

  • Server authorization for project-scoped message lookups needs the endpoint's permission checks and callers.
  • Cache lease isolation and encrypted preview handling need the cache and projection implementations.
  • Retry timers across session replacement need session lifecycle and request cancellation evidence.
  • Host networking, daemon binds, privileged paths, and guest isolation are absent from the supplied evidence.
  • Preview authorization: need endpoint and cache implementations to verify project ownership and message visibility.
  • Session change and ID reuse: need reset and fence lifecycle code to assess stale callbacks removing current in-flight entries.
  • Guest, realm and L2 isolation: need interface, flow, forwarding and daemon OUTPUT rules to trace all paths.
  • Create/update authorization, nested references and quota: need their handlers and validation paths to complete the comparison.
Coverage: 5 axes clean · 0 checks run · mode shipped

Threat model:

  • Tenants supply create/update fields and manifests; protect other tenants' resources, traffic, secrets and quota.
  • Guest frames, hostile realm root and L2 peers cross isolation boundaries protecting the host and underlay.
  • Unprivileged local users must not gain access to privileged files, sockets or control-plane ports.

Clean axes: security pass: Preview callbacks check authentication, owner and UUID fence before consuming a reply.; The changed pump limits dispatch to available in-flight slots and resumes pending work on completion.; Scope: catalog hooks cover streams and both topic catalogs.; Tests: the supplied sidebar case checks shared-pointer deduplication.; Tests: new cases cover the in-flight cap and recovery after refresh.; Readiness: the new switches are confined to window test scenes.

0 tool calls · 19s

cassi-volkova added a commit that referenced this pull request Nov 25, 2026
… retryable

#866 review round (exordy findings 1/3 and 2):

- The network stage started up to 8 lookups per pump pass and rescheduled
  itself immediately while pending work remained, so a large catalog
  dispatched every unresolved uuid before any reply landed: the batch
  bounded a per-pass start rate, not the total in-flight count. The pump
  now dispatches only into free slots (batch - in-flight) and the pending
  queue is resumed by the completion handler as replies retire their
  slots. The eager self-reschedule is gone.
- A transient failure that exhausts the retry budget no longer stores a
  sticky negative memo. Catalog seeding skips memoized uuids, so the
  sticky empty preview could never recover after the server came back.
  The row keeps the reference empty preview and a later catalog accept
  offers one fresh trial.

Test-first (RED witnesses on the pre-fix build):
- sidebarPreviewNetworkStageCapsTotalInFlight: RED showed
  rowPreviewNetworkIssuedForTest()==12 vs the expected 8 (client-side
  seam because the mock's HTTP/1 pool masks server-side over-dispatch);
  GREEN asserts the cap and drains all 12 previews through it, proving
  the completion-driven resume.
- sidebarPreviewRecoversAfterTransientFailureBudget: RED showed no 4th
  attempt after budget exhaustion (memo blocked the re-seed); GREEN
  recovers after refresh() once the server flips back.

Groups: native-controller-sidebar 139/139 green (was 137, +2 new cases).
@cassi-volkova
cassi-volkova force-pushed the cassi/sidebar-preview-hydration-860 branch from ca0ec17 to 796315e Compare November 25, 2026 23:47

@exordy exordy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exo-review: 3 medium, nothing blocking

Intent: Hydrate sidebar message previews in a bounded background pass when catalogs are accepted.

Verify before merge

  • Compare the endpoint's successful response and error contracts with the new array parsing and negative memo behavior.
  • Messages endpoint authorization and project ownership checks require server-side evidence for UUID lookups.
  • Encrypted-preview restrictions and owner-scoped cache lease enforcement require the omitted implementations.
  • Retry timers surviving session changes need session-transition and request-lifecycle evidence to assess cross-owner effects.
  • No prior background items were supplied for comparison.
Coverage: 3 axes clean · 0 checks run · mode pre-prod

Threat model:

  • Tenants supplying create/update fields or manifests may target other tenants’ resources, traffic, secrets, or quota.
  • Guest frames, hostile realm roots, and L2 peers may target the host, underlay, or control-plane ports.
  • Unprivileged local users may target privileged files, sockets, daemon settings, or other users’ secrets.

Clean axes: security pass: Catalog message UUIDs reach a GET request carrying project_id; replies are checked against owner, fence, and UUID.; Network preview dispatch is capped at eight tracked in-flight UUIDs within the active bookkeeping state.; The supplied changes introduce no privileged argv, routes, sysctls, binds, or network isolation rules.; Request scope: new message lookups include the current project ID.; Secrets: the supplied new request and callbacks add no payload logging.

0 tool calls · 37s

cassi-volkova added a commit that referenced this pull request Nov 26, 2026
… rows hydrate first

#866 review round 3:
- finding 1: every disk/network preview request now carries a token and only
  the request that still owns the uuid's marker may retire it, so a late reply
  can never free a newer request's in-flight slot (session resets clear the
  queues and tokens together). Reproduction attempt: the client aborts
  retired-session requests at the session switch, so the stale-reply premise
  is already neutralized at the transport layer; the token guard is kept as
  defense-in-depth and the test pins the marker-retention contract.
- finding 2: the pumps consume a priority-ordered queue instead of QSet value
  order: the open route first, then expanded sidebar streams (live state,
  re-evaluated at every slot hand-off), then the collapsed remainder. Each
  pointer knows its owning stream via the seed-time ownership map.
- finding 3 (delegate-recreation under hydration) is acknowledged and needs a
  narrow preview-revision projection design; it lands as a separate follow-up
  in this lane.
@cassi-volkova

Copy link
Copy Markdown
Member Author

Fix round on 1c56bcc addressing the three open mediums:

  • finding 1 (stale reply steals in-flight slot): per-request tokens gate the marker retirement in both pumps; session-reset seams clear queues/tokens together. Reproduction attempt showed the transport already aborts retired-session requests at the switch (pre-fix code survives that path via the abort); the guard is kept as defense-in-depth and sidebarPreviewStaleReplyCannotRetireNewSessionSlot pins the marker-retention contract via a new rowPreviewNetworkInFlightForTest() seam.
  • finding 2 (no visible/expanded priority): pumps now consume a priority-ordered queue (route first, expanded streams in expansion order, collapsed remainder last), with the foreground check re-evaluated at every slot hand-off against live m_stream / m_expandedSidebarStreams, backed by a seed-time uuid->stream ownership map. The dedicated multi-stream dispatch-order witness is still owed (the controller fixture cannot drive a second stream's route catalog into the pump yet); the lane stays open for it.
  • finding 3 (window tests run disk-only to hide delegate recreation): acknowledged; the proper fix is a narrow preview-revision projection so hydration arrivals stop rebuilding the sidebar model, then the window harness moves back to hydration-enabled. It needs its own design pass and will land as a follow-up on this lane.

Touched-group local run: native-controller-sidebar preview family 12/12 green offscreen (caps, transient-recovery, memo/edit/delete scenarios, async disk hydration, plus the new stale-slot test).

@exordy exordy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exo-review: 1 medium, nothing blocking · since 796315e: 2 fixed, 1 still open, 0 new

Still open from the previous review

  • thread packages/native/tests/native-window-test.cpp:3205 [medium] Disabling network hydration in window tests hides interaction regressions present in production.

Verify before merge

  • Compare the endpoint's successful response and error contracts with the new array parsing and negative memo behavior.
  • Messages endpoint authorization and project ownership checks require server-side evidence for UUID lookups.
  • Encrypted-preview restrictions and owner-scoped cache lease enforcement require the omitted implementations.
  • Retry timers surviving session changes need session-transition and request-lifecycle evidence to assess cross-owner effects.
  • No prior background items were supplied for comparison.
  • Compare create and update authorization, nested ownership and quota checks using the relevant API handlers and base code.
  • Trace catalog UUIDs through the messages endpoint and cache lease checks to establish project and owner isolation.
  • Check stale callbacks and retry timers across same-owner session or project changes using the full callback and reset paths.
  • Inspect privileged argv, files, modes, routes, sysctls, binds and daemon defaults, including their input validation and base behavior, for hunt B; that evidence is absent from this frontend-only diff and is not
Coverage: 8 axes clean · 0 checks run · mode pre-prod

Threat model:

  • Tenants can supply create/update fields and manifests; protect other tenants' resources, traffic, secrets and billing.
  • Guest frames, a hostile realm root and L2 peers may cross isolation boundaries to the host or underlay.
  • Unprivileged local users may target privileged files, sockets, daemons and control-plane ports.
  • Catalog data and delayed cache or network replies cross session and project boundaries during preview hydration.

Clean axes: security pass: Changed preview network requests include project_id and uuid; server-side authorization is not supplied.; Disk and network token guards prevent an old callback from removing a newer request's in-flight marker.; Request scope: UUID lookups include the current project ID.; Reply guards: owner, fence and UUID are checked.; Concurrency: tracked network requests are capped at eight.; Secrets: the new requests and callbacks add no payload logging.; Host access: no privileged argv, routes, binds or network rules added.; Priority: queued route and expanded rows are picked first.; Session slots: request tokens protect newer in-flight markers.

0 tool calls · 25s

cassi-volkova added a commit that referenced this pull request Nov 26, 2026
… row

Finding 3 (PR #866) acceptance case: with network preview hydration ENABLED
(the production shape the window harness previously had to pin off in
e326bc5), a held uuid lookup reply lands while a sidebar row holds keyboard
focus. The focused row must survive as the same item instance at the same
scene position with focus intact, the list offset must not move, and the
click target must still select its stream - while the preview text itself
flips through the previewRevision projection.

Witness: the identical case FAILS on the parent shape ecd82cc ('A network
preview arrival must not re-incubate the focused sidebar row' - the delegate
is destroyed by the old streamsChanged announcement) and PASSES green solo
at this head (single-case run 3.70 s, window-test buckets regenerated).
@cassi-volkova
cassi-volkova force-pushed the cassi/sidebar-preview-hydration-860 branch from 86ff16d to 28facfe Compare November 26, 2026 04:38
cassi-volkova added a commit that referenced this pull request Nov 26, 2026
… retryable

#866 review round (exordy findings 1/3 and 2):

- The network stage started up to 8 lookups per pump pass and rescheduled
  itself immediately while pending work remained, so a large catalog
  dispatched every unresolved uuid before any reply landed: the batch
  bounded a per-pass start rate, not the total in-flight count. The pump
  now dispatches only into free slots (batch - in-flight) and the pending
  queue is resumed by the completion handler as replies retire their
  slots. The eager self-reschedule is gone.
- A transient failure that exhausts the retry budget no longer stores a
  sticky negative memo. Catalog seeding skips memoized uuids, so the
  sticky empty preview could never recover after the server came back.
  The row keeps the reference empty preview and a later catalog accept
  offers one fresh trial.

Test-first (RED witnesses on the pre-fix build):
- sidebarPreviewNetworkStageCapsTotalInFlight: RED showed
  rowPreviewNetworkIssuedForTest()==12 vs the expected 8 (client-side
  seam because the mock's HTTP/1 pool masks server-side over-dispatch);
  GREEN asserts the cap and drains all 12 previews through it, proving
  the completion-driven resume.
- sidebarPreviewRecoversAfterTransientFailureBudget: RED showed no 4th
  attempt after budget exhaustion (memo blocked the re-seed); GREEN
  recovers after refresh() once the server flips back.

Groups: native-controller-sidebar 139/139 green (was 137, +2 new cases).
cassi-volkova added a commit that referenced this pull request Nov 26, 2026
… rows hydrate first

#866 review round 3:
- finding 1: every disk/network preview request now carries a token and only
  the request that still owns the uuid's marker may retire it, so a late reply
  can never free a newer request's in-flight slot (session resets clear the
  queues and tokens together). Reproduction attempt: the client aborts
  retired-session requests at the session switch, so the stale-reply premise
  is already neutralized at the transport layer; the token guard is kept as
  defense-in-depth and the test pins the marker-retention contract.
- finding 2: the pumps consume a priority-ordered queue instead of QSet value
  order: the open route first, then expanded sidebar streams (live state,
  re-evaluated at every slot hand-off), then the collapsed remainder. Each
  pointer knows its owning stream via the seed-time ownership map.
- finding 3 (delegate-recreation under hydration) is acknowledged and needs a
  narrow preview-revision projection design; it lands as a separate follow-up
  in this lane.
cassi-volkova added a commit that referenced this pull request Nov 26, 2026
… row

Finding 3 (PR #866) acceptance case: with network preview hydration ENABLED
(the production shape the window harness previously had to pin off in
e326bc5), a held uuid lookup reply lands while a sidebar row holds keyboard
focus. The focused row must survive as the same item instance at the same
scene position with focus intact, the list offset must not move, and the
click target must still select its stream - while the preview text itself
flips through the previewRevision projection.

Witness: the identical case FAILS on the parent shape ecd82cc ('A network
preview arrival must not re-incubate the focused sidebar row' - the delegate
is destroyed by the old streamsChanged announcement) and PASSES green solo
at this head (single-case run 3.70 s, window-test buckets regenerated).
cassi-volkova added a commit that referenced this pull request Nov 26, 2026
… retryable

#866 review round (exordy findings 1/3 and 2):

- The network stage started up to 8 lookups per pump pass and rescheduled
  itself immediately while pending work remained, so a large catalog
  dispatched every unresolved uuid before any reply landed: the batch
  bounded a per-pass start rate, not the total in-flight count. The pump
  now dispatches only into free slots (batch - in-flight) and the pending
  queue is resumed by the completion handler as replies retire their
  slots. The eager self-reschedule is gone.
- A transient failure that exhausts the retry budget no longer stores a
  sticky negative memo. Catalog seeding skips memoized uuids, so the
  sticky empty preview could never recover after the server came back.
  The row keeps the reference empty preview and a later catalog accept
  offers one fresh trial.

Test-first (RED witnesses on the pre-fix build):
- sidebarPreviewNetworkStageCapsTotalInFlight: RED showed
  rowPreviewNetworkIssuedForTest()==12 vs the expected 8 (client-side
  seam because the mock's HTTP/1 pool masks server-side over-dispatch);
  GREEN asserts the cap and drains all 12 previews through it, proving
  the completion-driven resume.
- sidebarPreviewRecoversAfterTransientFailureBudget: RED showed no 4th
  attempt after budget exhaustion (memo blocked the re-seed); GREEN
  recovers after refresh() once the server flips back.

Groups: native-controller-sidebar 139/139 green (was 137, +2 new cases).
@cassi-volkova
cassi-volkova force-pushed the cassi/sidebar-preview-hydration-860 branch from 28facfe to 767ac89 Compare November 26, 2026 04:38
cassi-volkova added a commit that referenced this pull request Nov 26, 2026
… rows hydrate first

#866 review round 3:
- finding 1: every disk/network preview request now carries a token and only
  the request that still owns the uuid's marker may retire it, so a late reply
  can never free a newer request's in-flight slot (session resets clear the
  queues and tokens together). Reproduction attempt: the client aborts
  retired-session requests at the session switch, so the stale-reply premise
  is already neutralized at the transport layer; the token guard is kept as
  defense-in-depth and the test pins the marker-retention contract.
- finding 2: the pumps consume a priority-ordered queue instead of QSet value
  order: the open route first, then expanded sidebar streams (live state,
  re-evaluated at every slot hand-off), then the collapsed remainder. Each
  pointer knows its owning stream via the seed-time ownership map.
- finding 3 (delegate-recreation under hydration) is acknowledged and needs a
  narrow preview-revision projection design; it lands as a separate follow-up
  in this lane.
cassi-volkova added a commit that referenced this pull request Nov 26, 2026
… row

Finding 3 (PR #866) acceptance case: with network preview hydration ENABLED
(the production shape the window harness previously had to pin off in
e326bc5), a held uuid lookup reply lands while a sidebar row holds keyboard
focus. The focused row must survive as the same item instance at the same
scene position with focus intact, the list offset must not move, and the
click target must still select its stream - while the preview text itself
flips through the previewRevision projection.

Witness: the identical case FAILS on the parent shape ecd82cc ('A network
preview arrival must not re-incubate the focused sidebar row' - the delegate
is destroyed by the old streamsChanged announcement) and PASSES green solo
at this head (single-case run 3.70 s, window-test buckets regenerated).

@exordy exordy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exo-review: 1 medium, nothing blocking · since ecd82cc: 1 fixed, 0 still open, 1 new

Verify before merge

  • Compare the endpoint's successful response and error contracts with the new array parsing and negative memo behavior.
  • Messages endpoint authorization and project ownership checks require server-side evidence for UUID lookups.
  • Encrypted-preview restrictions and owner-scoped cache lease enforcement require the omitted implementations.
  • Retry timers surviving session changes need session-transition and request-lifecycle evidence to assess cross-owner effects.
  • No prior background items were supplied for comparison.
  • Compare create and update authorization, nested ownership and quota checks using the relevant API handlers and base code.
  • Trace catalog UUIDs through the messages endpoint and cache lease checks to establish project and owner isolation.
  • Check stale callbacks and retry timers across same-owner session or project changes using the full callback and reset paths.
  • Inspect privileged argv, files, modes, routes, sysctls, binds and daemon defaults, including their input validation and base behavior, for hunt B; that evidence is absent from this frontend-only diff and is not
  • Compare the endpoint's success and error contracts with array parsing and negative memo behavior.
  • Check messages endpoint authorization and project ownership for UUID lookups against server handlers.
  • Inspect encrypted-preview restrictions and owner-scoped cache lease enforcement.
  • Trace retry timers across session transitions and request lifecycles for cross-owner effects without a tool or browser session to verify the cross-owner effect against the actual server behavior and the cache’s
  • Preview lookup authorization and project scoping: need the network pump, endpoint implementation and update callers.
  • Cross-session cache disclosure and stale replies: need owner checks, reset paths, cache implementation and request callbacks.
  • Encrypted preview disclosure: need rowPreviewFields and its memo population and invalidation paths.
  • Host and network isolation lifecycle: no relevant interface, flow, forwarding or local OUTPUT implementation was supplied.
Coverage: 9 axes clean · 0 checks run · mode shipped

Threat model:

  • Tenants can supply catalog fields and manifests; protect other tenants' messages, secrets and quota.
  • Guest frames, hostile realm root and L2 peers may cross host, underlay and control-plane boundaries.
  • Unprivileged local users may attempt to access cached messages or credentials.

Clean axes: security pass: Changed preview bindings pass the row's last-message UUID to the existing preview lookup.; Changed hunks introduce no privileged argv, file modes, routes, sysctls, binds or network rules.; Request scope: UUID lookups include the current project ID.; Reply guards: owner, fence and UUID are checked.; Session slots: request tokens protect newer in-flight markers.; Concurrency: tracked network requests are capped at eight.; Priority: queued route and expanded rows are picked first.; Secrets: preview requests and callbacks add no payload logging.; Host access: preview changes add no privileged routes or binds.; Tests: the new window case exercises a held network reply with focus.

0 tool calls · 23s

@cassi-volkova
cassi-volkova force-pushed the cassi/sidebar-preview-hydration-860 branch from 767ac89 to 35adecd Compare November 26, 2026 05:42
cassi-volkova added a commit that referenced this pull request Nov 26, 2026
… retryable

#866 review round (exordy findings 1/3 and 2):

- The network stage started up to 8 lookups per pump pass and rescheduled
  itself immediately while pending work remained, so a large catalog
  dispatched every unresolved uuid before any reply landed: the batch
  bounded a per-pass start rate, not the total in-flight count. The pump
  now dispatches only into free slots (batch - in-flight) and the pending
  queue is resumed by the completion handler as replies retire their
  slots. The eager self-reschedule is gone.
- A transient failure that exhausts the retry budget no longer stores a
  sticky negative memo. Catalog seeding skips memoized uuids, so the
  sticky empty preview could never recover after the server came back.
  The row keeps the reference empty preview and a later catalog accept
  offers one fresh trial.

Test-first (RED witnesses on the pre-fix build):
- sidebarPreviewNetworkStageCapsTotalInFlight: RED showed
  rowPreviewNetworkIssuedForTest()==12 vs the expected 8 (client-side
  seam because the mock's HTTP/1 pool masks server-side over-dispatch);
  GREEN asserts the cap and drains all 12 previews through it, proving
  the completion-driven resume.
- sidebarPreviewRecoversAfterTransientFailureBudget: RED showed no 4th
  attempt after budget exhaustion (memo blocked the re-seed); GREEN
  recovers after refresh() once the server flips back.

Groups: native-controller-sidebar 139/139 green (was 137, +2 new cases).
cassi-volkova added a commit that referenced this pull request Nov 26, 2026
… rows hydrate first

#866 review round 3:
- finding 1: every disk/network preview request now carries a token and only
  the request that still owns the uuid's marker may retire it, so a late reply
  can never free a newer request's in-flight slot (session resets clear the
  queues and tokens together). Reproduction attempt: the client aborts
  retired-session requests at the session switch, so the stale-reply premise
  is already neutralized at the transport layer; the token guard is kept as
  defense-in-depth and the test pins the marker-retention contract.
- finding 2: the pumps consume a priority-ordered queue instead of QSet value
  order: the open route first, then expanded sidebar streams (live state,
  re-evaluated at every slot hand-off), then the collapsed remainder. Each
  pointer knows its owning stream via the seed-time ownership map.
- finding 3 (delegate-recreation under hydration) is acknowledged and needs a
  narrow preview-revision projection design; it lands as a separate follow-up
  in this lane.
cassi-volkova added a commit that referenced this pull request Nov 26, 2026
… row

Finding 3 (PR #866) acceptance case: with network preview hydration ENABLED
(the production shape the window harness previously had to pin off in
e326bc5), a held uuid lookup reply lands while a sidebar row holds keyboard
focus. The focused row must survive as the same item instance at the same
scene position with focus intact, the list offset must not move, and the
click target must still select its stream - while the preview text itself
flips through the previewRevision projection.

Witness: the identical case FAILS on the parent shape ecd82cc ('A network
preview arrival must not re-incubate the focused sidebar row' - the delegate
is destroyed by the old streamsChanged announcement) and PASSES green solo
at this head (single-case run 3.70 s, window-test buckets regenerated).
cassi-volkova added a commit that referenced this pull request Nov 26, 2026
exordy finding on PR #866: the preview pumps recorded the memo but left the
learned created stamp out of the activity ledger, so a row whose true
last-message timestamp differed from its updated_at fallback never moved.
Record the stamp from both pumps and announce a coalesced streamsChanged
only when the projected order actually moves - a preview arrival that
reorders nothing keeps the preview-only announcement (pinned by
previewArrivalAnnouncesRevisionWithoutProjectionRebuild).

@exordy exordy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exo-review: 1 medium, nothing blocking · since 767ac89: 1 fixed, 0 still open, 1 new

Verify before merge

  • Compare the endpoint's successful response and error contracts with the new array parsing and negative memo behavior.
  • Messages endpoint authorization and project ownership checks require server-side evidence for UUID lookups.
  • Encrypted-preview restrictions and owner-scoped cache lease enforcement require the omitted implementations.
  • Retry timers surviving session changes need session-transition and request-lifecycle evidence to assess cross-owner effects.
  • No prior background items were supplied for comparison.
  • Compare create and update authorization, nested ownership and quota checks using the relevant API handlers and base code.
  • Trace catalog UUIDs through the messages endpoint and cache lease checks to establish project and owner isolation.
  • Check stale callbacks and retry timers across same-owner session or project changes using the full callback and reset paths.
  • Inspect privileged argv, files, modes, routes, sysctls, binds and daemon defaults, including their input validation and base behavior, for hunt B; that evidence is absent from this frontend-only diff and is not
  • Compare the endpoint's success and error contracts with array parsing and negative memo behavior.
  • Check messages endpoint authorization and project ownership for UUID lookups against server handlers.
  • Inspect encrypted-preview restrictions and owner-scoped cache lease enforcement.
  • Trace retry timers across session transitions and request lifecycles for cross-owner effects without a tool or browser session to verify the cross-owner effect against the actual server behavior and the cache’s
  • Preview lookup authorization and project scoping: need the network pump, endpoint implementation and update callers.
  • Cross-session cache disclosure and stale replies: need owner checks, reset paths, cache implementation and request callbacks.
  • Encrypted preview disclosure: need rowPreviewFields and its memo population and invalidation paths.
  • Host and network isolation lifecycle: no relevant interface, flow, forwarding or local OUTPUT implementation was supplied.
  • A: Create/update authorization, project ownership and nested-reference validation require the omitted callers and endpoint code.
  • B: Privileged argv, files, network rules and local OUTPUT paths require the omitted subsystem implementations.
  • C: Session resets, failed apply, restart and ID reuse require the omitted pump and lifecycle implementations.
  • Quota amplification and cache ownership require the omitted request dispatch, lease and cache implementations.
Coverage: 10 axes clean · 0 checks run · mode pre-prod

Threat model:

  • Tenants supply create/update fields and manifests; other tenants' resources, traffic, secrets and quota require isolation.
  • Guest frames and L2 peers cross network boundaries protecting the host, underlay and control-plane ports.
  • A hostile realm root and unprivileged local users may target privileged host services and files.

Clean axes: security pass: Both changed hydration paths require a parsed message UUID to match the requested UUID before updating activity.; Preview bindings: changed bindings use the row's last-message UUID.; Request scope: UUID lookups include the current project ID.; Reply guards: owner, fence and UUID are checked.; Session slots: tokens protect newer in-flight markers.; Concurrency: tracked network requests are capped at eight.; Priority: route and expanded rows are picked first.; Secrets: preview requests and callbacks add no payload logging.; Host access: preview changes add no privileged routes or binds.; Tests: a window case exercises a held reply with focus.

0 tool calls · 30s

cassi-volkova added a commit that referenced this pull request Nov 26, 2026
exordy finding 4704344635 on PR #866: the round-1 keyMoves guard skipped the
ledger write when the hydrated stamp matched the row's updated_at fallback.
A later stream.updated bump of updated_at then re-keyed the row from the
drift instead of the known message timestamp. Record the stamp whenever a
live row owns the pointer; announcement semantics unchanged (streamsChanged
only when the projected order actually moves).

Repro: sidebarPreviewHydrationKeepsEqualFallbackStampAgainstDrift (RED before
the fix: the drifted row jumped above the genuinely newer peer).

@exordy exordy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exo-review: LGTM · since 35adecd: 1 fixed, 0 still open, 0 new

Verify before merge

  • Compare the endpoint's successful response and error contracts with the new array parsing and negative memo behavior.
  • Messages endpoint authorization and project ownership checks require server-side evidence for UUID lookups.
  • Encrypted-preview restrictions and owner-scoped cache lease enforcement require the omitted implementations.
  • Retry timers surviving session changes need session-transition and request-lifecycle evidence to assess cross-owner effects.
  • No prior background items were supplied for comparison.
  • Compare create and update authorization, nested ownership and quota checks using the relevant API handlers and base code.
  • Trace catalog UUIDs through the messages endpoint and cache lease checks to establish project and owner isolation.
  • Check stale callbacks and retry timers across same-owner session or project changes using the full callback and reset paths.
  • Inspect privileged argv, files, modes, routes, sysctls, binds and daemon defaults, including their input validation and base behavior, for hunt B; that evidence is absent from this frontend-only diff and is not
  • Compare the endpoint's success and error contracts with array parsing and negative memo behavior.
  • Check messages endpoint authorization and project ownership for UUID lookups against server handlers.
  • Inspect encrypted-preview restrictions and owner-scoped cache lease enforcement.
  • Trace retry timers across session transitions and request lifecycles for cross-owner effects without a tool or browser session to verify the cross-owner effect against the actual server behavior and the cache’s
  • Preview lookup authorization and project scoping: need the network pump, endpoint implementation and update callers.
  • Cross-session cache disclosure and stale replies: need owner checks, reset paths, cache implementation and request callbacks.
  • Encrypted preview disclosure: need rowPreviewFields and its memo population and invalidation paths.
  • Host and network isolation lifecycle: no relevant interface, flow, forwarding or local OUTPUT implementation was supplied.
  • A: Create/update authorization, project ownership and nested-reference validation require the omitted callers and endpoint code.
  • B: Privileged argv, files, network rules and local OUTPUT paths require the omitted subsystem implementations.
  • C: Session resets, failed apply, restart and ID reuse require the omitted pump and lifecycle implementations.
  • Quota amplification and cache ownership require the omitted request dispatch, lease and cache implementations.
  • Hydration endpoint authorization, project scoping and owner-scoped cache isolation require the omitted request and cache code.
  • Create/update permissions, nested references and quota or billing checks require the relevant handlers and base evidence.
  • Privileged paths, argv, flows, routes, sysctls, binds and daemon defaults require the relevant subsystem code and base comparison.
  • Isolation across interfaces, forwarding paths and local-daemon OUTPUT requires network rules and their producers in both revisions to compare them across this PR range and test isolation coverage end to end. A
Coverage: 10 axes clean · 0 checks run · mode pre-prod

Threat model:

  • Tenants can supply create/update fields and manifests; other tenants' resources, traffic and secrets must remain isolated.
  • Guest frames, a hostile realm root and L2 peers must not gain host, underlay or control-plane access.
  • Unprivileged local users must not gain access to privileged files, sockets or other users' data.
  • Tenant-controlled activity must not bypass project authorization, quota or billing boundaries.

Clean axes: security pass: Equal fallback timestamp: a live owning row now records the hydrated timestamp without announcing an order change.; The supplied test covers a later catalog timestamp bump after equal-stamp hydration.; Activity ordering: equal fallback timestamps now reach the ledger.; Preview bindings: changed bindings use the row's last-message UUID.; Request scope: UUID lookups include the current project ID.; Reply guards: owner, fence and UUID are checked.; Session slots: tokens protect newer in-flight markers.; Concurrency: tracked network requests are capped at eight.; Priority: route and expanded rows are picked first.; Secrets: preview requests and callbacks add no payload logging.; Host access: preview changes add no privileged routes or binds.

0 tool calls · 16s

- Network empty-page no longer memoizes a sticky quiet row while the disk
  cache may still be about to receive the body: the miss buys two delayed
  disk re-reads (1 s apart) before the negative memo is stored, mirroring
  the reference's best-effort fill order (messenger-last-messages-loader
  disk-first semantics).
- crossRouteWarmYieldsWhileForegroundLoadIsInFlight pins the warm sweep's
  yield rule on the shared /messages/ mock handler, so it runs the
  disk-only preview shape via setRowPreviewNetworkEnabledForTest(false).

sidebarPreviewsHydrateFromTheCacheAsynchronously and
crossRouteWarmYieldsWhileForegroundLoadIsInFlight green solo; full
native-controller-sidebar group 137/137.
The uuid preview lookups seeded from the mock catalog recreated delegates
under traffic- and scroll-pinned window cases (wheel, auto-paging, quick
reactions, channel-info dialog): clicks lost their target mid-readiness and
contentY pins drifted. Wire setRowPreviewNetworkEnabledForTest(false) into
NativeWindowScene, ChannelInfoWindowScene and the five inline manual scenes
that already disable the topic preload sweep, matching the proven #718
per-case layout. Reproduced solo red before, solo green after: wheelNotch*,
scrollNearTopAutoLoadsOlderPages, quickReaction* (16/16), channelTopic*
(16/16) plus the remaining CI-red family (33/34; prefetchRefetchesOnFirst
-ScrollAfterRestore is a pre-existing host solo-red, red on master tip too).
… retryable

#866 review round (exordy findings 1/3 and 2):

- The network stage started up to 8 lookups per pump pass and rescheduled
  itself immediately while pending work remained, so a large catalog
  dispatched every unresolved uuid before any reply landed: the batch
  bounded a per-pass start rate, not the total in-flight count. The pump
  now dispatches only into free slots (batch - in-flight) and the pending
  queue is resumed by the completion handler as replies retire their
  slots. The eager self-reschedule is gone.
- A transient failure that exhausts the retry budget no longer stores a
  sticky negative memo. Catalog seeding skips memoized uuids, so the
  sticky empty preview could never recover after the server came back.
  The row keeps the reference empty preview and a later catalog accept
  offers one fresh trial.

Test-first (RED witnesses on the pre-fix build):
- sidebarPreviewNetworkStageCapsTotalInFlight: RED showed
  rowPreviewNetworkIssuedForTest()==12 vs the expected 8 (client-side
  seam because the mock's HTTP/1 pool masks server-side over-dispatch);
  GREEN asserts the cap and drains all 12 previews through it, proving
  the completion-driven resume.
- sidebarPreviewRecoversAfterTransientFailureBudget: RED showed no 4th
  attempt after budget exhaustion (memo blocked the re-seed); GREEN
  recovers after refresh() once the server flips back.

Groups: native-controller-sidebar 139/139 green (was 137, +2 new cases).
… rows hydrate first

#866 review round 3:
- finding 1: every disk/network preview request now carries a token and only
  the request that still owns the uuid's marker may retire it, so a late reply
  can never free a newer request's in-flight slot (session resets clear the
  queues and tokens together). Reproduction attempt: the client aborts
  retired-session requests at the session switch, so the stale-reply premise
  is already neutralized at the transport layer; the token guard is kept as
  defense-in-depth and the test pins the marker-retention contract.
- finding 2: the pumps consume a priority-ordered queue instead of QSet value
  order: the open route first, then expanded sidebar streams (live state,
  re-evaluated at every slot hand-off), then the collapsed remainder. Each
  pointer knows its owning stream via the seed-time ownership map.
- finding 3 (delegate-recreation under hydration) is acknowledged and needs a
  narrow preview-revision projection design; it lands as a separate follow-up
  in this lane.
…860)

Multi-stream companion for finding 2: the network pump picks the open route
and every expanded stream ahead of hidden candidates that were queued first,
re-checking the live expansion set per slot. Mock arrival order over the
parallel cache reads and the HTTP connection pool is not a deterministic
oracle, so the seam drives the pump's own queue and candidate picker:
plain FIFO (the pre-fix shape) fails the route pick and the expanded pick.
…jection

Design round for review finding 3: preview arrivals no longer rebuild the
sidebar projection. The controller gains a previewRevision Q_PROPERTY with a
coalesced previewChanged announcement for pump batches and a synchronous bump
for discrete encrypted preview-state transitions; the row DTOs drop the baked
preview keys and the delegates derive previewData via previewFields(uuid,
previewRevision) so a preview batch re-evaluates only the text bindings.
Pointer moves keep the streamsChanged rebuild path. All DTO-key test reads
migrated to the same seam; new controller pin asserts previewChanged fires
while the streamsChanged spy stays silent.
… row

Finding 3 (PR #866) acceptance case: with network preview hydration ENABLED
(the production shape the window harness previously had to pin off in
e326bc5), a held uuid lookup reply lands while a sidebar row holds keyboard
focus. The focused row must survive as the same item instance at the same
scene position with focus intact, the list offset must not move, and the
click target must still select its stream - while the preview text itself
flips through the previewRevision projection.

Witness: the identical case FAILS on the parent shape ecd82cc ('A network
preview arrival must not re-incubate the focused sidebar row' - the delegate
is destroyed by the old streamsChanged announcement) and PASSES green solo
at this head (single-case run 3.70 s, window-test buckets regenerated).
exordy finding on PR #866: the preview pumps recorded the memo but left the
learned created stamp out of the activity ledger, so a row whose true
last-message timestamp differed from its updated_at fallback never moved.
Record the stamp from both pumps and announce a coalesced streamsChanged
only when the projected order actually moves - a preview arrival that
reorders nothing keeps the preview-only announcement (pinned by
previewArrivalAnnouncesRevisionWithoutProjectionRebuild).
exordy finding 4704344635 on PR #866: the round-1 keyMoves guard skipped the
ledger write when the hydrated stamp matched the row's updated_at fallback.
A later stream.updated bump of updated_at then re-keyed the row from the
drift instead of the known message timestamp. Record the stamp whenever a
live row owns the pointer; announcement semantics unchanged (streamsChanged
only when the projected order actually moves).

Repro: sidebarPreviewHydrationKeepsEqualFallbackStampAgainstDrift (RED before
the fix: the drifted row jumped above the genuinely newer peer).
… catalog seed

exordy finding on PR #866 (medium): the row-preview catalog seed includes the
inbox slot topics of inactive streams, but both announce scans (the disk pump
affectsRow check and announceRowPreviewRows) only consulted m_streams and
m_topics. A memo completing an inbox-topic preview stored fine but never
announced previewChanged, so the bound row stayed blank forever.

Reproduced RED first (hydratedInboxTopicPreviewAnnouncesRevision: memo text
resolves while previewChanged stays silent), fixed by scanning m_inboxTopics
in both seams. Full sidebar suite green 148/148.
…ting the list

Finding 2 on PR #866: a hydrated preview stamp that re-ranked its row reset the
sidebar ListView model (whole QVariantList reassignment), destroying the
delegate under the user and losing focus. Introduce a move-aware sidebar model
(NativeSidebarStreamListModel) that diffs the projection into granular
inserted/removed/moved/dataChanged deltas, and carry keyboard focus across the
re-parent the view performs on a row move, so the moved row keeps focus like
the reference's keyed DOM row. The acceptance case
sidebarHydrationReorderKeepsActiveSidebarDelegates pins delegate identity,
order swap and focus survival; search-filter cases get the one-pass settle
that granular row removal takes (the reference DOM filter takes a render tick).
The move pass indexed the raw target list while new keys were still
missing, so a projection that inserted a row in front of survivors that
simultaneously re-rank ([A, B] -> [X, B, A]) left the survivors
unordered: the insertion pass then duplicated B and the content pass
read past the projection (deterministic SIGSEGV, reproduced by the new
acceptance case before the fix).

Build the survivor order (the target restricted to keys that already
exist), selection-sort the current rows against it, and only then run
the insertion pass - with survivors already in target order, every
position mismatch is exactly one new key.

Pins: sidebarModelOrdersSurvivorsBeforeInsertingNewRows
(native-controller-sidebar-test). Verified green: full sidebar group
149/149, hydration window cases, search family 26/26.
The fix-round-1 window case sidebarHydrationReorderKeepsActiveSidebarDelegates
had no recorded timing fragment, so native-window-buckets-sync failed in CI.
Measured solo (1.5 s on WM'd display) and regenerated the bucket layout.
…anular moves

Pre-tag gate triage on this lane:
- mediaViewerBackdropClick.../mediaViewerVideoControlsAutoHide... went red on
  CI shards and reproduced run-1-only locally: the stream/topic delegate is
  mid-recreation when the opening click resolves (preview-pump re-rank churn).
  Opening clicks now gate on a re-fetched delegate and resolve the click
  target through clickCurrentItem after the readiness wait.
- sidebarSearchArrowsCycleFilteredResults: the same-tick negative pins read
  one layout pass too early under granular rowsRemoved (delegates dispose one
  view pass later than the whole-list reassignment they replaced). Relaxed to
  QTRY_VERIFY per the documented granular-move recipe.

Refs #860
The network backoff and the late-disk retry captured only the uuid and
checked authentication at fire time, so an account swap during the
sleep could replay the previous session's uuid lookup under the new
owner and origin. Both timers now capture the session generation (the
retirement seam introduced in PR #292) plus the dispatch-time owner and
return when either moved. Pinned by
sidebarPreviewNetRetryIsFencedToItsSession (red before the fence:
second dispatch under the new owner).
The carry armed at rowsAboutToBeMoved re-aimed bubbled focus onto the
pre-move item for as long as it stood, and nothing disarmed it once the
move had completed - a later focus navigation could be forced back to
the old row. The carry now expires 500 ms after the last restore pass:
multi-pass relayout churn keeps it alive, a settled move releases it.
Pinned by sidebarMoveFocusCarryExpiresAfterSettle (buckets regenerated
for the new window case).
…window

exordy round 2 (thread 4708526165): focus must not be stolen during the
500 ms after a row move. Measured: the carry re-aim only fires for
delegate-ROOT landings, which production produces only via Qt's own
reparent fallback (the ring and clicks target the row button), and the
churn restores land more than once - so the carry cannot be cleared on
'restore complete' without regressing finding 2. Instead, real user
input inside the settle window (row click, search keyboard ring, wheel)
now cancels the carry outright via streamList.disarmFocusCarry(), and
the new window case pins: button-seam navigation sticks with the carry
armed, a click cancels it synchronously, and a later root-level focus
move sticks past the window. Solo witness: RED on the disarm assert
before the QML change, green x3 after.
@cassi-volkova
cassi-volkova force-pushed the cassi/sidebar-preview-hydration-860 branch from cf53bb8 to 6e26adc Compare November 26, 2026 17:48
@cassi-volkova
cassi-volkova merged commit 8ca11ee into master Nov 26, 2026
19 checks passed
cassi-volkova added a commit that referenced this pull request Nov 26, 2026
… retryable

#866 review round (exordy findings 1/3 and 2):

- The network stage started up to 8 lookups per pump pass and rescheduled
  itself immediately while pending work remained, so a large catalog
  dispatched every unresolved uuid before any reply landed: the batch
  bounded a per-pass start rate, not the total in-flight count. The pump
  now dispatches only into free slots (batch - in-flight) and the pending
  queue is resumed by the completion handler as replies retire their
  slots. The eager self-reschedule is gone.
- A transient failure that exhausts the retry budget no longer stores a
  sticky negative memo. Catalog seeding skips memoized uuids, so the
  sticky empty preview could never recover after the server came back.
  The row keeps the reference empty preview and a later catalog accept
  offers one fresh trial.

Test-first (RED witnesses on the pre-fix build):
- sidebarPreviewNetworkStageCapsTotalInFlight: RED showed
  rowPreviewNetworkIssuedForTest()==12 vs the expected 8 (client-side
  seam because the mock's HTTP/1 pool masks server-side over-dispatch);
  GREEN asserts the cap and drains all 12 previews through it, proving
  the completion-driven resume.
- sidebarPreviewRecoversAfterTransientFailureBudget: RED showed no 4th
  attempt after budget exhaustion (memo blocked the re-seed); GREEN
  recovers after refresh() once the server flips back.

Groups: native-controller-sidebar 139/139 green (was 137, +2 new cases).
cassi-volkova added a commit that referenced this pull request Nov 26, 2026
… rows hydrate first

#866 review round 3:
- finding 1: every disk/network preview request now carries a token and only
  the request that still owns the uuid's marker may retire it, so a late reply
  can never free a newer request's in-flight slot (session resets clear the
  queues and tokens together). Reproduction attempt: the client aborts
  retired-session requests at the session switch, so the stale-reply premise
  is already neutralized at the transport layer; the token guard is kept as
  defense-in-depth and the test pins the marker-retention contract.
- finding 2: the pumps consume a priority-ordered queue instead of QSet value
  order: the open route first, then expanded sidebar streams (live state,
  re-evaluated at every slot hand-off), then the collapsed remainder. Each
  pointer knows its owning stream via the seed-time ownership map.
- finding 3 (delegate-recreation under hydration) is acknowledged and needs a
  narrow preview-revision projection design; it lands as a separate follow-up
  in this lane.
@cassi-volkova
cassi-volkova deleted the cassi/sidebar-preview-hydration-860 branch November 26, 2026 19:06
cassi-volkova added a commit that referenced this pull request Nov 26, 2026
… row

Finding 3 (PR #866) acceptance case: with network preview hydration ENABLED
(the production shape the window harness previously had to pin off in
e326bc5), a held uuid lookup reply lands while a sidebar row holds keyboard
focus. The focused row must survive as the same item instance at the same
scene position with focus intact, the list offset must not move, and the
click target must still select its stream - while the preview text itself
flips through the previewRevision projection.

Witness: the identical case FAILS on the parent shape ecd82cc ('A network
preview arrival must not re-incubate the focused sidebar row' - the delegate
is destroyed by the old streamsChanged announcement) and PASSES green solo
at this head (single-case run 3.70 s, window-test buckets regenerated).
cassi-volkova added a commit that referenced this pull request Nov 26, 2026
exordy finding on PR #866: the preview pumps recorded the memo but left the
learned created stamp out of the activity ledger, so a row whose true
last-message timestamp differed from its updated_at fallback never moved.
Record the stamp from both pumps and announce a coalesced streamsChanged
only when the projected order actually moves - a preview arrival that
reorders nothing keeps the preview-only announcement (pinned by
previewArrivalAnnouncesRevisionWithoutProjectionRebuild).
cassi-volkova added a commit that referenced this pull request Nov 26, 2026
exordy finding 4704344635 on PR #866: the round-1 keyMoves guard skipped the
ledger write when the hydrated stamp matched the row's updated_at fallback.
A later stream.updated bump of updated_at then re-keyed the row from the
drift instead of the known message timestamp. Record the stamp whenever a
live row owns the pointer; announcement semantics unchanged (streamsChanged
only when the projected order actually moves).

Repro: sidebarPreviewHydrationKeepsEqualFallbackStampAgainstDrift (RED before
the fix: the drifted row jumped above the genuinely newer peer).
cassi-volkova added a commit that referenced this pull request Nov 26, 2026
… catalog seed

exordy finding on PR #866 (medium): the row-preview catalog seed includes the
inbox slot topics of inactive streams, but both announce scans (the disk pump
affectsRow check and announceRowPreviewRows) only consulted m_streams and
m_topics. A memo completing an inbox-topic preview stored fine but never
announced previewChanged, so the bound row stayed blank forever.

Reproduced RED first (hydratedInboxTopicPreviewAnnouncesRevision: memo text
resolves while previewChanged stays silent), fixed by scanning m_inboxTopics
in both seams. Full sidebar suite green 148/148.
cassi-volkova added a commit that referenced this pull request Nov 26, 2026
…ting the list

Finding 2 on PR #866: a hydrated preview stamp that re-ranked its row reset the
sidebar ListView model (whole QVariantList reassignment), destroying the
delegate under the user and losing focus. Introduce a move-aware sidebar model
(NativeSidebarStreamListModel) that diffs the projection into granular
inserted/removed/moved/dataChanged deltas, and carry keyboard focus across the
re-parent the view performs on a row move, so the moved row keeps focus like
the reference's keyed DOM row. The acceptance case
sidebarHydrationReorderKeepsActiveSidebarDelegates pins delegate identity,
order swap and focus survival; search-filter cases get the one-pass settle
that granular row removal takes (the reference DOM filter takes a render tick).
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.

2 participants