Skip to content

Live-reload (auto-update) for binary document previews#15

Closed
exilis wants to merge 20 commits into
masterfrom
feat/binary-doc-live-reload
Closed

Live-reload (auto-update) for binary document previews#15
exilis wants to merge 20 commits into
masterfrom
feat/binary-doc-live-reload

Conversation

@exilis

@exilis exilis commented Jun 26, 2026

Copy link
Copy Markdown
Owner

Summary

  • PDF/DOCX/XLSX/PPTX previews now auto-update when the file changes on disk, mirroring markdown live-reload. Active tab re-renders (debounced); background tabs show the updated dot and re-render lazily on activation.
  • PDF/DOCX/XLSX render off-screen and swap in — no flicker, and a half-written file that fails to parse leaves the previous preview intact. PPTX re-renders in place. Scroll position is best-effort preserved (proportional).
  • New pure module web/binreload.js holds all testable logic (debounce scheduler, change routing, scroll math, seq-guarded refresh); web/app.js is thin wiring. Embedded via //go:embed.
  • Backend fix: the fsnotify watcher gated change events on isMarkdown, so binary docs never emitted one — the frontend would have been dead end-to-end. Changed to isViewable (markdown + the four binary formats).
  • Delete handling: deleting an open document now shows the "this file no longer exists" state instead of a stale preview. This was previously broken for all file types (deletion emits only a directory-tree event, never a change event); the open tab is now re-checked when its directory listing refreshes.

End-to-end tests (Playwright)

Added browser E2E (web/e2e/) that drives a real reefdoc server in headless Chromium and verifies the live-reload pipeline end-to-end. The CDN PDF viewer is stubbed so tests run offline/deterministically. Three scenarios: active auto-update, background updated-dot + lazy render, delete→missing-state. Wired into CI as a third job; run locally with npm run e2e.

The delete→missing-state E2E caught a real gap the unit tests structurally couldn't: deletion produces no change event, so the original "missing on 404" handling never fired on actual deletion. That's now fixed (see Delete handling above).

Design & plan

  • Spec: docs/specs/2026-06-26-binary-doc-live-reload-design.md
  • Plan: docs/plans/2026-06-26-binary-doc-live-reload.md

Test Plan

  • go test -race ./... — all packages pass (incl. non-vacuous watcher test for a .pdf change event)
  • node --test — 87 passing, 0 failures (debounce, routing, scroll math, abort/seq-guard, off-screen leak cleanup, never-reject, PPTX in-place, dirOf/vanishedTabs)
  • npm run e2e — 3/3 Playwright tests pass (active auto-update, background dot, delete→missing); verified non-vacuous (each fails without its fix)
  • gofmt clean, go vet clean, build OK

exilis added 20 commits June 26, 2026 17:24
Drives a real reefdoc server in headless Chromium to verify the live-reload
pipeline end-to-end (active auto-update, background updated-dot, delete ->
missing state). Stubs the CDN PDF viewer so tests run offline. Adds an e2e CI
job and an npm run e2e script.
@exilis

exilis commented Jun 26, 2026

Copy link
Copy Markdown
Owner Author

Superseded by #17. PR #15 was opened before the document-download feature landed on master, which introduced conflicts (both features added a Playwright config, a CI e2e job, and touched package.json/.gitignore/README/CHANGELOG/web/app.js).

#17 merges this branch onto current master with those conflicts resolved — your feature commits keep their original authorship (it's a merge commit, not a rewrite). The two Playwright suites now share one config (testMatch: '**/*.{e2e,spec}.js') and one CI job; all 8 E2E tests (5 download + 3 binary-live-reload) and 90 unit tests pass on the merged tree.

Suggest reviewing #17 and closing this one once you're happy with the resolution.

@exilis exilis closed this in #17 Jun 26, 2026
exilis added a commit that referenced this pull request Jun 26, 2026
…nt previews (#17, supersedes #15)

Binary document live-reload (PDF/DOCX/XLSX/PPTX auto-update on disk change) by Yuki Hayashi, conflict-resolved onto master after document-download landed. Reconciles the two Playwright E2E setups into one shared config + CI job. All tests green (go -race, 90 unit, 8 E2E).
@exilis exilis deleted the feat/binary-doc-live-reload branch June 26, 2026 23:00
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