Skip to content

QueryFindCountJsonResult exposes both 'files' and 'file_count' for the same value #1423

Description

@Widthdom

Summary

QueryFindCountJsonResult exposes both files and file_count fields that carry the same value. This is internal schema noise that other count-shaped results in the same file (QueryCountFilesJsonResult) avoid.

Evidence

src/CodeIndex/Cli/JsonOutputContracts.cs:35-38:

internal sealed record QueryFindCountJsonResult(
    [property: JsonPropertyName("count")] int Count,
    [property: JsonPropertyName("files")] int Files,
    [property: JsonPropertyName("file_count")] int FileCount);

vs. QueryCountFilesJsonResult (line 30) which uses only files. Both ultimately came from the same total-files count in the underlying query.

Impact

  • Clients consuming both count-style commands must handle the inconsistent name.
  • New JSON consumers may pick the "wrong" field and silently break later if one is removed.

Proposed direction

  1. Decide on file_count (more explicit) or files (shorter, consistent with QueryCountFilesJsonResult).
  2. Deprecate the other field in JSON_OUTPUT.md (or wherever the schema is documented) with a removal-version note.
  3. Add a CHANGELOG fragment for the deprecation.

Repro env

  • Branch: main @ 2ee912d (release v1.21.0)

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