Summary
The pipeline-wide top-level [finalize] config is dead code: it deserializes and is stored in Context, but no stage ever reads it. The only working finalization mechanism is the WorkStats filter.
Details
FinalizeConfig is declared twice with the same three fields (until_hash, max_block_slot, max_block_quantity):
- Live path —
WorkStats filter (src/filters/work_stats.rs): builds its own FinalizeConfig from filter config, calls should_finalize(...) on every event, and ends the stage (gasket halts the daemon) when a condition is met. Fully implemented, unit-tested (src/framework/mod.rs:314-360), and used in E2E configs.
- Dead path — top-level
[finalize]: ConfigRoot.finalize (src/daemon/mod.rs:18) is moved into Context.finalize (src/daemon/mod.rs:97,104; src/framework/mod.rs:94) and never consumed. The work_stats bootstrapper signature is bootstrapper(self, _ctx: &Context) — the underscore confirms the context-level finalize is intentionally ignored. A [finalize] block in daemon.toml therefore silently does nothing.
Proposed change
Remove the dead config surface:
- Drop
finalize: Option<FinalizeConfig> from ConfigRoot (src/daemon/mod.rs) and Context (src/framework/mod.rs).
- Remove the now-unused plumbing in
run_daemon (src/daemon/mod.rs:97,104).
- Remove the
finalize: None lines in src/bin/oura/dump.rs:52 and src/bin/oura/watch.rs:49.
- Keep
FinalizeConfig + should_finalize (still used by the WorkStats filter).
Docs
The v2 docs have already been corrected to stop advertising a top-level [finalize] block and route finalization through the WorkStats filter (companion docs PR on branch docs/v2-fitness-fixes).
Summary
The pipeline-wide top-level
[finalize]config is dead code: it deserializes and is stored inContext, but no stage ever reads it. The only working finalization mechanism is theWorkStatsfilter.Details
FinalizeConfigis declared twice with the same three fields (until_hash,max_block_slot,max_block_quantity):WorkStatsfilter (src/filters/work_stats.rs): builds its ownFinalizeConfigfrom filter config, callsshould_finalize(...)on every event, and ends the stage (gasket halts the daemon) when a condition is met. Fully implemented, unit-tested (src/framework/mod.rs:314-360), and used in E2E configs.[finalize]:ConfigRoot.finalize(src/daemon/mod.rs:18) is moved intoContext.finalize(src/daemon/mod.rs:97,104;src/framework/mod.rs:94) and never consumed. The work_stats bootstrapper signature isbootstrapper(self, _ctx: &Context)— the underscore confirms the context-level finalize is intentionally ignored. A[finalize]block indaemon.tomltherefore silently does nothing.Proposed change
Remove the dead config surface:
finalize: Option<FinalizeConfig>fromConfigRoot(src/daemon/mod.rs) andContext(src/framework/mod.rs).run_daemon(src/daemon/mod.rs:97,104).finalize: Nonelines insrc/bin/oura/dump.rs:52andsrc/bin/oura/watch.rs:49.FinalizeConfig+should_finalize(still used by theWorkStatsfilter).Docs
The v2 docs have already been corrected to stop advertising a top-level
[finalize]block and route finalization through theWorkStatsfilter (companion docs PR on branchdocs/v2-fitness-fixes).