7 Commits

Author SHA1 Message Date
Matt Holloway dc3ee11f4c fix for -1 in tailLines (#2047)
CodeQL / Analyze (go) (push) Has been cancelled
CodeQL / Analyze (actions) (push) Has been cancelled
Docker / build (push) Has been cancelled
Build and Test Go Project / build (macos-latest) (push) Has been cancelled
Build and Test Go Project / build (ubuntu-latest) (push) Has been cancelled
Build and Test Go Project / build (windows-latest) (push) Has been cancelled
GoReleaser Release / release (push) Has been cancelled
MCP Server Diff / mcp-diff (push) Has been cancelled
Publish to MCP Registry / publish (push) Has been cancelled
2026-02-19 15:17:52 +00:00
Oleksandr Redko 505d5dc33a refactor: modernize code with modernize and intrange 2026-02-12 12:58:49 +01:00
Sam Morrow 47412e5c4b Refactor buffer processing for clarity and add edge case tests
CodeQL / Analyze (go) (push) Has been cancelled
CodeQL / Analyze (actions) (push) Has been cancelled
Docker / build (push) Has been cancelled
Build and Test Go Project / build (macos-latest) (push) Has been cancelled
Build and Test Go Project / build (ubuntu-latest) (push) Has been cancelled
Build and Test Go Project / build (windows-latest) (push) Has been cancelled
GoReleaser Release / release (push) Has been cancelled
MCP Server Diff / mcp-diff (push) Has been cancelled
Publish to MCP Registry / publish (push) Has been cancelled
- Extract storeLine() and accumulate() helper closures to eliminate
  duplicated line processing and truncation logic
- Simplify main loop by using early return pattern (newlineIdx < 0 -> break)
- Add test for empty response body edge case
- Add test for exact maxLineSize boundary condition (10MB)

The refactored code reduces nesting and makes the flow clearer:
accumulate handles byte collection with truncation detection,
storeLine handles ring buffer storage with truncation markers.
2026-01-27 12:20:47 +01:00
Matt Holloway 4bb1ba9e85 consolidate buffer logic 2026-01-27 12:20:47 +01:00
Matt Holloway a1e82e78f6 add line length truncate buffer 2026-01-27 12:20:47 +01:00
Matt Holloway c0bd7b2744 fix ring buffer panic (#1556) 2025-12-18 16:48:24 +01:00
Matt Holloway 2621dbefd9 Add actions job log buffer and profiler (#866)
* add sliding window for actions logs

* refactor: fix sliding

* remove trim content

* only use up to 1mb of memory for logs

* update to tail lines in second pass

* add better memory usage calculation

* increase window size to 5MB

* update test

* update vers

* undo vers change

* add incremental memory tracking

* use ring buffer

* remove unused ctx param

* remove manual GC clear

* fix cca feedback

* extract ring buffer logic to new package

* handle log content processing errors and use correct param for maxjobloglines

* fix tailing

* account for if tailLines exceeds window size

* add profiling thats reusable

* remove profiler testing

* refactor profiler: introduce safeMemoryDelta for accurate memory delta calculations

* linter fixes

* Update pkg/buffer/buffer.go

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* use flag for maxJobLogLines

* add param passing for context window size

* refactor: rename contextWindowSize to contentWindowSize for consistency

* fix: use tailLines if bigger but only if <= 5000

* fix: limit tailLines to a maximum of 500 for log content download

* Update cmd/github-mcp-server/main.go

Co-authored-by: Adam Holt <omgitsads@github.com>

* Update cmd/github-mcp-server/main.go

Co-authored-by: Adam Holt <omgitsads@github.com>

* move profiler to internal/

* update actions test with new profiler location

* fix: adjust buffer size limits

* make line buffer 1028kb

* fix mod path

* change test to use same buffer size as normal use

* improve test for non-sliding window implementation to not count empty lines

* make test memory measurement more accurate

* remove impossible conditional

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Adam Holt <omgitsads@github.com>
2025-08-19 14:02:16 +01:00