Skip to content

Bug: unmatched entity is diluted into unrelated generic query results #32

Description

@1wgrumph

Migrated from private source issue alphazede/bran-dev#18

Summary

BRAN query can dilute an unmatched, high-specificity entity with generic request terms and return unrelated locators without a miss or low-confidence warning.

This creates a grounding hazard: an agent can ask for one named component, receive unrelated files selected from generic terms such as tests or documentation, and mistake command success for evidence coverage.

Environment

  • Repository queried: alphazede/developers
  • Native policy: present
  • bran check <repo> bran-strict: selected profile passed
  • Pinned runtime: bran 0.1.0
  • Source commit: 39abfdcc823e0a1754c56ceb4a28df9faae375d8
  • Runtime SHA-256 matched the release pin

Reproduction

Exact entity controls:

bran query <repo> "grok-safe"
bran query <repo> "grok_safe_collector.py"

Both return:

{
  "status": "ok",
  "selected_locators": [],
  "source_rankings": [],
  "warnings": [],
  "failures": []
}

Expanded natural-language request:

bran query <repo> "Where are the Grok Safe wrapper, runner, completion semantics, transcript handling, and tests documented and implemented?"

This returns four az-sports-dev locators unrelated to Grok Safe. The selections are attributed to metadata_seed; rankings are driven by generic path matches such as test/public content. The response still has:

{
  "status": "ok",
  "warnings": [],
  "failures": []
}

The named entity is absent from every selected locator.

Expected behavior

When a query contains a high-specificity anchor that has no match, BRAN should not silently satisfy the request using only generic residual terms.

One safe result would be:

  • empty selections plus a typed semantic miss;
  • a warning naming only the unmatched query token/entity, not repository content;
  • explicit query-term coverage showing that the named anchor was not grounded; or
  • low-confidence partial results clearly marked as not answering the named component.

Command execution success may remain status:"ok", but the response needs a machine-readable semantic outcome such as query_outcome:"miss" or coverage:"partial_unanchored".

Acceptance criteria

  • Add a fixture with one unmatched unique entity plus generic words that match many indexed paths.
  • Do not return those generic matches as fully grounded results.
  • Add machine-readable matched/unmatched anchor or term coverage.
  • Distinguish exact miss, grounded partial match, and unanchored generic match.
  • Preserve deterministic ranking and bounded output.
  • Do not leak repository content in warnings.
  • Confirm ordinary multi-term queries with a grounded entity still return ranked evidence.
  • Document how callers should interpret empty selections versus partial/unanchored selections.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions