Background
collect_scan_updates (src/footnotes/renumber/definitions.rs:178-225) both
mutates the scan state (the command) and emits tracing diagnostics for
skipped candidates (lines ~206-211) in the same pass.
Problem
Mixing the state mutation with observability entangles two responsibilities and
makes the core mutation harder to unit-test in isolation: a test of the scan
logic cannot exercise it without also driving the logging path, and the logging
cannot be reasoned about independently of the mutation order.
Objective
Separate the command from the diagnostics.
- Have the collection pass record skipped candidates into the
state (or a
returned collection) without logging.
- Emit diagnostics in a distinct
log_skipped_candidates step after collection
completes.
This restores command/query separation and lets the mutation be tested without
the tracing side effect.
Acceptance criteria
collect_scan_updates performs no logging; skipped candidates are recorded in
state.
- A separate function owns the
tracing output.
- A unit test exercises the collection logic and asserts the recorded skipped
candidates without depending on log capture.
- Existing renumber tests continue to pass; run the full
make commit gate.
References
Background
collect_scan_updates(src/footnotes/renumber/definitions.rs:178-225) bothmutates the scan
state(the command) and emitstracingdiagnostics forskipped candidates (lines ~206-211) in the same pass.
Problem
Mixing the state mutation with observability entangles two responsibilities and
makes the core mutation harder to unit-test in isolation: a test of the scan
logic cannot exercise it without also driving the logging path, and the logging
cannot be reasoned about independently of the mutation order.
Objective
Separate the command from the diagnostics.
state(or areturned collection) without logging.
log_skipped_candidatesstep after collectioncompletes.
This restores command/query separation and lets the mutation be tested without
the tracing side effect.
Acceptance criteria
collect_scan_updatesperforms no logging; skipped candidates are recorded instate.
tracingoutput.candidates without depending on log capture.
makecommit gate.References