← Back to Pull requests

feat(metadata): dispatch metadata.fetch to one named source #281

Closed
unknown closed this pull request without merging on Nov 08, 2026 22:21 UTC
View on GitHub
unknown unknown commented on Oct 25, 2026 12:02 UTC
Author

Problem and behavior

Policy evaluation needs to acquire facts from one configured metadata source while preserving the executor's capability filtering and error handling.

This PR adds the typed, unphased metadata.fetch hook. The caller resolves the source with find_plugin_entries(name), selects its metadata.fetch handler, and invokes it with invoke_entries::<MetadataFetchHook>(). Generic engine entry points retain ordinary routing and condition filtering.

Closes #240.

Changes

  • Add MetadataFetchHook, MetadataFetchRequest, and MetadataFetchResult, including the built-in hook metadata/catalog entry.

  • Keep the payload as a facts-only result accumulator. Source selection belongs to the caller; MetadataFetchRequest::new() takes no instance name.

  • Remove metadata-specific downcasts, payload-driven instance targeting, and missing-source denial branches from generic engine dispatch.

  • Require callers to reject missing sources or missing metadata handlers before dispatch. The existing invoke_entries primitive allows an empty entry list.

  • Preserve capability filtering, direct host registration, configuration-driven factories, and hook-family validation.

  • Keep validation, provenance stamping, and installation under framework control. Source plugins cannot publish forged metadata through extension writes.

  • Align proposal 00215 and pipeline documentation with explicit source selection.
  • APL fetch(name) scheduling is implemented separately in #287. HTTP source implementation and changes to the AcquiredFacts record remain outside this PR.

    Validation

  • make lint — formatting and all supported Clippy passes.

  • make test — default and all-feature workspace tests, including integration, resilience, security, and doctests. Live-service tests retain their documented ignore gates.

  • Regression coverage for explicit source isolation, caller-side unknown-source rejection, source denial, condition filtering through all three generic entry points, explicit dispatch bypassing hook conditions, capability isolation, factory registration, and family mismatch.

  • Compiled API example and regression-tested YAML fixture.
  • <!-- This is an auto-generated comment: release notes by coderabbit.ai -->
    <!-- coderabbit-ai-generated:v1 -->

    Summary by CodeRabbit

    New Features
    Added metadata.fetch support for dispatching requests to a specifically selected metadata source.
    Sources can return acquired facts for framework validation and installation. Requests expose only capability-filtered metadata, and denied requests return no facts.
    Missing sources and sources without a compatible handler are rejected before dispatch.
    Documentation
    Added guidance and a configuration example for setting up and selecting metadata sources.
    <!-- end of auto-generated comment: release notes by coderabbit.ai -->

    Diff: 359 lines (+269 / -90) across 4 files Reviewer: guicassolato Review duration: 20778m
    All Vouch review confidence checks passed
    Residual risk 0.17 = Change Risk (0.43) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.43 · 359 lines diff across 4 files
    0.43
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    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.352
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #281"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% 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.6% (MEDIUM) · Higher = larger blast radius
    42.6%
    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: 60.5% · Lower = rushed or shallow review
    60.5%
    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: 16.8% · Safe to merge
    16.8%