pub fn commit(
sess: &mut Session,
year: i32,
ri: &ReturnInputs,
table: Option<&TaxTable>,
params: Option<&FullReturnParams>,
) -> Result<CommitOutcome, CliError>Expand description
Screen ri, and ONLY if it passes write the committed row and delete the draft (SPEC §5.7).
The write is all-or-nothing:
- No
table/paramsfor the year →CommitOutcome::NoTables(the TY2024-only gate, I-11) — writes nothing. screen_inputsreturnsSome(refusal)→CommitOutcome::Refused— writes nothing, so a refused commit never poisons the year atresolveand the draft remains for the user to fix.- Clean → snapshot the in-memory DB,
return_inputs::setthe committed row,delete_draft, thensess.save()viamutate_and_save(which rolls back on ANY failure) so there is never an in-memory/disk split (the committed row + draft-deletion are rolled back together, I-7).
Takes &mut Session for save(); reads through the SAME session’s conn() — never opens a second
Session (N-1).