Skip to content

feat(native): extend revisioned media to prose and file previews - #195

Merged
rynfar merged 4 commits into
nativefrom
nw/187-chat-media
Nov 4, 2026
Merged

rynfar merged 4 commits into
nativefrom
nw/187-chat-media

Conversation

@rynfar

@rynfar rynfar commented Nov 4, 2026 •

Copy link
Copy Markdown
Owner

Native chat images embedded in prose bypassed the signed media cache, and rendered Markdown file previews could not resolve images beside the document. This routes direct paragraph images through #186’s bounded revision cache, gives previews their own image base directory and workspace mutation scope, and invalidates an already-open image file on the first null-to-non-null mutation.

Each media block uses its document entity and stable source position for its complete GPUI namespace, including prose states and image consumers. Surrounding prose retains document reference definitions, native Markdown styles, and the existing HTTP/HTTPS/mailto link policy. Six actual GPUI prose entities each retain one source in the multi-paragraph capture.

The idle trace identified a separate native cache-boundary problem: TextView registers selection during paint, while cached transcript/file scenes skip that paint. The root selection layer then sweeps those registrations, clears selection, and notifies TextViews. The transcript and files panel now paint selectable content on each drawn frame; transcript list virtualization remains in place. No framework/dependency edits, selection disabling, notification filtering, animation requests, or new timers were added.

Markdown image I/O begins in clipped prepaint. Visible consumers protect their decodes; loads and inactive decodes are released or evicted independently of transcript renders. Blocking decode workers retain semaphore permits after caller cancellation. The shared timer uses each visible resource’s thirty-minute deadline, keeps five-minute staleness for remounts, and cancels when the last consumer leaves. An already-issued shared signing RPC may finish after unmount in the bounded revision cache; it cannot arm a timer without a consumer.

Local-media fallback follows web’s eligible absolute paths and missing-host error tags. The ClientHandle transport test exercises primary/fallback requests, local-origin URL resolution, optional revision/expiry metadata, and unknown-error decoding. Native presents failures with its existing generic unavailable state. The scaled non-playing video frame offers Open original / Open in browser.

Actual idle evidence replaces the earlier incomparable layout/creation counters. Compiler coverage measures the same pinned TextViewState::Render::render, parse, and selection callbacks for media and control; GPUI’s frame collector counts actual Window::draw calls. Before the cache-boundary fix, each media sample executed fourteen stale-selection clears and fourteen renders; selection was lost. Afterward, stale clears and TextView notifications are zero, and selection persists. The full client still renders for its composer caret (two actual window draws per sample), with no extra selection-driven draws. A document-only fixture using the same MarkdownStore and renderer creates no input timer: media and plain control each record three successive samples with zero actual TextView renders, zero window draws, zero parse updates, and retained selection. Appending a fourth media paragraph and changing font size also settles at zero. Compiler coverage was recorded before rebase; ordinary-build captures on the final head confirm the same draw/notification and selection results.

Remaining gaps: video playback; images nested in links or emphasis; reference-style images; heading, table, and HTML images. These contexts do not yet use the signed, lazy media renderer. TR-MEDIA and TV-STREAM remain partial with #187, which stays open. No server, dependency, web, mobile, or provider changes.

Local evidence (factory instructions prohibit uploads):

  • Actual-boundary trace, source locations, and before/after counts: /private/tmp/native-factory-2f5f764a/evidence-187-idle/idle-proof.json, before-failure.log, boundary-counts.json, document-counts.json, and stream-theme-fixed-counts.json. Matching .profraw and exported .coverage.json files are retained; coverage-rustc, export.py, and assert-idle.py reproduce the checks without editing dependency sources.
  • Before selection loss: /private/tmp/native-factory-2f5f764a/evidence-187-idle/blurred-media.png; after: boundary-media.png, boundary-control.png, document-media.png, and stream-theme-fixed-media.png in that directory.
  • Final ordinary snapshot build captures: head-media.png, head-control.png, head-document-media.png, head-document-control.png, head-relative.png, and head-fallback.png in that directory.
  • Lazy initial loading, scrolling, eviction, and timer cancellation: head-long-initial.json, head-long-scroll.json, head-long-tail.json and matching PNGs in that directory. The fixture uses a 262,144-byte budget; shipping remains 160 MiB.
  • Prior failing-first source-identity, eager-load, core policy/revision, and decode-cancellation regressions remain in /private/tmp/native-factory-2f5f764a/evidence-187-review/ and /private/tmp/native-factory-2f5f764a/evidence-187/.

Rebase-only update onto 0ee81fba11309b40060ed59e9007bfcdbf07ac24: the sole conflict was the parity ledger. All 129 other ledger rows retain their values, including the TR-WORK and ST-GENERAL updates for #188; the two owned rows remain partial with #187. All four non-ledger commit patches are identical, and all 22 implementation/harness source blobs are identical to the previous 9954a37552 head. The combined non-ledger patch is byte-identical. Cargo manifests/lockfiles are unchanged, preserving the prior cache lifecycle, selection, and compiler-coverage evidence. Reproducible proof: /private/tmp/native-factory-2f5f764a/evidence-187-rebase-199/rebase-proof.json, nonledger-range-diff.txt, and verify-rebase.py.

Validation: cargo test --workspace (1,340 passed), workspace/all-target clippy with warnings denied, default app build, snapshot-feature clippy with warnings denied, ordinary snapshot build, theme generation, parity-sync tests, client-runtime conformance generation, and vp run check:changed 0ee81fba11309b40060ed59e9007bfcdbf07ac24. All checks were joined on this rebase; logs are recorded in /private/tmp/native-factory-2f5f764a/evidence-187-rebase-199/verification.json.

All launches were offscreen with copied smoke state and T3_NATIVE_HOME; signed-asset reads used 14658. No servers, paid turns, workspace writes, live data, clipboard, or computer use. A thirty-minute wall-clock refresh, two live environments for local fallback, and a live first mid-turn file rewrite were not exercised; deterministic core and client transport tests cover those decisions.

Built with GPT-6.1 Sol in Codex

This was referenced Nov 4, 2026
@rynfar
rynfar force-pushed the nw/187-chat-media branch 2 times, most recently from bbd9fa8 to 9954a37 Compare November 4, 2026 09:23
@rynfar rynfar changed the title feat(native): extend revisioned chat media feat(native): extend revisioned media to prose and file previews Nov 4, 2026
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