Repository navigation
feat(autoindex): extract Excel workbooks (.xlsx), one dataset per sheet (rebase of #1120) - #1124
Merged
Merged
Conversation
Motivation: the XLSX extractor reads the same Open Packaging Conventions container as PPTX — a decompression budget across many parts, `.rels` relationship parsing and target resolution. Rather than copy them, move them from `extract/pptx.rs` into `extract/opc.rs`. Changes beyond the move: - `Budget::stream` hands a part to a closure as a bounded reader and charges the budget for the bytes actually pulled through it, so a worksheet can be parsed row by row instead of held whole. `read` is now `stream` + `read_to_end`; its behaviour is unchanged. - `attr` resolves entity references (`normalized_value`) instead of returning the raw bytes, so a sheet named `P&L` (stored `P&L`) or a relationship target with an escaped character reads correctly. A value that fails to unescape is still returned raw. Evidence: the moved `relationship_targets_resolve_like_opc` test and a new `streaming_charges_only_what_was_read_and_flags_a_cap_hit` test in `extract::opc`; every existing `extract::pptx` test passes unchanged.
Motivation: since #1114 a `.xlsx` is recognised but junked with "export each sheet as CSV". Spreadsheets are where data-science and business/finance users keep their data, and an exported CSV loses what the workbook knows: which numbers are dates, booleans, and which sheet a row came from. Record model — CSV/SQLite, not DOCX: - Each worksheet is its own group (`RawRecord.group` = sheet name, like a SQLite table), so it clusters into its own data dataset; the same sheet schema in several workbooks (q1.xlsx, q2.xlsx) merges into one. - Each row under the header is one record keyed by the header cells (`sanitize_field_name`, `_2` dedup as in CSV; unheaded columns are `col_<letter>`). Locator `<sheet>!r<row>` uses Excel's own row number. `FieldOrigin::Data`. - Typed values: numbers and booleans as JSON numbers/booleans; formula cells contribute their cached value; error cells and formulas with no cached value are absent. A number whose cell style (`xl/styles.xml` cellXfs -> numFmt) is a date format becomes an ISO-8601 string, so inference elects `date` with real min/max ranges instead of `long` over serials like 45839. Handles the 1900 and 1904 date systems and the fictitious 1900-02-29; time-only formats become `HH:MM:SS`; elapsed durations (`[h]:mm`) and percents stay numbers. Header detection (a sheet is not always a clean table): - The header is the first of the first 20 non-empty rows with >= 2 cells, some text, no numbers/booleans, that is not followed by a wider row of the same kind. Title rows above it ("Q3 Sales Report", "Prepared by | Finance") are skipped; repeated header rows are dropped. - A sheet with no such row (a form, a key/value assumptions tab, notes) is indexed as a document: `title` "<file> — <sheet>", `sheet`, body one line per row with cells joined by ` | `, blank sheet rows as paragraph breaks. One workbook can therefore feed a data dataset and the document dataset; `FileAssignment.assignments` already routes by group. Bounds: workbook/rels/styles/shared strings are held whole under a 64 MiB per-part cap; worksheets are streamed row by row (1 GiB per sheet, 2 GiB per container); a document sheet keeps at most 16 MiB of text. Hitting any cap sets `ExtractStats.truncated`. Wiring: `Family::Xlsx` (not `is_document`: rows are data), sniffed from `xl/workbook.xml`; dispatch passes the logical name for document titles and a 500-row per-sheet cap when sampling (like SQLite's per-table cap, `sample_limit_bytes` -> Some(1)); grouped family in `scan_file`; Data band in both band functions; not timeable in `exact_scan_bytes`. `unsupported_document_advice` drops `xlsx` and now tells `.xlsb`/`.ods` owners to save as `.xlsx`. Known limits: one table per sheet; merged cells not expanded; stored values, not displayed ones (a cell showing 21% is 0.21); a two-column all-text form sheet reads as a table; chart sheets skipped. Evidence (Linux container, cargo 1.98.1): - 17 new `extract::xlsx` tests plus a planner test `workbooks_plan_a_dataset_per_sheet_schema_and_documents_for_form_sheets` (two workbooks -> one `Sales` dataset with `Month` elected `date`, form sheets in the docs dataset, one file assigned to both). - The logical-name title test fails with "00000000 — Notes" when dispatch passes the blob path, and passes with the fix. - `cargo test -p xerj-autoindex --lib`: 1189 passed, 0 failed, 2 ignored. - Workbooks written by openpyxl and pandas extracted as expected.
4 of 6 tasks
8000
This was referenced Oct 4, 2026
neoneye
pushed a commit
to agent-memory-atlas-archive/xerj-org--xerj
that referenced
this pull request
Oct 4, 2026
Version bump rc.80 -> rc.81 (17 workspace crates in Cargo.lock). CHANGELOG section cites every window PR: xerj-org#1106 xerj-org#1107 xerj-org#1112 xerj-org#1113 xerj-org#1114 xerj-org#1115 xerj-org#1116 xerj-org#1117 xerj-org#1119 xerj-org#1123 xerj-org#1124. ROADMAP rolled: shortlist re-verified live at cut (four open xerj-org#1091 xerj-org#1092 xerj-org#1094 xerj-org#1100; xerj-org#1093 closed by xerj-org#1112 inside the window and moves to the CHANGELOG). Landing stamp sweep RC.80 -> RC.81 in 54 files — footer stamps only; historical prose ('since rc.80', 'rc.80 closed that', PR xerj-org#1082 claims in llms.txt/llms-full.txt and the S3/alerting answers pages) deliberately left at rc.80.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rebases #1120 onto main now that its stack parent #1117 has merged —
same two commits (shared OPC helpers + the XLSX extractor), original
authorship preserved. The fork branch cannot be pushed to from here, so
this is the same content on an in-repo branch to land it today.
Review/verification notes carry over from #1120;
cargo check -p xerj-autoindexis clean on the rebased tip. #1120 will be closed infavour of this PR.