config: unify the dotbot CLI config into one file (dotbot -c config.toml) - #266
Merged
Merged
Conversation
Phase 1 of the config unification: the pure resolver (pydantic schema + discovery + testbed selection + the one precedence function). Not wired into any command yet, so there is no behavior change; fully unit-tested headless. AI-assisted: Claude Opus 4.8
Phase 2 of the config unification. The root `dotbot` group now takes `-c/--config` and `--testbed`, loads + validates the file, selects the testbed, and stashes both on the Click context for subcommands to read. To free `-c` for that global flag, `fw`/`device` `--config`/`-c` becomes `--build-config` (clean break, no alias). No command consumes the config yet, so behavior is otherwise unchanged; the `~/.dotbot/config.toml` fallback stays off until `fw` migrates onto the resolver. AI-assisted: Claude Opus 4.8
`fw` build/clean/artifacts and `device flash` now take their option defaults from the loaded config (board, build_config, sandbox / sn), while an explicit flag still wins via Click's parameter source. With no config present the resolved value is the option's own default, so existing behavior is unchanged. AI-assisted: Claude Opus 4.8
Read-only: `dotbot config path`/`show` reports the resolved config and where it came from; `dotbot testbed list`/`show` lists the configured deployments and marks the active one. Writing (`testbed use`) is deferred. AI-assisted: Claude Opus 4.8
AI-assisted: Claude Opus 4.8
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #266 +/- ##
===========================================
+ Coverage 82.10% 83.74% +1.64%
===========================================
Files 105 116 +11
Lines 9677 10815 +1138
Branches 571 569 -2
===========================================
+ Hits 7945 9057 +1112
- Misses 1729 1754 +25
- Partials 3 4 +1
🚀 New features to boost your workflow:
|
A four-persona review found `deployment` clearest: it carries no overload with
the product name ("the DotBot Testbed") the way `testbed` does, and no clash
with the planned `Swarm` SDK object ("a swarm instance") the way `instance`
would, and it reads for the education/industry audience too. Renames the config
key, `--deployment` flag, `DOTBOT_DEPLOYMENT` env, `dotbot deployment` command,
and the schema. Develop-phase rename, no backwards-compat.
AI-assisted: Claude Opus 4.8
Turns the empty-config dead end into an on-ramp: `dotbot config init` writes an annotated `./dotbot.toml` (--global writes ~/.dotbot/config.toml; refuses to overwrite without --force). The starter is fully commented, so a fresh file loads as a valid empty config and doubles as schema-by-example; the empty `config show`/`path` now point at `config init`. AI-assisted: Claude Opus 4.8
AI-assisted: Claude Opus 4.8
AI-assisted: Claude Opus 4.8
AI-assisted: Claude Opus 4.8
AI-assisted: Claude Opus 4.8
AI-assisted: Claude Opus 4.8
AI-assisted: Claude Opus 4.8
AI-assisted: Claude Opus 4.8
AI-assisted: Claude Opus 4.8
AI-assisted: Claude Opus 4.8
AI-assisted: Claude Opus 4.8
AI-assisted: Claude Opus 4.8
AI-assisted: Claude Opus 4.8
AI-assisted: Claude Opus 4.8
AI-assisted: Claude Opus 4.8
AI-assisted: Claude Opus 4.8
AI-assisted: Claude Opus 4.8
Every swarmit dependency (cryptography, marilib-pkg, ...) is already in the core install via qrkey/marilib, so the `[swarm]` extra isolated nothing, and fleet operation is the primary use case rather than an opt-in. Calibration (opencv + textual) stays the one optional extra. AI-assisted: Claude Opus 4.8
AI-assisted: Claude Opus 4.8
AI-assisted: Claude Opus 4.8
swarmit (now a core dep) registers payload types 0x80-0xa1 into the shared dotbot_utils protocol registry on import, so collecting this test raised "Payload type '0x81' already registered" once swarmit was imported in the same pytest process. 0xfb/0xfc are clear of both dotbot (<= 0xfa) and swarmit. AI-assisted: Claude Opus 4.8
AI-assisted: Claude Opus 4.8
AI-assisted: Claude Opus 4.8
Contributor
Author
|
Huge PR! But at least half is tests + docs. Worth it in my opinion, as it now enables much much simpler developer experience such as: dotbot config init --conn mqtts://argus.paris.inria.fr:8883 --swarm-id 1234
dotbot swarm status
dotbot swarm flash ./artifacts/rgbled-sandbox-dotbot-v3.bin -ys
dotbot swarm stop |
AI-assisted: Claude Opus 4.8
AI-assisted: Claude Opus 4.8
AI-assisted: Claude Opus 4.8
fw's segger_dir/firmware_repo were read by a separate ~/.dotbot-only toml reader, so [fw] keys in a project dotbot.toml were ignored. They now resolve through the unified config like every other command, and ~/.dotbot is a normal user-file fallback for ALL commands (include_user_file on) rather than special fw-only state - so a per-machine ~/.dotbot/config.toml now applies everywhere. AI-assisted: Claude Opus 4.8
AI-assisted: Claude Opus 4.8
AI-assisted: Claude Opus 4.8
AI-assisted: Claude Opus 4.8
2 of 3 tasks
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.
Today dotbot configuration is scattered across three overlapping surfaces -
run controller --config-path,swarm -c(actually swarmit's loader, wrapped),and
~/.dotbot/config.toml's[fw]table - with three names for the network id(
swarm_id/network_id/swarmit_network_id) and an overloaded-c(build-config in
fw/device, config-file inswarm). This unifies the lotinto one file with a single, documented precedence chain.
The shape
One file, sections mirroring the four-namespace CLI, plus named deployments:
(
DOTBOT_<SECTION>_<KEY>) > file (section > selected deployment > top-level) >built-in default.
extra='forbid', so a typo'd key fails loud.-c PATH>DOTBOT_CONFIG> nearestdotbot.toml(cwd-upward) >
~/.dotbot/config.toml.--deployment/DOTBOT_DEPLOYMENT/default_deployment. The name waschosen by a four-persona review over
testbed(overloads with the productname "the DotBot Testbed") and
instance(clashes with the plannedSwarmSDK object);
deploymentis clean against both and reads for theeducation/industry audience. (The simulator is not a deployment; it is
--conn simulator.)DOTBOT_MQTT_USER/PASS), never a file key.What's in this PR
dotbot/config.py): pydantic schema, discovery, deploymentselection, one precedence function;
connvalidated via the existingparse_connectionso the file and the--connflag share one validator.dotbot -c/--config+--deployment(loads + selects into the Clickcontext).
fw/device--config/-crenamed to--build-configto free-c(clean break, no alias).fw/devicenow read their option defaults from the config (an explicit flagstill wins; with no config, behavior is unchanged).
dotbot config path/showanddotbot deployment list/show.Deferred (own follow-ups, called out so they aren't forgotten)
run controllerconsumption - it is also invoked directly byrun simulator(no root context), and still carries--config-path+ theconn-translation; migrating it cleanly wants care + bench validation.
swarmconsumption -dotbot swarmmounts swarmit's own CLI (its own-c); unifying it is a cross-repo decision, so it is intentionally untouchedhere.
network_id/swarmit_network_idin favour of oneswarm_id-touches the adapter layer; separate change.
~/.dotbot/config.tomlauto-fallback is wired but kept OFF for now(
include_user_file=False): that file is still owned by the legacyfwsegger_dir reader, and switches on when
fwmigrates onto the resolver.Validation
343 tests pass (headless): the resolver's precedence/discovery/deployment
permutations, the root wiring, the build-config rename, the helpers. black /
isort / ruff clean; docs build clean. No runtime/hardware path is changed by
this PR - the consumers either fall back to today's defaults when no config is
present, or are deferred above.