feat(diary): stdin append, date headers in read, CI/CD stack#1
feat(diary): stdin append, date headers in read, CI/CD stack#1birdmanmandbir merged 5 commits intomainfrom
Conversation
- append: read from stdin when no positional arg (pipe detection via golang.org/x/term); positional arg wins if both provided - read: prepend Today/Entry date header in plain-text mode; -t viewer unchanged - Makefile: add build, test, fmt, vet, lint, ci targets - CI/CD: lefthook.yml pre-commit hooks, GitHub Actions pr/ci/release workflows - goreleaser: release config with homebrew tap (tta-lab/homebrew-ttal) - golangci: add .golangci.yml with govet, staticcheck, unused, ineffassign - tests: subprocess-based CLI tests for stdin append and date header behavior - go.mod: promote golang.org/x/term from indirect to direct dependency - fix: gofmt formatting on existing files
PR Review: diary-cli stdin append + date headers + CI/CDOverall the feature work is solid and well-tested. Several issues were found across the CI/CD, core logic, and test suite. 🔴 Critical Issues[ci.yaml:32, pr.yaml:23] Format gate is completely inert — always passes run: make fmt && git status --porcelain | grep -q '\.go$' && exit 1 || trueThe trailing make fmt && git diff --exit-code -- '*.go'🟠 Important Issues[main.go] fmt.Printf("Today: %s\n", now.Format("2006-01-02 (Mon) 15:04 -07:00"))
fmt.Printf("Entry: %s\n\n", date)When reading [main.go:247-249, :256-258] Duplicated error block in The // after stdin vs arg branching:
if text == "" {
fmt.Fprintln(os.Stderr, "Error: text required for append command")
fmt.Fprintln(os.Stderr, "Usage: diary <user> append \"text\"")
os.Exit(1)
}[internal/tui/search.go]
[internal/crypto/age_test.go:20,81] recipient := identity.Recipient().String() //nolint:ineffassign,staticcheckThe linter is correctly flagging this. [go.mod]
[pr.yaml:14-15] Redundant
🟡 Test Gaps[main_test.go] No test for sequential appends (most common usage) The newline-joining logic ( [main_test.go:192] out, _ := cmd.Output()A TUI panic or key error would silently pass the test. Capture the error and at minimum log unexpected stderr: out, err := cmd.Output()
if err != nil {
var exitErr *exec.ExitError
if errors.As(err, &exitErr) && len(exitErr.Stderr) > 0 {
t.Logf("unexpected TUI stderr: %s", exitErr.Stderr)
}
}[main_test.go] Each test rebuilds the binary independently
✅ Strengths
VERDICT: Request Changes — CI format gate is broken (critical), "Today:" label is misleading, and a handful of medium issues should be cleaned up before merge. |
- ci: fix inert format gate (was '|| true', now 'git diff --exit-code') - ci: remove redundant 'go mod download' step in pr.yaml (setup-go handles it) - read: rename 'Today:' header to 'Now:' to avoid confusion for historical entries - append: deduplicate empty-text error block into single guard after branching - search.go: remove dead 'selectedStyle' variable - age_test.go: remove dead 'recipient' first-assignment; use loaded identity directly - tests: add TestMain for single binary build (5 builds → 1) - tests: add TestAppendSequential covering newline-joining logic - tests: log unexpected TUI stderr instead of silently discarding error
Triage UpdateFixed
Not Fixed
|
Re-review: fix(diary) address PR review findingsFixed ✅
Reviewer's false positive (acknowledged) ✅
New minor observation[main_test.go:253] Custom func min(a, b int) int {
if a < b { return a }
return b
}Go 1.21 introduced a built-in VERDICT: LGTM 🟢All reported issues resolved. The one new observation is non-blocking. Ready to merge. |
Triage UpdateFixed
All other issues were already resolved in the previous round. Reviewer verdict: LGTM 🟢 |
Re-review: chore(test) remove redundant min helperFixed ✅
VERDICT: LGTM 🟢All issues fully resolved across three rounds. Ready to merge. |
Summary
Test plan