Skip to content

Commit 0b2f6b7

Browse files
author
settings-as-code-release
committed
refactor(errors): return typed problems as neverthrow Results across validation, config, fold, flows, and the library
Every failure outside the sections' API-call channel is now a member of one `Problem` union (src/problem.ts, discriminated on `code`) returned as a neverthrow `Result`/`ResultAsync` instead of a thrown domain error or a `{error: string}` shape. `describeProblem` is the one renderer; the action edge (`failRun`, `run()`) renders there, so every line the action prints, every output, summary, and exit code is unchanged (the e2e corpus is green as it was). Converted: `validateSectionShapes`, `validateSettingsDoc`, `mergeLayers` (the admission walk returns Results; the `LayerRefusal` throw and `describeRefusal` are gone, their prose lives in `describeProblem` as the `layer-*` cases under the same value-free invariant), `parseSettingsDoc`, `readSettingsFile` (now takes the file's role, which selects the advice), `readLayerFiles`, `foldLayers`, `runSingle`, `runMulti` (a `safeTry` async generator; `orTee` flushes the buffered central warnings on the fatal paths), `runMerge` (returns the finished merge; `concludeMerge` writes the summary), `parseConfig` (`safeTry`), `parseReposInput`, `parseRepoSlug`, `resolveCentralTargets`, `discoverRepos` (`ResultAsync.fromPromise`), `parseRecipient`, and the library's `validateSettings`. `isPlainObject` moves to src/plain-data.ts so the renderer and the fold share it; `quoteList` moves to src/problem.ts. `ARTIFACT_NEEDS_UPLOADER` is gone: `requireUploader` returns the `artifact-uploader-missing` problem and `openReportChannel`'s backstop throw renders it. `architecture.yml` gains the `problem` layer (edges from engine, flows, discovery, report, library; problem reads github and plain-data). Tests assert on `code` and the structured payload; test/problem.test.ts renders one specimen per member, typed over every code so a new member fails compilation until it has both a case and a specimen.
1 parent f0bc13c commit 0b2f6b7

57 files changed

Lines changed: 2201 additions & 1372 deletions

Some content is hidden

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

‎.github/scripts/changed-sections.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ export const ALL_SELECTING_PREFIXES = [
7777
"src/plain-data.ts",
7878
"src/private-open.ts",
7979
"src/private.ts",
80+
"src/problem.ts",
8081
"src/schema.ts",
8182
"src/types.ts",
8283
"test/e2e/",

‎architecture.yml‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ layers:
1818
report: [src/report/]
1919
schema: [src/schema.ts]
2020
io: [src/io.ts]
21+
problem: [src/problem.ts]
2122
types: [src/types.ts]
2223
plain-data: [src/plain-data.ts]
2324
private: [src/private.ts, src/private-open.ts]
@@ -34,12 +35,13 @@ exclude:
3435
edges:
3536
main: [action]
3637
action: [library]
37-
library: [discovery, engine, flows, github, io, report, schema, sections, types]
38-
flows: [discovery, engine, github, io, private, report, schema]
39-
engine: [discovery, github, io, plain-data, schema, sections, types]
38+
library: [discovery, engine, flows, github, io, problem, report, schema, sections, types]
39+
flows: [discovery, engine, github, io, plain-data, private, problem, report, schema]
40+
engine: [discovery, github, io, plain-data, problem, schema, sections, types]
4041
sections: [discovery, engine, github, schema, types, upstream-gaps]
4142
github: [io, plain-data]
42-
discovery: [github, private]
43-
report: [discovery, engine, github, io, private, schema, sections, types]
43+
discovery: [github, private, problem]
44+
report: [discovery, engine, github, io, private, problem, schema, sections, types]
45+
problem: [github, plain-data]
4446
schema: [sections, types]
4547
upstream-gaps: [types]

‎docs/reference/architecture.md‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@ graph TD
239239
report["src/report/"]
240240
schema["src/schema.ts"]
241241
io["src/io.ts"]
242+
problem["src/problem.ts"]
242243
types["src/types.ts"]
243244
plain_data["src/plain-data.ts"]
244245
private["src/private.ts<br>src/private-open.ts"]
@@ -250,6 +251,7 @@ graph TD
250251
library --> flows
251252
library --> github
252253
library --> io
254+
library --> problem
253255
library --> report
254256
library --> schema
255257
library --> sections
@@ -258,13 +260,16 @@ graph TD
258260
flows --> engine
259261
flows --> github
260262
flows --> io
263+
flows --> plain_data
261264
flows --> private
265+
flows --> problem
262266
flows --> report
263267
flows --> schema
264268
engine --> discovery
265269
engine --> github
266270
engine --> io
267271
engine --> plain_data
272+
engine --> problem
268273
engine --> schema
269274
engine --> sections
270275
engine --> types
@@ -278,14 +283,18 @@ graph TD
278283
github --> plain_data
279284
discovery --> github
280285
discovery --> private
286+
discovery --> problem
281287
report --> discovery
282288
report --> engine
283289
report --> github
284290
report --> io
285291
report --> private
292+
report --> problem
286293
report --> schema
287294
report --> sections
288295
report --> types
296+
problem --> github
297+
problem --> plain_data
289298
schema --> sections
290299
schema --> types
291300
upstream_gaps --> types

0 commit comments

Comments
 (0)