Graphify: validate query-reader compatibility before reporting search available - #1031
Conversation
…#1029) build/refresh/status/connection-status now run the query's own read_graph over the published generation and report `search` plus a metadata-only `query_reader` verdict beside the lifecycle state. A known provider/reader mismatch (a doc_ref generation meeting a pre-1.5.0 reader, or an unknown type from an unreviewed provider release) reports reader_incompatible with an installed-version/upgrade remediation; unknown node types from the reviewed release still fail closed as unreadable. graph_context reports the same reason and remediation, so status, connection-status and a real query agree. Query summaries now carry generation_completeness and query_completeness separately, so a bounded partial answer stays available while disclosing provider_has_more / unresolved_entities / document_limit. CODE_MOWER_BUILDER:claude Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
| repository = Path(state["repository_root"]) | ||
| report = lifecycle.graph_status(repository, root=root, revision=revision) | ||
| # The query's own read, not the lifecycle's verdict alone: a current, | ||
| # complete generation this reader cannot consume must not be reported as | ||
| # searchable and then fail on the first question asked of it. | ||
| readiness = query.search_readiness(lifecycle.GraphStateRoot(repository, root=root), report) | ||
| verified = state["state"] == "verified" | ||
| search = readiness["search"] if verified else query.SEARCH_UNAVAILABLE | ||
| return {**_summary(state, search=search), "graph": report.shareable_summary(), | ||
| "query_reader": readiness, | ||
| "authorization": "available" if verified and report.usable | ||
| and search == query.SEARCH_AVAILABLE else "unavailable"} |
There was a problem hiding this comment.
💡 Performance: connection.status always runs full read_graph even when unverified
In context_graph_connection.py's status() (lines 158-174), query.search_readiness(...) is called unconditionally before checking verified = state["state"] == "verified". search_readiness performs a full read_graph when the generation is usable: opening the tar artifact, extracting and reading up to MAX_GRAPH_BYTES (64 MiB), parsing JSON, and building the whole CodeGraph. When the connection is disconnected, search is forced to SEARCH_UNAVAILABLE regardless (readiness["search"] if verified else query.SEARCH_UNAVAILABLE), so all of that work is thrown away. This is a real, reachable cost on every disconnected connection's status check, not just a corner case. Move the search_readiness call after the verified check so it only runs when its result can matter, or short-circuit it when not verified.
Skip the expensive read_graph-backed readiness check entirely when the connection is not verified, since its result is discarded anyway.:
repository = Path(state["repository_root"])
report = lifecycle.graph_status(repository, root=root, revision=revision)
verified = state["state"] == "verified"
if verified:
readiness = query.search_readiness(lifecycle.GraphStateRoot(repository, root=root), report)
search = readiness["search"]
else:
readiness = {"schema": query.READINESS_SCHEMA, "search": query.SEARCH_UNAVAILABLE,
"reader": "not_checked", "reason": "disconnected"}
search = query.SEARCH_UNAVAILABLE
return {**_summary(state, search=search), "graph": report.shareable_summary(),
"query_reader": readiness,
"authorization": "available" if verified and report.usable
and search == query.SEARCH_AVAILABLE else "unavailable"}
Was this helpful? React with 👍 / 👎
|
Note Automatic reviews are paused because your team has used its included automatic processing for this billing period (headroom scales with your seat count). You can still comment "Gitar review" to run one anytime, and automatic reviews resume on their own by October 1. Add seats for more headroom. Code Review 👍 Approved with suggestions 0 closed / 1 findings🟡 Medium risk Adds query-reader compatibility validation to report search readiness accurately, with comprehensive test coverage for complete generations, provider version mismatches, and upgrade remediation messaging. Consider deferring the full 💡 Performance: connection.status always runs full read_graph even when unverified📄 src/code_mower/context_graph_connection.py:163-174 In context_graph_connection.py's status() (lines 158-174), Skip the expensive read_graph-backed readiness check entirely when the connection is not verified, since its result is discarded anyway.🤖 Prompt for agentsReview coverageRules No rules evaluated OptionsDisplay: compact → Counting what did not apply, without listing it. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Gitar |
|
One follow-up before merge (P3 performance): |
…1029) connection.status() no longer runs the read_graph-backed search_readiness for a disconnected connection; it reports a stable not_checked projection with reason "disconnected". Regression proves the graph is not read. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
Fix round for the P3 follow-up (performance: disconnected Head:
Tests: a local Python run was blocked in this lane session (interpreter guard hook). Code Mower CI run 35310551868 on this head passed: package_matrix 3.12/3.13/3.14, package, graph containment on Linux and macOS, and board qualification. Remaining: a Codex re-audit of this head ( |
|
Exact-head independent review of
Read-only verification otherwise found the |
Codex audit unavailableHead SHA: |
…er requirement (#1029) A query whose only omission is unresolved_entities now reports packet and query completeness as partial. The reviewed-provider check compares the normalized distribution and version together, so another distribution at 0.9.58 gets the rebuild-or-upgrade remediation instead of the reviewed release's fail-closed verdict. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
Fix round for the two P2 findings from the exact-head review of Head:
Merge with main: Tests: local Python runs were blocked again in this lane session (the interpreter guard hook, and explicit-interpreter invocations need approval). The executed evidence is Code Mower CI run 35311612762 on Remaining: a Codex re-audit of this head ( |
Exact-head review evidence and owner gate decisionExact head:
The audit publisher did not write the normal verdict comment after the model verdict completed, consistent with tracked nonblocking publisher issue #1032. I cancelled the stalled source job after preserving the exact-head PASS artifact to free the self-hosted runner. Applying the documented owner gate override to this PR only; this does not weaken or replace the exact-head review, CI, or test evidence above. |
Closes #1029
Part of #1027 and #923. Builds on merged #1007 without re-implementing it:
doc_refacceptance, the provider-manifest budget and the frontend test conventions are unchanged.What changed
context_graph_query.search_readinessrunsread_graph, the same readgraph_contextuses, over the published generation.build/refresh/statusandconnection-statusreportsearchand aquery_readerverdict beside the lifecyclestate/usable, which stay the generation's own verdict.status/buildexit 0, andconnection-statusreportsauthorization: available, only when the generation is usable and the reader can consume it.KNOWN_PROVIDER_FILE_TYPES(doc_ref→1.5.0) that the reader doesn't support raisesReaderIncompatible. An unknown type in a generation built by a provider release outsideREADER_PROVIDER_VERSIONS(0.9.58) does the same. Both reportreason: reader_incompatiblewith aremediationnaming the installed Code Mower, the generation's provider and the required release, plusnext_action.graph_contextreturns the same reason and remediation.UnsupportedNodeType(aContextError), and readiness and query reportunreadable. The unknown type's spelling is never echoed.generation_completeness(from the manifest) andquery_completeness(this answer).completenesskeeps its meaning. A bounded partial answer staysavailable/usableand listsprovider_has_more,unresolved_entitiesanddocument_limit.v1.4.2), CHANGELOG Unreleased entry for v1.5.0, and a roadmap note.Regressions (tests/test_context_graph_connection.py
SearchReadinessTests)doc_refvalidates and is queryable.doc_ref) produces the upgrade action. The test asserts that no graph labels, targets, ids or local paths appear in the JSON or text output.provider_has_more,unresolved_entitiesanddocument_limitwhilegeneration_completenessstayscomplete.PACKAGE_FILESandcode-mower-package-manifest.json. Fix Graphify inventory limits and frontend test discovery #1007's own four compatibility tests are unchanged.test_the_verbs_address_one_checkout_from_any_directory_inside_itnow publishes a real (empty) provider graph document instead of opaque bytes.statusnow exits 0 only when the reader can consume the generation.Verification
Every Python interpreter invocation was denied in this lane session ("requires approval"). No suite ran locally, and CI on this head is the executed evidence. No new module was added, so the package manifest is unchanged.
🤖 Generated with Claude Code