Skip to content

Conversation

@andreatanky
Copy link

@andreatanky andreatanky commented Sep 7, 2025

Summary

  • Introduces a new exercise that implements a fixed-window, per-key rate limiter with an injected monotonic time source.
  • Adds canonical tests and specifications.

Details

  1. Added: exercises/rate-limiter/canonical-data.json
    Property: rateLimiter
    Input: limit (int), windowMillis (int), operations (array)
    Operations:
    {"op":"allow","key":string} → produce a boolean in order
    {"op":"advance","millis":int} → advance the simulated clock
    Covers: within-window allowance, window reset, per-key independence, exact boundary semantics, multi-window behavior, and invalid configs (limit<=0, windowMillis<=0).

  2. Added: exercises/rate-limiter/instructions.md
    Describes fixed-window semantics, per-key counters, boundary handling, and a suggested API with an injectable TimeSource to avoid sleeps in tests.

  3. Added: exercises/rate-limiter/introduction.md
    Provides context and motivation for rate limiting.

  4. Added: exercises/rate-limiter/metadata.toml
    Title and blurb for track integration.

Rationale

  • Teaches a practical systems concept with clear determinism by using an injected time source.
  • Fixed-window model keeps the exercise accessible and testable across tracks.

Discussion Link: https://forum.exercism.org/t/new-exercise-proposal-rate-limit/19109

@andreatanky andreatanky requested a review from a team as a code owner September 7, 2025 14:33
@github-actions
Copy link
Contributor

github-actions bot commented Sep 7, 2025

Hello. Thanks for opening a PR on Exercism 🙂

We ask that all changes to Exercism are discussed on our Community Forum before being opened on GitHub. To enforce this, we automatically close all PRs that are submitted. That doesn't mean your PR is rejected but that we want the initial discussion about it to happen on our forum where a wide range of key contributors across the Exercism ecosystem can weigh in.

You can use this link to copy this into a new topic on the forum. If we decide the PR is appropriate, we'll reopen it and continue with it, so please don't delete your local branch.

If you're interested in learning more about this auto-responder, please read this blog post.


Note: If this PR has been pre-approved, please link back to this PR on the forum thread and a maintainer or staff member will reopen it.

@github-actions github-actions bot closed this Sep 7, 2025
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