Skip to content

fix(artifact): flush piped reports before exit - #404

Merged
StepenkoAnatoli merged 1 commit into
mainfrom
fix/issue-359-flush-artifact-output
Oct 14, 2026
Merged

StepenkoAnatoli merged 1 commit into
mainfrom
fix/issue-359-flush-artifact-output

Conversation

@StepenkoAnatoli

@StepenkoAnatoli StepenkoAnatoli commented Oct 13, 2026 •

Copy link
Copy Markdown
Owner

Large artifact-validation reports sent through a pipe could be truncated at 64 KiB because the CLI called process.exit before stdout drained. Artifact CLI endings now await the existing exitAfterFlush helper, preserving report contents and exit codes. Regression coverage exercises 700 missing-file diagnostics in both JSON and text modes.

Fixes #359

what changed: Awaited output flush for artifact CLI help, refusal, successful create and validation endings. Added a large piped-report regression that verifies parseable JSON and all 700 text errors above 64 KiB, with exit code 1.

why: process.exit can discard queued stdout on asynchronous POSIX pipes. Use the established drain helper before exiting.

what it touched: artifact CLI and tests, architecture map, changelog and README test inventory. No report schema or exit-code change.

what you verified: verified - red-first/corrected-baseline runs and fixed CLI each passed 23 artifact-cli tests; JSON parses and text contains all 700 errors, both over 64 KiB. The required full commit gate accepted 87652bf. Expected - POSIX pipe truncation is prevented by awaiting the stream drain. Untested locally - POSIX pipe runtime behavior; GitHub CI passed all seven required jobs, including Linux and Windows (run 38441197165).

what you got wrong and fixed: mistake - the first missing-files test fixture was rebuilt by the seal helper; where - artifact-cli.test.mjs; impact - it did not reproduce the truncation failure; no delivered result was affected; cause - default inventory recomputation; fix - preserve the mutated manifest inventory using recomputeFiles:false; verified - corrected baseline and fixed CLI each passed 23 artifact-cli tests.

what changed: Await the existing exitAfterFlush helper for all artifact CLI help, refusal, success and validation endings. Add large-output regressions for JSON and text with 700 missing files.

why: Direct process.exit can discard queued stdout on POSIX pipes, truncating reports after 64 KiB. Drain output before preserving the existing exit code.

what it touched: artifact CLI/tests, architecture, changelog and README test inventory. No report schema or exit-code change.

what you verified: verified - corrected baseline and fixed CLI each passed 23 artifact-cli tests; large JSON parses and text retains 700 errors, both over 64 KiB and exit 1. Handoff OK, preflight PASS, doctor READY. Full gate is running.

what you got wrong and fixed: mistake - initial missing-files fixture was rebuilt by the seal helper. where - artifact-cli test. impact - it did not reproduce the truncation defect; no delivery affected. cause - default inventory recomputation; fix - preserve the mutated inventory using recomputeFiles:false; verified - corrected baseline and fixed CLI each passed 23 tests.
@StepenkoAnatoli
StepenkoAnatoli merged commit 0dc3ff0 into main Oct 14, 2026
7 checks passed
@StepenkoAnatoli
StepenkoAnatoli deleted the fix/issue-359-flush-artifact-output branch October 14, 2026 18:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

artifact validate --json through a pipe is cut at 64 KiB (process.exit without draining stdout), so a script gets invalid JSON

1 participant