Skip to content

perf(web): share reactive bff state and reduce desktop requests - #847

Merged
nixuuu merged 1 commit into
devfrom
fix/desktop-app-issues
Nov 15, 2026
Merged

nixuuu merged 1 commit into
devfrom
fix/desktop-app-issues

Conversation

@nixuuu

@nixuuu nixuuu commented Nov 15, 2026

Copy link
Copy Markdown
Member

Change

Running many threads made each renderer fetch background history and repeatedly reload panels and PR lists. The BFF now materializes overview, thread metadata and settings from one owner/target-scoped WatchOverview, shares loaded read models and pushes complete projections over SSE. Ready-key lookup is O(1); response encoding and list traversal still scale with response size.

  • Move bounded history warming to the BFF and remove renderer /warm requests and panel/PR polling. Visible history and older pages remain on demand.
  • Share and reactively refresh panels, PR lists, proxies, model catalogs, bots and updates. Bound caches/queues and fence old results across reconnects, sharing resets and target changes.
  • Allow independent diagnostics sessions with browser/BFF submission cooldown, accept GitHub avatar version hashes, and keep infinite decorative animations out of composer transition controls.
  • Update the affected Polish architecture, API, performance, diagnostics, connector and GitHub docs.

Verification

  • After rebasing onto current dev: 17 real-gRPC BFF integration tests / 100 assertions passed through check:tmp; temporary directory clean. Web and integration-package typechecks and test-shard ownership check passed.
  • Earlier focused checks passed for diagnostics, avatars/panels, shared-query invalidation/projection races, gateway/mobile/domain typechecks, and edited-file lint/formatting.
  • Inspected light/dark at desktop and phone widths. Reconnect recovery and rapid thread navigation worked without page errors.
  • Isolated browser probe with 12 synthetic thread submissions: the observed renderer issued 3 HTTP requests over 12.1 seconds, with no /warm, panel or PR-list requests. This is a synthetic sample, not a production percentile.
  • No user-facing copy changed. Full generated-code checks, repository-wide checks, remaining test shards and builds are left to CI.

Fixes: #623
Fixes: #569
Fixes: #756

Materialize overview, thread metadata and settings through one shared
owner-scoped gateway stream. Push loaded read models over SSE, share
bounded history warming in the BFF and remove renderer polling.

Fence reconnects, sharing resets and target changes against stale private
results. Allow independent diagnostics sessions with submission cooldown,
accept GitHub avatar version hashes and isolate composer transitions from
infinite decorative animations.

Fixes: #623
Fixes: #569
Fixes: #756
@nixuuu
nixuuu enabled auto-merge (squash) November 15, 2026 19:09
@nixuuu
nixuuu merged commit e16d931 into dev Nov 15, 2026
11 checks passed
@nixuuu
nixuuu deleted the fix/desktop-app-issues branch November 15, 2026 19:22
nixuuu added a commit that referenced this pull request Nov 16, 2026
Keep overview availability during planned subscription replacements, retain the outgoing composer draft through teardown, and make feed wheel handling passive.

Fixes: #847
nixuuu added a commit that referenced this pull request Nov 16, 2026
## Change

Switching threads replaced the overview subscription and briefly showed
“Reconnecting…” even when the gateway was healthy. Keep the last
availability status until the replacement receives a snapshot or
actually fails; real outages and the existing timeout still work.

Keep the outgoing composer's selected draft in raw state through feed
teardown so draft persistence does not read an inert derived. Make the
feed's wheel listener passive and update the UI API documentation.

Fixes: #847

## Verification

- Web package typecheck: 0 errors and 0 warnings.
- Lint and formatting of all three edited code files; diff/content
review of the documentation.
- Chromium with controlled API data: 20 thread switches across
desktop/phone widths and light/dark themes, with no console warnings or
errors and a steady Connected status. Also checked navigation after
opening a sidebar hover card.
- Typed draft survives switching away and back; wheel scrolling moves
the feed normally.
- Slow replacement stays connected; actual loss becomes
reconnecting/unavailable; navigation preserves unavailable; manual retry
recovers; a replacement without a snapshot reaches the existing timeout.
- UI copy audit: not applicable; no UI text changed.

