21 KiB
Settings TOML Redesign Implementation Plan
Summary
Use docs/brainstorms/2026-04-08-settings-toml-redesign-requirements.md as the source of truth and land this as a hard cut: replace the flat and organic config schema everywhere, update all loaders and consumers to the new namespaced model, and regenerate all outward-facing examples and contracts in the same change.
Fabro is still greenfield. This plan intentionally optimizes for the best steady-state code rather than backwards compatibility:
- one user-facing schema, not old and new in parallel
- one hard-cut contract update for config files and settings payloads
- no user-facing compatibility layer
This can still land as one cohesive PR. The staged sequence below is an internal implementation order so the work stays mechanically sane while the refactor is in flight.
This refactor is centered on four seams:
- schema and parsing in
lib/crates/fabro-types/src/settings/andlib/crates/fabro-config/src/config.rs - layering and trust-boundary resolution in
lib/crates/fabro-config/src/effective_settings.rs - CLI, workflow, agent, MCP, sandbox, and server consumers across the Rust workspace
- public contracts in
docs/api-reference/fabro-api.yaml, generated clients, generated config files, andapps/fabro-web
Public Types And Interfaces
- Replace the flat
fabro_types::Settingsshape with a resolved namespaced settings tree matching the redesign:_versionprojectworkflowruncliserverfeatures
- Replace the current
ConfigLayershape with a sparse namespaced parse tree. A temporary in-repo bridge between old and new internal types is acceptable only to keep intermediate stages compiling; it must not become a user-visible compatibility layer and must be deleted by the end of the cut. - Treat
cli.*andserver.*as schema-valid everywhere but runtime-consumed only from localsettings.tomlplus explicit process-local overrides. - Replace legacy flat run sections and fields with namespaced equivalents, including:
goalandworking_dirunder[run]varsto[run.inputs]labelstoproject.metadata,workflow.metadata, andrun.metadatallmto[run.model]setupto[run.prepare]mcp_serversto[run.agent.mcps.<name>]or[cli.exec.agent.mcps.<name>], depending on the consumerexecto[cli.exec]- flat server sections to
[server.*]
- Treat
vars -> run.inputsas a behavioral change, not just a rename.run.inputsintentionally replaces the inherited map wholesale rather than merging by key. - Replace legacy project shape
[fabro].rootwith[project].directory. - Replace hook merge identity from effective-name semantics to optional explicit
id, while keepingnamehuman-facing only. - Replace string-command hook and launcher shorthand with one execution-language rule:
script = "..."for shell-evaluated commandscommand = ["..."]for argv launches- mutually exclusive
- Treat
scriptandcommandfields as trusted executable config. Repo-scoped config using these fields executes with the consuming process privileges. Env interpolation insidescriptis raw string substitution, not shell-escaped templating. - Replace old MCP shapes with agent-scoped MCPs:
[run.agent.mcps.<name>][cli.exec.agent.mcps.<name>]
- Keep
SecretStoreand provider ambient auth as the credential sources for secrets. The redesigned config should describe selectors and non-secret knobs, not become a general secret transport. - Keep
/api/v1/settingsas the endpoint path, but replace broadSettingsserialization with an explicit public DTO. The hard cut is the schema and payload shape, not the path name.
Resolved Deferred Questions
run.scmfirst pass:- core fields are
provider,owner, andrepository - provider-specific capability leaves live under
[run.scm.<provider>] - branch and PR behavior stay out of
run.scmin this cut and remain on[run.pull_request]or runtime context
- core fields are
- object-store envelope first pass:
- provider-neutral envelope fields are
providerand optionalprefix - provider-specific tables live under
[server.artifacts.<provider>]and[server.slatedb.<provider>] localusesroot, defaulting toserver.storage.rootwhen omitteds3carries bucket and region plus optional endpoint and path-style settings- provider credentials come from
SecretStore,${env.NAME}, or ambient provider auth rather than first-pass secret fields in TOML
- provider-neutral envelope fields are
- MCP surface first pass:
- common fields are
enabled,type,startup_timeout, andtool_timeout startup_timeoutandtool_timeoutuse the shared duration type from the value-language helperstype = "http"usesurlplus optionalheaderstype = "stdio"requires exactly one ofscriptorcommandand may includeenvtype = "sandbox"requires exactly one ofscriptorcommand, requiresportas an integer, and may includeenv
- common fields are
- notification route surface first pass:
- route envelope fields are
enabled,provider, andevents - provider-specific destination fields live under
[run.notifications.<name>.<provider>] - first-pass Slack destinations use
channel
- route envelope fields are
- duration parser first pass:
- one shared parser accepts a single unit suffix per value:
ms,s,m,h, ord - composed values like
1h30mare not supported in first pass; use the smallest needed unit instead - one shared canonical renderer prints human-readable durations in the same single-unit form
- one shared parser accepts a single unit suffix per value:
- size parser first pass:
- one shared parser accepts bare integers plus
B,KB,MB,GB,TB, andKiB,MiB,GiB,TiB KB,MB,GB, andTBare decimal (powers of 1000);KiB,MiB,GiB, andTiBare binary (powers of 1024)- bare values default to
GB - fractional values are not supported in first pass
- one shared canonical renderer prints human-readable sizes using the largest decimal unit that represents the value as an integer multiple
- config-language parsing stays permissive; provider layers remain responsible for stricter admissible-value validation such as Daytona-specific CPU and memory limits
- one shared parser accepts bare integers plus
- object-store
providerfield is a closed enum. First-pass variants arelocalands3. Unknown providers hard-fail against the schema rather than passing through as opaque strings. SecretStoreaccess is not referenced from user TOML in first pass. Consumers read secrets via existing server-sideSecretStorecode paths; the config schema does not introduce a${secret.NAME}interpolation form. If TOML-level secret references become necessary later, they are a separate schema bump.
Implementation Changes
1. Replace the config parse tree and resolved types
- Introduce a new namespaced parse tree for
_version,project,workflow,run,cli,server, andfeatures; do not alias old field names forward. - Redesign
fabro_types::Settingsto match the new resolved schema rather than preserving the old flat representation internally. - Treat strict unknown-key handling as a parse-architecture change, not just a derive tweak. The loader must validate against the full union schema before consumer-specific filtering and must surface targeted rename hints for legacy keys.
- Add explicit
_versionhandling before deeper validation:- missing defaults to
1 - legacy
versionhard-fails with a rename hint - unsupported higher versions hard-fail with an upgrade hint
- missing defaults to
- Stage the new value-language helpers explicitly instead of bundling them into one opaque parser rewrite:
- one shared duration type and parser for config-facing time values
- one shared size type and parser for memory and disk values
- one model-reference parser for
run.model.fallbacks - one interpolation representation for
${env.NAME}tokens, including substring interpolation and multiple tokens per string - one splice-capable string-array helper for the exact
"..."semantics in the requirements doc
- Implement the resolved first-pass shapes from the previous section directly in the parse tree and resolved settings types rather than leaving them to implementer choice.
- Redesign run model types to cover:
run.metadatarun.inputsrun.modelrun.gitrun.prepare.stepsrun.executionrun.checkpointrun.sandboxrun.notifications.<name>run.interviewsrun.agentrun.agent.mcps.<name>run.hooksrun.scmrun.scm.<provider>run.pull_requestrun.artifacts
- Redesign CLI types to cover:
cli.targetcli.target.tlscli.authcli.execcli.exec.modelcli.exec.agentcli.exec.agent.mcps.<name>cli.outputcli.updatescli.logging
- Redesign server types to cover:
server.listenserver.listen.tlsserver.apiserver.webserver.auth.apiserver.auth.web.providers.<provider>server.storageserver.artifactsserver.slatedbserver.schedulerserver.loggingserver.integrations.<provider>
- Keep provider-neutral envelopes and provider-specific nested tables where the requirements already locked them:
- sandbox
- notifications
- interviews
- object stores
- SCM provider leaves
- Keep model config intentionally provider-neutral and implement the fallback grammar exactly as specified in the requirements doc.
2. Narrow merge changes to the paths whose behavior actually changes
- Keep
Combineas the default layering mechanism where it still matches the requirements. Add explicit custom merge only for paths whose behavior changes. - Encode the merge matrix from the requirements doc directly in code, with custom logic only for:
- replace-by-default maps like
run.inputs,project.metadata,workflow.metadata, andrun.metadata - sticky merge-by-key maps like
run.sandbox.env - splice-aware string arrays
- whole-list replacement for
run.prepare.steps - field-merge keyed objects like notifications, MCPs, and web-auth providers
- ordered hook merging by optional
id
- replace-by-default maps like
- Make splice-capable arrays explicit in the implementation rather than shape-driven. In the first pass, the only splice-capable array paths are:
run.model.fallbacksrun.notifications.<name>.events
- Treat
"..."in all non-splice arrays as a hard error rather than data or a silent no-op. - Keep inactive provider and strategy subtables inert when the selected provider changes; validate and consume only the selected subtree.
- Move env interpolation out of the current sandbox-only whole-value resolver and into a post-layering resolution pass that runs only on consumed string fields.
- If any
${env.NAME}token in a consumed string fails to resolve, fail the entire field with an error that identifies both the unresolved token and the config path. - Track interpolation provenance so env-sourced resolved values can be redacted consistently in outward-facing serialization, not just in the CLI.
- Keep hook ordering stable:
id-matched replacement happens in place- anonymous hooks from higher-precedence files append after the fully merged inherited hook list
- duplicate
idvalues in one file hard-fail
3. Rebuild resolution, trust boundaries, and safe serialization
- Rework
EffectiveSettingsLayersandresolve_settings()so owner-specific domains are consumed only from~/.fabro/settings.tomlplus flags and env overrides. - Remove the current “merge everything, then strip server-owned fields” model. Build shared layered domains and owner-specific domains separately from the start.
- Preserve today’s
execrouting behavior:- configured CLI target defaults affect commands that use server targeting
fabro execstill requires explicit--server
- Make the default server auth posture explicit and fail-closed:
- if
server.authis absent or resolves to no enabled API or web auth configuration, normal server startup must refuse to start - demo and test helpers may continue to inject explicit insecure settings where needed, but insecure startup must be opt-in rather than accidental
- if
- Settings API exposure:
- replace raw resolved settings serialization with explicit public DTOs
- two distinct exposure scopes, each with its own DTO:
- scope 1:
/api/v1/settings(server configuration view)- first-pass allow-list:
server.api.urlserver.web.enabledserver.web.url- enabled state for
server.auth.web.providers.* - non-secret
server.schedulervalues
- denies everything else, including all
project.*,workflow.*,run.*,cli.*, and anyserver.*path not explicitly allowed (notablyserver.listen,server.listen.tls.*,server.auth.api,server.integrations.*,server.artifacts*,server.slatedb*, local secret-store paths, and any env-resolved secret values)
- first-pass allow-list:
- scope 2:
/api/v1/runs/:id/settingsand run-settings snapshots exposed via API (run configuration view)- allows the resolved
run.*tree so the frontend run-settings page and equivalent consumers can render it - denies:
- any resolved string value tagged as
${env.NAME}-sourced (via the interpolation provenance tracking) - provider-credential fields under
run.notifications.*.<provider>even when not env-sourced - env values under
run.agent.mcps.*.envthat were env-interpolated - any field explicitly marked sensitive in its type (for example, tokens or keys)
- any resolved string value tagged as
- also denies all
project.*,workflow.*,cli.*, andserver.*; these are not part of a run-configuration view
- allows the resolved
- Apply the matching exposure scope and redaction rules consistently across all outward-facing settings renderers:
fabro settingsuses the server scope for server-facing rendering and the run scope for run-facing rendering/api/v1/settingsuses the server scope/api/v1/runs/:id/settingsand any API-exposed run-settings snapshots use the run scope- logs and emitted settings-like debug output use whichever scope matches the payload kind
- Trust model:
scriptandcommandfields in repo-scoped config are trusted executable config and should be reviewed like code- those fields execute with the consuming process privileges; the config system does not sandbox them
${env.NAME}interpolation insidescriptis raw substitution, not shell quoting or shell-safe templating
- Keep command-local override layering separate from machine settings loading:
run,preflight, and manifest code still build layered run defaultsexecstill loads machine CLI defaults directlysettingsstill assembles effective layers deliberately
- Classify server settings as startup-only vs live-reloadable in the first pass:
- live-reloadable:
server.loggingserver.scheduler
- startup-only:
server.listenserver.listen.tlsserver.apiserver.webserver.authserver.storageserver.artifactsserver.slatedbserver.integrations
- live-reloadable:
- Update server runtime application logic to stop assuming old flat fields like
storage_dir,artifact_storage,api, andweb. - Make the persisted-settings decision explicit: old run-settings snapshots and local dev state are not guaranteed to survive the hard cut. Tests, fixtures, and generated examples should be rewritten; no snapshot migration layer is planned.
4. Migrate all consumers, scaffolds, and contracts
- Update CLI overrides, run manifest building, workflow discovery, project discovery, and remote and local-daemon settings application to the new schema.
- Update all crates that currently consume settings or config layers, not just the CLI and server entrypoints. At minimum this includes:
fabro-clifabro-serverfabro-workflowfabro-agentfabro-mcp- sandbox-facing config consumers
- hook execution consumers
- test helpers in
fabro-test
- Update server start and foreground command flows to read and apply the new server config shape.
- Update
SecretStoreintegration points so server and installer flows continue to source secrets out of band while the new config shape only carries non-secret selectors and toggles. - Update scaffolding and installers so generated
settings.toml,fabro.toml, andworkflow.tomluse_versionand the new namespaced sections. - Update install-time config writers to stop editing legacy
[git],[web],[api], and similar flat sections. - Update the server
/api/v1/settingsresponse and any run-settings snapshot payloads to the new allow-listed resolved shape, then regenerate Rust and TypeScript clients from OpenAPI. - Update
apps/fabro-weband any generated TypeScript consumers to the new settings contract. The live/settingsand/runs/:id/settingsroutes currentlyJSON.stringifythe full response, so they remain shape-agnostic, but the staticworkflowDatafallback inapps/fabro-web/app/routes/workflow-detail.tsxuses the old schema shape and must be rewritten against the newRunSettingstype. - Update docs and examples in
docs/reference/, especially:user-configuration.mdxcli.mdx- any other config examples that currently show
[llm],[exec],[server],[sandbox],[fabro], orversion = 1
- Update installer, repo-init, and workflow-create generated content so no new files are emitted in the old schema after the cutover lands.
Sequencing
Implement in these internal compile-preserving stages:
- Add the new value-language helpers and namespaced sparse parse structs alongside the current code so the repo still builds while parser architecture is being introduced.
- Add the new resolved settings tree plus a temporary internal bridge between old and new types so callers can migrate incrementally without freezing the repo in an unbuildable state.
- Switch parsing and layering to the new schema, strict validation, merge behavior, trust boundaries, and env interpolation. This is where legacy user config starts hard-failing.
- Migrate consumers crate by crate:
fabro-clifabro-serverfabro-workflowfabro-agentfabro-mcp- hook, sandbox, and test-helper consumers
- Update
/api/v1/settings, OpenAPI, generated clients,apps/fabro-web, scaffolds, installers, and docs to the new contract. - Remove the old flat settings types, the temporary bridge, legacy fixtures, and any now-dead merge logic.
This remains a hard cut. These stages describe implementation order, not a staged user rollout.
Test Plan
- Add parser and unit coverage for:
_versiondefaulting and failure modes- representative hard failures for legacy keys and unknown keys
- model fallback token parsing and ambiguity errors
- duration and size parsing
- substring and multi-token
${env.NAME}interpolation - splice-array rules on allowed paths
- hard failure for
"..."on non-splice paths - hook
idreplacement and anonymous append ordering
- Add layering and resolution coverage for:
run.inputsreplace semanticsrun.sandbox.envsticky merge semantics- keyed object merge and disable behavior
- owner-specific trust boundaries for
cli.*andserver.* - inactive provider subtables remaining inert
- default server auth fail-closed behavior when
server.authis absent
- Add serialization and exposure coverage for:
fabro settingsredaction/api/v1/settingsallow-list behavior- exclusion of TLS paths, auth internals, object-store credentials, and env-resolved secrets
- any API-exposed run-settings snapshot redaction behavior
- Add behavior coverage for:
project.directory-based workflow discoveryrun.inputsreplace semantics- hook identity via explicit
id
- Update CLI integration tests in:
lib/crates/fabro-cli/tests/it/cmd/config.rslib/crates/fabro-cli/tests/it/cmd/exec.rslib/crates/fabro-cli/tests/it/cmd/repo_init.rslib/crates/fabro-cli/tests/it/cmd/workflow_create.rs
- Update server and API coverage for:
/api/v1/settings- startup-only vs live-reloadable server settings
- run settings snapshots
- any tests assuming old flat server settings fields
- Update frontend and generated-client expectations after the OpenAPI change.
- Update doc examples and snapshot tests that assert generated config files or
fabro settingsoutput.
Assumptions And Defaults
- Hard cut only: one user-facing schema, no compatibility aliases, and no user-facing compatibility layer.
- A temporary internal bridge between old and new settings types is acceptable only to keep intermediate stages compiling and must be removed before the work is done.
run.inputsreplaces inherited values wholesale;run.sandbox.envremains merge-by-key and sticky.cli.*andserver.*remain schema-valid in all files but are runtime-inert outside localsettings.toml.- Provider-specific subtables coexist inertly; only the selected provider or strategy subtree is validated and consumed.
- Object-store and integration credentials continue to come from
SecretStore,${env.NAME}, or ambient provider auth rather than new first-pass secret fields in TOML. /api/v1/settingsremains the endpoint path, but its payload shape becomes a new allow-listed public contract.