Skip to content

Field names differ between renderings: -o list prints UnitCount, --jq . -o list prints unit_count #750

Closed

Description

@David-Noble-at-work

Feature: #833 — Renderings: the pipeline from result value to stdout

A result's field names change depending on whether an unrelated flag was passed.

$ devlore-test run -o list test_hello.star
UnitCount        : 1
ExpectationCount : 1

$ devlore-test run --jq . -o list test_hello.star
unit_count        : 1
expectation_count : 1

Same command, same result, two vocabularies.

Cause

table, csv, value, and list derive columns by reflecting over the Go value:
csvFieldName (pkg/result/delimited.go:236) reads a csv: tag and otherwise falls back to
field.Name -- the Go identifier. json and yaml honor json: tags. Nothing reconciles them.

The jq filter is the exception: JQFilter.Apply normalizes through json.Marshal first, so anything
downstream of --jq sees the tag names. That is why the flag changes the answer.

Why it matters beyond inconsistency

The json: name is what a customer sees on the Starlark surface and in every stored document. A Go
identifier is an implementation detail, and -o list was publishing it. It also breaks the naming rule
already in force: snake_case on JSON/YAML surfaces, camelCase in Go.

Fix

Make stage 1 real: normalize once at the head of Pipeline.Emit, so the filter and the formatter see the
same JSON. Documented in docs/architecture/10-command-line-interface.md §8.

Numbers must stay json.Number through normalization -- decoding to float64 rounds any integer past 2^53,
which is #712's defect.

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

Metadata

Metadata

Labels

Area:CLICommand-line interfaceEpic:CommandLineOne output convention across every CLI in the suitebugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions