Skip to content

Compact /stats-history responses by default#224

Merged
chopratejas merged 2 commits intochopratejas:mainfrom
gglucass:codex/compact-stats-history-default
Apr 22, 2026
Merged

Compact /stats-history responses by default#224
chopratejas merged 2 commits intochopratejas:mainfrom
gglucass:codex/compact-stats-history-default

Conversation

@gglucass
Copy link
Copy Markdown
Contributor

@gglucass gglucass commented Apr 21, 2026

Description

Compacts /stats-history checkpoint payloads by default so long-running installs do not return ever-growing JSON responses, while keeping history_mode=full for explicit export/debug flows and history_mode=none for rollup-only clients.

Fixes #(issue number): not tracked as a GitHub issue.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Performance improvement
  • Code refactoring (no functional changes)

Changes Made

  • Return compact checkpoint history by default from /stats-history, plus a history_summary block and history_mode={compact,full,none} support.
  • Keep dashboard JSON export on the full checkpoint list by requesting history_mode=full.
  • Add coverage for compact/full/none history responses and update changelog/wiki docs.

Testing

Describe the tests you ran to verify your changes:

  • Unit tests pass (pytest)
  • Linting passes (ruff check .)
  • Type checking passes (mypy headroom)
  • New tests added for new functionality
  • Manual testing performed

Test Output

$ rtk uvx --with '.[dev]' pytest tests/test_proxy_savings_history.py -vv
12 passed in 11.56s

$ rtk uvx --with '.[dev]' ruff check headroom/proxy/savings_tracker.py headroom/proxy/server.py tests/test_proxy_savings_history.py
All checks passed!

$ rtk uvx --with '.[dev]' mypy headroom
Success: no issues found in 299 source files

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have updated the CHANGELOG.md if applicable

Screenshots (if applicable)

N/A

Additional Notes

  • No matching upstream issue was open for /stats-history growth when I prepared this PR.
  • This keeps backward-compatible access to the full retained checkpoint list via history_mode=full; the default change only affects the size of the JSON response payload.

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 21, 2026

Codecov Report

❌ Patch coverage is 81.25000% with 6 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
headroom/proxy/savings_tracker.py 81.25% 3 Missing and 3 partials ⚠️

📢 Thoughts on this report? Let us know!

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@chopratejas chopratejas merged commit da54d4a into chopratejas:main Apr 22, 2026
14 of 15 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