Repository navigation
Releases
v7.0.1
What's Changed
7.0.1 is the first patch of the 7.x line, and a security release: every 7.0 app
should take it. It changes no API, and nothing that compiled on 7.0.0 stops
compiling. Upgrading is a version bump. Two things change at the deploy: requests
that broke a rule unnoticed are now refused, and live rate-limit counters start
afresh once.
- Security
- An argument is validated through every value it carries. 7.0.0 validated
an argument only when its own type implementedValidate. A
Json<HashMap<String, Dto>>body or aVec<Option<Dto>>argument therefore
reached the handler with none of the DTO's rules run. Every edge now holds an
argument to the rules of every value inside it: HTTP, GraphQL, WebSocket, MCP
and the queue. - A rate-limit bucket is one unit and one caller, on every edge. These now
keep their own budgets: two verbs of one path, a query and a mutation of one
name, one event on two gateways, a tool and a prompt of one name. A WebSocket
connection's bucket is no longer shared across gateways, replicas or restarts.
(#14) - A reconnecting client no longer fills the in-memory store for every other
caller. Connections are counted in a table of their own. - The in-memory store's refusal, its
Retry-Afterand its eviction agree.
Retry-Afteris never zero while a bucket still refuses, and a caller can no
longer reset its own denial by minting fresh keys. (#14)
- An argument is validated through every value it carries. 7.0.0 validated
- Fixed
- A validation refusal keeps a field named
params, and says a list by
position. A list's failures that 7.0.0 filed under_tmp_validatornow sit
one level up, by position. (#13)
- A validation refusal keeps a field named
- Changed
- 6.1 receives no more fixes. The latest minor of 7.x is the one supported
line (Security policy).
- 6.1 receives no more fixes. The latest minor of 7.x is the one supported
Thanks to @HatemSaadallah for reporting #13 and #14, each with a reproduction.
Every entry, with its upgrading note, is in
changelog/7.0.md.
Full Changelog: v7.0.0...v7.0.1
v7.0.0
What's Changed
7.0 is a major release: the queue's, and the foundation every 7.x builds on. Every
edge runs one execution contract with its layers, HTTP speaks the http crate's
types on a server of nestrs's own, the lifecycle is ordered and open, a resource
opens once per named instance, and a driver, a port or a package has a seam of its
own. A 6.1 project upgrades in one pass: the ordered checklist is
Upgrading from 6.x to 7.0, and a queue on Redis
also moves its keys, as Upgrading queues from 6.x
lays out. Below are the headlines of each group; the changelog holds every entry a 6.1
caller, driver author or deployment can see, what breaks and why.
- Security first
- rustls 0.23.45 — a TLS 1.3 handshake message across a key change is refused
- A security header set under its 6.x key fails the boot naming its 7.0 key
- A refusal never quotes what the client sent
- …and 61 more
- The execution contract and its layers
- A handler's
Resultis known by its type at every edge, never by its name - WebSockets, GraphQL and MCP each dispatch one key to one method
- The kernel knows the unit a layer runs around:
UnitContext,Edge,Handler,Reflector,Posture,Peer - …and 32 more
- A handler's
- HTTP on the
httpcrate's types- The OpenAPI document types what a generated client reads, and its page loads nothing from elsewhere
- A route's document lists what its guards answer, read off the guards themselves
- A route's document says what it answers: the edge's statuses, and
2XXfor a status only the handler knows - …and 29 more
- The container, its boot and an ordered, open lifecycle
- Shutdown ends within a bound, and every backend call the framework awaits has one of its own
- Long-lived connections end at the shutdown signal, the standard way
- A contested declaration names both imports that made it
- …and 24 more
- Named instances
- A resource can be opened once per instance, each instance a type of its own
- A second Valkey is a named instance of the Redis connection
- Two values of one type are two types: string-keyed injection is removed
- Configuration and the driver recipe
- Every variable can be given as a file, and a family's variables carry the family as a level
- A variable nothing reads is reported at boot
- A
.envkey a config pinned in code shadows is named at boot - …and 19 more
- Real ports: the queue, Redis, scheduling, rate limiting, storage
- The queue port: a push names its job, a retry backs off, and a backend says what it honours
- The Redis queue runs on Redis Streams, every transition one fenced script
- The Redis connection is the connection, and a command Redis never answers fails within the budget
- …and 13 more
- Data and effects
- A unique violation is a 409, read once for every edge
- A savepoint is one call:
nest_rs::database::atomic - Every edge runs its unit of work through one port,
nest_rs::database::UnitOfWork - …and 22 more
- Authentication, authorization and OAuth
- An HMAC secret is held to its hash's size, a key is judged once, and the config is
AuthnConfig - An identity store or provider that does not answer is a 503, with its Retry-After
- A resource server verifies an external issuer's tokens against its JWK Set
- …and 32 more
- An HMAC secret is held to its hash's size, a key is judged once, and the config is
- Observability
- Every edge files a unit cancelled and a unit that panicked
- A unit's span says how it ended, and a request cut before it answers keeps its route
- A failure its caller earned sets no error on the server's span
- …and 35 more
- Seams and semver hygiene
- Every impl-half decorator reads a method with one grammar
- Every value refusal opens with the decorator and the key
- Tier 1 holds what a developer writes, each item at one path
- …and 18 more
- The CLI, the testing kit, the demo and the docs
- The demo follows 7.0
- The demo's password hash never prints
- A new project's committed
.envnames no plaintext URL - …and 21 more
- Manifests, CI and the rules
- 7.0 builds on Rust 1.100
- Each capability builds alone, and the crates kept past the freshness bar are on the record
- The rules are held by types, lints and behaviour tests
- …and 3 more
Every entry, with what breaks and why, is in changelog/7.0.md.
Full Changelog: v6.1.0...v7.0.0
v6.1.0
What's Changed
nestrs lint — a file's stem, read against what it declares
Every naming rule in architecture.md is derivable from a path: a module.rs
under redis/queue/ is a RedisQueueModule whatever it holds, so the
conformance suite reads the path and compares. One rule is not. Nothing about
principal.rs predicts Principal — only reading the file says whether the two
meet — and that rule is now a command:
nestrs lint
crates/features/src/desks/principal.rs
`principal` reaches none of `DeskOperator`
name the file from the type, or split it — a stem that reaches nothing
is a slot, and a slot fills
- One shape is refused, and only one: a stem that reaches nothing the file
declares. That file was named for a slot — "who acts", "what we pass around" —
rather than for a subject, and a slot has no admission test, so the next type
about that slot lands there too. It is ashared/folder at the scale of a
file, and it is invisible from outside: both names read perfectly well alone,
and only the pair is wrong. - Everything short of that passes, and the tolerance is deliberate. The
tighter test — the stem as the type's first or last word — reads well and is
false on a third of this framework: the shared word may come from the folder
(throttler/store.rsholdsRedisThrottler), an inflection is the same word
(scope.rsholdsScoped), an abbreviation is one too, and a file whose
principal export is a function is a namespace that owes no pairing at all
(queue/consume.rsexportsconsume::attempt). Files a table already names —
service.rs,controller.rs,registry.rs— are that table's business. - The rule shipped and the rule met are one symbol.
nest-rs-cligrows a
library target, andnest-rs-conformancecallsnest_rs_cli::lint::scanover
both workspaces instead of carrying a second implementation — which is how the
two would come to disagree with nobody positioned to notice. The reserved
vocabulary goes the same way:nest_rs_cli::reserved_words()derives it from
thearchitecture.mdthe CLI embeds, and the suite reads it from there rather
than re-parsing the markdown. - Declarations are read with
syn, not with a text scan. Apub struct
inside a template string is what a scan counts and a parser does not, and this
repo ships such strings. - It exits non-zero on a finding, so it belongs in CI. The scaffolded
lint
recipe runs it, behindnestrs run lint.
Nothing here is an install surface: nestrs is still reached with
cargo install --locked nest-rs-cli, and the library exposes only what a second
caller needs — lint and reserved_words.
Four files in this repo were named for a slot and now pair with what they hold:
nest-rs-throttler's rate.rs → throttle.rs (a private module; Throttle and
DEFAULT_THROTTLE are re-exported from the crate root as before), the demo's
audio/http/extract.rs → uploaded_audio.rs, and the hygiene crate's
HygieneLoaders → HygieneDataloaders, HygieneTier → HygieneWireTier.
dto, command and event join the reserved vocabulary as a singulars
row: they name role files, so a module wearing one makes every path ambiguous.
nestrs new dto and nestrs g feature event now refuse, as the plurals and the
edges already did.
The scaffold keeps one layout, and it is the workspace
Removed: nestrs new --standalone. It wrote a shape the rest of the CLI then
refused to serve — every generator resolves paths against crates/features/ and
wires the serving app's module.rs, so g feature, g resource, g auth,
g migration and the six adapters all failed inside a single crate with
not inside a nestrs workspace. A starter whose next command cannot run is not a
second layout, it is a dead end, and growing out of it was a documented page of
hand-moved files.
nestrs new writes one thing: crates/features/ for the domain, apps/* for
the binaries that serve it. A second workload is another nestrs new inside it,
never a second repository.
- The templates lose the standalone service, controller, manifest and
main,
and with them the{{service_use}}seam that existed only so one template
could serve two shapes. Dockerfileand.dockerignoreare no longer scaffolded. They shipped in
standalone mode alone, and a workspace image has to name which app it builds —
a decision the scaffold cannot make for you. The repo's own images are
unaffected and still hold their pins.nestrs infodrops the standalone row; outside a workspace it says so
plainly.
If you carry a crate scaffolded that way, nothing in it stops working — it is an
ordinary Cargo crate. The CLI page keeps the file-by-file move under Move an
existing crate into a workspace.
nestrs run test cov works on a project minutes old
The recipe shipped; the tool behind it did not, and coverage failed on a freshly
generated project. cargo-llvm-cov joins the first-run bootstrap beside
just, bacon and cargo-nextest — all of it at once, whichever recipe was
asked for, because a project's own recipes are forwarded without the CLI knowing
what they run. Whoever wants to pay nothing still has --no-bootstrap /
NESTRS_NO_BOOTSTRAP.
- A cargo subcommand is probed through its verb.
cargo-llvm-cov --version
answersexpected subcommand 'llvm-cov'and exits1, so a probe assuming the
bare flag would call an installed tool missing and reinstall it on every
nestrs run. The arguments are now read off the tool. llvm-tools-previewis pinned inrust-toolchain.toml— this repo's and
every scaffold's. It is not a crate and never lands on PATH, so the bootstrap
could not own it; andllvm-covreads a.profrawonly when it comes from the
LLVM that rustc itself was built with, which is exactly what following the
channelguarantees. A scaffold's copy now declaresclippyandrustfmt
as well — it pinned the channel alone, so those two were present only because
rustup's default profile installs them, andnestrs run lintworked on your
machine while failing on aminimalone.- On a toolchain installed outside rustup the file is inert — point
LLVM_COV
andLLVM_PROFDATAat your own binaries.
Also
- The docs site wears its own design. Logo, wordmark, favicon and social
preview redrawn; every code fence names the file it comes from; and above
1440px the layout caps and centres instead of stretching code blocks and tables
while the prose held its measure — a wide window buys margin, not a wider
column. architecture.mdgains the vocabulary-pairing rule, the reason ashared
crate is refused wherecoresurvives (a kernel is checkable: everything
composes on it and it composes on nothing), and the note that a pluralized
folder exists to carry several — one of a kind isdto.rs, notdtos/with a
single entry.resolve_start— the-p/ cwd fallback every path-taking command repeats —
moves up tocommands, one spelling for the four of them.nest_rs_core's hex codecs readas_chunks::<2>rather thanchunks_exact,
so the pair indexing is bounds-checked once at the split.
Full Changelog: v6.0.0...v6.1.0
v6.0.0
What's Changed
Ports & Adapters — three module shapes, and a variable is a path too
The framework now states what it is: Ports & Adapters, as practised — the
port owns the semantics, the adapter owns only the transport, a multi-backend
library is wrapped rather than abstracted, and the composition root has
three module shapes and no fourth. architecture.md carries the section;
naming.rs and units.rs in nest-rs-conformance keep it true.
- Three shapes.
<Vendor>Module::for_root(cfg)opens a resource —
SeaOrmModule(the pool),RedisModule(the connection).<Port>Module::for_root(cfg)
carries a capability's policy —ThrottlerModule,HttpModule.
<Vendor><Port>Modulebinds one to the other, bare unless it owns settings —
SeaOrmDatabaseModule,SeaOrmHealthModule,RedisQueueModule,
RedisThrottlerModule,RedisWorkerModule::for_root. A composition root reads:
SeaOrmModule::for_root(None), SeaOrmDatabaseModule, RedisModule::for_root(None), RedisQueueModule, RedisWorkerModule::for_root(None), ThrottlerModule::for_root(None), RedisThrottlerModule. - A
#[config]'s namespace is its stem — crate subject, then binding folders,
joined by__— exactly as its type is named.SeaOrmConfig→
NESTRS_SEAORM__*(NESTRS_DATABASE__*is gone: the universal convention
named neither the crate nor the type that parsed it);RedisConfig→
NESTRS_REDIS__*(NESTRS_QUEUE__*is gone);RedisWorkerConfig→
NESTRS_REDIS__WORKER__SHUTDOWN_TIMEOUT_SECS;NESTRS_THROTTLER__*and
NESTRS_SOCIAL__GITHUB__*unchanged.namespace_is_the_stemcompares segment
by segment. From a variable a reader finds the type; from a module, the
variable. nest-rs-seaormis the adapter that wraps sea-orm.SeaOrmModule::for_root
resolvesSeaOrmConfigand opens the one pool;SeaOrmDatabaseModuleis a bare
binding that installs the ambient executor (DbContext,WorkerDbContext)
and fails the boot namingSeaOrmModuleif the pool is absent.
SeaOrmDatabaseConfigandSeaOrmDatabaseSetupare gone;connect_from_env
resolvesSeaOrmConfig.nest-rs-redisis one connection and three bindings.RedisModule::for_root
opensRedisConnection;RedisQueueModule(bare) bindsRedisQueueProducer
asArc<dyn JobProducer>;RedisWorkerModule::for_rootowns
RedisWorkerConfig;RedisThrottlerModule(bare) declares the store.
RedisQueueConnection,RedisQueueConfig,RedisQueueSetupand
RedisThrottlerSetupare gone; the connection's events file on a
nest_rs::redistarget.- The throttler's policy lives in the port, its counters in the store.
ThrottlerStoreishitalone —default_limitis gone, and so are the
defaultarguments ofInMemoryThrottler::newandRedisThrottler::new;
the guard carries the default (ThrottlerGuard::new(store, default),
Throttle: Default).ThrottlerModule::for_rootbinds the in-process store as
an ordinary factory, soRedisThrottlerModulesupersedes it wherever it sits
inimportsand the app removes no line; two vendor bindings still contest
(BACKEND_REMEDY).provide_guardandresolveare no longer public seams. - The queue port owns the attempt.
nest_rs_queue::consume::{discover, attempt, Attempt}— discovery, the envelope, the trace, thequeue.jobspan, the panic
catch, the outcome classes, the events and the operation line — written once in
the port;RedisWorkeris a fetch loop that translatesAttemptinto apalis's
Abort/Failed. A second adapter copies nothing, and
a_unit_is_opened_only_by_the_crate_that_declares_itrefuses one that tries. - A factory may declare the factory output it reads.
ContainerBuilder::provide_factory_after,provide_factory_dyn_afterand
provide_declared_factory_aftername the type; the boot drains in dependency
order with queue order as the tie-break, soimports = [..]order is a
readability choice. A cycle isFactoryCycleError, naming the set. - Demo features inject
Arc<dyn JobProducer>; the CLI scaffold and.env
templates write_SEAORM__URL/_REDIS__URL;nest-rs-throttler's in-band
caller-bucket helpers are gated on the edges that use them.
The one guard that answers every transport lives at the root
AbilityGuard implements four of Guard's entries — check_http,
check_graphql, check_ws_message, check_mcp — and carries the four matching
marker traits, but it sat in nest-rs-authz/src/http/. A folder named for one
edge held the type that answers all of them, and the cost was never only the
path:
nest_rs::authz::http::AbilityGuardis nownest_rs::authz::AbilityGuard,
besidegateandchain— the crate's other transport-agnostic decision
points. Eachcheck_*arm is gated on its own feature.- A transport no longer turns on
httpto reach its own guard.graphql,
wsandmcpeach pull the guard's dependencies directly; a GraphQL-only app
used to enable the HTTP surface for a type it bound on resolvers. check_ws_messagecompiles underws, nothttp. Thehttpfeature
forwardednest-rs-guards/wsandnest-rs-wsfor exactly one method of one
misfiled file; both forwardings are gone, andgate::transport::WSdrops the
#[cfg(any(feature = "http", feature = "ws"))]that documented the anomaly.- In the product and in what the CLI scaffolds,
authz/http/is gone.
AuthzGuardisauthz/guard.rsandAuthzModuleprovides it, so
AuthzGraphqlModule,AuthzWsModuleandAuthzMcpModuleimportAuthzModule
rather than the HTTP adapter they never served.AuthzHttpModuleheld that one
provider and nothing else; everyimports = [.., AuthzHttpModule]becomes
imports = [.., AuthzModule].
A declaration is refused at the token that wrote it
The second refusal wave: what a decorator silently accepted, deferred to a
dependency's error, or worded for itself alone is now one sentence per
offence, worded once in nest_rs_codegen, spanned at the offending token,
with a trybuild snapshot per site — eighteen new snapshot pairs across eight
crates.
- A mount path has a grammar, and every decorator that takes one enforces
it.#[controller],#[gateway]and#[mcp]refuse a path that is
empty, not absolute, longer than 256 characters, carrying an empty segment,
or spelling a character RFC 3986 §3.3 does not allow in a segment —
percent-encoding included, deliberately: a mount path is written, not
received, so%2Fasks to mount an address the router will never match.
#[mcp]used to refuse only the empty string; the other two checked
nothing, sopath = "users"compiled and mounted. #[use_guards]on the impl half names the struct half. One sentence
from the pair itself — the struct half declares the host's access posture,
this half declares its operations — where GraphQL and MCP each had a drifted
wording of their own and#[routes]/#[messages]had nothing: the
attribute reached rustc ascannot find attribute `use_guards`with no
transport, reason or remedy named.#[force_guards]is refused the same
way, and a#[crud]impl inherits both.- A missing mandatory key shows what to write.
#[queue] requires `name` — write `name = "emails"`— one shape at ten sites in six crates, where
three verbs and three shapes had grown. - A method declaring two roles is refused naming both, on
#[hooks]
lifecycle phases,#[indicators]probes,#[scheduled]triggers, and MCP
roles — where it closes a real defect: a method carrying both#[tool]and
#[prompt]compiled, and the surviving second attribute was handed to rmcp
as an operation nobody declared. #[input]names the shape it cannot take. A tuple or unit struct used
to die insidevalidator's derive —Unsupported shape `one unnamed field`against a#[derive]line the developer never wrote. The refusal
now names the shape, the derive whose limit it is, and the enum/newtype
remedies.#[cron(tz = …)]is checked against the IANA time zone database at
compile time. The key is always a string literal over a closed name set,
so a typo was the one half of the attribute still deferred to a deployment
failure while the expression beside it was refused at expansion.
A 405 names what the route serves
RFC 9110 §15.5.6 makes Allow on a 405 a MUST, and the framework computed
the verb set at the declaration and discarded it at the mount — so poem's
MethodNotAllowedError rendered a bare status. #[routes] now registers
through nest_rs_http::MethodTable, which records each verb in the same call
that mounts it, so what is served and what is advertised cannot drift —
#[version]-narrowed routes included, each version advertising its own set.
HEADis advertised wheneverGETis — poem answers an unregistered
HEADby re-dispatching to theGETendpoint, so it is served.OPTIONS
never is: serving it would put an unguarded method-listing endpoint at
every route, so it is an owner question rather than a default.- Only poem's own refusal is rewritten. A handler that deliberately
answers405is stating something about its own resource and keeps its
response; an unrouted path stays a bare404— inventing anAllowthere
would turn every probe into a confirmation that something is there. - Self-mounting crates are the reported gap.
nest-rs-graphqlroutes by
method through poem directly, soPUT /graphqlstill answers a bare405;
MethodTableis public as the drop-in for it.
A timeout is the origin's own 503, and every header the framework knows is emitted or argued
Breaking, wire and API. Four correc...
v5.1.0
What's Changed
Every log line carries the trace context of the unit of work that emitted it
Behaviour change, both log formats. The correlation on a line is now read
from the ambient W3C trace context — trace_id, span_id, actor_id — and a
line carries no span attributes and no span names at all:
DEBUG features::posts: creating post title="hello" trace_id=01a01569ae687353bc034a9ee8bd8774 span_id=a3f7cc8bac648278 actor_id=01a0112ce24e75509be691162cbbab1f
{"timestamp":"…","level":"DEBUG","fields":{"message":"creating post","title":"hello"},"target":"features::posts","trace_id":"01a015…74","span_id":"39d4f2…54","actor_id":"01a011…1f"}It used to render the span scope, and that is a different question with a
different answer. A service runs under the HTTP request's span, so its every line
carried the request's http.request.method, url.path, client.address and
user_agent.original — the line stopped being about what the service did — and a
nested unit of work (an MCP operation inside a request, a job inside its enqueue)
printed one trace_id per level.
- The ids come from the kernel, not from a formatter's view of the span
stack.current_trace_id()/current_span_id()/current_actor_id()are
what the line prints, which is the same read application code does. That makes
the line self-contained however deep the nesting runs, and it reaches where a
span stack does not: a streaming body is polled after its handler returned, and
the framework re-installs the request around it. - Nothing here depends on an exporter. The trace context is a kernel
primitive, so a bare app logging to a terminal has it;nest-rs-opentelemetry
exports the same ids and installs the same two formatters, so an app's lines do
not change shape because it adopted or dropped the observability stack. - JSON puts
trace_id/span_id/actor_idat the top level of the
record rather than inside aspanobject. The rest of the envelope keeps
tracing-subscriber's keys —timestamp,level,fields,target,
filename,line_number— so a pipeline reading this output keeps reading it. - Span structure is untouched, and none of this was a defect in the trace:
nesting is whattracing-opentelemetrybuilds the exported tree from.
Two knobs moved and neither is silent: .event_format(…) replaces the Format
that with_file / with_line_number configure, so file:line is the
formatter's own source_location (still NESTRS_LOG_SOURCE_LOCATION), and ANSI
follows the writer as before. There is no variable that puts span state back on a
line.
Every edge files one line per unit of work
HTTP has always had an access log; no other edge did. Now a WS message, a socket
opening and closing, a scheduled tick, a queue job, an MCP operation and a
GraphQL subscription each file one line on the same nest_rs::access target,
carrying what the work was — plus duration_ms, and outcome
(ok / error / panic) everywhere a request's status does not already say it
better:
INFO nest_rs::access: tick ran provider="AudioTasks" method="enqueue_transcode" outcome="ok" duration_ms=101.901 trace_id=01a015a9252076e399f736a97ae90784 span_id=052e261668035200
INFO nest_rs::access: job ran queue="audio" processor="AudioProcessor::transcode" attempt=1 outcome="ok" duration_ms=33.733 trace_id=01a015a9252076e399f736a97ae90784 span_id=7bbcfc44c1f0c676
Those two lines are from two different binaries ninety seconds apart, and that is
the point: one query on nest_rs::access answers "what did this deployment do
and what failed" across every transport, and the ids join it to everything each
unit of work logged.
- It is the counterpart of a line carrying no span state. A span's
attributes are not part of a log record, so the identity of a unit of work has
to arrive as event attributes on a line the edge emits — otherwise the ids
say two lines belong together and nothing says what they were. - One target is the family's toggle.
NESTRS_LOG=info,nest_rs::access=off
silences all of them, so no edge grew a#[config]field — and thefor_root
seam that one would oblige — for a boolean the filter already answers.
NESTRS_HTTP__ACCESS_LOGstays: it predates the family and is an app's pinned
config rather than a deployment's filter. - A successful queue job is reported once, not twice: the
job okevent is
gone andjob ranreplaces it. The failure events keep saying why and no
longer restateelapsed_ms. nest_rs_core::operation_logholds the target, the outcome words and the
duration formula, and A new edge owes the same list now includes this line.- Two of the six lines were wrong until real output was captured, which is
the note worth keeping. The MCP line carried no ids at all: it is emitted
outside the scope the dispatch installs, so it now emits through the
correlation explicitly. And the GraphQL subscription line never fired — a
socket that is aborted rather than closed never completes its future — so it is
filed from aDropguard, the way HTTP's access log always has been. Neither
was visible to aLogCaptureassertion, because the ids are not fields of the
event; only rendering the line found them.
The HTTP access log stops spelling the ids itself
It wrote trace_id, span_id and actor_id as event fields while every line
already carried them, so text printed each twice and JSON put them in two
different positions. The body now re-enters the request's context (never its
span — the line is still nobody's child event) around filing, and the fields are
gone. Same for four WebSocket connection-lifecycle events, and for the authn
guard's authenticated line.
The scaffold e2e suite no longer races itself
nest-rs-cli's e2e compiles every scaffolded workspace into one shared
CARGO_TARGET_DIR, and nextest runs each test in its own process, so concurrent
builds raced on the fingerprints of shared dependencies. It surfaced as a
linker error on whichever generic crate lost — quote, proc-macro2,
libc — which names nothing about the cause and moved between runs, reading
exactly like a broken toolchain. .config/nextest.toml now puts that binary in a
max-threads = 1 test group: the shared directory keeps making the suite fast,
and nothing else in the workspace loses a core.
trace_flags, and one grammar for LOG_FORMAT
JSON records now carry trace_flags, the third field OpenTelemetry's log data
model names beside the two ids. Text does not, deliberately: a record joined
against an export needs to know whether the export exists, and a human at a
console never acts on a sampling bit.
LogFormat and the boolean env grammar are declared once, in
nest_rs_core::logging; nest_rs_opentelemetry::LogFormat is now a re-export of
it. They were two enums with two parsers and two build-profile defaults, which is
how an app's log shape could have come to change on adopting the exporter.
Full Changelog: v5.0.0...v5.1.0
v5.0.0
What's Changed
Correlation is W3C Trace Context, it lives in the kernel, and the homemade id is gone
A request, a WS message, an MCP operation, a queue job and a scheduled tick each
run under a W3C trace the framework starts or continues. trace_id names the
distributed operation, span_id names the unit of work inside it, and the pair
is readable from anywhere the framework carries work:
let trace = nest_rs::core::current_trace_id();
let span = nest_rs::core::current_span_id();
// `None` for an anonymous caller — absence is the answer, not a gap.
let actor = nest_rs::core::current_actor_id();Breaking. RequestId, current_request_id() and with_correlation() are
removed, the X-Request-Id and X-Trace-Id response headers with them, and
nest-rs-opentelemetry no longer has an http feature. No shims.
- The standard replaced a duplicate, and the argument is recorded. The old
request_idanswered exactly the questiontrace-idanswers, so the framework
carried two identifiers for one thing. Three defences were offered and the
specification retires all three: a forgeable inbound id is answered by the
spec's own restart trace mutation, not by a second identifier; the standard
needs 16 random bytes and aformat!, not an SDK; and a trace id sorts by time
if you choose bytes that do — ours are a UUID v7's, so the value is a
conformant trace id and an ordered UUID whose right-most 7 bytes still
satisfy therandom-trace-idflag. The deciding fact was the ecosystem's:
OpenTelemetry's conventions have no request-id concept, only
http.request.header.x-request-id— a captured header. It is now recorded as
exactly that, behind a trusted peer, and never decides what a request is called. traceparentis gated onNESTRS_HTTP__TRUSTED_PROXIES, the same list
X-Forwarded-Foris weighed against. It used to be honoured from any
caller, so a public client could file its requests into a trace of its choosing
and setsampledon traffic it generated — the denial-of-service surface the
specification names. From an untrusted peer the trace is now restarted, which
is what the spec defines a front gate to do, and the caller's claim is kept on
the span so nothing is lost.- The request side is implemented to the letter: version
ffrefused,
version00exactly 55 characters, a higher version still read as far as this
one understands, all-zero trace and parent ids refused, lower-case hex only,
andtracestateforwarded verbatim wherever the trace is continued — a
MUST whose breakage is invisible to us and fatal to whichever vendor's routing
rides in it. The response carriestraceresponse, the working group's form. - A queue job is a child of the enqueue.
traceparentandtracestate
travel in the wire envelope, so a worker running minutes later in another
binary appears under the request that enqueued it rather than beside it.
The parent/child relation is what a flat id could not express. actor_idis unchanged in spirit and now reachable. You still declare it
once on your principal;current_actor_id()reads it back anywhere the
framework carries work, and answersNone— never a sentinel — for an
anonymous caller. It remains an audit identity, never an authorization
input.
A unit of work ends when its answer ends, not when its handler returns
A streaming response — #[sse], a download, anything built over a Stream —
runs after its handler returned, on the connection task, and used to emit under
no span and no ambient context at all. Every event it logged was attributable to
nothing, and current_trace_id() answered None inside the developer's own
stream.
- The HTTP edge carries the request into that gap, re-installing it around
every body poll, and does so whateverNESTRS_HTTP__ACCESS_LOGis set to: a
config flag is a weaker condition than a crate, and a primitive true for short
responses and false for long ones reads as present exactly where a long
operation needs it. - The framing is unchanged, and that is load-bearing. The wrapper forwards
size_hint, so a fixed-length response still declaresContent-Length. A body
counter written over a byte stream turns every response in the framework
Transfer-Encoding: chunked, silently, and is invisible to any assertion made
before the response is written — so it is now read off the wire by a test. - Three more edges were in the same position and are closed with it: a
graphql-ws subscription socket, a WebSocket connection'son_connect/
on_disconnecthooks, and the GraphQL dataloader's spawned batches, which
carried the span but not the ambient context — so their events looked
correlated while every accessor inside answeredNone. - A socket inherits identity, never resources. A connection that outlives its
upgrade takes the trace and the actor and opens its own scope per message; it
does not pin the upgrade's.
The observability stack enriches spans; it no longer owns any
nest-rs-opentelemetry mints no identifier: its IdGenerator adopts the
kernel's, so the exported trace and the log lines name one request by one value
instead of two that nothing joins.
Breaking. The http feature and its per-request interceptor are removed. An
app that listed features = ["http"] on this crate drops the line; the umbrella's
http feature no longer forwards it.
- What the interceptor did now hangs off the span constructor. The remote
parent link and the sampler's verdict are seeded ontooperation_span!at
init, so they reach every edge — a queue job in a headless worker as much
as an HTTP request — instead of the one transport band an interceptor could
hang from. Attached there, a job continuing a trace out of an envelope had no
way to say so, and its exported span carried no causal edge to the enqueue. - A parent is announced remote only when it is. A queue job's parent ran in
another process; a WS message's and an MCP operation's ran in this one, and
claiming otherwise renders a network hop that never happened. otel.kindis required vocabulary, not a field a call site may add: it is
an argument ofoperation_span!, so an edge cannot ship unclassified and
export asinternalwhere a messaging view would never find it.- The access log belongs to
nest-rs-http. Method, path, status, duration,
client,trace_id,span_idandactor_idneed no collector, no exporter and
no propagator, so none is required for a deployment to answer what it did.
The span reports the route template, and names itself for it
http.route used to carry the path as addressed. A backend groups latency and
error rates on that field, so /users/01a0… there is one group per identifier
and no signal at all.
http.routeis now the matched template (/users/:id); the addressed path is
url.path, which is what the conventions mean by it.- The exported span is named
{method} {route}throughotel.name, because
tracingfixes a span name to a literal and one literal for every route
renders a whole deployment as a single line in a trace list. - A request that matched nothing is named by its method alone — the
conventions' own fallback, and deliberately not the URL: naming an unmatched
span after its path is how one scanner fills a backend with junk.
An MCP operation is its own unit of work
It used to re-enter the HTTP request's span, so under rmcp's default session mode
every operation in a session filed under the request that opened it and "what did
this tool call do" had no answer. Each dispatch now opens an mcp.operation span:
same trace, its own span id, the request's span as its parent — the shape
ws.message already had.
Also
- A WebSocket message refused for size is recorded. The client was told and
the operator was not, so a cap set too low looked from the outside exactly like
clients that stopped sending. nest_rs_testing::LogCapturecaptures spans, not only events —
expect_spanandspans(). Most of what the framework promises an operator
lives on the operation span, and a harness that could read only events could
assert none of it. A field declared and never recorded is absent there,
which is what makes arecordcall nobody wired assertable at all.- Correlation is a page of its
own, under Fundamentals rather than inside OpenTelemetry — the primitive is
unconditional, and documenting it in an optional section left a developer who
never installs an exporter with no path to it. - Minimum supported Rust is now 1.97 (was 1.96), moved in one sweep:
rust-toolchain.toml, all three workspacerust-versions (root,demo/, the
bench SUT), the three images, the publish workflow, and everythingnestrs new
scaffolds. 1.97.1 backports an LLVM fix for a miscompilation present since at
least 1.87 — every release profile here islto = "fat"on a single codegen
unit, which is the regime that bug reaches. The pin stays two-component:
1.97resolves to the newest patch at install time, so a fresh clone
takes the fix without anyone spelling it and a machine that installed 1.97.0
earlier takes it on the nextrustup update.manifests-ci.mdasserted that
these pins agree and nothing read it, sotoolchain_pins_agreenow does —
including the scaffold's toolchain file and Dockerfile, which the
manifest-shaped scan could never see. - A scaffolded project's
rust-versionis now read by the crates under it.
Generated members wroteversion.workspace = trueandedition.workspace = truebut never `...
v4.0.0
What's Changed
#[entity] — a schema serves as a subgraph, gated like everything else
NESTRS_GRAPHQL__FEDERATION serves the schema as an Apollo subgraph: the
federation directives are declared and the emitted SDL is the subgraph form —
@key present, _service / _entities stripped, as the spec requires. It is
one flag on a call this repo already makes; async-graphql =7.2.1 carries the
whole thing with no cargo feature and no new dependency, and the roadmap's
recorded reason for deferring it ("the dedicated schema tooling it would
reintroduce") was simply false.
The flag does not switch the surface on, and the boot is what makes it mean
anything. async-graphql serves _service and _entities as soon as one
entity resolver has registered its keys, whatever the builder was told — so
#[entity] plus federation = false would publish the schema's own SDL while
the config claimed otherwise, and the flag would be a comment. Declaring an
entity without the flag now fails the boot, naming the resolver.
So does claiming one key shape twice. An entity is addressed by @key
rather than by name, so the duplicate leaves nothing in the SDL but a doubled
@key while the router reaches whichever body linked first — access posture
included. The shape is the identity, not the type: Apollo lets a type carry
several @keys and async-graphql matches a reference against the shape, so two
resolvers keying Widget by id and by slug are both reachable and are not a
duplicate. Two claims on id are. And it is checked within a resolver as
well as across them — two #[entity] methods in one impl are one
registration, which is the arrangement a per-registration diff cannot see and
the way the mistake is easiest to write. The existing duplicate-operation check
was blind to all of it, an entity method contributing no field; it now reads the
key shapes out of the same scratch registry it already builds.
What it actually cost is a new operation role, and that is the whole of it.
_entities is a Query-root field the router calls with references —
{__typename, <key fields>} — for objects the client never named, so it is the
one operation whose posture is invisible from the document a client reads. Ship
it ungated and every @key-ed type is readable from outside every #[authorize]
in the schema, which is the Hard "no" list's first line. #[entity] therefore
takes exactly what a #[query] takes, through the same code path: the guard
chain, a mandatory #[authorize] / #[public], the argument pipes, the
response mask, and the GraphqlGuard bound on every guard bound at its site.
The @key is inferred from the resolver's own arguments, so #[expose] never
declares a federation key and the cross-transport declaration question never
arises.
One thing had to be built rather than switched on, and it is the half a
merged root loses silently: ContainerType::find_entity defaults to None, and
DiscoveredQuery merges its members by hand. A root that forwards only
resolve_field answers Entity not found to every reference, however many
entity resolvers the app wrote — a whole operation role missing with no field
missing. It now forwards both, under the same first-member-that-answers rule.
Seven refusals, each a named compile error with a trybuild snapshot. Three are
about the role: an #[entity] with no posture (whose sentence names why this
role is the worst one to forget), and #[entity] beside #[mutation] or
#[subscription] — a role, not a modifier, because _entities lives on the
Query root and no other root has one. Four are things a #[query] allows and
this cannot:
- A
Resultreturn is required. The guard chain is emitted only where a
denial has somewhere to go, so a bare-return operation silently has none. On a
#[query]that trade is visible in the document; an entity is reached for a
type the client never named, so a resolver-scope#[use_guards]compiled out
there shows up nowhere at all. bind = Serviceis refused. It answersNOT_FOUNDfor an absent row and
FORBIDDENfor a withheld one — right for a mutation subject the caller
named, an existence oracle on a field addressed by key.#[entity(key = "…")]is refused. The key is not the developer's to
declare, and it is the first thing someone arriving from Apollo reaches for.- A
#[graphql(...)]of its own is refused. async-graphql reads the first
one on a method and removes exactly one, so a developer's would silently take
the slot#[graphql(entity)]needs and the method would stop being an entity
resolver — reported, before this, as a leftover attribute against
#[operations]. There is no working spelling to redirect to, so the sentence
names the limit. asyncand at least one argument, reworded from async-graphql's own
refusals, which land on the#[operations]attribute naming a generated type
nobody wrote.
Deliberately absent: composition, and the demo is not a subgraph. Merging
subgraphs is the router's job and rover is a dependency this repo will not
take, so what ships is the subgraph half. And demo/apps/api leaves federation
off — _service cannot be switched off; disable_introspection does not
cover it and its field is unconditionally visible, so a subgraph publishes its
own SDL to whoever can reach it. The demo is a standalone API on a public
address with no router in front of it, so being one would publish its schema and
buy it nothing. demo/apps/api/schema.graphql is unchanged for that reason.
With it, ROADMAP.md's deferred section is empty and gone.
An #[sse] ceiling bounds its stream; its socket is a reported gap
SseSettings::respond composes the deadline into the response body, so it is
evaluated whenever that body is polled: no event is produced past the ceiling
at any rate a peer reads at, measured against a trickling client rather than
assumed. That is the stale-privilege window, and it holds.
What outlives it is the socket. Measured against a client that sent the
request and then read nothing: the server had ~1.6 MB queued for a peer taking
none of it, and hyper's connection task, its buffers and everything the stream
held stayed alive until that peer felt like reading.
Closing that from inside this crate was attempted twice and neither is sound,
which is why the gap is documented and witnessed instead. The only thing still
polled while a write is parked is the socket — and a socket does not know
which response its bytes belong to:
- Arming the connection for the stream's ceiling killed traffic that never asked
for a stream: on HTTP/1.1 keep-alive an ordinary request issued afterwards
died with zero bytes and no status line; on HTTP/2, where a browser
multiplexes an origin's whole traffic onto one connection, siblings died
mid-flight without even aGOAWAY. - Narrowing it to fire only on a parked write was worse, not better. A parked
write is ordinary TCP backpressure, not a peer that stopped reading: a
full-speed client downloading 4 MB over a connection that had once carried a
stream received 1 404 928 bytes under a declaredcontent-length: 4194304
— a protocol lie told to a well-behaved peer — while a stream small enough to
fit the socket buffer never parked at all and so was never bounded.
The information the control needs — which response is stalled — lives in the
body, which is precisely what stops being polled; poem 3.1 and hyper 1 expose no
per-response write deadline and no abort handle usable while parked. So the
ceiling stays what it is, sse::a_peer_that_stops_reading_still_holds_its_socket_past_the_ceiling
asserts the residual so it cannot be quietly reclassified as closed, and the
answer for now is poem's own Server::idle_timeout or the reverse proxy —
controls that do not need to know whose bytes are queued.
A commit that fails the same way every time no longer costs a retry budget
Per-job transactions above turned an unsettleable attempt into a failure, which
was right, and then classified every one of them as retryable, which was
not. A constraint checked at COMMIT — a deferred unique index, the shape whose
whole point is that it fires late — fails identically on every attempt. The job
therefore replayed its body once per unit of retry budget, including every
side effect that is not the database's (an HTTP call, an S3 write, a mail),
and dead-lettered anyway. #[process] already aborts on its three other
deterministic failures — an unsupported wire version, an undeserializable
payload, a missing provider — and did the opposite here.
The classification now comes from the database. CommitError::is_retryable_conflict
already existed and the HTTP interceptor already consulted it; the worker
context could not, because JobSettlement was a payload-free Copy enum and
run_in_job_context's unhonoured: fn() -> T was a bare function pointer with
nothing to capture. It carries an Unhonoured { reason, retryable } now, and a
LazyTransaction records the same verdict on the first failed statement, so
a poisoned transaction answers the question the same way a failed commit does —
the first is the one that aborted the transaction, and everything after it fails
with 25P02, which says nothing about why.
An in-doubt commit aborts, and that is the deliberate half. A connection lost
during COMMIT may have landed. Replaying it turns "may have written once" into
"wrote twice", so the framework re-attempts only what it knows rolled back —
which is exactly what keeps the default's promise standing: a PerAttempt job
needs no idempotency key because a retry has nothing left to repeat, and
transactional = false needs one because the t...
v3.1.0
What's Changed
An MCP endpoint aggregates several features
#[mcp(path = "/mcp")] used to mean this struct owns that URL. Hosts that
declare the same path now merge into one endpoint, so a product exposing several
domains over MCP keeps one mcp/ adapter per feature instead of folding them
into a single cross-domain host.
- Why it had to change. MCP namespaces tools per endpoint and every shipped
client config points at a single URL. One host per path therefore made the
framework's own layout rule — one adapter sub-folder, one<Feature><Edge>Module
per transport — impossible to follow for any product with more than one domain
to expose. That was a framework defect, and it is closed. - Nothing changes for a host. It stays a plain
ServerHandlerand never
learns that it shares. A path with a single host is served verbatim — the
merge only engages beyond one. - What merging means, per operation.
tools/list,prompts/list,
resources/listandresources/templates/listare the union of every host on
the path;tools/call,prompts/get,resources/read,tasks/*and custom
methods are routed to the host that owns the name;logging/setLeveland every
notification are broadcast; declared capabilities are unioned and protocol
versions intersected. - One new failure mode, and it fails boot. Two hosts on one path serving the
same tool name is a boot error naming the tool and both providers — MCP
addresses a tool by bare name within an endpoint, so the loser would silently
be unreachable, and which one lost would depend on registration order. - Distinct paths stay distinct. Grouping is by path, so an app that
deliberately serves two endpoints keeps their tool namespaces apart.
demo/apps/assistantmountsaudio+userson/mcpandpostson
/posts/mcp. - Module-gating is unchanged and structural: a host whose module the app does
not import contributes nothing, because metadata is attached fromregister. - New public surface on
nest-rs-mcp:McpHost(the object-safeServerHandler
view a host is merged through),CompositeHandler,McpHostMeta,hosts_on.
New onnest-rs-core:ContainerBuilder::attached_meta, the mid-build read of
the metadata index a surface needs to attach an aggregated mount exactly once.
The app names its MCP endpoint
An MCP endpoint is one server to every client that reaches it — the protocol
carries one serverInfo and one instructions, whatever the endpoint is made
of. That identity is now the app's to declare:
McpModule::endpoint(
McpEndpoint::new("/mcp", "acme-assistant", env!("CARGO_PKG_VERSION"))
.instructions("What this endpoint is for."),
)- This is the ecosystem's shape, not an invention: the TypeScript SDK creates
one server with its identity and registers tools onto it, and a FastMCP
parent "retains its own name and serves as the orchestrator" when it mounts
children. A#[mcp]host owns a feature, so on a shared path none of them can
speak for the endpoint. - Identity is declared; capabilities are observed. The declaration replaces
what it states —serverInfoalways,instructionswhen written — and can
never claim a capability no host serves. Omit the instructions and the hosts'
own are joined rather than dropped. - Optional and additive. A lone host that names itself is a complete server
and nothing changed for it. - Two boot
warns where the answer used to be silent: a shared endpoint
nobody declared reports its first host's identity (a function of
imports = [..]order), and an endpoint no one named at all reports rmcp's
own name and version —ServerInfo::newleaves the SDK's build identity in
place, so an unnamed nestrs endpoint has been introducing itself to clients as
rmcp. Both events carry the remedy. - Two boot errors: an identity declared for a path no
#[mcp]host serves
(a typo that would otherwise do nothing at all), and two declarations for one
path that disagree. - New public surface on
nest-rs-mcp:McpEndpoint,McpModule::endpoint,
McpSetup::endpoint,declared_endpoint.
The invariant behind it
A transport aggregates contributions from several providers onto one mount
point; owning a whole mount is the exception and has to be justified. Six
transports already honoured it. MCP was the exception and now aggregates; WS was
audited and keeps its per-gateway mount deliberately — nothing pushes a product
to share a socket path the way MCP clients push it to share a URL, and
cross-gateway fan-out is already WsServer<N>'s job.
A new project ships the architecture rules it is built on
nestrs new now writes AGENTS.md at the project root, plus a CLAUDE.md that
imports it. Both are committed, so the layout and naming conventions reach every
contributor — and every coding agent — without anyone having to look them up.
- Why the scaffold carries them. A tree of four files says nothing about the
fifth. A project that has to re-derive where a second service goes, or what to
call a provider that is not a service, derives it differently each time; the
conventions were reachable only by reading the framework's own repository. - What the file states. Four naming levels and the rule that none overflows
into the next (the project's name stops at the workspace); the two module files
and their two jobs, withmod.rs'spub uselist named as the export contract
the framework has noexportskey for; a three-question procedure for naming
any provider, since#[module]carries nocontrollerslist and the name is
therefore the only thing that says what a type is for; the role table; what
happens when a role repeats; and the structural words a module may not take. - One source, three readers. The text lives once, in
nest-rs-cli's templates: the CLI embeds it, this repository symlinks it into
.claude/rules/, and/architecture/restates its two tables under a docs-lint
check that fails when they drift. Two agent files were disagreeing about the
same rule before this; now they cannot. - Two shapes, one body. The crate-type table describes
apps/plus
crates/features, so it belongs to the workspace layout header and is absent
from a standalone project — doctrine about a layout the reader does not have is
worse than none. --env-prefixreaches the new files like every other artifact that names a
variable, and the span-target example is rooted at the crate that would emit
it: the shared feature library in a workspace, the app's own name standalone.
Documented — the conventions have a page
/architecture/ carries the model for a reader rather than for a generator, with
the reasoning the shipped file leaves out. It is promoted in llms.txt, so a
coding agent that finds the site reads the layout rules before anything else.
Full Changelog: v3.0.0...v3.1.0
v3.0.0
What's Changed
The env prefix is the deployment's, and it is one variable
2.1.0 made the prefix the application's, declared in source with
nest_rs::env_prefix!("ACME"). It is now the deployment's, set on the
process like everything else it governs:
environment:
NESTRS_ENV_PREFIX: ACME
ACME_DATABASE__URL: postgres://…Breaking. env_prefix! and EnvPrefixDecl are removed — no shim. A project
on 2.1.0 deletes its declarations and sets one variable instead.
- One write, and everything downstream follows. The link-time declaration
had to be repeated per binary — themigrationsandseedtools link neither
the feature crate nor each other — and a binary added later silently resolved
NESTRS_*against anACME_*cascade. A variable on the process reaches every
binary, every test and every container without being written anywhere twice,
and the CLI reads the same variable from its own environment, so
[workspace.metadata.nestrs] env-prefixis gone too: there is no second source
left to disagree. .envcannot carry it, and saying so is enforced. The prefix selects the
cascade, so a value inside that cascade arrives after it was needed. It would
have renamed nothing, silently;Environment::initnow aborts naming both
values instead.- A malformed value aborts on first read rather than falling back to
NESTRS— which would be just as wrong, and quiet. The shape is unchanged
(uppercase ASCII, digits, underscores, no trailing_); the check simply moved
from compile time to the first read. nestrs new --env-prefix ACMEnow writes the variable into the generated
JustfileandDockerfile— the processes the project starts — and the.env
cascade under the new names.nestrs doctorreports where the prefix came
from, and says plainly when the shell names none, because a project whose
deployment renames its variables looks untouched from a terminal that does not.NESTRS_ENV_PREFIXis spelled literally, joiningRUST_LOGand
NESTRS_NO_BOOTSTRAPas a name that is not the app's. It is the one name no
prefix can rename.
Existing apps that never renamed anything are unaffected: setting nothing keeps
NESTRS.
Fixed — a created Location named a path that was not the caller's
The Location a #[crud] create stamps was read off poem's
original_uri(), which the hyper path populates and Request::builder() does
not: the same route answered /orgs/<id> on the wire and /<id> under
TestClient, so an in-process witness failed on a route that was correct.
Reading uri() instead only moves the wrongness — a global prefix is mounted
with Route::nest, which strips itself off before the handler runs, so the
header would name a path that 404s on that very app.
The edge now captures the URI once, after canonicalization and before the
router sees it, and nest_rs_http::caller_path reads that capture — one value
in process and on the wire. A trailing slash resolves to the canonical spelling
rather than being echoed back, so a resource has one Location whichever
spelling was typed. nest-rs-http's global-prefix suite is the executed
witness for both.
Full Changelog: v2.1.0...v3.0.0
v2.1.0
What's Changed
The env prefix is the application's
NESTRS_ was a fixture; it is now a default. An app declares its own once and
every framework variable follows — ACME_ENV, ACME_LOG, ACME_HTTP__PORT,
ACME_DATABASE__URL:
nest_rs::env_prefix!("ACME");- A link-time declaration, not a setter. The prefix is read before anything
else —<PREFIX>_ENVselects the.envcascade,<PREFIX>_LOGconfigures
the subscriber beforemainhas built anything — so a setter would carry an
ordering rule nobody can verify.inventorymakes the declaration a fact
already true at the first read, wherever in the binary it is written.
Resolution caches into aOnceLock<&'static str>: no allocation added to any
path that was allocation-free. - It is a rename, not an alias. Once declared,
NESTRS_HTTP__PORTis inert.
A fallback would let a stale value silently win. - Every name is built from it, including the ones outside the
<PREFIX>_<DOMAIN>__<KEY>scheme:<PREFIX>_ENV, the three<PREFIX>_LOG*
variables, and the OpenTelemetry namespace.RUST_LOGkeeps its name — it is
the ecosystem's, not ours. - Error messages name the variable the operator actually has. Every
hardcodedNESTRS_AUTHN__SECRET-style literal in authn, redis, seaorm and the
test harness now goes throughnest_rs_config::var_name, the readerless
primitiveConfigService::var_namedelegates to. nestrs new <name> --env-prefix ACMEwrites the declaration, the.env
cascade under the new names, and a[workspace.metadata.nestrs] env-prefix
entry — which is hownestrs doctorandnestrs g authlearn the project's
names instead of assuming ours.doctorreports the prefix it resolved.
One declaration per generated binary: themigrationsandseedtools link
neither the feature crate nor each other, sonestrs run db upwould
otherwise resolveNESTRS_*against anACME_*cascade.- Compile-time shape check (uppercase ASCII, digits, underscores, no
trailing_), and two conflicting declarations in one binary abort at boot
naming both sites.
Existing apps are unaffected: declaring nothing keeps NESTRS.
Full Changelog: v2.0.0...v2.1.0