Skip to content

Improve history storage, full text search, and processing limits - #8

Merged
nklmilojevic merged 3 commits into
mainfrom
improve/history-performance-and-storage
Sep 6, 2026
Merged

nklmilojevic merged 3 commits into
mainfrom
improve/history-performance-and-storage

Conversation

@nklmilojevic

@nklmilojevic nklmilojevic commented Sep 6, 2026 •

Copy link
Copy Markdown
Owner

History operations could leave the displayed list out of sync after a failed save. Repeated copies could stay in the wrong position, and search skipped text beyond the title. This change makes each history operation use one save with rollback, preserves duplicate identity, and searches full text without the fixed delay.

  • Separate history operations, content processing, image work, and popup state. Move hashing, text extraction, image reads, and search to worker tasks.
  • Add a 512 MiB default history data limit, a 32 MiB preview cache, two OCR workers, and task cancellation. Keep pinned items and show storage errors in the popup. Reject edits, OCR updates, and pin removal before changes start if retention would delete the affected item.
  • Add compact view, an adjustable divider, and a full text action for previews longer than 5,000 characters.
  • Migrate existing text metadata and repair orphaned content. Use local HTML parsing through SwiftSoup.
  • Remove the automated UI test target and files. Isolate unit tests from the system pasteboard and app preferences.
  • Commit package versions and run unit tests on pull requests and before release tagging. Pin the new check workflow actions to verified commit IDs. Document the services and performance checks.

Validation: all 107 unit tests passed with locked package versions on macOS 26.6.2, arm64. Tests include failed saves, duplicate order, full text search, old-schema migration, external file deletion, cache limits, OCR cancellation, and rejection of updates that would delete their target. The unsigned Release build passed before the retention review fixes; those fixes were built and tested in Debug.

The exact-search fixture gave median times of 6.9 ms for 200 documents and 33.5 ms for 999 documents, across ten Debug measurements. Each document has about 6,000 characters. These figures exclude fixture creation and UI rendering.

Manual popup, image navigation memory, and idle CPU measurements are still required. The new controls have not had a manual visual check. SwiftData saves remain on the main actor. The byte limit covers stored content and search text; SQLite files and indexes can use additional space. New UI text uses English fallback until translations are added. Runtime checks on macOS 14 are not included in this local run.

@greptile-apps

greptile-apps Bot commented Sep 6, 2026 •

Copy link
Copy Markdown

Greptile Summary

The PR restructures clipboard-history persistence and processing while adding bounded storage, full-text search, background image work, migration repair, and expanded unit-test automation.

  • Introduces transactional history operations with rollback and target-retention checks.
  • Adds full-text metadata processing, storage and preview limits, OCR concurrency, and cancellation.
  • Updates popup presentation, detail previews, settings, migrations, CI, release validation, and architecture documentation.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
Lodge/HistoryService.swift Adds transactional history operations, prospective retention validation, pruning, and rollback-aware update handling; the previously reported target-pruning paths are guarded.
Lodge/Storage.swift Implements repository transactions and restoration of cached model values after failed saves.
Lodge/ContentProcessor.swift Moves hashing and searchable-text extraction into isolated processing work.
Lodge/ImageProcessingService.swift Adds bounded preview caching, limited OCR concurrency, and cancellation-aware image processing.
Lodge/Search.swift Extends search to processed full text and removes the fixed scheduling delay.
.github/workflows/check.yml Adds locked-package unit-test CI and pins the previously reported action dependencies to immutable commits.
.github/workflows/release.yml Adds unit tests before release mutation while preserving the existing release, signing, and publication flow.

Sequence Diagram

sequenceDiagram
  participant C as Clipboard
  participant P as ContentProcessor
  participant H as HistoryService
  participant R as HistoryRepository
  participant UI as History/UI
  C->>P: Submit clipboard snapshot
  P-->>H: Processed content and search text
  H->>H: Apply duplicate and retention rules
  H->>R: Execute one transaction
  alt Save succeeds
    R-->>H: Committed items
    H-->>UI: Publish updated history
  else Save fails
    R->>R: Roll back changes
    R-->>H: Storage error
    H-->>UI: Preserve prior history and report error
  end
Loading

Reviews (3): Last reviewed commit: "Keep history items when unpinning exceed..." | Re-trigger Greptile

Comment thread Lodge/HistoryService.swift Outdated
Comment thread .github/workflows/check.yml Outdated
Comment thread Lodge/HistoryService.swift
@greptile-apps

greptile-apps Bot commented Sep 6, 2026

Copy link
Copy Markdown

Want your agent to iterate on Greptile's feedback? Try greploops.

@nklmilojevic
nklmilojevic merged commit c62ae8e into main Sep 6, 2026
2 checks passed
@nklmilojevic
nklmilojevic deleted the improve/history-performance-and-storage branch September 6, 2026 11:43
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