Skip to content

Naravel 0.2.0

Latest

Choose a tag to compare

@github-actions github-actions released this 13 Nov 20:47
· 509 commits to main since this release
60e6452

Added

  • Routing: IThrottleStore and ThrottleDecision, the store the throttle middleware counts attempts in (PDR-024, stage R31). The default store is the in-process limiter and throttle behaves exactly as before (counters per application instance, empty after a restart, same X-RateLimit-*, Retry-After and 429); registering your own IThrottleStore replaces it. No shared store ships yet: it follows in a separate package.
  • Routing: how throttle treats a registered IThrottleStore that fails (PDR-024, stage R31). A call that throws or takes longer than RoutingOptions.Throttle.StoreTimeout (default 250 ms) opens one breaker per store for Throttle.BreakerPeriod (default 5 s); in that time the store is not called and each policy's ThrottleFailureMode decides the request: DegradeToLocal (the default: this instance's in-process limiter with the policy's numbers), FailClosed (503 with Retry-After, set per policy with the new ConfigureThrottlePolicy overload) or FailOpen (no limit, explicit opt-in). After the period one request probes the store. A client that disconnects is not a failure, and no fallback decision admits it: under FailOpen a request whose client has already gone ends with the cancellation instead of being admitted (DegradeToLocal already ended it that way, and FailClosed refuses it). New counters on the Naravel.Routing meter: naravel.routing.throttle (policy, outcome) and naravel.routing.throttle.store_failures (policy, reason). The default in-process store has no timeout or breaker and behaves as before.
  • Routing.Cache: a new package, Naravel.Routing.Cache, with AddNaravelSharedThrottle(storeName): an IThrottleStore that counts the throttle middleware's attempts in a named Naravel.Cache store, so every application instance that uses the same store shares one quota (PDR-024, stage R31). One atomic ICacheStore.IncrementAsync call per request and no lock; the key is throttle:{SHA-256 of the partition key}:{window index}, so it has a fixed length and no client address in it. The window is aligned to the clock (floor(UtcNow / window)): a caller can use the limit on both sides of a boundary (up to twice the limit in a short time) and the instances need clocks within the usual NTP skew. Policies, throttle:login, the X-RateLimit-* headers and the 429 are unchanged, and a backend that is down or slow follows each policy's failure mode. The memory store is process-local, so it counts per process like the default. The package depends on Naravel.Routing and Naravel.Cache; Routing does not reference Cache. Nothing is released by this entry: a new package id and new Routing API need a version bump and a tag.
  • CI: .github/scripts/check-package-metadata.py fails a package with fewer than four tags, and .github/scripts/check-package-readmes.py fails a package whose README has a relative link or image (nuget.org does not render relative images, and a README cannot be corrected after the version is published). Both follow Microsoft's NuGet package guidance.
  • CI: .github/scripts/consumer-smoke.py installs every packed package into a consumer outside the repository the way a user does (Naravel.* from the packed files only, a fresh package cache), builds it, loads every Naravel assembly and runs the Naravel.AotSmoke program against the packages. It runs in the pack job, where a failure fails the build and so also stops a release; the manual workflow package-smoke.yml runs it against a version published on nuget.org, with an optional exclude list for packages that were added after that version (0.1.1 predates Naravel.Routing.Cache). Nothing else consumed a packed package before.
  • CI: .github/workflows/release-notes.yml creates the GitHub Release for each version tag from that version's section of this changelog (.github/scripts/release-notes.py, whose self-test the pins job runs), so every package's NuGet "Release notes" link leads somewhere. It runs when a tag is pushed and when main changes, where it also creates the release of any version tag that has none (the v0.1.1 tag predates it); pull requests get a read-only dry run. It is separate from the NuGet publish job and never edits an existing release.
  • CI: .github/scripts/check-doc-names.py reports names in README.md, docs/en and docs/nuget that the source does not define: an Add* method that no PublicAPI baseline lists, a dotnet add package Naravel.* id that no project under src/ has, and a configuration key (in a json block, a Section:Key path or a Section__Key variable) that no code reads. Microsoft, BCL and illustration names are listed with a reason in .github/scripts/doc-names.allow. It is report only (the findings go to the job summary and the step passes); --strict makes it fail. It checks that a name exists, not what it means.
  • CI: .github/scripts/check-api-shipped.py fails a version-tag build, and with it the publish, while any project's PublicAPI.Unshipped.txt still has an entry, and names each such project, so a release cannot go out with API that the baseline still calls unreleased (stage R33). It does not run on pull requests or on main, where those files hold the next release's work; its self-test runs in the pins job on every pull request.
  • Repository: README.md is now a short front page (banner, a Laravel-to-Naravel comparison, a runnable quickstart, the module table, status and links). The install matrix, the registration calls, the sample-app notes and every module's example moved, unchanged, to docs/en/getting-started.md, and docs/en/modules.md, and docs/README.md indexes every guide. No code or package content changed.

