feat(kmp): promote per-response context-coverage signals into the MCP/API contract#115
Merged
Merged
Conversation
…/API contract
Promote per-response, actionable context-coverage signals from OTel-only into
the in-band KMP MCP/API contract so a navigating client (the operator) can
estimate coverage and decide expand-vs-stop without OTel access. Criterion: a
metric joins the contract only if it is per-response AND actionable; operational
metrics (latency, call-count, lag) stay OTel-only.
proto (memory.proto, non-breaking additive):
- TemporalCoverage.dimensions: repeated DimensionCoverage{dimension,returned,present}
(per-dimension coverage on temporal moves).
- Proof.frontier_size (= |missing|) on wake/ask/temporal proofs.
- ResponseQuality{nodes,relationships,details,detail_coverage,causal_density,
truncated} on the five temporal moves + Trace + Inspect responses. Quality is
the KMP-read-computable subset (render-path metrics like noise_ratio/tokens are
not available on memory tools, so excluded).
transport-grpc: populate dimensions / frontier_size / quality from the bundle
views (responses.rs + bundle_views.rs); copy quality through the Goto/Near/
Rewind/Forward builders.
mcp: serialize dimensions / frontier_size / quality in the KMP JSON
(kmp.rs); test fixtures updated + enriched, grpc_backend fixtures extended.
contract-stability test updated for the new response fields.
fmt + clippy -D warnings + workspace tests green.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
SonarCloud's quality gate flagged 4.2% duplication on new code: appending `quality` to the Goto/Near/Rewind/Forward response field lists made the four assertions identical. Assert them in a loop so the shared field set is stated once. Test-only; no production change. The contract is unchanged — each temporal response must still match the exact field set (now including `quality`). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
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.



Promotes per-response, actionable context-coverage signals from OTel-only into the in-band KMP MCP/API contract so a navigating client (the operator) can estimate coverage and decide expand-vs-stop without OTel access. Criterion: a metric joins the contract only if per-response AND actionable; operational metrics (latency, call-count, lag) stay OTel-only.
Proto (memory.proto, non-breaking additive)
TemporalCoverage.dimensions: repeated DimensionCoverage{dimension,returned,present}— per-dimension coverage on temporal moves.Proof.frontier_size(= |missing|) on wake/ask/temporal proofs.ResponseQuality{nodes,relationships,details,detail_coverage,causal_density,truncated}on the five temporal moves + Trace + Inspect responses (the KMP-read-computable subset; render-path metrics excluded).Plumbing
Backward/forward compatible: additive fields only, so old clients ignore them and a new kernel works with old clients.
Verified: fmt + clippy -D warnings + full gate (coverage 87.80%). Already built and deployed to the shared cluster as
dev-1b494fe(release rev 130) for the operator's window-expansion work.🤖 Generated with Claude Code