Skip to content

refactor(core): propagate context and errors - #61

Merged
ekalinin merged 2 commits into
masterfrom
refactor/error-context
Jul 30, 2026
Merged

refactor(core): propagate context and errors#61
ekalinin merged 2 commits into
masterfrom
refactor/error-context

Conversation

@ekalinin

Copy link
Copy Markdown
Owner

Summary

  • propagate context.Context from the CLI entry point through app, controller, use cases, ports, and HTTP requests
  • return explicit use case errors instead of encoding failures as nil TOCs
  • aggregate document errors while preserving successful output
  • return a non-zero exit code and omit the footer when processing fails
  • add tests for dependency failures, missing files, empty TOCs, context cancellation, and partial success

Checks

  • go test -count=1 ./...
  • go test -race -count=1 ./...
  • GOTOOLCHAIN=go1.21.13 go test ./...
  • go vet ./...
  • golangci-lint run
  • go mod tidy -diff

@codecov

codecov Bot commented Jul 30, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 59.62733% with 65 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.13%. Comparing base (8c71213) to head (11b558c).

Files with missing lines Patch % Lines
internal/controller/stdin.go 0.00% 12 Missing ⚠️
cmd/gh-md-toc/main.go 33.33% 10 Missing ⚠️
internal/controller/file.go 62.96% 8 Missing and 2 partials ⚠️
internal/adapters/tocgrabber_json.go 14.28% 3 Missing and 3 partials ⚠️
internal/adapters/tocgrabber_re.go 14.28% 3 Missing and 3 partials ⚠️
internal/adapters/filechecker.go 60.00% 2 Missing and 2 partials ⚠️
internal/controller/new.go 0.00% 3 Missing ⚠️
internal/adapters/filetemper.go 33.33% 1 Missing and 1 partial ⚠️
internal/adapters/filewriter.go 33.33% 1 Missing and 1 partial ⚠️
internal/adapters/remoteposter.go 66.66% 1 Missing and 1 partial ⚠️
... and 4 more
Additional details and impacted files
@@             Coverage Diff             @@
##           master      #61       +/-   ##
===========================================
+ Coverage   63.75%   79.13%   +15.38%     
===========================================
  Files          27       27               
  Lines         549      623       +74     
===========================================
+ Hits          350      493      +143     
+ Misses        190      100       -90     
- Partials        9       30       +21     

☔ 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.

@ekalinin
ekalinin merged commit 4d9bf98 into master Jul 30, 2026
5 of 6 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.

1 participant