Skip to content

feat(cli)!: require canonical config discovery - #619

Merged
LukeMathWalker merged 8 commits into
mainfrom
amp/canonical-config-discovery
Sep 3, 2026
Merged

feat(cli)!: require canonical config discovery#619
LukeMathWalker merged 8 commits into
mainfrom
amp/canonical-config-discovery

Conversation

@LukeMathWalker

@LukeMathWalker LukeMathWalker commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Why

OpenFirma has one current configuration-file selection contract. firma doctor, firma control, and firma monitor still exposed a separate environment input, while duplicated documentation obscured the difference between file selection, section overlays, and Run-only profile inheritance.

What Changed

  • Bind doctor, control, and monitor to canonical FIRMA_CONFIG; explicit --config remains highest precedence and nearest .firma/firma.toml remains the project fallback.
  • Ignore FIRMA_STACK_CONFIG completely and remove it from public help and current-product documentation.
  • Prove every command's flag, environment, ignored-input, and project-discovery behavior through compiled subprocess tests.
  • Centralize the selected-file/default/Authority-overlay/Sidecar-overlay/Run-only layering model and compact Run shape rules in docs/configuration.md, with aligned links and llms.txt guidance.

Breaking Contract

FIRMA_STACK_CONFIG no longer selects configuration. Use FIRMA_CONFIG or explicit --config.

Plan and Independent Review

  • Accepted plan and plan-review disposition: 3f41248e.
  • Independent implementation reviews and dispositions: 8c87cfb7. The final exact candidate had no actionable findings.
  • Immediate mechanical plan removal: 4ff42c53. No plan Markdown remains at the tip or in the PR diff.

Atomic Revisions

  1. 3f41248e — accepted plan and independent plan-review disposition.
  2. 5ec3d34d — canonical command selection and compiled behavior proof.
  3. 95ce03e2 — concise canonical resolution documentation.
  4. 8c87cfb7 — independent implementation-review record and dispositions.
  5. 4ff42c53 — immediate plan removal.

@LukeMathWalker
LukeMathWalker force-pushed the amp/canonical-config-discovery branch from 7fc9cbb to 4ff42c5 Compare August 28, 2026 17:32
@luca-iachini
luca-iachini force-pushed the amp/canonical-config-discovery branch 2 times, most recently from 7ea2199 to 2135a80 Compare September 1, 2026 16:29
@LukeMathWalker
LukeMathWalker force-pushed the amp/canonical-config-discovery branch from 2135a80 to 747da4f Compare September 1, 2026 16:56
@luca-iachini
luca-iachini added this pull request to the merge queue Sep 2, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue because a pull request earlier in the stack was removed Sep 2, 2026
luca-iachini added a commit that referenced this pull request Sep 2, 2026
## Why

`firma sidecar` bound `--config` to `FIRMA_SIDECAR_CONFIG_FILE`,
`authority` bound no env, and the stack-inspection commands bound
`FIRMA_CONFIG` — all selecting the same unified `firma.toml`. The
`FIRMA_SIDECAR_CONFIG_FILE` name was also overloaded as a `firma run`
autostart sidecar-template source, so setting it for one purpose
silently affected the other. This unifies unified-config selection under
one canonical flag and env.

## What Changed

- Add a global `-c` / `--config` bound to `FIRMA_CONFIG` on the
top-level `firma` command (accepted before or after any subcommand);
`main.rs` threads the resolved path into each consumer.
- Remove the per-command unified-config `--config` from `control`,
`doctor`, `monitor`, `sidecar` (serve/start/stop), and `authority`.
`firma run --config` keeps working via the global (it was already the
unified-config selector).
- Fully retire `FIRMA_SIDECAR_CONFIG_FILE`, including the `firma run`
autostart template fallback (`TemplateSource::Env` removed; selection is
now `--sidecar-config` → `./firma_sidecar.toml` → synthesized minimal).
- Update docs (cli.md, README, manage-the-stack, firma-run, examples)
and extend the `--help` contract test to sidecar/authority.

## Risks / Notes

- **Breaking (`feat!`)**: `FIRMA_SIDECAR_CONFIG_FILE` is removed.
Migration: export `FIRMA_CONFIG` to select the unified `firma.toml`; use
`--sidecar-config <path>` (or `./firma_sidecar.toml`) for a `firma run`
autostart template.
- Config resolution precedence and fail-closed behavior are unchanged
(still owned by `firma-config-loader` `ConfigResolver`); the path — not
a pre-resolved config — is threaded because `doctor` reports resolution,
`run` may scaffold, and `sidecar start` uses a different resolver.
- As a clap global, `--config` is also accepted (and ignored) by
commands that do not consume the unified config (`token`, `policy`,
internal `__*`).
- Design/rationale: `docs/architecture/config-env-unification-plan.md`.
- Stacked on top of #619 (`amp/canonical-config-discovery`); base
retargets to `main` once that merges.

## AI Assistance

Claude Opus 4.8 (claude-opus-4-8).
Base automatically changed from amp/remove-legacy-run-config to main September 3, 2026 07:07
@LukeMathWalker
LukeMathWalker force-pushed the amp/canonical-config-discovery branch from fa500cb to 1868504 Compare September 3, 2026 07:08
LukeMathWalker pushed a commit that referenced this pull request Sep 3, 2026
## Why

