Skip to content

feat(preview): implement audit v4 phase 6 preview architecture - #43

Merged
dhanyyudi merged 4 commits into
mainfrom
audit-v4-phase6-preview-architecture
May 3, 2026
Merged

dhanyyudi merged 4 commits into
mainfrom
audit-v4-phase6-preview-architecture

Conversation

@dhanyyudi

Copy link
Copy Markdown
Owner

Phase 6, Preview architecture

Summary

This PR closes Audit V4 Phase 6 by replacing blob iframe Preview with a Service Worker backed /preview/{token} route, restoring strict main app CSP, and aligning editor plus runtime initial view behavior with the original qgis2web export.

@codex please review this Phase 6 preview architecture work.

Changes

  • public/q2ws-preview-sw.js, add virtual preview asset server with scoped preview CSP, TTL pruning, publish and evict lifecycle, and same origin routed preview assets.
  • public/_headers, remove temporary blob iframe CSP relaxation from the main app after preview no longer depends on blob URLs.
  • src/lib/previewBridge.ts, add publish and evict bridge with MessageChannel readiness handshake.
  • src/lib/runtimePreview.ts, publish exported ZIP entries directly to the preview route instead of rewriting assets into blob documents.
  • src/components/PreviewOverlay.tsx, handle routed preview lifecycle, cleanup, rebuild failure stale state eviction, and runtime tab open flow.
  • src/types/project.ts, src/lib/defaults.ts, src/lib/qgis2webParser.ts, src/components/mapCanvasHooks.ts, src/runtime/runtime.ts, add export-original initial view parity and preserve original center when available.
  • src/components/Inspector/ProjectMapTab.tsx, add Match qgis2web export view reset action.
  • tests/map-render.spec.ts, add Phase 6 coverage for preview route, strict main CSP, export-original bounds parity, and preview reopen stability.

Evidence

  • Build: docs/screenshots/phase-6/npm-run-build-20260503-100734.txt, PASS
  • Smoke fixture: docs/screenshots/phase-6/npm-run-smoke-fixture-20260503-100734.txt, PASS
  • Smoke export: docs/screenshots/phase-6/npm-run-smoke-export-20260503-100734.txt, PASS
  • Playwright Phase 6: docs/screenshots/phase-6/npx-playwright-phase-6-20260503-100734.txt, PASS, 4 passed
  • Editor screenshot: docs/screenshots/phase-6/editor-20260503-100734.png
  • Runtime preview screenshot: docs/screenshots/phase-6/runtime-preview-20260503-100734.png
  • Runtime tab screenshot: docs/screenshots/phase-6/runtime-20260503-100734.png
  • Console log: docs/screenshots/phase-6/console-20260503-100734.txt, 0 errors, 1 imported plugin deprecation warning
  • Network tile log: docs/screenshots/phase-6/network-tile-20260503-100734.json, 36 ArcGIS tile resource entries observed

Parity sweep

  • Default parity: PASS, new projects and imports now default to export-original initial view for qgis2web parity.
  • Legacy migration parity: PASS, imported original bounds stay preserved and fixed mode now prefers original center when present.
  • Export serialization parity: PASS, preview now serves the exported ZIP entries directly through the Service Worker route rather than a special blob rewrite path.
  • Editor versus runtime visual parity: PASS, Playwright verifies original export bounds in both editor and runtime preview.
  • Collision parity: PASS, repeated preview open and close flow stays stable without orphan preview state.
  • Deferred gaps: none in Phase 6 scope.

Notes

  • Preview iframe still keeps allow-same-origin intentionally because the qgis2web runtime and relative asset fetches need same origin behavior under /preview/{token}.
  • Preview scoped CSP now includes unsafe-eval for compatibility with preserved qgis2web measure plugin code. This allowance is limited to Service Worker preview responses, not the main app CSP.
  • Root log updated in ../AGENTS.MD and ../docs/agents/changelog/2026-05.md.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented May 3, 2026

Copy link
Copy Markdown
Contributor

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
q2web-studio ec28d39 Commit Preview URL

Branch Preview URL
May 03 2026, 03:18 AM

@dhanyyudi
dhanyyudi merged commit bab2a9a into main May 3, 2026
2 checks passed
@dhanyyudi
dhanyyudi deleted the audit-v4-phase6-preview-architecture branch May 4, 2026 07:04
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