Skip to content

Commit bbaf5f4

Browse files
authored
Merge pull request #103 from RAprogramm/new_version
New version
2 parents a1dd292 + dca02e2 commit bbaf5f4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+7383
-1591
lines changed

CHANGELOG.md

Lines changed: 315 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,321 @@ All notable changes to this project will be documented in this file.
33

44
## [Unreleased]
55

6+
## [0.21.1] - 2025-10-09
7+
8+
### Fixed
9+
- Packed rarely used `AppError` context (source and backtrace slots) inside the
10+
boxed inner payload so the `AppResult` alias no longer triggers Clippy's
11+
`result_large_err` lint under `-D warnings`.
12+
13+
## [0.21.0] - 2025-10-08
14+
15+
### Added
16+
- Introduced typed `ensure!` and `fail!` macros as allocation-free alternatives
17+
to `anyhow::ensure!`/`anyhow::bail!`, complete with documentation and tests.
18+
19+
### Changed
20+
- Highlighted the new control-flow macros across the English and Russian
21+
READMEs and module documentation so adopters discover them alongside the
22+
derive tooling.
23+
## [0.20.8] - 2025-10-08
24+
25+
### Fixed
26+
- Classified Redis `BusyLoadingError` responses as `DependencyUnavailable` and
27+
preserved their retry advice in metadata so downstreams can distinguish cache
28+
warmup from client mistakes when the `redis` feature is enabled.
29+
- Serialized the serde_json syntax error position using the location reported
30+
by `serde_json::Error` to stay aligned with the upstream parser changes.
31+
- Guarded the tracing telemetry test with a process-wide mutex to prevent
32+
spurious race failures when the full feature suite runs the test harness in
33+
parallel.
34+
35+
## [0.20.7] - 2025-10-07
36+
37+
### Fixed
38+
- Replaced the remaining fallible `Status::try_from` conversions in the Tonic
39+
adapter tests with the infallible `Status::from` API so Clippy's
40+
`unnecessary_fallible_conversions` lint passes under `-D warnings`.
41+
42+
## [0.20.6] - 2025-10-06
43+
44+
### Fixed
45+
- Restored compilation on Rust 1.90+ by aliasing the infallible gRPC
46+
conversion error to `core::convert::Infallible` and re-exporting it without
47+
exposing the private `convert::tonic` module.
48+
49+
## [0.20.5] - 2025-10-05
50+
51+
### Changed
52+
- Rewrote the English and Russian READMEs to reflect the matured workspace, feature flags, telemetry flows and transport integrations introduced across the 0.20 releases.
53+
### Fixed
54+
- Promoted the gRPC converter to an infallible `From<Error>` implementation
55+
while retaining the `TryFrom` API via the new documented
56+
`StatusConversionError`, satisfying Clippy's infallible conversion lint.
57+
- Collapsed nested metadata guards in the Tonic adapter and reused borrowed
58+
booleans to silence Clippy without regressing runtime behaviour.
59+
- Simplified the `AppResult` alias test to avoid large `Err` variant warnings
60+
from Clippy's `result_large_err` lint.
61+
62+
## [0.20.4] - 2025-10-04
63+
64+
### Added
65+
- Implemented `FromStr` support for `AppCode` together with a lightweight
66+
`ParseAppCodeError` so RFC7807 responses and documentation examples can parse
67+
machine codes without bespoke helpers.
68+
69+
### Fixed
70+
- Removed the redundant `#![cfg(feature = "axum")]` attribute and tightened
71+
Axum, SQLx and Tonic integration tests to satisfy `-D warnings` builds.
72+
- Allowed attaching JSON details via `ErrorResponse::with_details` without
73+
tripping Clippy's `result_large_err` lint by documenting the intentional
74+
`AppError` return shape.
75+
76+
## [0.20.3] - 2025-10-03
77+
78+
### Fixed
79+
- Restored the Axum transport adapter in builds by wiring the `convert::axum`
80+
module into the crate graph and relaxing the tests to validate responses via
81+
`serde_json::Value` instead of requiring `ProblemJson` deserialization.
82+
- Hardened converter telemetry for Redis, Reqwest, SQLx, Tonic and multipart
83+
integrations by owning metadata strings where necessary and covering
84+
non-exhaustive enums so the crate compiles cleanly on Rust 1.90.
85+
- Reworked `ProblemJson` metadata internals to use `Cow<'static, str>` keys and
86+
values, preserving zero-copy behaviour for borrowed data while allowing owned
87+
fallbacks required by the updated converters.
88+
89+
## [0.20.2] - 2025-10-02
90+
91+
### Fixed
92+
- Restored compatibility with Rust 1.89 by updating gRPC, Redis, SQLx and
93+
serde_json integrations to avoid deprecated APIs, unsafe environment
94+
mutations and Debug requirements that no longer hold.
95+
- Added deterministic backtrace preference overrides for unit tests so
96+
telemetry behavior remains covered without mutating global environment
97+
variables.
98+
- Ensured config error mapping gracefully handles new non-exhaustive variants
99+
by falling back to a generic context that captures the formatted error.
100+
101+
## [0.20.1] - 2025-10-01
102+
103+
### Changed
104+
- Enriched converter metadata across `multipart`, `redis`, `reqwest`,
105+
`serde_json` and `sqlx` integrations to surface HTTP status details,
106+
retry-after hints and structured failure positions while keeping existing
107+
error categories intact.
108+
- Updated the Teloxide mapping to classify `ApiError::InvalidToken` as
109+
`Unauthorized` and hash potentially sensitive network error details before
110+
emitting telemetry.
111+
112+
### Tests
113+
- Extended integration tests to assert the new metadata fields, retry hints,
114+
and redaction policies covering the updated converters.
115+
116+
## [0.20.0] - 2025-09-30
117+
118+
### Added
119+
- Added a `Context::redact_field_mut` builder method to tweak metadata
120+
redaction policies in place before attaching additional fields.
121+
- Extended response tests to cover JSON serialization of redacted payloads and
122+
hashed metadata along with checks for the opt-in internal formatters.
123+
124+
### Changed
125+
- Verified `ErrorResponse` and `ProblemJson` serialization respects message and
126+
metadata redaction policies, ensuring secrets stay out of wire payloads while
127+
keeping diagnostic logging intact.
128+
129+
## [0.19.0] - 2025-09-29
130+
131+
### Changed
132+
- Reworked `AppError` storage to keep sources behind shared `Arc` handles and
133+
lazily capture optional `Backtrace` snapshots without allocating when
134+
`RUST_BACKTRACE` disables them.
135+
- Updated the `masterror::Error` derive and `ResultExt` conversions to forward
136+
sources/backtraces automatically under the new storage layout.
137+
138+
### Tests
139+
- Added regression coverage for chained error sources and conditional
140+
backtrace capture driven by the `RUST_BACKTRACE` environment variable.
141+
142+
## [0.18.0] - 2025-09-28
143+
144+
### Added
145+
- Added the `AppCode::UserAlreadyExists` classification and mapped it to RFC7807
146+
responses with the appropriate retry hint.
147+
148+
### Changed
149+
- Switched all integration converters in `src/convert/*` to build structured
150+
`Context` metadata before producing `Error` values, including HTTP status,
151+
operation, endpoint, duration and retry/edit flags.
152+
- Extended integration tests to validate the enriched metadata, retry behavior
153+
and error code/category mappings across the updated converters.
154+
155+
## [0.17.0] - 2025-09-27
156+
157+
### Added
158+
- Per-field redaction metadata via a new [`FieldRedaction`] enum, default
159+
heuristics for common secret keys (passwords, tokens, card numbers) and the
160+
`Context::redact_field` / `AppError::redact_field` helpers.
161+
- `#[masterror(redact(fields(...)))]` support in the derive macro to configure
162+
metadata policies alongside message redaction.
163+
- Opt-in internal formatters for [`ErrorResponse`] and [`ProblemJson`] that are
164+
safe to use in diagnostic logs without additional serialization boilerplate.
165+
166+
### Changed
167+
- Problem JSON and legacy `ErrorResponse` serialization now hash, mask or drop
168+
metadata according to per-field policies while honoring the global redaction
169+
flag.
170+
- Redaction-aware conversions ensure redactable messages fall back to the error
171+
kind across HTTP and gRPC mappings.
172+
173+
## [0.16.0] - 2025-09-26
174+
175+
### Changed
176+
- Switched the internal `AppError` source storage to `Arc<dyn Error>` and added a
177+
shared `with_source_arc` helper so conversions can reuse existing `Arc`
178+
handles without extra allocations.
179+
- Replaced the backtrace slot with an `Option<Backtrace>` managed through an
180+
environment-aware lazy capture that respects `RUST_BACKTRACE` and avoids
181+
snapshot allocation when disabled.
182+
- Updated the `masterror::Error` derive and `ResultExt` conversions to forward
183+
sources using the new shared storage while preserving error chains.
184+
185+
### Tests
186+
- Added regression coverage for the `std::error::Error` chain, `Arc` source
187+
preservation in the derives, and conditional backtrace capture driven by the
188+
`RUST_BACKTRACE` environment variable.
189+
190+
## [0.15.0] - 2025-09-25
191+
192+
### Added
193+
- Introduced a `response::problem_json` module with an RFC7807 `ProblemJson`
194+
payload that serializes metadata, gRPC mappings and retry/authentication
195+
hints while respecting the message redaction policy.
196+
- Added an optional `tonic` feature exposing `TryFrom<Error> for tonic::Status`
197+
with sanitized metadata and canonical gRPC code mapping.
198+
- Published a compile-time `CODE_MAPPINGS` table mapping each `AppCode` to
199+
HTTP, gRPC and problem type information for reuse across transports.
200+
201+
### Changed
202+
- Updated Axum and Actix integrations to emit `application/problem+json`
203+
bodies, attach `Retry-After`/`WWW-Authenticate` headers automatically and
204+
avoid leaking redactable messages or metadata.
205+
- Re-exported `ProblemJson` from the crate root alongside `ErrorResponse` for
206+
direct construction in custom handlers.
207+
208+
### Tests
209+
- Added unit coverage for the problem+json metadata sanitizer, header
210+
propagation in Axum, and gRPC code mapping under the new `tonic` feature.
211+
212+
213+
## [0.14.1] - 2025-09-25
214+
215+
### Changed
216+
- Boxed the internal `AppError` payload inside a new `ErrorInner` allocation,
217+
keeping public field access via `Deref` while shrinking the error to a
218+
pointer-sized handle that shares metadata, retry hints, and backtrace state.
219+
220+
### Removed
221+
- Dropped `clippy::result_large_err` allowances in response helpers and tests
222+
now that `AppError` is pointer-sized and lint-clean without suppressions.
223+
224+
### Fixed
225+
- Removed the unused `BacktraceSlot::get` helper to restore builds with `-D warnings`.
226+
- Simplified the metrics recorder test harness with dedicated types to satisfy
227+
`clippy::type_complexity` without sacrificing coverage.
228+
229+
## [0.14.0] - 2025-09-24
230+
231+
### Added
232+
- Introduced optional `tracing`, `metrics` and `backtrace` features. When
233+
enabled they emit structured `tracing` events, increment the
234+
`error_total{code,category}` counter and capture lazy [`Backtrace`] snapshots
235+
from a new `AppError::emit_telemetry` hook.
236+
237+
### Changed
238+
- Reworked the `AppError` core to emit telemetry exactly once, track dirty
239+
mutations and expose a crate-private `new_raw` constructor for contexts that
240+
enrich errors before flushing instrumentation.
241+
- Updated Axum and Actix integrations to rely on the telemetry hook instead of
242+
manually logging errors while preserving backward-compatible APIs.
243+
244+
### Tests
245+
- Added tracing dispatcher coverage to assert a single telemetry event with MDC
246+
propagated `trace_id` values.
247+
- Installed a deterministic metrics recorder in unit tests to confirm
248+
`error_total` increments once per error.
249+
250+
## [0.13.1] - 2025-09-23
251+
252+
### Fixed
253+
- Documented allowances for `clippy::result_large_err` on APIs that intentionally
254+
expose the rich `AppError` payload, restoring lint-clean builds.
255+
256+
## [0.13.0] - 2025-09-23
257+
258+
### Added
259+
- Introduced `#[derive(Masterror)]` and the `#[masterror(...)]` attribute to
260+
convert domain errors directly into [`masterror::Error`] while capturing
261+
metadata, message redaction policy and optional transport mappings.
262+
- Added transport mapping descriptors in `mapping::{HttpMapping, GrpcMapping,
263+
ProblemMapping}` generated by the new derive for HTTP/gRPC/problem-json
264+
integrations.
265+
266+
### Changed
267+
- Re-exported the `Masterror` derive from the crate root alongside the existing
268+
`Error` derive.
269+
270+
### Documentation
271+
- Expanded crate docs and both READMEs with `Masterror` examples, telemetry
272+
guidance and redaction policy notes.
273+
274+
### Tests
275+
- Added integration tests and trybuild coverage exercising the
276+
`#[masterror(...)]` attribute and generated mapping tables.
277+
278+
## [0.12.1] - 2025-10-30
279+
280+
### Added
281+
- Introduced the `Context` builder for enriching error conversions with
282+
metadata, caller tracking, and redaction hints via `ResultExt::ctx`.
283+
- Implemented the `ResultExt` trait to wrap fallible operations into
284+
`masterror::Error` without extra allocations while merging context fields.
285+
286+
### Documentation
287+
- Added rustdoc examples showcasing `Context` chaining and the new
288+
`ResultExt` helper.
289+
290+
### Tests
291+
- Added unit coverage for `ResultExt::ctx`, ensuring happy-path results pass
292+
through and error branches preserve metadata and sources.
293+
294+
## [0.12.0] - 2025-10-29
295+
296+
### Added
297+
- Introduced typed `Metadata` storage with `Field`/`FieldValue` builders and helper functions in `field::*`.
298+
- Captured error sources and backtraces inside the new `app_error::Error` container, exposing `MessageEditPolicy` to control redaction.
299+
300+
### Changed
301+
- Replaced the legacy `AppError` struct with the richer `Error` model carrying `AppCode`, metadata, retry/auth hints and transport policy.
302+
- Updated response mapping and constructors to preserve machine-readable codes without extra allocations.
303+
304+
### Documentation
305+
- Refreshed crate docs, README (EN/RU) and examples to highlight metadata helpers and the new error contract.
306+
307+
### Tests
308+
- Added regression coverage ensuring codes, metadata and sources survive conversions without unnecessary cloning.
309+
310+
## [0.11.2] - 2025-10-28
311+
312+
### Changed
313+
- Surfaced the [`AppErrorKind`] display text as the fallback `ErrorResponse`
314+
message so clients receive semantic descriptions without providing a custom
315+
message.
316+
317+
### Tests
318+
- Added regression coverage ensuring bare `AppError` kinds map to their
319+
corresponding default message.
320+
6321
## [0.11.1] - 2025-10-27
7322

8323
### Documentation

0 commit comments

Comments
 (0)