Skip to content

Extract PDF import persistence#451

Merged
elkimek merged 2 commits into
mainfrom
codex/extract-pdf-import-persistence
May 30, 2026
Merged

Extract PDF import persistence#451
elkimek merged 2 commits into
mainfrom
codex/extract-pdf-import-persistence

Conversation

@elkimek
Copy link
Copy Markdown
Owner

@elkimek elkimek commented May 30, 2026

Summary

  • Add pdf-import-persistence.js for imported-data snapshot/rollback, post-save refresh, and remove/rename entry save flows
  • Keep marker-specific confirmImport logic in pdf-import.js, but route rollback and refresh through the shared helper
  • Preserve legacy pdf-import.js exports/window bindings for settings and existing callers
  • Precache/document the new module and bump app version to 1.8.277

Validation

  • node --check js/pdf-import.js
  • node --check js/pdf-import-persistence.js
  • node tests/test-unit-import.js
  • node tests/test-audit.js
  • node tests/test-correctness-phase2.js
  • node tests/test-image-utils.js
  • node tests/test-v1-6-shipped.js
  • git diff --check
  • ./run-tests.sh

@vercel
Copy link
Copy Markdown

vercel Bot commented May 30, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
get-based Ready Ready Preview, Comment May 30, 2026 12:13pm

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented May 30, 2026

Greptile Summary

This PR extracts the durable import persistence helpers (snapshotImportedData, restoreImportedDataSnapshot, refreshImportedDataViews, removeImportedEntry, renameImportedEntryDate) from pdf-import.js into a new focused module pdf-import-persistence.js, eliminating ~80 lines of duplicate code while preserving all public exports and window bindings via re-exports.

  • New module pdf-import-persistence.js: consolidates snapshot/rollback, post-save UI refresh, remove, and rename flows; the isValidISOCalendarDate helper is correctly kept unexported (module-private).
  • pdf-import.js cleanup: removes the now-redundant private function bodies, imports the shared helpers, and re-exports removeImportedEntry/renameImportedEntryDate for backward compatibility with existing window.* callers; confirmImport and handleBatchPDFs now delegate to refreshImportedDataViews() instead of inlining the three-call sequence.
  • Service worker + tests updated: pdf-import-persistence.js is precached in APP_SHELL and the unit/audit/correctness test suites now resolve removeBlock/renameBlock from persistenceSrc rather than src.

Confidence Score: 5/5

This is a mechanical extraction of ~80 lines from pdf-import.js into a new focused module; all logic, public exports, and window bindings are faithfully preserved with no observable behavioral change.

The refactoring moves code verbatim — snapshot/rollback, refresh, remove, and rename functions are identical to their originals. Imports and re-exports are wired correctly and no logic paths were altered.

No files require special attention.

Important Files Changed

Filename Overview
js/pdf-import-persistence.js New module faithfully reproduces the snapshot/rollback, refresh, remove, and rename logic from pdf-import.js; isValidISOCalendarDate is correctly kept private (no export); all imports are present and used.
js/pdf-import.js Removes ~80 lines of now-extracted functions; imports five symbols from the new module; confirmImport and handleBatchPDFs delegate correctly to refreshImportedDataViews(); re-exports and window bindings preserve backward compatibility.
tests/test-unit-import.js Correctly redirects removeBlock and renameBlock extraction to persistenceSrc; rollback assertion split into two predicates for clarity; all existing assertions still target the right source.
service-worker.js Adds pdf-import-persistence.js to APP_SHELL precache list in the correct position alongside the other pdf-import-* modules.
version.js Version bumped from 1.8.276 to 1.8.277 to bust the service worker cache for the new module.

Reviews (2): Last reviewed commit: "Hide internal import date validator" | Re-trigger Greptile

Comment thread js/pdf-import-persistence.js Outdated
@elkimek elkimek merged commit b3885e7 into main May 30, 2026
5 checks passed
@elkimek elkimek deleted the codex/extract-pdf-import-persistence branch May 30, 2026 12:17
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