Skip to main content

Module testonly

Module testonly 

Source

Structs§

AmountCols
The 4 monetary “amount” columns of a Form 8949 / Schedule D totals row: (d) proceeds, (e) cost, (g) adjustment, (h) gain. Column (f) — the code column — has no total (a spacer), so it is absent.
Field
One terminal (leaf) AcroForm field: its object id, fully-qualified name, widget rectangle, and whether it is a checkbox (/FT /Btn).
FlatPlacement
One authorized SP2 write. col indexes a hand-pinned column-x cluster (None = geometry-exempt, e.g. a wide free-text identity field); descent = (group, ordinal) for per-group strictly- descending-y ordering (None = not in any ordered sequence); check marks a checkbox (only in the no-unmapped scan + any same-y-pair predicate).
Form1040Fill
The result of a Form 1040 cap-gains fill: the bytes + what was actually written (drives the CLI’s partial-scope + loss notices).
Form1040Map
Form8275Map
The Form 8275 (Disclosure Statement, Rev. 10-2024) field map. One revision, aliased to every SUPPORTED_YEAR — see F8275_MAP_2024.
Form8275Row
One Form 8275 Part I row (Rev. 10-2024): the columns btctax actually fills, keyed to a T13 Part1Item. FREE-TEXT, no money-grid clustering (arch/T15): every cell here is written via push_free/FlatPlacement::free, not the column-x-clustered push_cell form8283/Schedule-SE use.
Form8283Map
The Form 8283 (Rev. 12-2025) field map for one tax year.
Form8949Map
The full Form 8949 field map for one tax year.
Form8959Map
The Form 8959 (Additional Medicare Tax) field map for one tax year.
Form8960Map
The Form 8960 (Net Investment Income Tax) field map for one tax year.
Form8995Map
The Form 8995 (QBI deduction, simplified) field map for one tax year.
MoneyPair
A dollars-field + cents-field PAIR (the 2017 Schedule SE / Form 1040 / Form 8283 split every money amount into a whole-dollars field and a 2-digit cents field). The geometric oracle treats the pair as ONE logical cell at the dollars-field geometry (the cents field rides along as an authorized but geometry-exempt write). Because both fields descend from the same AcroForm root, merge_copies (which renames only the root /T) rewrites BOTH names as a unit — so overflow is safe.
PartData
One part’s formatted rows + totals, ready to place on the form.
PartMap
One Form 8949 part (Part I short-term on page 0, Part II long-term on page 1).
Placement
One authorized write: the field we set, and the logical cell it must occupy.
Schedule1Map
The Schedule 1 (Additional Income and Adjustments to Income) field map for one tax year.
Schedule2Map
The Schedule 2 (Additional Taxes) field map for one tax year.
Schedule3Map
The Schedule 3 (Additional Credits and Payments) field map for one tax year.
ScheduleAMap
The Schedule A (Itemized Deductions) field map for one tax year.
ScheduleBMap
The Schedule B (Interest and Ordinary Dividends) field map for one tax year.
ScheduleCMap
The Schedule C (Profit or Loss From Business) field map — the crypto trade or business.
ScheduleDMap
The Schedule D field map for one tax year.
ScheduleSeMap
The Schedule SE (Form 1040) field map for one tax year — the filled §1401 line chain.

Enums§

Geo
Where a written value is supposed to land.
MoneyCell
A monetary cell: a single field carrying the whole formatted amount (2024/2025), or a dollars+cents MoneyPair (the 2017 forms). Deserializes untagged: a TOML stringMoneyCell::Single; a TOML inline table { dollars_field, cents_field }MoneyCell::Pair.

Constants§

F1040_MAP_2024
The TY2024 Form 1040 map (embedded at compile time).
F1040_PDF_2017
The bundled TY2017 Form 1040 (official IRS fillable PDF, US-gov public domain).
F1040_PDF_2024
The bundled TY2024 Form 1040 (official IRS fillable PDF, US-gov public domain).
F1040_PDF_2025
The bundled TY2025 Form 1040 (official IRS fillable PDF, US-gov public domain).
F8275_MAP_2024
The Form 8275 map (Rev. 10-2024, embedded at compile time). ★ Form 8275 is REVISION-versioned, not tax-year-versioned: this ONE map + its bundled PDF are aliased to EVERY SUPPORTED_YEAR — there is no F8275_MAP_2017 / F8275_MAP_2025 (Form8275Map::for_year reuses this same parsed map, re-stamping only the year field).
F8275_PDF_2024
The bundled Form 8275, Rev. 10-2024 (official IRS fillable PDF, US-gov public domain). ★ Form 8275 is REVISION-versioned, not tax-year-versioned: this ONE asset is aliased to EVERY SUPPORTED_YEAR by [f8275_pdf] — there is no separate F8275_PDF_2017 / F8275_PDF_2025.
F8283_MAP_2024
The TY2024 Form 8283 map (Rev. 12-2023, embedded at compile time).
F8283_PDF_2017
The bundled Form 8283, Rev. 12-2014 (TY2017; official IRS fillable PDF, US-gov public domain).
F8283_PDF_2024
The bundled Form 8283, Rev. 12-2023 (TY2024; official IRS fillable PDF, US-gov public domain).
F8283_PDF_2025
The bundled Form 8283, Rev. 12-2025 (official IRS fillable PDF, US-gov public domain).
F8949_MAP_2024
The TY2024 Form 8949 map (embedded at compile time).
F8949_PDF_2017
The bundled TY2017 Form 8949 (official IRS fillable PDF, US-gov public domain).
F8949_PDF_2024
The bundled TY2024 Form 8949 (official IRS fillable PDF, US-gov public domain).
F8949_PDF_2025
The bundled TY2025 Form 8949 (official IRS fillable PDF, US-gov public domain).
F8959_MAP_2024
The TY2024 Form 8959 (Additional Medicare Tax) map (embedded at compile time).
F8959_PDF_2024
The bundled TY2024 Form 8959, Additional Medicare Tax (official IRS fillable PDF, public domain).
F8960_MAP_2024
The TY2024 Form 8960 (Net Investment Income Tax) map (embedded at compile time).
F8995_MAP_2024
The TY2024 Form 8995 (QBI deduction, simplified) map (embedded at compile time).
SCHEDULE_1_MAP_2024
The TY2024 Schedule 1 (Additional Income and Adjustments) map (embedded at compile time).
SCHEDULE_2_MAP_2024
The TY2024 Schedule 2 (Additional Taxes) map (embedded at compile time).
SCHEDULE_3_MAP_2024
The TY2024 Schedule 3 (Additional Credits and Payments) map (embedded at compile time).
SCHEDULE_A_MAP_2024
The TY2024 Schedule A (Itemized Deductions) map (embedded at compile time).
SCHEDULE_B_MAP_2024
The TY2024 Schedule B (Interest and Ordinary Dividends) map (embedded at compile time).
SCHEDULE_C_MAP_2024
The TY2024 Schedule C (Profit or Loss From Business) map (embedded at compile time).
SCHEDULE_D_MAP_2024
The TY2024 Schedule D map (embedded at compile time).
SCHEDULE_D_PDF_2017
The bundled TY2017 Schedule D (official IRS fillable PDF, US-gov public domain).
SCHEDULE_D_PDF_2024
The bundled TY2024 Schedule D (official IRS fillable PDF, US-gov public domain).
SCHEDULE_D_PDF_2025
The bundled TY2025 Schedule D (official IRS fillable PDF, US-gov public domain).
SCHEDULE_SE_MAP_2024
The TY2024 Schedule SE map (embedded at compile time).
SCHEDULE_SE_PDF_2017
The bundled TY2017 Schedule SE (official IRS fillable PDF, US-gov public domain).
SCHEDULE_SE_PDF_2024
The bundled TY2024 Schedule SE (official IRS fillable PDF, US-gov public domain).
SCHEDULE_SE_PDF_2025
The bundled TY2025 Schedule SE (official IRS fillable PDF, US-gov public domain).

Functions§

