@ontrails/core 1.0.0-beta.43 → 1.0.0-beta.46

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,28 @@
1
1
  # @ontrails/core
2
2
 
3
+ ## 1.0.0-beta.46
4
+
5
+ ### Patch Changes
6
+
7
+ - [`768cc79`](https://github.com/outfitter-dev/trails/commit/768cc79ca10947b8808b376e281e1a81131b4acc): Close missed projection vocabulary residue in Regrade internals and public
8
+ error-rendering guidance, and keep lifecycle-ambiguous governed identifiers in
9
+ the Warden review inventory instead of assigning them an unsafe automatic
10
+ target.
11
+
12
+ ## 1.0.0-beta.45
13
+
14
+ ### Patch Changes
15
+
16
+ - [`f9533a4`](https://github.com/outfitter-dev/trails/commit/f9533a4ef7392201c71d7f751361b4f7177eeacb): Keep public error projection shared and redacted while using transport-neutral CLI vocabulary and preserving safe topo diagnostics in structured output.
17
+
18
+ ## 1.0.0-beta.44
19
+
20
+ ### Patch Changes
21
+
22
+ - [`b1fbe57`](https://github.com/outfitter-dev/trails/commit/b1fbe574e6f44d1fecb5e3a000270955c0a77b7b): Publish Bun-validated package tarballs through an npm trusted-publishing adapter
23
+ binding, add exact repository metadata for each public workspace package, and
24
+ correct the native Bun release descriptor to its pack-only runtime boundary.
25
+
3
26
  ## 1.0.0-beta.43
4
27
 
5
28
  ### Minor Changes
package/README.md CHANGED
@@ -139,7 +139,7 @@ Dynamic classes:
139
139
  - `RetryExhaustedError` inherits category and surface codes from its wrapped `TrailsError`; retryable is always No.
140
140
  <!-- error-taxonomy:end -->
141
141
 
142
- Public surface renderings redact sensitive substrings before exposing a non-internal `TrailsError` message. Internal-category `TrailsError` instances and unknown native errors render with the generic message `Internal server error`; diagnostics and serialized payloads keep their useful structure while redacting messages, context, and stack strings.
142
+ Public surfaces share one redacted rendering contract before applying surface codes. Sensitive substrings are removed from non-internal `TrailsError` messages. Internal-category `TrailsError` instances and unknown native errors remain opaque: HTTP, MCP, and library boundaries use `Internal server error`, while CLI uses the transport-neutral `Internal error`. Diagnostics and serialized payloads keep their useful structure while redacting messages, context, and stack strings.
143
143
 
144
144
  The developer returns `Result.err(new NotFoundError(...))`. The framework maps it to the right code on every surface.
145
145
 
package/package.json CHANGED
@@ -1,6 +1,11 @@
1
1
  {
2
2
  "name": "@ontrails/core",
3
- "version": "1.0.0-beta.43",
3
+ "version": "1.0.0-beta.46",
4
+ "repository": {
5
+ "type": "git",
6
+ "url": "git+https://github.com/outfitter-dev/trails.git",
7
+ "directory": "packages/core"
8
+ },
4
9
  "files": [
5
10
  "src/**/*.ts",
6
11
  "!src/**/__tests__/**",
@@ -15,6 +15,13 @@ export interface ErrorDiagnosticsRendering {
15
15
  readonly stack?: string | undefined;
16
16
  }
17
17
 
18
+ export interface PublicErrorRendering {
19
+ readonly category: ErrorCategory;
20
+ readonly message: string;
21
+ readonly name: string;
22
+ readonly retryable: boolean;
23
+ }
24
+
18
25
  export const redactErrorString = (value: string): string =>
19
26
  errorRedactor.redact(value);
20
27
 
@@ -49,3 +56,32 @@ export const renderErrorDiagnostics = (
49
56
  ...(stack === undefined ? {} : { stack }),
50
57
  };
51
58
  };
59
+
60
+ /**
61
+ * Render an error through the shared public redaction policy.
62
+ *
63
+ * @example
64
+ * ```ts
65
+ * const rendering = renderPublicError(new NotFoundError('missing'));
66
+ * ```
67
+ */
68
+ export const renderPublicError = (error: Error): PublicErrorRendering => {
69
+ if (isTrailsError(error)) {
70
+ return {
71
+ category: error.category,
72
+ message:
73
+ error.category === 'internal'
74
+ ? INTERNAL_ERROR_PUBLIC_MESSAGE
75
+ : redactErrorString(error.message),
76
+ name: error.name,
77
+ retryable: error.retryable,
78
+ };
79
+ }
80
+
81
+ return {
82
+ category: 'internal',
83
+ message: INTERNAL_ERROR_PUBLIC_MESSAGE,
84
+ name: 'InternalError',
85
+ retryable: false,
86
+ };
87
+ };
package/src/index.ts CHANGED
@@ -63,11 +63,15 @@ export type {
63
63
  export {
64
64
  INTERNAL_ERROR_PUBLIC_MESSAGE,
65
65
  renderErrorDiagnostics,
66
+ renderPublicError,
66
67
  redactErrorContext,
67
68
  redactErrorStack,
68
69
  redactErrorString,
69
70
  } from './error-rendering.js';
70
- export type { ErrorDiagnosticsRendering } from './error-rendering.js';
71
+ export type {
72
+ ErrorDiagnosticsRendering,
73
+ PublicErrorRendering,
74
+ } from './error-rendering.js';
71
75
  export type {
72
76
  DiagnosticBase,
73
77
  DiagnosticSeverity,
@@ -9,14 +9,12 @@ import {
9
9
  codesByCategory,
10
10
  errorClasses,
11
11
  exitCodeMap,
12
- isTrailsError,
13
12
  jsonRpcCodeMap,
14
13
  statusCodeMap,
15
14
  } from './errors.js';
16
- import {
17
- INTERNAL_ERROR_PUBLIC_MESSAGE,
18
- redactErrorString,
19
- } from './error-rendering.js';
15
+ import { renderPublicError } from './error-rendering.js';
16
+
17
+ const CLI_INTERNAL_ERROR_PUBLIC_MESSAGE = 'Internal error';
20
18
 
21
19
  export const surfaceNames = ['cli', 'http', 'jsonRpc', 'mcp'] as const;
22
20
 
@@ -118,23 +116,14 @@ export const renderPublicSurfaceError = (
118
116
  surface: SurfaceName,
119
117
  error: Error
120
118
  ): SurfaceErrorRendering => {
121
- if (isTrailsError(error)) {
122
- const rendering = renderSurfaceError(surface, error);
123
- return {
124
- ...rendering,
125
- message:
126
- rendering.category === 'internal'
127
- ? INTERNAL_ERROR_PUBLIC_MESSAGE
128
- : redactErrorString(rendering.message),
129
- };
130
- }
131
-
119
+ const rendering = renderPublicError(error);
132
120
  return {
133
- category: 'internal',
134
- code: codesByCategory.internal[surfaceCodeKeys[surface]],
135
- message: INTERNAL_ERROR_PUBLIC_MESSAGE,
136
- name: 'InternalError',
137
- retryable: false,
121
+ ...rendering,
122
+ code: codesByCategory[rendering.category][surfaceCodeKeys[surface]],
123
+ message:
124
+ surface === 'cli' && rendering.category === 'internal'
125
+ ? CLI_INTERNAL_ERROR_PUBLIC_MESSAGE
126
+ : rendering.message,
138
127
  surface,
139
128
  };
140
129
  };