fix(core): refresh pending relations from accepted content - #1161
Merged
Conversation
Signed-off-by: phernandez <paul@basicmachines.co>
8 tasks
14 tasks
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
An accepted
write_notecan schedule relation resolution before its Markdownprojection has been materialized. Relation resolution then refreshes affected
source search rows through a disk-backed path and raises
FileNotFoundErrorduring a valid accepted-but-pending state.
This fixes #1159 without moving materialization back onto the request path, so
durable write acceptance keeps its current performance characteristics.
What Changed
NoteContentalongside source entities after relation targetsare resolved.
path so genuine missing-file inconsistencies still surface.
NoteContentRepositoryinstances into every shared andlocal relation-resolution composition root.
boundary.
Implementation Details
RepositoryRelationResolutionRuntimeperforms one additional batchNoteContentlookup only when relation resolution changed source entities.Rows whose
file_write_statusis notsyncedare converted throughaccepted_search_content_from_markdown()and passed toSearchService.index_entities()as an explicit per-entity content mapping.An entity absent from that mapping keeps the existing
content=Nonebehavior,which reads the Markdown projection from disk. This avoids broadly swallowing
FileNotFoundErrorand preserves detection of real projection inconsistencies.Materialization remains asynchronous and off the acceptance path.
Testing
Automated
source .venv/bin/activate && just fast-check: passed; reported nine existingPython 3.14 asyncio deprecation warnings.
source .venv/bin/activate && BASIC_MEMORY_ENV=test LOGFIRE_IGNORE_NO_CONFIG=1 pytest -q tests/index/test_local_project_index.py:44 passed.
source .venv/bin/activate && BASIC_MEMORY_ENV=test LOGFIRE_IGNORE_NO_CONFIG=1 pytest -q tests/indexing/test_relation_resolution.py tests/services/test_project_service_composition.py tests/index/test_local_schedulers.py:30 passed.
just doctor: passed the end-to-end file, database, and search loop.git diff --check: passed.Manual
file did not yet exist.
relation metadata while preserving the synchronized-source missing-file
failure.
Risks / Follow-ups
NoteContentread only whenrelations changed.
lifecycle coverage; it does not need duplicate production policy.
SQLite/Postgres matrix.