♻️ refactor(models): remove redundant burst field from Limit model#408
Merged
Conversation
) The `burst` field was the actual bucket ceiling while `capacity` went unused in bucket math. This collapses both into a single `capacity` field that serves as the bucket ceiling, simplifying the mental model. - Remove `burst` from Limit and `burst_milli` from BucketState - Remove `BUCKET_FIELD_BX` and `LIMIT_FIELD_BX` from schema - Rename `burst_milli` → `capacity_milli` in refill_bucket() - Replace `burst` with `refill_amount`+`refill_period_seconds` in exception dict - Update migration to map old burst → new capacity (ceiling preservation) - Update CLI, examples, aggregator, and all documentation Closes #406 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #408 +/- ##
==========================================
+ Coverage 91.76% 91.78% +0.01%
==========================================
Files 33 33
Lines 7333 7349 +16
==========================================
+ Hits 6729 6745 +16
Misses 604 604
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
The `per_second`, `per_minute`, `per_hour`, and `per_day` factory methods now accept an optional `burst` keyword. When set, `capacity` is set to `burst` while `refill_amount` stays at `rate`, allowing temporary spikes above the sustained rate. The CLI also supports `name:rate:burst` format (e.g., `-l tpm:10000:15000`). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…t_limit Cover the burst parsing path (name:rate:burst format) and the burst display branch (capacity != refill_amount) to satisfy patch coverage. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add inline period support to the -l/--limit flag: name:rate[/period][:burst] where period is /[N]sec, /[N]min, /[N]hour, or /[N]day. Defaults to /min when omitted, preserving full backward compatibility. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…over Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…n examples Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ning Reword --limit help text to use 'name:rate[/period]:burst' instead of 'name:rate[/period][:burst]' so mkdocs-autorefs does not interpret [:burst] as a Python cross-reference target in strict mode. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
sodre
added a commit
that referenced
this pull request
Feb 20, 2026
Align with the Limit model refactor (PR #408) that removed the redundant `burst` field — `capacity` now serves as the bucket ceiling. - Remove `burst` from LimitDecl (accept it in YAML for backwards compat, treating it as capacity override) - Stop writing `bx` attribute to DynamoDB in applier - Remove Burst from CFN template generation and handler parsing - Update docs to remove burst references from YAML examples Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
burstfield fromLimitandburst_millifromBucketState—capacitynow serves as the bucket ceiling (max tokens), which is whatburstwas actually doing in all bucket mathbxattribute from DynamoDB writes (bucket and config records); read path usesmax(cp, bx)fallback for backward compatibility with existing recordsrefill_bucket()parameter naming (burst_milli→capacity_milli), aggregator processor, CLI display, exception serialization, migration logic, examples, and all documentation-lflag:name:rate[/period][:burst]where period is/[N]sec,/[N]min(default),/[N]hour, or/[N]day— fully backward compatibleTest plan
uv run pytest tests/unit/— all unit tests pass with updated assertions (models, bucket, limiter, repository, CLI, exceptions, migrations, processor)uv run pytest tests/integration/— integration tests pass with LocalStackuv run pytest tests/e2e/— end-to-end workflows passhatch run generate-syncoutput matches committed sync filespre-commit run --all-filespasses (lint, type check, sync verification)Closes #406
Closes #410
🤖 Generated with Claude Code