Skip to content

feat(cmd): send verbose make logs to stderr#115

Merged
luoliwoshang merged 6 commits into
xgo-dev:mainfrom
MeteorsLiu:codex/make-output-contract
Jun 4, 2026
Merged

feat(cmd): send verbose make logs to stderr#115
luoliwoshang merged 6 commits into
xgo-dev:mainfrom
MeteorsLiu:codex/make-output-contract

Conversation

@MeteorsLiu

Copy link
Copy Markdown
Collaborator

Summary

  • keep llar make stdout reserved for final metadata
  • redirect verbose build stdout to stderr during OnBuild
  • add regression coverage for stdout/stderr separation

Tests

  • go test -ldflags=-checklinkname=0 -short ./...

Note: non-short go test ./cmd/llar/internal still hits existing real integration tests that write to the user cache and failed locally with permission denied.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the make command to redirect verbose build logs to stderr while reserving stdout for the final metadata line, allowing callers to capture the output separately. The test suite has been updated to capture both streams concurrently, and a new test has been added to verify this behavior. The review feedback highlights critical issues in the tests: first, modifying global variables makeVerbose and makeOutput without restoring them can cause test pollution; second, ignoring errors from os.Pipe() and failing to close the read ends of the pipes in runMakeCmdStreams and captureBuildModuleStreams leads to potential nil pointer dereferences and file descriptor leaks.

Comment thread cmd/llar/internal/make_test.go Outdated
Comment thread cmd/llar/internal/make_test.go
Comment thread cmd/llar/internal/make_test.go Outdated
@codecov

codecov Bot commented Jun 1, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 87.87879% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.46%. Comparing base (f1a02d8) to head (c180b53).

Files with missing lines Patch % Lines
cmd/llar/internal/make.go 87.87% 2 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #115      +/-   ##
==========================================
+ Coverage   80.43%   80.46%   +0.02%     
==========================================
  Files          37       37              
  Lines        2116     2129      +13     
==========================================
+ Hits         1702     1713      +11     
- Misses        300      301       +1     
- Partials      114      115       +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

fennoai[bot]

This comment was marked as outdated.

@MeteorsLiu MeteorsLiu force-pushed the codex/make-output-contract branch from 45a7ce7 to 56d8f94 Compare June 1, 2026 06:29
@MeteorsLiu

Copy link
Copy Markdown
Collaborator Author

/gemini review

@MeteorsLiu

Copy link
Copy Markdown
Collaborator Author

/review

@MeteorsLiu MeteorsLiu changed the title fix(cmd): send verbose make logs to stderr feat(cmd): send verbose make logs to stderr Jun 1, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors build output redirection in cmd/llar/internal/make.go by extracting the logic into a redirectBuildOutput helper, which redirects stdout to stderr in verbose mode and discards it in silent mode. It also updates the testing framework to capture both stdout and stderr concurrently using pipes and adds a new integration test for verbose output. The review feedback highlights several issues: 1) os.Stdout and os.Stderr should be restored before closing devNull to prevent panics from concurrent writes; 2) the read ends of the pipes in runMakeCmdStreams and captureProcessStreams should be closed to prevent file descriptor leaks; and 3) the global makeVerbose variable modified in tests should be restored using t.Cleanup to avoid test flakiness.

Comment thread cmd/llar/internal/make.go
Comment thread cmd/llar/internal/make_test.go
Comment thread cmd/llar/internal/make_test.go
Comment thread cmd/llar/internal/make_test.go

@fennoai fennoai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Summary

Clean refactoring that extracts output redirection into a well-structured helper with proper restore semantics. The new verbose-to-stderr behavior is a solid improvement for machine-parseable stdout. A few items below, mostly in the test code.

Comment thread cmd/llar/internal/make_test.go
Comment thread cmd/llar/internal/make_test.go
Comment thread cmd/llar/internal/make_test.go
Comment thread cmd/llar/internal/make.go
@MeteorsLiu MeteorsLiu requested a review from luoliwoshang June 4, 2026 09:40

@luoliwoshang luoliwoshang left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@luoliwoshang luoliwoshang merged commit 288fdd6 into xgo-dev:main Jun 4, 2026
4 checks passed
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.

2 participants