REPOSITORY CODING · MEDIUM
Queued packets obey strict FIFO
Queued packets obey strict FIFO. A blocked head cannot be bypassed by a smaller later packet. The complete application includes native models, services, repository projections, a working preview and visible acceptance cases. Preserve the other documented invariants and run bash test/run.sh.
traffic-shapingHierarchical token bucket traffic laboratory
Work through a real codebase.
Choose an environment, investigate the existing implementation and use the tests to check your change. Sign in to open a workspace; execution and Ono usage follow your plan’s allowances.
Task requirements and environments
Go · 55 minute session
- Refill with exact fractional carry across every tick, including ticks that do not create a whole token.
- Permit a packet exactly matching burst credit and discard excess refill above burst rather than retaining hidden credit.
- Queued packets obey strict FIFO. A blocked head cannot be bypassed by a smaller later packet.
- Debit every ancestor exactly once after checking the whole path, and reject parent cycles before simulation.
- Replay identical packet IDs without enqueuing again, reject changed bucket or size, and reject packets larger than an ancestor burst.
- At most eight buckets, sixty monotone integer-time events and byte bursts of at most 1000. Refill uses rational token units. Queued and drop modes are deterministic offline models; no network traffic is sent.