@venizia/ignis-atlas 0.1.1-8 → 0.1.1-9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,56 @@
1
+ ---
2
+ title: Error Messages Fill Their Placeholders
3
+ description: "The error response's message fills each %{key} from normalized.args, so a client with no translation for the code shows readable text. normalized.text, Error.message and the log keep the template."
4
+ ---
5
+
6
+ # Changelog - 2026-10-11
7
+
8
+ ## Error messages fill their placeholders
9
+
10
+ <Badge type="tip" text="Enhancement" /> <Badge type="warning" text="Behavior Change" />
11
+
12
+ **In one line.** The response `message` of an intentional error is ready to show.
13
+
14
+ ```typescript
15
+ throw getError({
16
+ message: { text: 'Only %{available} left of %{variantId}.', code: 'stock.unavailable' },
17
+ messageArgs: { available: 2, variantId: 'V1' },
18
+ statusCode: 409,
19
+ });
20
+ ```
21
+
22
+ ```json
23
+ {
24
+ "message": "Only 2 left of V1.",
25
+ "normalized": {
26
+ "text": "Only %{available} left of %{variantId}.",
27
+ "code": "stock.unavailable",
28
+ "args": { "available": 2, "variantId": "V1" }
29
+ }
30
+ }
31
+ ```
32
+
33
+ Before, `message` was the raw template. A client that fell back to `message` for a code it could not translate showed `%{available}` to the user.
34
+
35
+ ## What changed
36
+
37
+ - **`message` is filled.** The error middleware replaces each `%{key}` with `String(args[key])` from `normalized.args`.
38
+ - **`normalized.text` keeps the template.** A client that translates `code` + `args` works unchanged. A `transform` still changes only `normalized.text`.
39
+ - **`Error.message` and the log keep the template.** An arg value stays in the `args` map, where the log redacts secret-shaped keys.
40
+ - **A missing arg stays as written.** Outside production, the middleware logs one warning that names the code and the missing keys. Production stays silent.
41
+ - **Only an intentional error is filled.** A validation, database or unexpected error writes its own text, and that text passes through unchanged.
42
+
43
+ A route error inside a Worker host goes through the same middleware, so it answers the same body.
44
+
45
+ ## Who is affected
46
+
47
+ - **A client that shows `message`.** It now shows readable text. No change needed.
48
+ - **A client or test that compares `message` with the catalog template.** Compare `normalized.text` instead, or expect the filled text.
49
+
50
+ ## Details
51
+
52
+ The fill runs in the response only. Filling `Error.message` too would print each value inline in the log line, outside the redacted `args` map.
53
+
54
+ **Files:** [`packages/kernel/src/base/middlewares/app-error/app-error.middleware.ts`](https://github.com/VENIZIA-AI/ignis/blob/main/packages/kernel/src/base/middlewares/app-error/app-error.middleware.ts), [`packages/kernel/src/base/middlewares/app-error/message.handler.ts`](https://github.com/VENIZIA-AI/ignis/blob/main/packages/kernel/src/base/middlewares/app-error/message.handler.ts)
55
+
56
+ See [Read the error response shape](/extensions/helpers/error/#read-the-error-response-shape) for the full response.
@@ -17,6 +17,7 @@ This section tracks the history of significant changes, refactors, and updates t
17
17
 
18
18
  | Date | Title | Type |
19
19
  |------|-------|------|
20
+ | 2026-10-11 | [Error Messages Fill Their Placeholders](./2026-10-11-error-message-placeholders) | Enhancement, Behavior Change |
20
21
  | 2026-10-09 | [Const Values Stay Literal](./2026-10-09-const-value-literals) | Bug Fix, Breaking Change |
21
22
  | 2026-10-07 | [HttpResponseReader Moves Next to the Server Contract](./2026-10-07-response-reader-in-kernel) | Enhancement |
22
23
  | 2026-10-07 | [A List Answers Extras Only When They Are Asked For](./2026-10-07-list-extras) | Feature |
@@ -13,6 +13,12 @@
13
13
  ],
14
14
  "releases": {
15
15
  "atlas": [
16
+ {
17
+ "version": "0.1.1-8",
18
+ "date": "2026-10-09",
19
+ "sha": "64d382a1",
20
+ "order": 1603
21
+ },
16
22
  {
17
23
  "version": "0.1.1-7",
18
24
  "date": "2026-10-07",
@@ -4339,6 +4345,12 @@
4339
4345
  }
4340
4346
  ],
4341
4347
  "kernel": [
4348
+ {
4349
+ "version": "0.2.1-6",
4350
+ "date": "2026-10-12",
4351
+ "sha": "c004a935",
4352
+ "order": 1605
4353
+ },
4342
4354
  {
4343
4355
  "version": "0.2.1-5",
4344
4356
  "date": "2026-10-07",
@@ -4672,6 +4684,17 @@
4672
4684
  ]
4673
4685
  },
4674
4686
  "changelogs": [
4687
+ {
4688
+ "id": "changelog:2026-10-11-error-message-placeholders",
4689
+ "file": "2026-10-11-error-message-placeholders.md",
4690
+ "date": "2026-10-11",
4691
+ "title": "Error Messages Fill Their Placeholders",
4692
+ "packages": [
4693
+ "kernel"
4694
+ ],
4695
+ "kind": "Enhancement",
4696
+ "order": 1604
4697
+ },
4675
4698
  {
4676
4699
  "id": "changelog:2026-10-09-const-value-literals",
4677
4700
  "file": "2026-10-09-const-value-literals.md",
@@ -629,7 +629,7 @@
629
629
  "specifier": "@venizia/ignis",
630
630
  "kind": "class",
631
631
  "file": "packages/kernel/src/base/middlewares/app-error/app-error.middleware.ts",
632
- "line": 87,
632
+ "line": 88,
633
633
  "signature": "class BaseAppErrorMiddleware extends BaseHelper implements IProvider<ErrorHandler>"
634
634
  },
635
635
  {
@@ -6472,7 +6472,7 @@
6472
6472
  "specifier": "@venizia/ignis",
6473
6473
  "kind": "type",
6474
6474
  "file": "packages/kernel/src/base/middlewares/app-error/app-error.middleware.ts",
6475
- "line": 25,
6475
+ "line": 26,
6476
6476
  "signature": "type TErrorLogFormatter = (opts: { error: unknown; messageCode?: string; extra?: Record<string, unknown>; includeStack?: boolean; maxStackFrames?: number; }) => string"
6477
6477
  },
6478
6478
  {
@@ -30413,7 +30413,7 @@
30413
30413
  "specifier": "@venizia/ignis-kernel",
30414
30414
  "kind": "class",
30415
30415
  "file": "packages/kernel/src/base/middlewares/app-error/app-error.middleware.ts",
30416
- "line": 87,
30416
+ "line": 88,
30417
30417
  "signature": "class BaseAppErrorMiddleware extends BaseHelper implements IProvider<ErrorHandler>"
30418
30418
  },
30419
30419
  {
@@ -32763,7 +32763,7 @@
32763
32763
  "specifier": "@venizia/ignis-kernel",
32764
32764
  "kind": "type",
32765
32765
  "file": "packages/kernel/src/base/middlewares/app-error/app-error.middleware.ts",
32766
- "line": 25,
32766
+ "line": 26,
32767
32767
  "signature": "type TErrorLogFormatter = (opts: { error: unknown; messageCode?: string; extra?: Record<string, unknown>; includeStack?: boolean; maxStackFrames?: number; }) => string"
32768
32768
  },
32769
32769
  {
@@ -349,6 +349,8 @@ interface ErrorResponse {
349
349
 
350
350
  There's no top-level `messageCode` - read `normalized.code`. `extra` never mirrors `messageArgs`; the resolved interpolation values live at `normalized.args`.
351
351
 
352
+ An intentional error's `message` has each `%{key}` filled from `normalized.args`, so a client can show it as is. `normalized.text` keeps the template for a client that translates `code` + `args`.
353
+
352
354
  **400 Bad Request:**
353
355
 
354
356
  ```json
@@ -266,7 +266,7 @@ const NOT_FOUND = MessageCode.build({ parts: ['core', 'user', 'not_found'] });
266
266
  | `ZodError` (validation) | 422 | the first issue's `params.code`, else its raw Zod code | that issue's message; per-field list in `details.cause` | never |
267
267
  | DB client error (SQLSTATE class 22/23/44) | 400 | `core.system_error` | a fixed, safe summary - never the driver's text | never |
268
268
  | Transient DB conflict (40001/40P01) | 409 | `database.conflict` | a fixed retry message | never |
269
- | `getError(...)` - intentional | its own | its own | its own | when the throw site attached `extra` or unknown keys |
269
+ | `getError(...)` - intentional | its own | its own | its own, with each `%{key}` filled from `normalized.args` | when the throw site attached `extra` or unknown keys |
270
270
  | Anything else | 500 | `core.system_error` | `Internal Server Error` in production; the raw message in development | never |
271
271
 
272
272
  Only the intentional branch reports what the throw site wrote. The other four **replace** the message - a driver error can carry SQL, schema, and constraint names. `normalized` is built from that replacement, so it can never leak what `message` just scrubbed.
@@ -277,7 +277,7 @@ The handler is fail-closed on environment. It exposes `stack` and `cause` in `de
277
277
 
278
278
  ```json
279
279
  {
280
- "message": "Only %{available} left of %{variantId}.",
280
+ "message": "Only 2 left of V1.",
281
281
  "statusCode": 409,
282
282
  "normalized": {
283
283
  "text": "Only %{available} left of %{variantId}.",
@@ -300,7 +300,9 @@ The handler is fail-closed on environment. It exposes `stack` and `cause` in `de
300
300
  > Note the two `details`. The inner one is context the throw site attached - it went through `extra`. The outer one is the middleware's own request info. They're unrelated despite sharing a name.
301
301
 
302
302
  > [!NOTE]
303
- > `message` and `normalized.text` are the same string, unless a `transform` deliberately makes them differ. `message` stays the raw text the throw site wrote. `normalized.text` is what a client shows. Most errors never set `transform`, so most of the time the two match.
303
+ > `message` is ready to show: the middleware fills each `%{key}` with `String(args[key])` from `normalized.args`. `normalized.text` keeps the template, so a client that translates `code` + `args` formats it itself. A `transform` changes only `normalized.text`.
304
+ >
305
+ > A key with no arg stays as written. Outside production, the middleware logs one warning naming the code and the missing keys. `Error.message` and the log line keep the template, so an arg value never leaves the redacted `args` map.
304
306
 
305
307
  ### Consume the error response from a browser client
306
308
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@venizia/ignis-atlas",
3
- "version": "0.1.1-8",
3
+ "version": "0.1.1-9",
4
4
  "description": "MCP server for IGNIS: search and read the wiki, changelogs and knowledge bundle by section, with citations. Bun-only, zero-dependency transport.",
5
5
  "homepage": "https://ignis.venizia.ai",
6
6
  "repository": {