Settings is a 19-field bag passed whole to every stage, while diarize_audioalso accepts its own threshold knobs — the 0.7 default is written three times (config.py:87, diarize.py:60-64 module constant, diarize.py:369 signature default), so a library caller passing settings without cluster_threshold silently gets 0.7 regardless of settings.diarize_cluster_threshold. Deepen the interface: Settings stays a config reader, but each stage takes a frozen per-stage options value.
Problem (evidence)
diarize.py:364-372: diarize_audio(wav, *, settings, num_speakers=-1, cluster_threshold=DEFAULT_CLUSTER_THRESHOLD, ...) — two channels for the same knobs in one interface.
pipeline.py:476, 948 forward settings.diarize_cluster_threshold (so the pipeline path works); direct library callers get the signature default instead. Same knob, two sources of truth, one silent.
resolved_vlm() / resolved_synthesis() (config.py:134-145) are byte-identical twins that must be kept in sync by hand.
resolved_stt() (config.py:120-127) branches on model_fields_set — on construction history — so a TOML/env user cannot express "whisper with the default checkpoint".
Callers patch the bag to change one field: model_copy(update=...) at cli.py:555, 593, mcp_server.py:153 — what an interface looks like when it cannot be narrowed at the call site.
tests/test_pipeline.py:55-72 constructs ten unrelated fields to exercise one stage.
Proposed design
Per-stage option values, defined next to their stage (CONTRACTS.md 1.2 pattern; single source per value):
# diarize.pyclassDiarizeOptions(BaseModel,frozen=True):backend:strcluster_threshold:float# NO independent default heremin_duration_on:floatmin_duration_off:floatnum_speakers:int=-1
(similarly SttOptions in transcribe/__init__.py; ShotOptions composed from the plan_shots issue; describe/report options next to their stages)
# config.pydefoptions_for(self,stage:str)->...# on Settings; constructs the stage's value
Stage signatures change to take their options value: diarize_audio(wav, options: DiarizeOptions). The settings parameter disappears from stage functions — the pipeline holds settings; stages receive values.
Defaults live once: DiarizeOptions has no independent threshold default; Settings.options_for("diarize") fills it from diarize_cluster_threshold. Constructing options without a knob becomes a visible, explicit act instead of a silent 0.7.
resolved_vlm / resolved_synthesis collapse into one private helper parameterised by the settings field; the two knobs remain two knobs.
resolved_stt's whisper-model-selects-backend rule moves into options_for("stt") as one documented rule.
Pipeline stage runners and the injectable stages= seam take options values — aligning the pipeline fake seam with real stage signatures (today FakeStages.transcribe has a different shape than the Transcriber protocol).
Cache-key builders consume the options values (feeds the stage-descriptor-table issue).
Acceptance criteria
Every default appears exactly once (grep -rn "0.7" src/ -> one hit, in config)
diarize_audio(wav, settings.options_for("diarize")) honours diarize_cluster_threshold; a direct DiarizeOptions(...) without a threshold is a constructor-level decision, not a silent default
Stage functions no longer take Settings
tests/test_pipeline.py stage tests construct only the stage's options value
diarize_audio happy path testable with a fake sherpa module (today only error paths are tested, tests/test_diarize.py:560-578)
Env/TOML profile tests keep passing; "whisper with the default checkpoint" is expressible
Sequencing
Before the Transcriber-identity issue (its Diarizer.cache_params() consumes DiarizeOptions) and ideally before the stage-descriptor-table issue (key params read options).
Decision required - CONTRACTS.md freeze
Touches config.py, frozen by CONTRACTS.md 1.10 ("do not modify foundation files"). The freeze governed phase-2 build-time agents; this issue reopens it deliberately. Maintainer call: approve reopening the freeze for config.py (and models.py / transcribe/base.py in the sibling issues), and record the reopening in CONTRACTS.md itself.
## Summary
`Settings` is a 19-field bag passed whole to every stage, while `diarize_audio` *also* accepts its own threshold knobs — the 0.7 default is written three times (`config.py:87`, `diarize.py:60-64` module constant, `diarize.py:369` signature default), so a library caller passing `settings` without `cluster_threshold` silently gets 0.7 regardless of `settings.diarize_cluster_threshold`. Deepen the interface: `Settings` stays a config reader, but each stage takes a frozen per-stage options value.
## Problem (evidence)
- `diarize.py:364-372`: `diarize_audio(wav, *, settings, num_speakers=-1, cluster_threshold=DEFAULT_CLUSTER_THRESHOLD, ...)` — two channels for the same knobs in one interface.
- `pipeline.py:476, 948` forward `settings.diarize_cluster_threshold` (so the pipeline path works); direct library callers get the signature default instead. Same knob, two sources of truth, one silent.
- `resolved_vlm()` / `resolved_synthesis()` (`config.py:134-145`) are byte-identical twins that must be kept in sync by hand.
- `resolved_stt()` (`config.py:120-127`) branches on `model_fields_set` — on *construction history* — so a TOML/env user cannot express "whisper with the default checkpoint".
- Callers patch the bag to change one field: `model_copy(update=...)` at `cli.py:555, 593`, `mcp_server.py:153` — what an interface looks like when it cannot be narrowed at the call site.
- `tests/test_pipeline.py:55-72` constructs ten unrelated fields to exercise one stage.
## Proposed design
Per-stage option values, defined next to their stage (CONTRACTS.md 1.2 pattern; single source per value):
```python
# diarize.py
class DiarizeOptions(BaseModel, frozen=True):
backend: str
cluster_threshold: float # NO independent default here
min_duration_on: float
min_duration_off: float
num_speakers: int = -1
```
(similarly `SttOptions` in `transcribe/__init__.py`; `ShotOptions` composed from the `plan_shots` issue; describe/report options next to their stages)
```python
# config.py
def options_for(self, stage: str) -> ... # on Settings; constructs the stage's value
```
- Stage signatures change to take their options value: `diarize_audio(wav, options: DiarizeOptions)`. The `settings` parameter disappears from stage functions — the pipeline holds settings; stages receive values.
- Defaults live **once**: `DiarizeOptions` has no independent threshold default; `Settings.options_for("diarize")` fills it from `diarize_cluster_threshold`. Constructing options without a knob becomes a visible, explicit act instead of a silent 0.7.
- `resolved_vlm` / `resolved_synthesis` collapse into one private helper parameterised by the settings field; the two knobs remain two knobs.
- `resolved_stt`'s whisper-model-selects-backend rule moves into `options_for("stt")` as one documented rule.
- Pipeline stage runners and the injectable `stages=` seam take options values — aligning the pipeline fake seam with real stage signatures (today `FakeStages.transcribe` has a different shape than the `Transcriber` protocol).
- Cache-key builders consume the options values (feeds the stage-descriptor-table issue).
## Acceptance criteria
- [ ] Every default appears exactly once (`grep -rn "0.7" src/` -> one hit, in config)
- [ ] `diarize_audio(wav, settings.options_for("diarize"))` honours `diarize_cluster_threshold`; a direct `DiarizeOptions(...)` without a threshold is a constructor-level decision, not a silent default
- [ ] Stage functions no longer take `Settings`
- [ ] `tests/test_pipeline.py` stage tests construct only the stage's options value
- [ ] `diarize_audio` happy path testable with a fake sherpa module (today only error paths are tested, `tests/test_diarize.py:560-578`)
- [ ] Env/TOML profile tests keep passing; "whisper with the default checkpoint" is expressible
## Sequencing
Before the Transcriber-identity issue (its `Diarizer.cache_params()` consumes `DiarizeOptions`) and ideally before the stage-descriptor-table issue (key params read options).
## Decision required - CONTRACTS.md freeze
Touches `config.py`, frozen by CONTRACTS.md 1.10 ("do not modify foundation files"). The freeze governed phase-2 build-time agents; this issue reopens it deliberately. **Maintainer call: approve reopening the freeze for `config.py` (and `models.py` / `transcribe/base.py` in the sibling issues), and record the reopening in CONTRACTS.md itself.**
Maintainer decision (2026-11-23): the CONTRACTS.md 1.10 freeze is reopened per ADR-0001 (docs/adr/0001-reopen-foundation-freeze.md). Approved to touch config.py; relabeled ready-for-agent.
Maintainer decision (2026-11-23): the CONTRACTS.md 1.10 freeze is reopened per ADR-0001 (`docs/adr/0001-reopen-foundation-freeze.md`). Approved to touch `config.py`; relabeled ready-for-agent.
Implemented on arch-deepening in c58c0e4 (+8 tests; one 0.7 default left in config.py; fake-sherpa happy path added; options_for composes media's existing ShotOptions; STT rule is value-based — stt_backend='whisper' documents the default checkpoint). Gates 3/3 on the branch. Closes when arch-deepening merges to main.
Implemented on arch-deepening in c58c0e4 (+8 tests; one 0.7 default left in config.py; fake-sherpa happy path added; options_for composes media's existing ShotOptions; STT rule is value-based — stt_backend='whisper' documents the default checkpoint). Gates 3/3 on the branch. Closes when arch-deepening merges to main.
Merged to main in 37ef5e5 (arch-deepening): c58c0e4 - Settings.options_for(stage) with per-stage frozen option values; every default lives once (the diarize threshold grep hits config alone); resolved_vlm/resolved_synthesis share one helper; the pipeline seam takes options.
Merged to main in 37ef5e5 (arch-deepening): c58c0e4 - Settings.options_for(stage) with per-stage frozen option values; every default lives once (the diarize threshold grep hits config alone); resolved_vlm/resolved_synthesis share one helper; the pipeline seam takes options.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Summary
Settingsis a 19-field bag passed whole to every stage, whilediarize_audioalso accepts its own threshold knobs — the 0.7 default is written three times (config.py:87,diarize.py:60-64module constant,diarize.py:369signature default), so a library caller passingsettingswithoutcluster_thresholdsilently gets 0.7 regardless ofsettings.diarize_cluster_threshold. Deepen the interface:Settingsstays a config reader, but each stage takes a frozen per-stage options value.Problem (evidence)
diarize.py:364-372:diarize_audio(wav, *, settings, num_speakers=-1, cluster_threshold=DEFAULT_CLUSTER_THRESHOLD, ...)— two channels for the same knobs in one interface.pipeline.py:476, 948forwardsettings.diarize_cluster_threshold(so the pipeline path works); direct library callers get the signature default instead. Same knob, two sources of truth, one silent.resolved_vlm()/resolved_synthesis()(config.py:134-145) are byte-identical twins that must be kept in sync by hand.resolved_stt()(config.py:120-127) branches onmodel_fields_set— on construction history — so a TOML/env user cannot express "whisper with the default checkpoint".model_copy(update=...)atcli.py:555, 593,mcp_server.py:153— what an interface looks like when it cannot be narrowed at the call site.tests/test_pipeline.py:55-72constructs ten unrelated fields to exercise one stage.Proposed design
Per-stage option values, defined next to their stage (CONTRACTS.md 1.2 pattern; single source per value):
(similarly
SttOptionsintranscribe/__init__.py;ShotOptionscomposed from theplan_shotsissue; describe/report options next to their stages)diarize_audio(wav, options: DiarizeOptions). Thesettingsparameter disappears from stage functions — the pipeline holds settings; stages receive values.DiarizeOptionshas no independent threshold default;Settings.options_for("diarize")fills it fromdiarize_cluster_threshold. Constructing options without a knob becomes a visible, explicit act instead of a silent 0.7.resolved_vlm/resolved_synthesiscollapse into one private helper parameterised by the settings field; the two knobs remain two knobs.resolved_stt's whisper-model-selects-backend rule moves intooptions_for("stt")as one documented rule.stages=seam take options values — aligning the pipeline fake seam with real stage signatures (todayFakeStages.transcribehas a different shape than theTranscriberprotocol).Acceptance criteria
grep -rn "0.7" src/-> one hit, in config)diarize_audio(wav, settings.options_for("diarize"))honoursdiarize_cluster_threshold; a directDiarizeOptions(...)without a threshold is a constructor-level decision, not a silent defaultSettingstests/test_pipeline.pystage tests construct only the stage's options valuediarize_audiohappy path testable with a fake sherpa module (today only error paths are tested,tests/test_diarize.py:560-578)Sequencing
Before the Transcriber-identity issue (its
Diarizer.cache_params()consumesDiarizeOptions) and ideally before the stage-descriptor-table issue (key params read options).Decision required - CONTRACTS.md freeze
Touches
config.py, frozen by CONTRACTS.md 1.10 ("do not modify foundation files"). The freeze governed phase-2 build-time agents; this issue reopens it deliberately. Maintainer call: approve reopening the freeze forconfig.py(andmodels.py/transcribe/base.pyin the sibling issues), and record the reopening in CONTRACTS.md itself.Maintainer decision (2026-11-23): the CONTRACTS.md 1.10 freeze is reopened per ADR-0001 (
docs/adr/0001-reopen-foundation-freeze.md). Approved to touchconfig.py; relabeled ready-for-agent.Implemented on arch-deepening in
c58c0e4(+8 tests; one 0.7 default left in config.py; fake-sherpa happy path added; options_for composes media's existing ShotOptions; STT rule is value-based — stt_backend='whisper' documents the default checkpoint). Gates 3/3 on the branch. Closes when arch-deepening merges to main.Merged to main in
37ef5e5(arch-deepening):c58c0e4- Settings.options_for(stage) with per-stage frozen option values; every default lives once (the diarize threshold grep hits config alone); resolved_vlm/resolved_synthesis share one helper; the pipeline seam takes options.