Repository navigation
Let a store seed retrieval and flag partial reads - #707
Conversation
|
@hydra-mira-review review |
Mira score 5/5 · 🟢 Good to merge
Stores can supply retrieval candidates and report incomplete graph reads in both SDKs. Retrieval and graph walks expose How this PR works · 6 changes, 4 medium risk, 2 low riskStores that cannot list every entity need another way to seed retrieval and report incomplete edge reads. This PR adds optional store hooks in both SDKs and exposes partial results through 1. Define errors for stores with restricted reads and writes · 🟢 low risk ·
|
|
@hydra-mira-review review |
3 similar comments
|
@hydra-mira-review review |
|
@hydra-mira-review review |
|
@hydra-mira-review review |
There was a problem hiding this comment.
Mira Review Summary
Partial chunk-node reads still crash Python retrieval instead of returning truncated context. Partial entity reads can also produce path steps without an entity in TypeScript, while the corresponding Python path handling raises an exception.
Key Issues
| Issue | Location | |
|---|---|---|
| 🔴 | Partial chunk-node reads still abort retrieval before it can report truncation. | src/selfgraph/retrieval.py:1393 |
| 🔴 | Partial entity batches produce invalid path steps in TypeScript and an exception in Python. | typescript/src/retrieval.ts:2320 |
Signed-off-by: adityamishra-hydradb <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
154ac9b to
aa8da33
Compare
|
@hydra-mira-review review |
1 similar comment
|
@hydra-mira-review review |
Summary
1/5 of #706. A store that cannot list every entity can now seed retrieval with
seed_candidates, and flag a read it cut short withmark_partial.retrieve,neighbors, andfind_paththen reporttruncated. This PR also adds the three error codes the read-only Postgres store raises. Both SDKs.Implementation details
Door:
one-wayNew public error codes (
read_only_store,unsupported_read,graph_unavailable) and a newtruncatedfield on the retrieve and path results.Cleanup:
noneWhat to delete:
Decisions
seed_candidates(ns, terms)is optional and found withgetattr, likeentities_matchingandedge_versions. When a store has it,retrieve,search, and embedding seeds rank only its candidates with BM25. Other stores behave as before._opsdoes not change.mark_partial()lives inretrieval.pyand is for edge reads only: node reads by id must still return every node that exists. It appends to a per-call list in aContextVar(AsyncLocalStoragein TypeScript), so reads insideasyncio.gatherstill reach it.retrieve,neighbors,impact, andfind_pathsettruncatedon their result when a store called it.truncatedis left out of the retrieve and path output when it is false, so the output of every other store stays the same byte for byte.find_pathnow traces the path through the entities both searches reached with the least total distance. Before, it assumed the two searches met at their last levels. That fails when a cut read makes the adjacency one-sided:_traceraisedValueError: min() iterable argument is empty. For complete reads the result is the same as before.readinessreports a store that refuses full scans (unsupported_read) as ready and reachable, with that error and no counts. Before, an agent that calledcheck_readinessfirst was told the graph was unreachable.read_only_store,unsupported_read,graph_unavailable) are in this PR so the error docs and the every-code tests stay in parity in both SDKs. 2/5 and 5/5 replace the helper triggers with real store calls.Validation
tests/test_store_read_hooks.pyand TypeScripttest/storeReadHooks.test.ts, use a wrapper over the Kuzu test store. They cover seeding from candidates,truncatedon each walk result, the omitted field on a complete read, the early-meeting path, and readiness. The path test fails on main with theValueErrorabove.bb99998, B = top of the stack: A 1743 passed, 39 skipped; B 1750 passed, 48 skipped, 0 failed.conformanceGraphwhile Docker builds loaded the machine; the rerun passed.python scripts/precheck.py --base origin/main,make probes,ruff check,ruff format --check:precheck --base origin/main: all checks passed.make probes:plan_apply,secret_echo, andunmerge_orderpass;parity_tablefails the same way on main and on the branch (vitest cannot parse a.scmquery file in this environment).ruff checkandruff format --check: clean.selfgraph-oss136-proof/regression/(local).Limits
check_answerablestill needs every entity and relation, so it raisesunsupported_readon such a store.Linked issue
Closes #706
AI Assistance
Checklist
/approved.AGENTS.md).Breaking changes
None.
_traceno longer takeshops; it is private.🤖 Generated with Claude Code