You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When processing large filings that contain [BEGINTEXT]/[ENDTEXT] blocks (used for F99 miscellaneous text and TEXT records), libfec fastfec panics with:
thread 'main' panicked at crates/fec-cli/src/commands/fastfec.rs:89:18:
CSV position to be available
The [BEGINTEXT]/[ENDTEXT] handler in Filing::next_row() constructs a new StringRecord from the text content, but this record lacks the CSV byte-position metadata. The progress bar code then calls .expect() on the missing position.
Root Cause
fastfec.rs:86-90:
pb.set_position(
r.record.position().expect("CSV position to be available").byte(),);
Records emitted from [BEGINTEXT]/[ENDTEXT] processing (in lib.rs:344-382) are constructed from the next record after [ENDTEXT], which may not have position info depending on the CSV reader state.
Affected Filing
Filing ID: 1947601 (130MB, Trump for President F3PA filing FEC-1434701)
Reproduction
# libfec panics:
libfec fastfec ~/.cache/libfec/cache/1947601.fec /tmp/out_libfec
# thread 'main' panicked at crates/fec-cli/src/commands/fastfec.rs:89:18:# CSV position to be available# FastFEC succeeds:
fastfec --no-stdin ~/.cache/libfec/cache/1947601.fec /tmp/out_fastfec
# Done; parsing successful!
Observe the Difference
# libfec produces no output (panics before completing):
ls /tmp/out_libfec/1947601/ 2>/dev/null ||echo"directory incomplete or missing"# FastFEC produces full output:
ls /tmp/out_fastfec/1947601/
# F3PA.csv SA20A.csv SB23.csv SB29.csv SD12.csv TEXT.csv header.csv
Suggested Fix
Replace .expect("CSV position to be available") with a fallback:
Note
Much of this ticket was composed with Claude
Description
When processing large filings that contain
[BEGINTEXT]/[ENDTEXT]blocks (used for F99 miscellaneous text and TEXT records),libfec fastfecpanics with:The
[BEGINTEXT]/[ENDTEXT]handler inFiling::next_row()constructs a newStringRecordfrom the text content, but this record lacks the CSV byte-position metadata. The progress bar code then calls.expect()on the missing position.Root Cause
fastfec.rs:86-90:Records emitted from
[BEGINTEXT]/[ENDTEXT]processing (inlib.rs:344-382) are constructed from the next record after[ENDTEXT], which may not have position info depending on the CSV reader state.Affected Filing
Filing ID: 1947601 (130MB, Trump for President F3PA filing FEC-1434701)
Reproduction
Observe the Difference
Suggested Fix
Replace
.expect("CSV position to be available")with a fallback:(NOTE: wait no, we can copy the position data from the original StringRecord to the new one, right?)