test(todos): guard todos show --json surfaces SDK fields (Refs #449)

Merged
JE
4mo ago
+118-0

What

Adds TestTodosShowJSONSurfacesSDKFields, a regression guard for #449: the fields that issue reported as missing from todos show --json — due_on, starts_on, comments_count, boosts_count, completion_subscribers, description_attachments — must all surface in the JSON output.

Why this is Refs, not Fixes

The implementation already landed on main (unreleased — latest published CLI is v0.7.2, which predates it). Provenance chain:

  • SDK #375 added completion_subscribers and comments_count.
  • SDK #400 added description_attachments.
  • CLI #552 absorbed the earlier field set; CLI #554's SDK bump absorbed #400 (main now rides a98f52fd3ddd).
  • due_on, starts_on, boosts_count already existed with omitempty.

todos show emits the SDK Todo object directly (todos.go data := any(todo)), so all six fields surface today. The remaining work is coverage, not a fix.

The test

Serves a fully-populated todo from a focused GET transport (nonzero due_on/starts_on/comments_count/boosts_count so the omitempty fields are actually exercised, plus a non-empty completion_subscribers and description_attachments), runs todos show 999 with JSON output, and asserts both the presence and the values of all six fields. This keeps a future SDK bump from silently dropping any of them.

Deliberately does not add a CLI presenter/model wrapper to force stable zero-valued keys — that would fork the SDK contract; a stable-zero-key policy, if ever wanted, is a separate upstream SDK-model decision.

bin/ci green.

Refs #449


Summary by cubic

Add a regression test (TestTodosShowJSONSurfacesSDKFields) to ensure todos show --json includes due_on, starts_on, comments_count, boosts_count, completion_subscribers, and description_attachments (Refs #449). The test serves a fully populated todo and asserts presence and values; this is coverage only since the behavior already exists on main via recent SDK bumps.