You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(cli): announce shortened projection values instead of clipping silently
An over-budget list projection shortens string values and marks them with
"...", on the reasoning that a marked value is distinguishable from a
genuinely short one. That holds for a reader. It does not hold for the
consumer `--json` exists to serve: a jq filter or exact match runs over the
value itself and never sees the marker, so a clipped title turns a matching
query into an empty result that looks exactly like "nothing matched". The
cost lands on whoever wrote the filter, who re-runs variations of a query
that was correct all along.
boundProjectedOutput now returns a note naming the clipped fields, and the
three list call sites print it on stderr next to the existing default-
projection note. Behaviour is otherwise unchanged: the same values are
shortened, with the same fair per-field cap and the same marker.
The list-overflow error also gains what the detail path already had — the
largest fields by aggregate byte size. Finding the oversized field
previously meant re-running the query once per field until one of them was
dropped; the error now names it outright. Both paths share one helper.
returnfmt.Errorf("projected detail is %d bytes, exceeds the %d-byte limit; largest fields: %s; request fewer --fields, or omit --fields for the full, unbounded detail",
// The overflow error names the fields responsible, exactly as the detail
204
+
// path does, so the request can be narrowed in one pass.
205
+
tooBig:=func() (string, error) {
206
+
largest, err:=largestProjectedFields(rows)
207
+
iferr!=nil {
208
+
return"", err
209
+
}
210
+
return"", fmt.Errorf("projected list is %d bytes across %d rows, exceeds the %d-byte limit; largest fields: %s; request fewer rows (--limit) or fewer --fields",
returnfmt.Sprintf("note: %d of %d string values were shortened to fit the %d-byte limit and now end with \"...\" (fields: %s); matching or filtering on those fields will miss — narrow --fields or --limit for untruncated values",
0 commit comments