32 KiB
| title | type | status | date |
|---|---|---|---|
| refactor: collapse settings resolve indirection layer | refactor | completed | 2026-04-23 |
refactor: collapse settings resolve indirection layer
Overview
Delete fabro_config::Resolver, the per-*Settings *_into(&mut errors) methods, the private ResolvedSettingsTree in fabro-workflow, and the resolve_settings_tree free fn. Add a WorkflowSettings sibling to ServerSettings/UserSettings so workflow ops have one entrypoint. Standalone resolve_*_from_file helpers stay (single-namespace consumers depend on them) but get rewritten to not go through Resolver.
WorkflowSettings is workflow-only: { project, workflow, run }. It does NOT hold server or features — even though the per-request layer DOES carry features and a subset of server (storage, scheduler, artifacts, web, api) per materialize_settings_layer. Excluding them is an ownership choice: we want the live ServerSettings (resolved at server boot) to remain the single authority for deployment-level config, and we don't want a workflow-side parallel copy that can quietly drift. ServerSettings and UserSettings keep features because they're constructed from a complete owned settings layer at boot — they ARE the authority.
Today's lifted server_storage_root field on ResolvedSettingsTree was an asymmetric workaround for "create_run needs one server-ops field but has no access to live ServerSettings." The fix: create_run gains a storage_root: PathBuf parameter so the caller (which owns the live ServerSettings) supplies it. No more lifted server fields anywhere.
PR 2 (Combine trait + derive, uv pattern) is a separate, larger refactor — instructions in docs/plans/2026-04-23-002-refactor-combine-trait-uv-pattern-plan.md.
Problem Frame
Today three layers sit between SettingsLayer and consumer code:
Resolver(introduced in52d24531d) — cachesapply_builtin_defaultsacross multiple per-namespace resolves.*_into(&mut errors)methods onResolver— letServerSettings::from_layerandUserSettings::from_layeraccumulate errors across two namespaces.resolve_settings_tree+ResolvedSettingsTreeinfabro-workflow/src/operations/create.rs— bundles four namespaces forcreate_run.
Resolver exists only because create_run was running 4× apply_builtin_defaults(file.clone()) per request. It's a perf micro-fix dressed up as an API primitive. ResolvedSettingsTree is the missing WorkflowSettings sibling of ServerSettings/UserSettings — wrong crate, wrong name, asymmetric shape (lifts storage_root: InterpString instead of holding a full ServerNamespace).
Requirements Trace
- R1. Single entrypoint per consumer (Server/User/Workflow), each with
from_layer(&SettingsLayer) -> Result<...>. - R2. Multi-namespace error accumulation preserved —
*Settings::from_layermust surface errors from ALL its namespaces, not first-only. - R3. Standalone
resolve_*_from_filehelpers continue to work for single-namespace consumers (dozens of callers across the workspace). - R4.
WorkflowSettingsholds workflow-owned namespaces only (project,workflow,run).serverandfeaturesare excluded as an ownership choice — the liveServerSettingsis the single authority for deployment-level config, even thoughmaterialize_settings_layerdoes flowfeaturesand a subset ofserver.*(storage, scheduler, artifacts, web, api) through into the per-request layer.ServerSettingsandUserSettingsare constructed at boot from a complete owned settings layer and hold every namespace their consumer reads. Server-ops fields needed bycreate_run(today: juststorage.root) come from the caller as parameters, not from the bundle. - R5. No change to resolved-settings semantics or to persisted
Event::RunCreated.settingsshape.record.run_diris now derived from the newstorage_rootparameter, not fromrequest.settings.server.storage.rootas today. For the production HTTP caller (which passes the same resolvedserver.storage.rootit would have read from the liveServerSettings),record.run_dirmatches today's value. For directcreate()callers (test helpers, future API consumers) that pass a different path,record.run_dirwill reflect the parameter — that is the new invariant. The other consumer-visible changes are: (a)create_run's signature gains one parameter (R7); (b) the storage-root interpolation-failure error path moves from workflow-side to transport-side with different error text — see Risks. - R6. Workflow-settings resolution errors preserve
render_resolve_errorsformatting (today:;-joined).WorkflowSettings::from_layerreturnsResult<Self, Vec<ResolveError>>(matching theresolve_*_from_fileconvention) socreate_runkeeps formatting viarender_resolve_errors. R6 covers ONLY theresolve_*failure path insidefrom_layer— not the storage-root interpolation failure, which moves out ofcreate_runper R5. - R7.
create_run's signature gains astorage_root: PathBufparameter. Callers supply it from the live deployment context:fabro-serverreads it from its boot-timeServerSettings; tests pass a fixture path.
Scope Boundaries
- Out of scope: the Combine refactor (PR 2).
- Out of scope: migrating every
resolve_*_from_filecaller to a bundle. Standalone helpers stay; onlycreate_rungets the bundle treatment. - Out of scope: removing
render_resolve_errors(used by 4+ callers; orthogonal). - Out of scope: changing the
*Layer/*Namespacetypes infabro-types. - Out of scope: changing
apply_builtin_defaults,defaults.toml, or any per-namespaceresolve_*(layer, &mut errors)function body.
Context & Research
Relevant Code and Patterns
lib/crates/fabro-config/src/context.rs— currentServerSettingsandUserSettings(useResolver).lib/crates/fabro-config/src/resolve/resolver.rs— entire file deletes.lib/crates/fabro-config/src/resolve/mod.rs—resolve_storage_root+ 6×resolve_*_from_filehelpers (today: thin wrappers overResolver; rewrite to inlineapply_builtin_defaults+ per-namespace resolve).lib/crates/fabro-config/src/resolve/{cli,server,project,features,run,workflow}.rs— per-namespaceresolve_*fns; bodies unchanged. Visibility stayspub(callers in tests + helper crates).lib/crates/fabro-config/src/defaults.rs—apply_builtin_defaults(layer: SettingsLayer) -> SettingsLayer. One clone per call.lib/crates/fabro-workflow/src/operations/create.rs:63-68—ResolvedSettingsTree;:116use site;:166combined_labelscall;:287-297resolve_settings_tree;:299-304combined_labelsfn.lib/crates/fabro-config/src/resolve/server.rs:68-75—resolve_storagealready substitutesdefault_storage_dir()whenserver.storage.rootis missing.Resolver::storage_root()was duplicating this. Withserverexcluded fromWorkflowSettings, the duplication moves: the single authority for storage_root is now whateverServerSettings::server.storage.rootresolves to at server boot (used by the existingstate.server_storage_dir()helper).lib/crates/fabro-server/src/server.rs:577,643,659—AppState.settingsis a rawArc<RwLock<SettingsLayer>>;AppState.server_settingsis a separateRwLock<Arc<ServerSettings>>accessed viastate.server_settings()(line 643). There IS astate.server_storage_dir() -> PathBufhelper (line 659), but it panics on interpolation failure (.expect("server storage root should be resolved at startup")). Today'screate()returnsError::Preconditionon the same failure (create.rs:118-126). Unit 3 must NOT useserver_storage_dir()— the HTTP handler has to do its ownresolve_interp_stringand map errors toApiError. See Unit 3 Approach.lib/crates/fabro-config/src/effective_settings.rs:55-64— documents thatserver_settings.featuresAND a small subset ofserver_settings.server(storage, scheduler, artifacts, web, api) ARE applied authoritatively into the per-request layer. Server-ops fields (auth, listen, ip_allowlist, slatedb, logging, integrations) are stripped. So the per-request layer DOES carry storage and features —WorkflowSettingsexcludes them by ownership choice (we want the liveServerSettingsto be the single authority for deployment-level config), not by capability constraint.
Call Site Audit (verified)
resolve_*_from_file standalones — KEEP (dozens of callers):
resolve_run_from_file: 20+ callers across fabro-cli, fabro-server, fabro-workflow, testsresolve_server_from_file: 12+ callers across fabro-cli, fabro-server, fabro-install, testsresolve_features_from_file:fabro-server/src/server.rs:1364resolve_project_from_file/resolve_workflow_from_file/resolve_cli_from_file: callers infabro-config/src/project.rs, fabro-cli, testsresolve_storage_root: 1 external caller (fabro-cli/src/local_server.rs:15) + tests
Resolver — DELETE (1 caller):
lib/crates/fabro-workflow/src/operations/create.rs:288(inresolve_settings_tree)
ResolvedSettingsTree / resolve_settings_tree / combined_labels (free fn) — DELETE (private to create.rs, all uses local).
Institutional Learnings
None directly applicable. The original Resolver commit (52d24531d) explicitly framed itself as a perf optimization, not an API improvement — its rationale evaporates once the per-consumer bundles each do their own apply-defaults.
Key Technical Decisions
- Principle:
WorkflowSettingsholds workflow-owned namespaces only.{ project, workflow, run }— the namespaces whose authority belongs to the workflow consumer.serverandfeaturesare excluded as an ownership choice (liveServerSettingsis the single authority for deployment-level config), even thoughmaterialize_settings_layermakes them available in the per-request layer.ServerSettingsandUserSettingsare constructed from a complete owned layer at boot and hold every namespace their consumer reads. create_rungainsstorage_root: PathBufparameter. Storage root is deployment-level config — it belongs to whoever booted the server. Lifting it through a per-request bundle (today'sResolvedSettingsTree.server_storage_root) was an asymmetric workaround. Pushing it to a parameter eliminates the asymmetry and makes the data-flow honest. The caller resolves env-var interpolation before passing and maps any resolution error to the appropriate transport-level response.- Persisted settings layer is the request-derived/materialized artifact; do NOT overwrite it. What lands in
Event::RunCreated.settingsis not the raw submitted layer —create()runsmaterialize_run(settings, ...)first (create.rs:407) which normalizes and applies graph-time materialization. Treat the persisted field as "the materialized request artifact."Event::RunCreatedcarries two separate fields (create.rs:234-265):settings: <JSON of materialized SettingsLayer>andrun_dir: String(where the run actually went). They serve different purposes and should remain separately recorded. Thestorage_rootparameter is the runtime authority forcreate_run;record.run_diris the persisted authority for "where is this run?" downstream.record.settings.server.storage.rootis whatever the materialized layer carries — possibly an env-template that resolved differently at runtime than whatrecord.run_dirrecords. Future code that needs the path should readrun_dir, not re-resolve the layer. Audit (one grep) confirmed no currentfabro-workflowconsumer readssettings.server.storage.rootfrom a persisted record beyond the line being removed. - Keep standalone
resolve_*_from_filehelpers; rewrite withoutResolver. Each becomesapply_builtin_defaults(file.clone())+resolve_<ns>(&layer.<ns>.unwrap_or_default(), &mut errors). Rationale: dozens of single-namespace callers (e.g. "is this a dry run?" →resolve_run_from_file(...)?.execution.mode); forcing them through a bundle would pay full validation cost for one field. WorkflowSettings::from_layerreturnsResult<Self, Vec<ResolveError>>. Asymmetric withServerSettings::from_layerandUserSettings::from_layer(which returnfabro_config::Result<Self>wrappingError::Resolve), but symmetric withresolve_*_from_file. Reason: preservescreate_run's existing user-visible error format (;-joined viarender_resolve_errors); changing it would be an unowned scope expansion (R6). ExistingServer/UserSettingscallers undisturbed.combined_labelsbecomes a method onWorkflowSettings. Free fn was only callable in one place.- Each
*Settings::from_layercallsapply_builtin_defaults(layer.clone())independently. Acceptable —create_runis human-paced, not per-request. - Visibility of per-namespace
resolve_*fns stayspub. Called by*_from_filestandalones and tests.
Open Questions
Resolved During Planning
- Should
WorkflowSettingsholdServerNamespaceand/orFeaturesNamespace? Neither. Per R4,WorkflowSettingsholds workflow-owned namespaces only. Server-ops and features ARE available in the per-request layer (viamaterialize_settings_layer), but excluded from the bundle as an ownership choice — liveServerSettingsis the single authority for deployment-level config. - Where does
create_rungetstorage.rootif not from the bundle? From astorage_root: PathBufparameter. Caller (fabro-server, tests) supplies it. See R7. - Should we migrate every
resolve_*_from_filecaller to a bundle? No. Standalones stay; bundles are for multi-namespace consumers only. - Does
combined_labelsbelong as a method or free fn? Method onWorkflowSettings. - What error type does
WorkflowSettings::from_layerreturn?Result<Self, Vec<ResolveError>>(matchesresolve_*_from_file, preservescreate_run's existing error message format viarender_resolve_errors).Server/UserSettingskeep their existingfabro_config::Result<Self>shape. - Should
resolve_storage_rootstandalone keep its separate identity? Yes, keep it (rewrite inline). It's used byfabro-cli/src/local_server.rs:15to compute a runtime path without resolving full server settings; that use case remains. Don't migrate that caller in this PR.
Deferred to Implementation
- Test layout for
WorkflowSettings. Either add tolib/crates/fabro-config/tests/resolve_root.rs(existing multi-namespace tests live there) or new filetests/workflow_settings.rs. Pick during implementation based on what reads better.
Implementation Units
- Unit 1: Add
WorkflowSettingstofabro-config::context
Goal: New consumer bundle for workflow ops, sibling to ServerSettings/UserSettings. Workflow-only namespaces.
Requirements: R1, R2, R6
Dependencies: None.
Files:
- Modify:
lib/crates/fabro-config/src/context.rs - Modify:
lib/crates/fabro-config/src/lib.rs(exportWorkflowSettings) - Test:
lib/crates/fabro-config/tests/resolve_root.rsOR newtests/workflow_settings.rs
Approach:
- Add a
pub struct WorkflowSettingswith all fieldspub:pub project: ProjectNamespacepub workflow: WorkflowNamespacepub run: RunNamespaceEvery field ispubso cross-crate field access fromfabro-workflowworks.
- Add
WorkflowSettings::from_layer(layer: &SettingsLayer) -> Result<Self, Vec<ResolveError>>. ReturnsVec<ResolveError>(NOT wrapped infabro_config::Error::Resolve) so callers can format via existingrender_resolve_errors. Body:apply_builtin_defaults(layer.clone()), then callresolve_project,resolve_workflow,resolve_runinto a sharedVec<ResolveError>. ReturnOk(Self { ... })iferrors.is_empty(), elseErr(errors). - Add
WorkflowSettings::combined_labels(&self) -> HashMap<String, String>— extendproject.metadata, thenworkflow.metadata, thenrun.metadata(later wins on key conflict). Match today'scombined_labelsfree fn ordering exactly. - Do NOT yet delete
*_intomethods orResolver. This unit is purely additive.
Patterns to follow:
resolve_*_from_filehelpers inlib/crates/fabro-config/src/resolve/mod.rsfor theResult<_, Vec<ResolveError>>return shape and the per-namespace inline pattern.- For the
combined_labelsordering, today's free fn inlib/crates/fabro-workflow/src/operations/create.rs:299-304.
Test scenarios:
- Happy path:
SettingsLayer::default()resolves successfully. (Unlikeresolve_server— which requires explicitserver.auth.methodspertests/resolve_root.rs:8— the workflow-only namespaces have all required defaults indefaults.toml.) - Happy path: layer with
project.metadata,workflow.metadata,run.metadataproducescombined_labelscontaining the union, with later sections winning on key conflict. - Error path: layer with invalid
run.sandbox.provider(e.g."not-a-provider") returnsErr(errors)containing aResolveErrorforrun.sandbox.provider. (See existing fixture intests/resolve_root.rs:38.) - Error path: layer with multiple invalid fields within
run(e.g. invalidsandbox.providerPLUS another resolve_run-emitting error — pick from existing run-resolve test fixtures during implementation) returns ALL of them in oneErr. Proves R2 — the sharederrorsvec is being threaded through allresolve_*calls infrom_layer. (Note:resolve_projectandresolve_workflowcannot emit errors today —lib/crates/fabro-config/src/resolve/{project,workflow}.rsboth ignore theerrorsvec — so a "two namespaces both error" test isn't constructible. The within-runtest is the closest structural proof we can write.)
Verification:
- New tests pass.
WorkflowSettingsis exported fromfabro_configand constructable from any test fixture.- All three fields publicly accessible from outside
fabro_config(smoke-test by readingwf.run.execution.modefrom a test file).
- Unit 2: Delete
Resolver; rewrite*Settings::from_layerandresolve_*_from_fileto not depend on it
Goal: Remove the Resolver indirection. Each consumer-bundle constructor and each standalone helper inlines apply_builtin_defaults + the per-namespace resolve.
Requirements: R2, R3, R5
Dependencies: Unit 1 (so WorkflowSettings exists; not strictly required for this unit, but Unit 3 depends on both and ordering is cleaner).
Files:
- Delete:
lib/crates/fabro-config/src/resolve/resolver.rs - Modify:
lib/crates/fabro-config/src/resolve/mod.rs(removemod resolver;andpub use resolver::Resolver;; rewrite the 6resolve_*_from_filehelpers +resolve_storage_rootto inline) - Modify:
lib/crates/fabro-config/src/context.rs(rewriteServerSettings::from_layerandUserSettings::from_layerwithoutResolver) - Modify:
lib/crates/fabro-config/src/lib.rs(removeResolverfrom re-exports)
Approach:
- Each
resolve_*_from_file(file)becomes:let layer = apply_builtin_defaults(file.clone()); let mut errors = Vec::new(); let value = resolve_<ns>(&layer.<ns>.clone().unwrap_or_default(), &mut errors); if errors.is_empty() { Ok(value) } else { Err(errors) } resolve_storage_root(file)becomes a thin extraction from a defaulted layer (same logic as today'sResolver::storage_root()).ServerSettings::from_layerandUserSettings::from_layerbuild a defaulted layer once, accumulate errors from both their namespaces into oneVec<ResolveError>. Preserves today's "errors from BOTH namespaces" behavior — verify with existing tests intests/resolve_server.rsandtests/resolve_cli.rs.
Patterns to follow:
- Today's
Resolver::server_into(&mut errors)body shows the inline shape per namespace. - Today's
ServerSettings::from_layershows the dual-namespace error accumulation pattern.
Test scenarios:
- Happy path: existing
tests/resolve_server.rs,tests/resolve_cli.rs,tests/resolve_run.rs,tests/resolve_workflow.rs,tests/resolve_project.rs,tests/resolve_features.rs,tests/defaults.rs,tests/resolve_root.rsall pass without modification (proves no behavior change for any consumer). - Edge case:
ServerSettings::from_layerwith multiple errors withinserver(e.g. invalidlisten.addressAND invalidip_allowlistCIDR — see existing fixture pattern intests/resolve_root.rs:22) returns ALL errors in oneErr. Proves the sharederrorsvec is threaded through. (resolve_featurescannot emit errors perlib/crates/fabro-config/src/resolve/features.rs:5, so the "errors from both namespaces" pairing isn't constructible — within-namespace multi-error is the closest structural proof.)
Verification:
cargo build -p fabro-configclean.cargo nextest run -p fabro-configgreen with no test changes.cargo nextest run -p fabro-config-tests(if separate) or whatever test target coverstests/— green.grep -rn "Resolver\b" lib/crates/fabro-config/srcreturns no hits except in deleted file.
- Unit 3: Migrate
create_runtoWorkflowSettings; addstorage_rootparameter; deleteResolvedSettingsTree+resolve_settings_tree+combined_labelsfree fn
Goal: create_run consumes WorkflowSettings for workflow-owned config and storage_root from the caller for deployment-owned config. WorkflowSettings::from_layer failures keep today's ; -joined render_resolve_errors format (R6). Storage-root interpolation failures move out to the HTTP handler with new error attribution (R5).
Requirements: R1, R5, R6, R7
Dependencies: Unit 1 (needs WorkflowSettings), Unit 2 (needs Resolver gone — though Unit 3 could technically land before Unit 2).
Files:
- Modify:
lib/crates/fabro-workflow/src/operations/create.rs- Add
storage_root: PathBufparameter topub async fn create(...). - Delete
struct ResolvedSettingsTree(lines 63-68). - Delete
fn resolve_settings_tree(lines 287-297). - Delete
fn combined_labels(lines 299-304). - Replace
let resolved_settings = resolve_settings_tree(&settings)?;(line 116) withWorkflowSettings::from_layer(&settings).map_err(|errors| Error::Precondition(render_resolve_errors(&errors)))?. - Replace lines 118-127 (today's storage_root resolution + Storage::new call): use the
storage_rootparameter directly. No moreInterpString::resolve(env)here — caller did it. - Pass
settings(unmodified) intoPersistCreateOptions. Do NOT overwritesettings.server.storage.root— see Key Technical Decisions: persisted layer is the request-derived/materialized artifact (post-materialize_run);record.run_diris the path-of-truth. - Replace
combined_labels(&resolved_settings)(line 166) withresolved_settings.combined_labels(). - Imports: remove
Resolverif directly imported; removeHashMapimport if no longer used; addPathBufif not already imported.
- Add
- Modify:
lib/crates/fabro-server/src/server.rs:4019— production caller. Resolvestorage_rootfrom the liveServerSettingsand map any interpolation failure to a transport error. Do NOT usestate.server_storage_dir()— that helper panics on resolution failure (server.rs:659), which would replace today'sError::Preconditiongraceful-failure path with a process abort. The handler must do its ownresolve_interp_string(or equivalent) and map errors to anApiErrorshape used elsewhere in the file. - Modify:
lib/crates/fabro-workflow/src/operations/start.rs:1008,1190— test helpers (persisted_workflowand the bundled-workflow test). Pass a temp dir or fixture path. - Audit and modify: any other callers of
fabro_workflow::operations::create::create()in workspace tests. Rungrep -rn "operations::create(\|workflow::operations::create" lib/crates/fabro-workflow/tests/ lib/crates/fabro-server/tests/during implementation.
Approach:
- Production caller pattern (sketched — verify error constructor and locking shape during implementation):
This preserves today's "interpolation failure becomes a graceful HTTP error" semantics. The exact// Read the live ServerSettings (Arc<ServerSettings>) and resolve env-var template let storage_root = match resolve_interp_string(&state.server_settings().server.storage.root) { Ok(s) => PathBuf::from(s), Err(e) => return ApiError::<chosen-shape>(format!("storage root: {e}")).into_response(), }; let created = match Box::pin(operations::create(state.store.as_ref(), create_input, storage_root)).await { ... };ApiErrorconstructor (e.g.bad_request,internal, or a new variant) is implementer's choice — pick whatever matches today's error shape for similar request-time validation failures in this file.resolve_interp_stringalready exists in the same module (used byserver_storage_dir). - Test helpers can use
tempfile::tempdir()or a hardcoded path; passtmp.path().to_path_buf()(or similar) as the third argument. validate_sandbox_providerat line 306 still usesfabro_config::resolve_run_from_file(&resolved.settings)— leave it. Different code path, same as today.
Patterns to follow:
- Today's
to_errorclosure increate.rs:289-290for therender_resolve_errorsmapping shape. Error::Preconditionis the established envelope for create-time settings failures.
Behavior change in scope (limited to R7 signature change):
pub async fn create()gains astorage_root: PathBufparameter. Three production/test caller sites + workspace test audit.- No new resolve-time validation surfaces. The bundle now resolves only
project/workflow/run, exactly as today'sResolvedSettingsTreedid. Server-ops fields (auth,listen,ip_allowlist,integrations) are NOT touched by this PR; they remain owned by the liveServerSettings. - The InterpString env-var resolution that today happens inside
create()(lines 119-126) moves to the caller. fabro-server today already has plenty ofInterpString::resolvepatterns to mirror.
Test scenarios:
- Happy path: existing
create_runtests (increate.rs'smod tests, inlib/crates/fabro-workflow/tests/, inlib/crates/fabro-server/tests/) pass after caller updates. - Happy path:
combined_labels()method produces the same map as today's free fn for the same fixture (proves ordering preservation). - Error path:
SettingsLayerwith malformedrun.sandbox.providercausescreate_runto fail with the expected;-joined message (proves R6 format preservation). - Edge case: caller passes a non-existent
storage_root—create_runeither creates the dir (matches today's behavior viaStorage::new) or fails with the same error today'sStorage::newwould produce. Verify behavior is identical to today.
Verification:
cargo build -p fabro-workflowclean.cargo build -p fabro-serverclean.cargo nextest run -p fabro-workflowgreen.cargo nextest run -p fabro-servergreen (HTTP handler still works end-to-end).grep -rn "ResolvedSettingsTree\|resolve_settings_tree" lib/returns no hits.
- Unit 4: Workspace build + lint sweep
Goal: Confirm no caller across the workspace still references deleted symbols.
Requirements: R5
Dependencies: Units 1-3.
Files: None modified directly; this unit is verification only.
Approach:
cargo build --workspacefrom repo root.cargo +nightly-2026-04-14 clippy --workspace --all-targets -- -D warnings(per CLAUDE.md).cargo nextest run --workspace.grep -rn "fabro_config::Resolver\|ResolvedSettingsTree\|resolve_settings_tree" lib/ apps/returns no hits.cargo +nightly-2026-04-14 fmt --check --all.
Test expectation: none — pure verification unit. No new test scenarios; existing tests must pass unchanged.
Verification:
- All commands green.
- No grep hits for deleted symbols.
System-Wide Impact
- Interaction graph:
create_run's signature gains astorage_root: PathBufparameter. ~3 production/test callers updated to pass it. No new resolve-time validation runs anywhere — the bundle resolves the same namespaces today'sResolvedSettingsTreedid. - Error propagation:
Server/UserSettingserror envelopes unchanged.WorkflowSettings::from_layerreturnsResult<Self, Vec<ResolveError>>(a new shape, asymmetric with the other two bundles);create_runformats it viarender_resolve_errorsto keep its user-visible error message format identical to today (;-joined). See R6. The InterpString-resolution error path that today lives insidecreate_runmoves up to the caller — same error class, different attribution. - State lifecycle risks: None — pure refactor, no persistent state touched.
- API surface parity:
fabro_configpublic API losesResolver(and the*_intomethods accessible through it). Gainspub struct WorkflowSettings. All other re-exports unchanged.render_resolve_errorsstays public (used bycreate_runand others).fabro_workflow::operations::create::create()signature changes (one new parameter). - Integration coverage: Existing tests in
lib/crates/fabro-config/tests/exercise both single-namespace (resolve_*_from_file) and multi-namespace (*Settings::from_layer) paths; they cover the integration shape. - Server-ops authority preserved: No part of this PR re-resolves server-ops fields (
auth,listen,ip_allowlist,integrations,slatedb,logging) per-request. The liveServerSettings(owned byfabro-serverat boot) remains the single authority.WorkflowSettingsdoesn't pretend to hold them. - Unchanged invariants:
*Layerand*Namespacetypes infabro-types— untouched.apply_builtin_defaults+defaults.toml— untouched. Per-namespaceresolve_*function bodies — untouched. Consumer field-access patterns (ctx.user_settings().cli.output.verbosity) — untouched.Server/UserSettings::from_layersignatures — untouched.
Risks & Dependencies
| Risk | Mitigation |
|---|---|
create_run signature change misses a workspace test caller; build break |
Audit step listed in Unit 3 Files (grep -rn "operations::create("). Compiler will catch all production paths. |
fabro-server's storage_root resolution call site fails with a new error class (env var missing, parse error) where today the failure happened inside create_run |
Same error semantics; just attributed to the caller. Mention in PR description so reviewers don't read it as a regression. |
One extra apply_builtin_defaults(layer.clone()) per bundle on the create path vs. shared-via-Resolver |
Acceptable — create_run is human-paced. Not in any hot path. |
combined_labels method ordering subtly differs from free fn (both extend project → workflow → run) |
Match today's free-fn ordering exactly. Existing tests will catch label-ordering regressions. |
Asymmetric from_layer return type (Result<Self, Vec<ResolveError>> for Workflow; fabro_config::Result<Self> for Server/User) reads as inconsistency |
Documented as a Key Technical Decision; reason is preserving create_run's error-message format. Future PR could converge all three when the format change is intentional. |
record.settings.server.storage.root (the request-derived/materialized artifact) and record.run_dir (where the run actually lives) can disagree — e.g. user submitted env-template "{{ env.X }}" that resolved at runtime to a different path than the parameter |
Documented design (see Key Technical Decisions): persisted settings = request-derived/materialized artifact; run_dir = path-of-truth. Audit grep verifies no current consumer reads settings.server.storage.root from a persisted record beyond the line being removed. Future readers must use run_dir for paths. |
HTTP handler's storage-root resolution failure path differs from today's Error::Precondition text |
Documented behavior change — moves from a workflow-side Error::Precondition to a transport-side ApiError. Same failure class (graceful HTTP error), different attribution and error-message text. Mention in PR description. |
Documentation / Operational Notes
- No user-facing docs to update (internal refactor).
- No migration scripts, feature flags, or rollout concerns.
- One signature change:
fabro_workflow::operations::create::create()gainsstorage_root: PathBuf. Three caller sites + workspace test audit. No resolved-settings semantics change. - Net code: ~150 lines deleted, ~50 added (smaller WorkflowSettings = smaller diff).
Sources & References
- Origin: design conversation in this session.
- Related code:
lib/crates/fabro-config/src/resolve/resolver.rs(introduced commit52d24531d). - Follow-up plan:
docs/plans/2026-04-23-002-refactor-combine-trait-uv-pattern-plan.md(PR 2 — Combine trait + derive).