Skip to content

EventStore(max_events_per_stream=0) retains every event ID #5534

Description

@mikamikasuki

What happened?

`EventStore` documents `max_events_per_stream` as the maximum number of events retained per stream, but accepts zero without validation. When trimming the stream index, Python evaluates `event_ids[-0:]` as `event_ids[0:]`, which keeps the full list instead of removing all entries.

With `EventStore(max_events_per_stream=0, ttl=None)`, a local reproduction stored 20 events and retained all 20 event IDs. A control configured with a limit of five retained five. The default cap of 100 is unaffected.

Could the constructor reject non-positive values, or define and implement explicit zero-cap behavior? The current behavior silently permits unbounded per-stream index growth for a configuration that appears to set the maximum to zero.

### Example Code

```Python

```

### Version Information

```Text
- FastMCP main: `5baeacfe20eca735cb949564b4915f93a622b916`
- Python: 3.12.15
- OS: macOS 15.0.1 arm64
```

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working. Reports of errors, unexpected behavior, or broken functionality.httpRelated to HTTP transport, networking, or web server functionality.serverRelated to FastMCP server implementation or server-side functionality.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions