Document the 1024-PAT limit of the disabled-user PAT warning bound

Open
#54 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
76/100
Issue type
Documentation
Clarity
Clearly specified
Activity status
Active
Tech stack
fastapi, python

Research direction

Read the PAT warning description in docs/user-manual.md around lines 3643–3646, then inspect server/orcaster_server/pats/service.py and server/orcaster_server/auth/rate_limit.py at the referenced lines. Find the existing rate-limit tests and their fake-clock setup, then add coverage rotating through more than 1024 PAT ids. Done means the manual explains eviction and immediate logging on return, and the test confirms the accepted behavior without changing code.

Written by the indexing model from the issue text.

Description

documentation P3 server

Problem

When a disabled user's personal access token (PAT) is used, the server logs a warning. It is rate-limited by a KeyedBoundedWarning keyed by PAT id, with a 5-minute window and at most 1024 remembered PATs (server/orcaster_server/pats/service.py:54-64).

When a 1025th key arrives, the least recently used key is evicted and its pending count is flushed (server/orcaster_server/auth/rate_limit.py:362-378). A key that comes back after eviction opens a new window and logs at once. So with more than 1024 PATs in use at the same time, requests that rotate through them can produce up to one log line per request. No events are lost and memory stays bounded. Only log volume grows.

The user manual states the bound without that condition: "a warning (WARNING) per token at most every 5 minutes (per server process)" (docs/user-manual.md:3643-3646). That is wrong above 1024 tracked PATs.

Decision

The limit is accepted as it is. This issue does not change the code. It fixes the documentation and pins the current behavior with a test.

Proposed change

  1. Fix the manual: the 5-minute maximum per token holds only while at most 1024 PATs are tracked per server process. Above that, a token that was evicted logs again at once when it is used.
  2. Add a test with a fake clock that rotates through more than 1024 PAT ids (for example 1025) and asserts the current behavior: memory stays at 1024 keys, an evicted key flushes its pending count, and a returning key logs at once. The test comment states that this behavior is accepted.

Acceptance criteria

  • docs/user-manual.md says that the per-token 5-minute bound holds only with at most 1024 PATs tracked per server process, and what happens above that.
  • A test rotates through more than 1024 PAT ids and asserts the accepted behavior described above.
  • No code change: the warning text, its fields, the 1024 limit and the 401 response for a disabled user stay the same. Existing tokens keep working as before.
Dominant language
Python
Stars
0
Forks
0
Avg merge
1d 1h
Merged PRs (30d)
10

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from AInvirion/orcaster

All issues in AInvirion/orcaster

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.