Skip to content

fix: honor speedtest result count with paginated API - #176

Open
laozhej wants to merge 2 commits into
TMHSDigital:mainfrom
laozhej:fix/160-speedtest-result-count
Open

laozhej wants to merge 2 commits into
TMHSDigital:mainfrom
laozhej:fix/160-speedtest-result-count

Conversation

@laozhej

@laozhej laozhej commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

What changed

homelab_speedtestResults({ count: 10 }) now requests up to ten results, newest first, from /api/v1/results instead of calling the single-result legacy endpoint with an ignored limit. The tool preserves the paginated JSON response, including its data array.

Configure HOMELAB_SPEEDTEST_TOKEN with a Speedtest Tracker API token that has results:read permission. Token and port settings support per-node overrides. Missing credentials and HTTP errors explain the required configuration; tokens are shell-quoted and redacted from error and dry-run output. Configuration examples and CHANGELOG are updated.

Why

Fixes #160. The request uses page[size] and sort=-created_at, matching the upstream controller and its JSON API paginator. Brackets are URL-encoded so curl does not treat them as glob syntax. The v1 API also requires Accept: application/json and bearer authentication.

Type

  • New MCP tool
  • New skill
  • New rule
  • Bug fix
  • Documentation
  • Other

Testing

  • cd mcp-server && npm run build && npm test passes: 626 passed, 10 live-Pi tests skipped
  • cd mcp-server && npm run typecheck passes
  • pytest tests/ -v --tb=short passes: 273 passed
  • Tested against a live Pi (not available; no live Speedtest Tracker instance used)

Focused handler tests pass. Nine fail against the original implementation. Coverage includes default/custom/maximum counts, newest-first requests, empty results, node-specific settings, missing credentials, HTTP/connection/timeout errors, shell quoting, and redaction in both dry-run and command-failure output. Request/response tests use mocked SSH; a local shell with stubbed curl verifies token quoting. Tested on macOS with Node 22.23.0.

Checklist

  • No secrets or credentials committed
  • CHANGELOG.md updated
  • README.md updated (MCP server configuration)
  • CLAUDE.md updated (not applicable; no new tools/skills/rules)

Prepared with OpenAI Codex assistance. The commit includes the required DCO sign-off.

@laozhej
laozhej requested a review from TMHSDigital as a code owner November 19, 2026 16:03
@github-actions github-actions Bot added documentation Improvements or additions to documentation mcp labels Nov 19, 2026
@laozhej
laozhej force-pushed the fix/160-speedtest-result-count branch from c496c30 to 79a9a40 Compare November 26, 2026 04:13
@TMHSDigital

Copy link
Copy Markdown
Owner

Thanks for rebasing. I merged #177, and that left #176 and #179 each conflicting on one CHANGELOG.md line. Could you rebase both onto main once more? #178 and #180 can rebase now too.


Generated by Claude Code

@laozhej
laozhej force-pushed the fix/160-speedtest-result-count branch from 79a9a40 to 8f98922 Compare November 27, 2026 06:03

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation mcp

Projects

None yet

Development

Successfully merging this pull request may close these issues.

speedtestResults ignores count: /api/speedtest/latest returns one result

2 participants