Skip to content

[release gate] checksum verify drops stdout when non-TTY #5

Description

@Vonng

Problem

mcli checksum verify successfully verifies objects in a terminal, but the same command under a pipe or stdout redirect exits 0 with no stdout. Even an explicit --json produces a zero-byte file. --report still works, so CI can only recover results through a secondary file.

Reproducer observed against a real local S3 server:

mcli --json checksum verify --fail-on none ALIAS/BUCKET/OBJECT > results.jsonl
echo $?          # 0
wc -c results.jsonl  # 0 before the fix

Root cause

cmd/main.go automatically sets globalQuiet=true when stdout has no terminal size. That behavior was introduced to disable progress UI outside a terminal. checksum verify reused globalQuiet to gate semantic object records and the final summary, conflating non-interactive progress suppression with an explicit user request for silence.

The nested CLI flag sets add two compatibility constraints:

  • GlobalBool stops at the nearest ancestor flag set, so a leaf-only lookup misses app-level flags;
  • repeated Before: setGlobalsFromContext hooks can reset globalJSONLine after an app-level --json.

Required contract

  • Unless --quiet, -q, or MC_QUIET=true is explicitly requested, every object result and the final summary are written to stdout in both TTY and non-TTY execution.
  • Non-TTY --json is compact JSON Lines at app, parent, and leaf flag positions.
  • TTY human and JSON presentation remain unchanged.
  • --report remains an independent JSON Lines output and still works under explicit quiet.
  • --fail-on exit semantics and report-write failure handling remain unchanged.
  • Non-TTY pipe, regular-file redirect, JSON, quiet, report, MISMATCH, and UNKNOWN paths have subprocess-level coverage.

Local implementation

  • Base command: dac3f07b feat: add read-only object checksum verification
  • Output fix: 26af1a96 fix: preserve checksum output in pipelines

The fix walks the full cli.Context parent chain for explicit quiet/json flags and restores compact JSONL only inside the checksum action. It does not change global quiet semantics or re-enable progress bars for other commands.

Local evidence includes real-S3 TTY/non-TTY before/after probes, report-write failure, MISMATCH/UNKNOWN exit status, focused and full unit/race, vet, lint, branding, credits, module checks, nine-target crosscompile, and clean VCS provenance. The commits are not yet pushed, so these hashes will not resolve on GitHub until the follow-up PR is published.

Documentation and close criteria

  • Record the stdout/quiet/JSONL/report decision in docs/checksum-verify.md.
  • Add bilingual public checksum-audit documentation or release-note coverage in pgsty/silo.pgsty.com.
  • Push a focused branch/PR referencing this issue.
  • Require DCO, Go, Crosscompile, VulnCheck, and Test Release Pipeline to pass.
  • Merge and verify the same checks on remote main.

Close this issue after code and design documentation are merged and remote main CI is green. Tagging, package publication, Server image pinning, and public deployment remain separate release gates.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdocumentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions