Skip to content

feat: declare a paid tier's rate limits in a config file - #25

Merged
markramm merged 1 commit into
mainfrom
feat/configurable-limits
Oct 10, 2026
Merged

markramm merged 1 commit into
mainfrom
feat/configurable-limits

Conversation

@markramm

Copy link
Copy Markdown
Owner

What

A source's budget windows can be overridden per account:

# ~/.evidence-search/limits.conf   (or EVIDENCE_SEARCH_LIMITS_FILE)
courtlistener = 20/min, 250/hr, 1000/day

EVIDENCE_SEARCH_LIMITS takes the same text, ;-separated, and wins over the file. Limiter.policy() and the limits command both read the effective policy; limits marks an overridden source and says where the windows came from (windows_from in --json).

Why

The built-in policies encode what each source publishes for everyone. A CourtListener membership raises 5/50/125 to 20/250/1,000, and the limiter refused calls the account was entitled to.

Decisions

  • Windows only. Spacing, session caps and backoff are not overridable: they protect the source from us and no membership changes them.
  • An unreadable override raises (LimitsConfigError, exit 70) and never falls back. A typo that silently ran a paid account at the free rate, or the reverse, is the kind of quiet wrong answer this tool exists to prevent.
  • Unknown source names are errors, for the same reason.
  • Read on every call. The file is a few bytes; a long-lived process should not keep spending at a rate its operator has changed.
  • The test fixture points EVIDENCE_SEARCH_LIMITS_FILE at an empty path so a developer's own file cannot change what the suite asserts.

Tests

tests/test_limits_overrides.py, 13 cases: no override; file; variable over file; the limiter allows 20 and refuses the 21st; still stops at 5 without one; six malformed inputs raise; units and multiples; the limits command output. Full suite: 275 passed, 2 xfailed.

Independent of #24 (token file); the two touch different README passages.

🤖 Generated with Claude Code

…conf

The built-in policies encode what each source publishes for everyone. A
CourtListener membership raises 5/50/125 to 20/250/1,000, and the limiter
refused calls the account was entitled to. An override replaces a source's
budget windows only; spacing, session caps and backoff stay as built. An
unreadable line stops the tool, and 'limits' marks every overridden source.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@markramm
markramm merged commit 5711a68 into main Oct 10, 2026
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