Skip to content

Propagate unknown-origin coverage into ad hoc search count authority #5357

Description

@Widthdom

Problem

Ad hoc search --count reports authoritative_count: true and exit 0 after origin filtering has excluded matches whose C# lexical context is unknown. The count describes accepted indexed search rows, but cannot establish the complete code-origin count or authoritative absence.

This was observed while validating #5348. That issue adds bounded lexical continuation; propagating classification coverage into the existing ad hoc count-output path is a separate follow-up. Regex find already retains its partial/unknown outcome, and recipe materialization already observes origin coverage before filtering.

Reproduction

Using the repository-built Debug/net8.0 cdidx 1.49.0 and an index of 1ad7e604d336c38b7df1508e9ac339c34b9b230f:

dotnet ./src/CodeIndex/bin/Debug/net8.0/cdidx.dll search return --path src/CodeIndex/Cli/QueryCommandRunner.SearchRecipes.cs --origin code --format count --json --db .cdidx/codeindex.db
dotnet ./src/CodeIndex/bin/Debug/net8.0/cdidx.dll search return --path src/CodeIndex/Cli/QueryCommandRunner.SearchRecipes.cs --origin unknown --format count --json --db .cdidx/codeindex.db
dotnet ./src/CodeIndex/bin/Debug/net8.0/cdidx.dll find return --regex --path src/CodeIndex/Cli/QueryCommandRunner.SearchRecipes.cs --origin code --format count --json --db .cdidx/codeindex.db

The first command reports count 58, degraded: false, authoritative_count: true, and exit 0, although matches after the first lexical window remain unknown. The explicit unknown query confirms such search rows exist. The regex-find control reports 111 unknown-origin occurrences, origin_classification_complete: false, authoritative_count: false, and exit 11. Search counts indexed result rows whereas find counts occurrences; these numeric counts are not interchangeable.

The one-pass classification and ad hoc count-output behavior are unchanged by the #5348 implementation. The observation was made on macOS arm64 while testing that implementation, using the baseline index above.

Expected behavior and validation

  • Observe unknown candidate origins before applying include/exclude filters and before output selection.
  • Report incomplete/non-authoritative counts and actionable classification recovery guidance, with the shared partial-exit opt-in semantics.
  • Preserve authoritative complete zero results and distinguish intentional output selection from incomplete classification.
  • Check ordinary count, count format, grouped/count-by and named-query routes for the same propagation gap; keep recipe and regex-find controls.
  • Add a small C# fixture with executable matches before and after a lexical window, plus malformed/missing-context controls; compare one-pass and explicitly continued classification on net8/net9.

Duplicate checks: open issues searched for search origin authoritative and "origin" "count"; no issue specifically tracking ad hoc count authority was found.

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions