Skip to main content

Module input_form_store

Module input_form_store 

Source
Expand description

Per-year return_inputs_draft(year, inputs_json, schema_version, parked) side-table — the input form’s crash-recovery scratch, INVISIBLE to resolve.rs. parked = 1 marks a parked committed return (C-1).

Plan-2 task 1 built the table + low-level row I/O; task 2 added save_draft (the autosave primitive); task 3 adds load (the read path: draft ⇒ committed ⇒ fresh, with the §6.3 stale split). Every low-level item now has a non-test caller — set_draft_row/parked_flag via save_draft, and DraftRow/ get_draft_row via load — so none carries a #[allow(dead_code)] any longer.

Structs§

StaleNote
The §6.3 fact that load discarded a stale work-in-progress draft (schema found — a version this build does not read — vs expected). Returned ALONGSIDE Loaded so the caller can surface it: a store read fn must not eprintln! the note itself, because its only future caller is plan 3’s raw-mode, alternate-screen TUI, where stderr is invisible/screen-corrupting (I-1). pub so plan 3 can render it.

Enums§

ActiveSource
The source the input form is CURRENTLY displaying/editing for year — the toggle’s read side.
CommitOutcome
The outcome of a commit attempt.
Loaded
The working return for a year, resolved through the §6.1 precedence: a draft shadows the committed row.

Functions§

active_source
Which source is active for year, mirroring resolve.rs precedence (committed full return, then tax_profile, then neither).
coherence_clear_or_refuse
§6.2 draft-coherence: reconcile that year’s input-form draft with an authoritative committed-row write.
commit
Screen ri, and ONLY if it passes write the committed row and delete the draft (SPEC §5.7).
discard_parked_draft
Discard the parked draft for year — the ‘X’ path (§9A/M-2), the ONLY deleter of a parked = 1 row.
draft_exists
init_draft_table
Create the draft side-table if absent. Idempotent; called first by every fn (safe on an older vault).
load
Resolve the working return for year (§6.1 precedence + §6.3 stale split).
park_to_profile
Park the committed return for year into its draft (the “switch to tax-profile” toggle — C-1).
save_draft
Autosave a mid-entry return to the draft table (the input form’s crash-recovery scratch).
shadows_profile
Whether a tax_profile exists for year — the TUI’s commit-time shadow warning (§9 create-row amendment): committing a full return for a year that also has a tax_profile leaves the profile in place but no longer active, so the form warns before writing.