`firma sidecar` bound `--config` to `FIRMA_SIDECAR_CONFIG_FILE`,
`authority` bound no env, and the stack-inspection commands bound
`FIRMA_CONFIG` — all selecting the same unified `firma.toml`. The
`FIRMA_SIDECAR_CONFIG_FILE` name was also overloaded as a `firma run`
autostart sidecar-template source, so setting it for one purpose
silently affected the other. This unifies unified-config selection under
one canonical flag and env.

## What Changed

- Add a global `-c` / `--config` bound to `FIRMA_CONFIG` on the
top-level `firma` command (accepted before or after any subcommand);
`main.rs` threads the resolved path into each consumer.
- Remove the per-command unified-config `--config` from `control`,
`doctor`, `monitor`, `sidecar` (serve/start/stop), and `authority`.
`firma run --config` keeps working via the global (it was already the
unified-config selector).
- Fully retire `FIRMA_SIDECAR_CONFIG_FILE`, including the `firma run`
autostart template fallback (`TemplateSource::Env` removed; selection is
now `--sidecar-config` → `./firma_sidecar.toml` → synthesized minimal).
- Update docs (cli.md, README, manage-the-stack, firma-run, examples)
and extend the `--help` contract test to sidecar/authority.

## Risks / Notes

- **Breaking (`feat!`)**: `FIRMA_SIDECAR_CONFIG_FILE` is removed.
Migration: export `FIRMA_CONFIG` to select the unified `firma.toml`; use
`--sidecar-config <path>` (or `./firma_sidecar.toml`) for a `firma run`
autostart template.
- Config resolution precedence and fail-closed behavior are unchanged
(still owned by `firma-config-loader` `ConfigResolver`); the path — not
a pre-resolved config — is threaded because `doctor` reports resolution,
`run` may scaffold, and `sidecar start` uses a different resolver.
- As a clap global, `--config` is also accepted (and ignored) by
commands that do not consume the unified config (`token`, `policy`,
internal `__*`).
- Design/rationale: `docs/architecture/config-env-unification-plan.md`.
- Stacked on top of #619 (`amp/canonical-config-discovery`); base
retargets to `main` once that merges.

## AI Assistance

Claude Opus 4.8 (claude-opus-4-8).
LukeMathWalker and others added 8 commits September 3, 2026 07:13
Move config_commands_expose_only_canonical_environment_variable out of the
doctor integration test into cli_help, alongside the other --help surface
assertions. doctor keeps only its doctor-specific JSON-output test.
The monitor flags table said --config does not participate in resolution and
listed no env var; control's section omitted it entirely. Both now bind
FIRMA_CONFIG and select the config used for audit-log and policy discovery,
failing closed on an unreadable file. Mirror the doctor guide's table.
## Why

`firma sidecar` bound `--config` to `FIRMA_SIDECAR_CONFIG_FILE`,
`authority` bound no env, and the stack-inspection commands bound
`FIRMA_CONFIG` — all selecting the same unified `firma.toml`. The
`FIRMA_SIDECAR_CONFIG_FILE` name was also overloaded as a `firma run`
autostart sidecar-template source, so setting it for one purpose
silently affected the other. This unifies unified-config selection under
one canonical flag and env.

## What Changed

- Add a global `-c` / `--config` bound to `FIRMA_CONFIG` on the
top-level `firma` command (accepted before or after any subcommand);
`main.rs` threads the resolved path into each consumer.
- Remove the per-command unified-config `--config` from `control`,
`doctor`, `monitor`, `sidecar` (serve/start/stop), and `authority`.
`firma run --config` keeps working via the global (it was already the
unified-config selector).
- Fully retire `FIRMA_SIDECAR_CONFIG_FILE`, including the `firma run`
autostart template fallback (`TemplateSource::Env` removed; selection is
now `--sidecar-config` → `./firma_sidecar.toml` → synthesized minimal).
- Update docs (cli.md, README, manage-the-stack, firma-run, examples)
and extend the `--help` contract test to sidecar/authority.

## Risks / Notes

- **Breaking (`feat!`)**: `FIRMA_SIDECAR_CONFIG_FILE` is removed.
Migration: export `FIRMA_CONFIG` to select the unified `firma.toml`; use
`--sidecar-config <path>` (or `./firma_sidecar.toml`) for a `firma run`
autostart template.
- Config resolution precedence and fail-closed behavior are unchanged
(still owned by `firma-config-loader` `ConfigResolver`); the path — not
a pre-resolved config — is threaded because `doctor` reports resolution,
`run` may scaffold, and `sidecar start` uses a different resolver.
- As a clap global, `--config` is also accepted (and ignored) by
commands that do not consume the unified config (`token`, `policy`,
internal `__*`).
- Design/rationale: `docs/architecture/config-env-unification-plan.md`.
- Stacked on top of #619 (`amp/canonical-config-discovery`); base
retargets to `main` once that merges.

## AI Assistance

Claude Opus 4.8 (claude-opus-4-8).
@LukeMathWalker
LukeMathWalker force-pushed the amp/canonical-config-discovery branch from 1868504 to 8836aab Compare September 3, 2026 07:14
@LukeMathWalker
LukeMathWalker added this pull request to the merge queue Sep 3, 2026
Merged via the queue into main with commit a1d9674 Sep 3, 2026
30 checks passed
@LukeMathWalker
LukeMathWalker deleted the amp/canonical-config-discovery branch September 3, 2026 08:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants