fix: keep customer content out of loguru message formatting during index retries - #1216
Merged
Conversation
Signed-off-by: phernandez <paul@basicmachines.co>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Index retry jobs can reach Loguru with customer-derived note paths already interpolated into the
message template. When a path contains literal braces such as
{AG}, Loguru treats the customertext as a formatting field and raises
KeyError, preventing the note from indexing across everyidentical job attempt.
Closes #1212
What Changed
two audited indexing modules
regressions
Implementation Details
The log messages now use static templates and provide paths as positional arguments, which Loguru
formats once without interpreting braces inside the argument value. Existing structured context
such as entity IDs, checksums, operations, and graph counts remains attached to each record. This
is intentionally a call-site fix rather than a logging wrapper or content sanitizer.
Testing
Automated
uv run pytest tests/indexing/test_file_indexer.py tests/index/test_local_markdown_file_indexer.py -q: 12 passedjust fast-check: passed (Ruff fix/format andtytypecheck)just fast-test: 5,116 passed, 41 skippedjust doctor: passedManual
notes/{AG}.mdrendered,while the interpolated success template raised
KeyError: 'AG'Risks / Follow-ups
The change affects logging argument construction only; indexing control flow and persisted data are
unchanged. Production should be monitored for recurrence of the two Logfire issue cohorts cited in
#1212 after deployment.