mfd doctor
mfd doctor checks your configuration before you run anything long. It loads mfd.yml, resolves every ${NAME} reference, and checks that each pipeline has a source and that every reference between pipelines and entries resolves. It does not connect to your source or destination, so it is fast and safe to run anywhere: after editing the config, in CI on every change, or as the first step of a deploy. Omit --pipeline to check every pipeline in the file. Pass --pipeline <name> to check that pipeline only. PIPELINE_NAME does not change the default.
Usage
import mfd
session = mfd.Session(mfd.Config.discover().get_pipeline("bikehire"))
result = session.doctor()
print(result["ok"])mfd doctor [--pipeline <name>] [--output text|json] [--config <path>]Options
| Flag | Default | Description |
|---|---|---|
--pipeline <NAME> | every pipeline | Check this pipeline only. Omit to check the whole file. |
--output <MODE> | text | text prints one line per check. json prints {"ok": bool, "checks": [...]} for scripts. |
--config <PATH> | ./mfd.yml | Config file to check. |
--log [LEVEL] | Off | Print logs to stderr. |
See CLI overview for the other global flags.
What doctor checks
| Check | Passes when |
|---|---|
| Config loads | mfd.yml parses and every ${NAME} reference has a value. If not, doctor stops with [mfd] config failed: ... before running other checks. |
| Pipelines | At least one pipeline is configured. |
| Sources | data_sources is not empty. |
| Destinations | Always passes. A pipeline without a data_sink is valid: its data stays in the WAL. |
| Each pipeline | Its data_source, data_sink, and other references point at entries that exist, and the source format and mode are legal. |
| Whole config | No two ManifoldLake or DuckDB destinations write the same namespace. |
| Storage mode | Reports mfd_el_storage_mode for each pipeline. |
Doctor validates configuration only. To test credentials and connectivity, run mfd discover, which reads the source but never writes to the destination.
A missing ${NAME} variable fails while the config loads, before doctor runs: the CLI prints [mfd] config failed: ... and exits 1. Python raises ValueError when you construct Session, so doctor() never runs. A dangling data_sources.foo is a failed doctor check on the CLI; in Python it is also ValueError at Session(...), because a Session is bound to one pipeline that must already resolve.
Examples
Check the config in the current directory
mfd doctor [ok] 1 pipeline(s) configured
[ok] data_sources configured
[ok] data_sinks configured (optional)
[ok] pipeline 'bikehire' (source+sink)
[ok] mfd_el_storage_mode=local
All checks passed.A failing check is marked [FAIL] and the summary reads Some checks failed.
Check one pipeline
mfd doctor --pipeline bikehireOmit --pipeline to check every pipeline in the file.
JSON for CI
mfd doctor --output json{
"ok": true,
"checks": [
{ "ok": true, "severity": "info", "message": "1 pipeline(s) configured" },
{ "ok": true, "severity": "info", "message": "data_sources configured" },
{ "ok": true, "severity": "info", "message": "no data_sink; WAL is the dataset" },
{ "ok": true, "severity": "info", "message": "pipeline 'rides' (source, WAL-only)" },
{ "ok": true, "severity": "info", "message": "mfd_el_storage_mode=local" }
]
}Each check has ok, severity (info or error), and message. A check may also include suggested_fix_command.
Fail a CI job on a bad config
mfd --config deploy/mfd.yml doctor --output json > doctor.json || {
jq -r '.checks[] | select(.ok == false) | .message' doctor.json
exit 1
}Doctor needs every ${NAME} variable to be set, so export your secrets (or test placeholders) in the CI job first.
Troubleshooting
| Output | Cause | Fix |
|---|---|---|
[mfd] config failed: ... references ${NAME} at ... but that environment variable is not set | A secret reference has no value. | export NAME=..., or add it to a .env file next to mfd.yml. |
[FAIL] no pipelines configured and [FAIL] data_sources is empty | Doctor found no config file, or the file is empty. | Run from the folder that contains mfd.yml, or pass --config. |
[mfd] config failed: Invalid Manifold configuration in ... | mfd.yml has a YAML error or an unknown key. | Fix the line named in the message. |
Exit codes
| Code | Meaning |
|---|---|
0 | All checks passed. |
1 | At least one check failed, or the config could not be loaded. |
