fix: prevent stale markdown preview cache in app://md-preview protoco…#2387
Draft
dushyant-hada-90 wants to merge 5 commits into
Draft
fix: prevent stale markdown preview cache in app://md-preview protoco…#2387dushyant-hada-90 wants to merge 5 commits into
dushyant-hada-90 wants to merge 5 commits into
Conversation
…l handler Add Cache-Control: no-cache, no-store, must-revalidate headers to the app://md-preview protocol handler response so Chromium does not cache the rendered HTML. When the file-backed markdown changes, the chokidar watcher updates the cached HTML in MarkdownHost and emits md:fileChanged; the renderer calls reload(), which re-requests the URL. Without cache prevention headers, Chromium served the stale cached copy instead of re-invoking the protocol handler for the updated HTML.
…mon proxy URL file watching The markdown auto-refresh failed for daemon-proxied URLs because: 1. Chromium cached the app://md-preview response (Cache-Control fix already deployed) 2. Daemon proxy URLs (http://host/api/v1/sessions/<id>/preview/files/<entry>) bypassed chokidar watchers since resolveLocalPath() only handled file:// Fix: - Backend: sessionView() populates WorkspacePath from SessionMetadata - API: SessionView DTO + regenerated OpenAPI spec + TypeScript types - Frontend: workspacePath flows SessionView → BrowserPanel → useBrowserView → preload → markdownHost.render() → resolveLocalPath() - markdown-host.ts: parseDaemonProxyEntry() extracts entry from proxy URL and resolves it against workspacePath with directory traversal guard - Test: removed negative assertion for workspacePath leak (now curated field)
…roaden BrowserPanel path normalization - Replace httpFetch() with native fetch() — simpler, standard, no extra deps - Add tryLocalFile() fallback for UNC/drive-letter paths that fail fileURLToPath - Guard file:// URLs from reaching fetch() to avoid ERR_INVALID_PROTOCOL - Broaden BrowserPanel path normalization to handle UNC (\\host) and Windows drive-letter (C:\) paths - Remove md_implementation.md from git tracking (internal reference doc, not intended for remote)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…l handler
Add Cache-Control: no-cache, no-store, must-revalidate headers to the app://md-preview protocol handler response so Chromium does not cache the rendered HTML. When the file-backed markdown changes, the chokidar watcher updates the cached HTML in MarkdownHost and emits md:fileChanged; the renderer calls reload(), which re-requests the URL. Without cache prevention headers, Chromium served the stale cached copy instead of re-invoking the protocol handler for the updated HTML.