Skip to content

Cache CelesTrak queries and persist retry cooldowns - #66

Merged
satyalyadav merged 4 commits into
mainfrom
fix/59-celestrak-cache
Nov 7, 2026
Merged

satyalyadav merged 4 commits into
mainfrom
fix/59-celestrak-cache

Conversation

@satyalyadav

@satyalyadav satyalyadav commented Nov 6, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Closes #59.

Reuse GP responses for two hours and SATCAT searches for twelve hours, including valid no-match responses. Persist cached data and shared cooldowns across restarts, with a 50 MiB response-data budget.

lookup
  return an unexpired cached response when available
  otherwise check the shared cooldown
  serialize the download and persist validated data

Temporary rate limits pause downloads for two hours. Service failures pause downloads for ten minutes. Any other non-200 response also pauses downloads: two hours for HTTP 403, ten minutes otherwise. Recovery happens on demand. Both Compose environments mount the cache volume and rotate MCP logs at three files of 10 MiB each.

Evidence

  • Before: repeated GP lookups downloaded the same data twice; the first cache regression failed on the HTTP request count.
  • After: 552 tests passed on Python 3.12.3 using OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1 apps/mcp-server/.venv312/bin/python -m pytest -q apps/mcp-server/tests in 118.55 seconds. Two existing dependency deprecation warnings remain.
  • Regression tests cover expiry, cold-interpreter persistence, concurrent requests and recovery, cached reads during a slow download, capacity, HTTP classification, safe app errors, and bounded diagnostics. HTTP and time are controlled; tests make no live CelesTrak data requests.
  • Review hardening: every non-200 response now starts a service-wide cooldown, and read-only cache errors fall through to the locked writer so a hot journal or empty cache file repairs itself. A 0-byte cache file regression test covers the repair path.
  • Both Compose configurations validate with the durable cache mount and log limits. Whitespace, Python compilation, and focused static checks pass.
  • Tool definitions and server instructions are unchanged, so the tool-schema behavioral-eval requirement does not apply.

Merge Danger

Door: two-way.

The cache holds disposable upstream data. Reverting the server and Compose changes rolls back the behavior. Merging to main follows the existing MCP image build and EC2 deployment workflow.

Blast Radius: CelesTrak.

Orbital-data and satellite-name lookups share the cooldown. Unexpired cached results remain usable. Unavailable or full cache storage stops new downloads and returns an app error. The 50 MiB response-data budget has additional bounded SQLite metadata and journal overhead. Capacity-failure metadata is capped at 1,024 query records; reaching that cap stops new misses until records expire, while cached results remain usable.

@satyalyadav
satyalyadav merged commit 74a642f into main Nov 7, 2026
1 check 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.

Cache CelesTrak queries to accommodate strict rate limit

1 participant