Skip to content

fix: include live Chrome history in SQLite snapshots - #419

Open
Iams4kura wants to merge 1 commit into
StarTrail-org:mainfrom
Iams4kura:bugfix/include-live-chrome-history-20260921t061217z
Open

Iams4kura wants to merge 1 commit into
StarTrail-org:mainfrom
Iams4kura:bugfix/include-live-chrome-history-20260921t061217z

Conversation

@Iams4kura

Copy link
Copy Markdown
Contributor

What does this PR do?

Chrome can commit new history rows to its SQLite write-ahead log before checkpointing them into the main History file. ChromeHistoryReader copied only that main file, so indexing a live profile could silently omit recent pages.

This replaces the main-file copy with SQLite's online backup API. The reader now snapshots a consistent view of both the main database and committed WAL content into memory, keeps the browser database read-only, and closes both connections on every path.

Regression evidence

  • Before: uv run --no-project --offline --with pytest pytest tests/test_chrome_history_reader.py -q exited 1; the reader returned zero documents while the committed recent row remained in the WAL.
  • After: the same command exited 0 and returned the recent page.

Verification

  • uv run --no-project --offline --with pytest pytest tests/test_chrome_history_reader.py -q
  • uvx --from 'ruff==0.12.7' ruff check packages/leann-core/src/leann/readers.py tests/test_chrome_history_reader.py
  • uvx --from 'ruff==0.12.7' ruff format --check packages/leann-core/src/leann/readers.py tests/test_chrome_history_reader.py
  • python3 -m py_compile packages/leann-core/src/leann/readers.py tests/test_chrome_history_reader.py
  • git diff --cached --check

The full dependency environment could not be synchronized locally because repeated PyPI downloads timed out; the deterministic reader regression and all changed-file checks above completed successfully.

Related Issues

No existing issue or pull request matched this failure after searches for ChromeHistoryReader, the legacy temporary filename, browser-history WAL handling, and SQLite backup behavior.

Checklist

  • Focused regression test passes
  • Code formatted (ruff format --check)
  • Changed files pass lint (ruff check)
  • Full pre-commit suite (pre-commit run --all-files) — dependency downloads timed out; equivalent changed-file Ruff and diff checks pass

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