refactor(config): loadConfig returns an initialized LoadedFlatbreadConfig#208
Merged
tonyketcham merged 2 commits intoJul 18, 2026
Conversation
…nfig Make the config package the single owner of "a loaded, initialized config". loadConfig already called initializeConfig internally, but its return type claimed raw FlatbreadConfig, so downstream callers defensively re-initialized: codegen's CLI, watchAndGenerate's config-reload branch, and flatbread's loadFlatbreadConfig each ran a second initializeConfig over an already-initialized config. - loadConfig now returns ConfigResult<LoadedFlatbreadConfig>; the three redundant re-inits are deleted. - initializeConfig has exactly two call sites: the loader and FlatbreadProvider (the programmatic entry point that accepts raw config from user code). - Typed load errors (NoConfigFoundError, TooManyConfigsFoundError) surface without process exit; process.exit stays only in CLI wrappers. Test plan: new AVA unit tests in packages/config cover both error modes and assert a successful load returns an initialized (normalized) config. Full suite green: pnpm verify (lint + typecheck + build + 243 AVA + 52 vitest). Co-authored-by: Cursor <[email protected]> Change-Id: I0bf57aa7bf50e9bb90fcb3432d36349ac0c74ff3
Collaborator
Author
|
This pull request is part of a Mergify stack:
|
This was referenced Jul 17, 2026
Merged
Collaborator
Author
|
@Mergifyio queue |
Contributor
Merge Queue Status
This pull request spent 15 minutes 49 seconds in the queue, including 4 minutes 21 seconds running CI. Required conditions to merge
|
Base automatically changed from
stack/tonyketcham/feat/unified-watch-effort-graph/journaled-semantic-writer-effort-graph--4bd555ef
to
main
July 18, 2026 08:46
…graph/loadconfig-returns-initialized--0bf57aa7
tonyketcham
deleted the
stack/tonyketcham/feat/unified-watch-effort-graph/loadconfig-returns-initialized--0bf57aa7
branch
July 18, 2026 08:51
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Make the config package the single owner of "a loaded, initialized
config". loadConfig already called initializeConfig internally, but its
return type claimed raw FlatbreadConfig, so downstream callers
defensively re-initialized: codegen's CLI, watchAndGenerate's
config-reload branch, and flatbread's loadFlatbreadConfig each ran a
second initializeConfig over an already-initialized config.
redundant re-inits are deleted.
FlatbreadProvider (the programmatic entry point that accepts raw
config from user code).
surface without process exit; process.exit stays only in CLI wrappers.
Test plan: new AVA unit tests in packages/config cover both error modes
and assert a successful load returns an initialized (normalized) config.
Full suite green: pnpm verify (lint + typecheck + build + 243 AVA + 52
vitest).
Co-authored-by: Cursor [email protected]
Depends-On: #207