Skip to content

Keep projected rows and readiness metadata consistent across JSON modes #4835

Description

@Widthdom

Summary

Projection and JSON-shape selection change the meaning and placement of query results. Projected symbols/files calls can return results:[] while placing the first row under metadata.response_context, and symbols --json=array drops exact_index_available that is present in streaming JSON.

Audit IDs: Q-01 and Q-30. Reproduced with v1.40.3 at 404db09489c305f17d94f37026e00564d3ac527a. Closed #1527 is adjacent response/freshness contract work.

Expected behavior

Array, NDJSON, and envelope modes must serialize the same row DTO and readiness facts. Projection may remove only fields the caller did not request; it must not relocate rows or fabricate has_more:false.

PR scope

One PR should fix row projection/serialization across symbols and files. Unknown-field validation/schema discovery is tracked separately.

Implementation guide for Codex 5.6 sol xhigh

  • Add a matrix covering symbols/files, projected/unprojected rows, array/NDJSON/envelope, empty/non-empty, and bounded pages.
  • Build the projected row once, then pass it to format-specific writers; never reuse the first row as response-context metadata.
  • Keep readiness/pagination metadata outside projected row fields and consistent across modes.
  • Preserve backward-compatible field names, add contract tests, run net8/net9, and add a bilingual changelog fragment.

Acceptance criteria

  • Every non-empty projected query returns all rows in the documented collection/stream.
  • exact_index_available, counts, truncation, and cursor facts agree across JSON modes.
  • No row appears under metadata.response_context.
  • Empty results remain genuinely empty.

Metadata

Metadata

Assignees

No one assigned

    Labels

    .NETPull requests that update .NET codebugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions