← Back to Pull requests

Fix/kv explicit backends #1439

Open
unknown opened this pull request with 329 lines diff across 4 files
View on GitHub
unknown unknown commented on Oct 22, 2026 21:15 UTC
Author

What does this PR do?

KvStoreRegistry::get_or_create() silently created an InMemoryKvBackend
for any name it didn't hold. A filter that asked for a store the embedder
configured with another backend, or a misspelled name, got a new, empty,
process-local store with no error.

This PR makes backend creation explicit (crates/core/src/kv.rs):

- register(name, backend) adds a caller-supplied backend and returns
KvRegistryError::AlreadyRegistered if the name is taken.
- get_or_create_memory(name) replaces get_or_create, so creating an
in-memory store is an explicit choice.
- get / lookup are unchanged and never create a store. The admin KV API
still returns 404 for an unknown store.

The docs and the rustdoc example now use get for configured stores.
New tests prove that a missing or misspelled store is never created, both
in the registry and through the admin API.

Follow-up (out of scope): ServerComposition and RegistryContext don't
expose the KvStoreRegistry yet, so embedders on the composition API can't
call register.

Which issue(s) does this relate to?

Fixes #1433

Checklist

  • Signed off all commits (git commit -s)

  • Tests added or updated

  • Documentation updated (if applicable)

  • CHANGELOG.md updated (if the change is user-visible)

  • make lint && make test && make test-integration passes locally
  • Does this introduce a breaking change?

    Yes. KvStoreRegistry::get_or_create is removed. Use
    get_or_create_memory(name) for a store the filter owns, get(name) for
    one the embedder configures, or register(name, backend) for a custom
    backend.

    <!-- This is an auto-generated comment: release notes by coderabbit.ai -->
    <!-- coderabbit-ai-generated:v1 -->

    Summary by CodeRabbit

    New Features
    Register caller-provided key-value backends by name. Registering a name that is already in use returns an error without replacing its backend.
    Create in-memory stores explicitly with the memory-store option.
    Added an example configuration for serving registered key-value stores through the admin API.

    Behavior Changes
    Store lookups no longer create a store when the name is missing; they return no result. Admin requests for unregistered stores return 404 without creating them.
    The previous combined lookup-and-create method has been removed.

    Documentation
    * Updated key-value store guidance to reflect the lookup and explicit creation options, and documented the admin API example.
    <!-- end of auto-generated comment: release notes by coderabbit.ai -->

    Diff: 329 lines (+246 / -83) across 4 files Reviewer: redhat-chai-bot Review duration: 3849m
    All Vouch review confidence checks passed
    Residual risk 0.22 = Change Risk (0.42) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.42 · 329 lines diff across 4 files
    0.42
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    46%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.347
    Shallow Review Depth shallow_review_depth
    0.344
    Real PR Conversation Timeline
    1 comments
    "Review active on #1439"
    general weight: 0.35
    Assignees
    Unassigned
    Labels
    risk: low confidence: 46.7% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 42.1% (MEDIUM) · Higher = larger blast radius
    42.1%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 46.7% · Lower = rushed or shallow review
    46.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 22.4% · Safe to merge
    22.4%