Full repository checks, integration tests and builds are left to CI.
nixuuu added a commit that referenced this pull request Nov 18, 2026
…gs (#986)

## Nightly.75 console report

- Reproduced the `actorAvatars` exception and `derived_inert` warnings
by invalidating avatar reads just before a PR snapshot reset. Scheduled
refreshes now use a mounted subscriber, and a later explicit read uses
its own fetch function.
- Preserve the saved timeline anchor through a slow initial snapshot.
Start the positioning deadline once data arrives and compare watch
liveness against loaded history. Routine history paging still
contributes to the diagnostics counter. Actionable recovery warnings
keep their reason.
- Open a cold thread through the owner-scoped GetThread RPC while the
overview stream is rebuilding. Skip Git scans for unavailable
placements. Report busy, missing, oversized and timed-out checkouts in
the panel, retain the last successful counts on a transient scan
failure, and cancel an abandoned shared HTTP request when its last
reader leaves.
- Skip idle web, desktop and BFF diagnostics submissions. Reserve
admission and checkpoint space for active sessions within the existing 6
MiB budget. A frozen minute carries its checkpoints even if RPC load
exhausted the space for its metric series.

The screenshots omit response bodies and the expanded recovery objects.
The tests cover concrete paths to the reported statuses. Genuine
connectivity and rate limits still surface.

## Local verification

- Focused shared-query, overview invalidation, BFF state and reads, Git
status, thread history/watch, client diagnostics and persistence tests.
Gateway, domain and web typechecks passed. Lint and formatting checked
on edited files. Full gate runs in CI.
- Chromium at 1280 and 390 px, light and dark. PR reset and avatar
reload produced no exception or Svelte warning after the fix. In a
1000-turn thread, a 2.25 s initial snapshot delay restored an 8 px
scroll offset. A real checkout reported its changed file, and a removed
worktree issued no Git request. Desktop rapid navigation cancelled the
in-flight request. At phone width in both themes, closing thread details
and navigating to the removed worktree started one Git read, cancelled
it once and issued no further Git request.

## Copy audit

Reviewed all ten items in docs/copy.md §8. Generic Git refresh failures
now identify the missing directory, busy checkout, size limit or timeout
and give a recovery action. Directory terminology matches the glossary.
Short, typical and long names were checked at desktop and phone widths.
All items pass or are inapplicable.

Fixes: #456
Fixes: #569
Fixes: #672
Fixes: #799
Fixes: #847
Fixes: #900
nixuuu added a commit that referenced this pull request Nov 19, 2026
## Change

A cached pull request read could publish thread and overview updates for
every linked thread in its repository. Selecting another active thread
could also restart the shared overview twice and fetch two full
snapshots. A slow overview subscriber could then reach its 256-frame
limit while little data was queued.

- Scope PR updates to active links for that owner and PR. Repair stale
projections on cache hits. Re-read under the thread row lock so a
concurrent unlink cannot restore a removed link in the sidebar. Refresh
open lists when an older PR changes.
- Send changed bot summaries and preserve pending approvals and
execution state across partial bot replies. Limit the project updates
generated by worker status reports while keeping workspace origin and
scratch placement discovery.
- Keep the upstream overview open for a 500 ms renderer handover and
replay authorized head cursors to the new subscriber.
- Compact a slow overview queue only at its existing item or byte limit.
Keep ordering around state transitions and controls. An irreducible
queue still reports DataLoss and can recover from a new snapshot.

Migration 0177 initializes a per-link summary fingerprint for current
active links. It keeps concurrent readers of the same PR from increasing
a thread’s list revision repeatedly.

## Verification

An isolated repository with 439 linked threads, including five linked to
the measured PR, reproduced the fan-out. One warm GetPullRequest made
439 projection calls, read 439 thread rows and produced 878 hub
publications before the change. Each count fell to zero, with the same
PR returned and no GitHub HTTP request in either run. One local RPC took
247.7 ms before and 6.7 ms after.

On the original gateway a two-thread burst of 300 worker events
terminated the stalled overview with DataLoss. The fixed gateway
delivered both final states, persisted all 300 events in order and
replayed both completed responses from pre-burst checkpoints. Separate
cases exercise item and byte overflow with nonreplaceable frames, and
delivery to a healthy observer.

Five renderer handovers with the same subscriptions produced ten
additional snapshots before and zero after. Real PostgreSQL and gRPC
integration coverage exercises independent PRs in the same repository,
shared links, concurrent unlink, older PRs, cache repair, account
changes, bot feeds, disconnection, worker replay and lost
acknowledgements.

With five projects and 16 status reports, the original gateway published
80 project frames. The fixed gateway published zero, issued zero project
list queries and delivered all 16 worker updates. The same suite
verifies changed Git origins, retry after a failed read and a new
worker’s scratch placement.

Production renderer in Chromium, isolated gateway, BFF and PostgreSQL.
Seven bot conversation switches opened no additional overview SSE. A
pending approval survived navigation and reload and sent exactly one
worker response. Checked light and dark at desktop and phone widths.

Fixes: #501
Fixes: #847
Fixes: #458
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