button_on_states
The possible ON-state name(s) of a button widget — the /AP /N appearance keys other than /Off (without the leading /). Read straight from the bundled PDF, so the SP2 same-y /Btn pair oracle (the 1040 Digital-Asset Yes/No question) is map-INDEPENDENT. Empty when the widget carries no /AP//N.
checkbox_on
Read back a checkbox’s /AS on-state (None if /Off or absent).
collect_fields
Walk the AcroForm /Fields tree and collect every terminal (leaf) field.
extract_lines
Read a filled PDF back as logical line name → the text actually on the paper.
fill_1040_with_map
Fill the Form 1040 capital-gains cells. Returns Ok(None) — skip the whole 1040 — when there is no reportable activity (da_yes == false). Otherwise the DA question is answered YES and line 7a is filled per the active/line-16 rules. Read back through the geometric verifier (fails closed).
fill_8275_with_map
The map-parametrized fill (exposed via testonly for fault-injection KATs — mirrors fill_schedule_se_with_map / fill_1040_with_map). Kept identity-REQUIRED (unlike fill_form_8283’s Option) at this call surface — every existing caller (the full-return packet, sp4.rs’s KATs) has one; the crypto-slice caller goes through [fill_form_8275_slice] instead.
fill_8283_with_map
Fill Form 8283 from the projected donation rows. Ok(None) when there are no donation rows.
fill_8949_full_with_map
Fill the full-return Form 8949 (whole dollars) from the core-derived printed chain.
fill_8949_parts
Fill Form 8949 (Part I + Part II, ≤ 11 rows each) into the bundled TY2025 PDF and return the serialized bytes. The output is read back through the geometric verifier — a mis-mapped cell or a stray write FAILS CLOSED (no bytes returned). Pagination for > 11 rows is handled by crate::fill_form_8949, which chunks before calling this.
fill_form_1040_full_with_map
Fill the FULL-RETURN Form 1040. The serialized bytes are read back through the geometric verifier (a mis-mapped cell FAILS CLOSED).
fill_form_8959_with_map
Fill Form 8959 for year from the core-derived line chain. Returns Ok(None) when the form is not required (line 18 and line 24 both zero — see the module note on why line 24 is not redundant). Otherwise returns the serialized PDF bytes, read back through the geometric verifier (a mis-mapped cell FAILS CLOSED).
fill_form_8960_with_map
Fill Form 8960 from the core-derived line chain. The serialized bytes are read back through the geometric verifier (a mis-mapped cell FAILS CLOSED).
fill_form_8995_with_map
Fill Form 8995 from the core-derived line chain. The serialized bytes are read back through the geometric verifier (a mis-mapped cell FAILS CLOSED).
fill_schedule_1_with_map
Fill Schedule 1 from the core-derived printed chain.
fill_schedule_2_with_map
Fill Schedule 2 from the core-derived printed chain. The serialized bytes are read back through the geometric verifier (a mis-mapped cell FAILS CLOSED).
fill_schedule_3_with_map
Fill Schedule 3 from the core-derived printed chain. Single page, so one descent group.
fill_schedule_a_with_map
Fill Schedule A from the core-derived printed chain. The serialized bytes are read back through the geometric verifier (a mis-mapped cell FAILS CLOSED).
fill_schedule_b_with_map
Fill Schedule B from the core-derived printed chain. The serialized bytes are read back through the geometric verifier (a mis-mapped cell FAILS CLOSED).
fill_schedule_c_with_map
Fill Schedule C from the core-derived printed chain. The serialized bytes are read back through the geometric verifier (a mis-mapped cell FAILS CLOSED).
fill_schedule_d_full_with_map
Fill the FULL-RETURN Schedule D from the core-derived printed chain, including Part III’s routing. The serialized bytes are read back through the geometric verifier (a mis-mapped cell FAILS CLOSED).
fill_schedule_d_totals
Fill Schedule D from the year’s part totals and return the serialized bytes, read back through a geometric + no-unmapped verifier (a mis-mapped amount column fails closed).
fill_schedule_se_full_with_map
Fill the full-return Schedule SE from the core-derived printed chain.
fill_schedule_se_with_map
Fill Schedule SE for year from the computed SeTaxResult, the filer’s Form W-2 Social Security wages (w2_ss_wages, line 8a), and the year’s Social Security wage base (ss_wage_base, line 7). Returns Ok(None) when net SE earnings are below the $400 floor (no SE tax owed — skip the form). Otherwise returns the serialized PDF bytes, read back through the geometric verifier (a mis-mapped cell FAILS CLOSED).
fmt_money_pair
Split a money amount into (whole-dollars, 2-digit-zero-padded-cents) — the REAL formatter the dollars+cents pairs need (fmt_money is the raw Decimal Display, which pads no cents). The value is rounded to cents first, so 100 → ("100","00"), 45500.5 → ("45500","50"), 100.05 → ("100","05").
index
Index the collected leaf fields by fully-qualified name.
load
Parse a bundled PDF into a mutable document.
no_unmapped_filled
Assert that every field carrying a value is in the authorized (placement) set.
part_data
Build one part’s PartData from its rows.
pdf_has_xfa
Whether the document’s AcroForm still carries an /XFA key.
split_parts
Split the year’s rows into Part I (short-term) and Part II (long-term), preserving the core’s deterministic order.
text_value
Read back a leaf field’s /V as a string (text value) — used by tests and the no-unmapped scan.
topmost_yes_no_pair
Map-INDEPENDENT oracle for the 1040 Digital-Asset Yes/No question: the top-most horizontally ADJACENT page-page /Btn pair (exactly two widgets sharing a center-y, boxes ≤ [DA_PAIR_MAX_DX] apart) whose on-states are exactly {/1,/2}. Returns (yes_fqn, no_fqn) = (LEFT member, right member). Derived from the blank PDF’s widget geometry + appearance states, never the map.
verify_8949
Verify a Form 8949 fill: (1) every written value lands in the geometrically-expected column/row band, and (2) no unmapped field carries a value. Fails closed. table_token is the per-year data-grid subform token (Table_Line1 for 2024, Table_Line1_Part for 2025).
verify_flat
Verify a flat-form fill: page membership + hand-pinned column-x membership + per-group ordinal-y descent + the no-unmapped scan. clusters is the per-form hand-pinned logical-column → (min_x0, max_x1) table (measured from the blank PDF). Fails closed.