Changed

  • Docs: docs/en/foundation.md says how to avoid a driver being created after its manager was disposed (stop the callers first, let the factory stop on the token the manager cancels, do not let Dispose throw), and that the failure of the disposal of such a driver is not reported, which is intended (the owner's choice of 2026-11-10; AUDIT D-84, stage R32.T02). No code changes.
  • Repo: AGENTS.md now lists "never invent an API, a package or a configuration key; verify it in the code or the docs first" as hard rule 13, with the place to check each kind of name in this repository. The longer "Evidence before claims" section stays as the detail.
  • Docs: English is now the only maintained documentation language. The Persian guides, decision records, README.fa.md, ROADMAP.fa.md, CONTRIBUTING.fa.md and CODE_OF_CONDUCT.fa.md are removed (they stay in git history), roadmap/check.py fails if a localized file comes back or a maintained page links to a removed one, and AGENTS.md and the pull request template carry the new operating rules: source evidence for every API and example, links closed in the same change, a default pull request size, no weakened tests.
  • Docs: the module guides are being rewritten with complete, source-checked examples, the exact error messages and a testing section. Done so far: Naravel.Foundation, the database dialect contract, Naravel.Cache (a runnable memory-only quickstart, every operation with its return value, how BlockAsync waits and releases, creating an asynchronous-only store, an Errors section), Naravel.Events (a runnable quickstart, an Errors section including the queued-listener messages; the duplicate testing and example sections were merged), Naravel.Mail and Naravel.Notifications (a runnable quickstart each, an Errors section with the exact messages, copies and a sender of your own for a mailable), Naravel.Queue (a quickstart that runs on the memory driver with an in-process worker, an Errors section; the Redis walkthrough is kept as its own section), Naravel.Queue.Coordination (a quickstart that runs on the memory queue and the memory Cache, the names the middleware give to the Cache, an Errors section with the exact messages, and a Testing section with examples that are run), Naravel.Database (a quickstart on in-memory SQLite, an Errors section with the exact messages, a complete DatabaseFake example and a note on testing against SQLite in memory), Naravel.Pagination (one runnable quickstart with the three kinds of page that replaces the incomplete "complete example", an Errors section with the exact messages including the cursor ones, and a Testing section), Naravel.Filesystem (a runnable quickstart on a local disk, an Errors section with the exact messages, the archive example, and a Testing section with a complete StorageFake example; the old "Complete example" section is gone), Naravel.Routing (a runnable quickstart, an Errors section with the exact messages that says which mistakes are reported at startup, which only on the first request and which not at all, and a Testing section with a middleware test, a TestServer test and how to test an expired signed link; the Complete example is kept), Naravel.Scheduling (a runnable worker quickstart that needs no cache, an Errors section with the exact messages and the log lines of a failing run, and a Testing section with the guards under two fakes and a task that needs services; the Complete example is kept) and Naravel.Broadcasting (a runnable quickstart that needs no sign-in and no Events registration, and an Errors section with the exact messages, including what a client sees when the hub refuses and what is only logged, and a Testing section with the fake, a rule kept in a method and a hub test on TestServer). The DocsExampleTests.cs files in the Cache, Mail, Notifications, Queue, Queue.Coordination, Database, Pagination.EntityFrameworkCore, Filesystem, Routing, Scheduling and Broadcasting test projects run the new snippets and assert the documented messages.
  • Docs: the "Honest about guarantees" line of README.md no longer says that route throttling is always process-local. It is by default; the routing guide describes the shared store and what it does not cover.
  • NuGet metadata: Naravel.Notifications has five tags instead of three, so a search for notification channels finds it; the change ships with this version, because metadata cannot be edited after a version is pushed.
  • Repo: .gitignore ignores Python bytecode, and the two .pyc files that an earlier change committed by mistake are removed. The README check ignores fenced code with CommonMark rules (a four-backtick fence can show a three-backtick example).
  • NuGet package pages: every package page now has a Use section with the registration call, the configuration and a minimal example, so the page on nuget.org says how to start, not only how to install. Each name and configuration key was checked against the source and the public API baselines; the snippets are not compiled by CI.
  • NuGet package pages: the pages now share one at-a-glance layout so a visitor sees what a package is before reading any code: four badges (version, downloads, .NET 10, MIT), a one-line pitch, a facts table (install command, target, dependencies, providers or drivers), a short "What you get" list, the Use example as "Quick start", the related packages as a table and the links to the guide. All 36 pages under docs/nuget have it, Naravel.Foundation included (its page was its full guide, docs/en/foundation.md, until now; the guide is unchanged and the page links to it). The badges are images from img.shields.io, a host nuget.org allows.

Fixed

  • Routing: the throttle partition key could be the same for two different partitions. It joined the policy name, the endpoint and the subject with | and nothing else, so a policy or endpoint name that contains | could make two partitions share one counter (the endpoint a|b with the subject c and the endpoint a with the subject b|c counted together). Each of the three is now written as its length, a colon and the text (3:5:2|8:/limited|11:203.0.113.7), so the key can be read back in one way only. Policies and endpoints whose names do not contain | count exactly as before; IThrottleStore is not in a published version, so no stored counter is left under the old text (AUDIT D-87, stage R32).
  • Foundation: Manager did not notice some changes to a store's configuration, so it went on using the old driver: text moving between a key and a value or between a value and the next key (a Bar of b;Foo=a read the same as a Bar of b next to a Foo of a), a missing value becoming an empty one, or a change to the value of a store written as a single value. The fingerprint it compares on every configuration reload now writes each key and value with its length and includes the store's own value, so these changes rebuild the drivers.
  • Foundation: the synchronous Manager.Driver could wait for an asynchronous factory. It checked that the factory was synchronous and then read the factory again to create the driver, so a factory replaced by an asynchronous one in between (Extend, or a registration on the registry from another thread) was awaited on the calling thread, against the documented rule that Driver never blocks on an asynchronous factory. It now creates the driver through the registry's synchronous path, which reads the factory once, and throws the same InvalidOperationException as for an asynchronous-only driver that does not exist yet. An asynchronous caller that had joined that creation starts over and gets the driver of the new factory.
  • Foundation: disposing a Manager could leave its drivers undisposed. The manager cancels the token it passes to asynchronous factories, and a callback registered on that token that throws made the cancellation throw before any driver was disposed, after the cache was already emptied, so the drivers were lost and a second Dispose did nothing. The same held for a failure while detaching the manager's subscriptions to the registry and to option changes. Each failure is now kept, every driver is disposed, and one AggregateException reports them together with any driver's. Its message is now The manager did not dispose cleanly: one or more drivers, lifetime callbacks or subscriptions failed.
  • Foundation: Manager.DriverAsync could start a creation for a caller that had already cancelled. When the entry it waited on was a synchronous creation that found its factory replaced by an asynchronous one, the caller started over without looking at its token, and Task.WaitAsync returns a creation that has already finished even for a cancelled token, so a caller that had given up could be handed the driver. It now throws OperationCanceledException before starting over.

All Naravel packages share this version, for example Naravel.Foundation 0.2.0.