Repository navigation
test(engine): cover XLS and XLSB reader losses - #2474
Conversation
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
| | Shapefile Z/M reader-loss fixtures (`crates/engine/testdata/reading-losses/shp-*`) | The RustGIS project: independently encoded, made-up point and line records following the published Shapefile specification; byte layout in [SHAPEFILE.md](crates/engine/testdata/reading-losses/SHAPEFILE.md) | Apache-2.0 | | ||
| | XLSX reader-loss fixtures (`crates/engine/testdata/reading-losses/book-*.xlsx`) | The RustGIS project: made-up one-row workbooks, encoded as Office Open XML with Python standard-library ZIP/XML writing; [fixture notes](crates/engine/testdata/reading-losses/README.md#xlsx) describe their contents | Apache-2.0 | | ||
| | ODS reader-loss fixtures (`crates/engine/testdata/reading-losses/book-*.ods`) | The RustGIS project: made-up one-row OpenDocument workbooks, independently encoded with Python standard-library ZIP/XML writing; [fixture notes](crates/engine/testdata/reading-losses/README.md#ods) describe their contents | Apache-2.0 | | ||
| | XLS/XLSB reader-loss fixtures (`crates/engine/testdata/reading-losses/book-*.xls`, `book-*.xlsb`) | The RustGIS project: made-up one-row workbooks generated offline with SheetJS CE 0.18.5, with unused XLSB package parts removed; [fixture notes](crates/engine/testdata/reading-losses/README.md#xls-and-xlsb) describe contents and checks | Apache-2.0 | |
There was a problem hiding this comment.
Provenance understates the modification (low, Quality/AGENTS.md). The row says the XLS/XLSB fixtures were "generated offline with SheetJS CE 0.18.5, with unused XLSB package parts removed". The fixture notes say more: the XLSB short string and RK cell records were hand re-encoded as full BrtCellSt/BrtCellRk records. That makes the .xlsb files no longer pure writer output, and the attribution should say so. Suggested wording:
| | XLS/XLSB reader-loss fixtures (`crates/engine/testdata/reading-losses/book-*.xls`, `book-*.xlsb`) | The RustGIS project: made-up one-row workbooks generated offline with SheetJS CE 0.18.5, with unused XLSB package parts removed; [fixture notes](crates/engine/testdata/reading-losses/README.md#xls-and-xlsb) describe contents and checks | Apache-2.0 | | |
| | XLS/XLSB reader-loss fixtures (`crates/engine/testdata/reading-losses/book-*.xls`, `book-*.xlsb`) | The RustGIS project: made-up one-row workbooks generated offline with SheetJS CE 0.18.5; the XLSB files then had unused package parts removed and their cell records re-encoded by hand to the published MS-XLSB layout; [fixture notes](crates/engine/testdata/reading-losses/README.md#xls-and-xlsb) describe contents and checks | Apache-2.0 | |
There was a problem hiding this comment.
Clarified in 5d7a50b: attribution now explicitly says that the XLSB package was minimized and its short cell records re-encoded to the published full-cell layout. The detailed fixture notes describe both changes. Full fork CI passed on this commit.
| 1980-01-01. The generated XLSB short string/RK cell records were re-encoded as | ||
| full `BrtCellSt`/`BrtCellRk` records with explicit column indexes, following the | ||
| published [MS-XLSB Cell layout](https://learn.microsoft.com/en-us/openspecs/office_file_formats/ms-xlsb/1e3e0c46-6175-4123-b02b-903643a5cc07). | ||
| The writer's undocumented short forms are not read by the current XLSB parser; |
There was a problem hiding this comment.
A known XLSB reader gap is documented here but not tracked or pinned (medium, Bugs/Quality). The note says SheetJS's undocumented short cell forms are not read by the current XLSB parser. Those are the forms SheetJS writes by default, so real files from that writer may be refused or may load with wrong values. The PR records this only in the fixture notes. It does not go into the ROADMAP reader-loss list or the coverage table, and no test shows what RustGIS does with such a file. Silent wrong values would break the never-silent rule. Please either add a row to the coverage table as a known gap with its observed behaviour, or pin that behaviour in a test. Also, these fixtures were hand-rewritten after the calamine reader was inspected. A conformance check with a second independent reader (for example LibreOffice) would show that the expectations are not tuned to this parser.
There was a problem hiding this comment.
Recorded the observed short-cell behavior in the coverage table and ROADMAP in 5d7a50b. A fresh original SheetJS 0.18.5 clean XLSB retains POINT(1 2) but native reading returns no fields or attribute values, including the source id=7, with zero skipped rows and no messages. This is now an explicit known silent-loss gap.
For an independent parser check of the rewritten fixtures, SheetJS readFile and sheet_to_json read all six committed XLS/XLSB workbooks back to the documented headers, WKT and ID. That parser is independent of RustGIS/calamine. No parser fix or new conformance claim is included in this corpus PR. Full fork CI passed.
Code reviewI found no crash, silent-loss or correctness bug in the test code. The new XLS/XLSB cases follow the existing harness pattern: clean files give no notice, lossy files give the expected notice, and Bugs: none found. Security: none found. The change adds only test fixtures and test code. Performance: none found. Quality
AGENTS.md: the required ATTRIBUTION row is present. The README coverage rows I spot-checked (CSV WKT Z, GeoJSON Z, GPX, GeoRSS, KML, the Shapefile rows) match case names in the test file. The surface-reach statement in the PR body is adequate. The PR body's references to "on-box/hq" and a "private fixed-baseline preflight" point to infrastructure a reviewer cannot reproduce, so they are not verifiable evidence. The fork CI link is the checkable part. Prior reviews: the thread file is empty, so there were no earlier concerns to skip. Change sizeCompared with
The stats file reports byte totals of 74,267 and 97,787, which are 72.5 KB and 95.5 KB; the table's totals come from those. The largest-changes list is in bytes, and I converted the sizes to KB. |
📖 Docs preview
GitHub Pages takes a minute or two to publish a new commit. Newer commits from the fork aren't published until a maintainer adds the |
|
The provenance and observed short-cell gap documentation are corrected in 5d7a50b; detailed evidence is in the inline replies. The DBF encoding PR #2325 exists. Public full fork CI passed for this head. Wrapping and the test-failure debug-output refinement are left for the release quality pass. |
| if rustgis_engine::data::sheets::is_sheet_name(file) { | ||
| let (native, report) = rustgis_engine::data::sheets::read(content, "a", None, &Default::default()) | ||
| .map_err(|e| std::io::Error::other(format!("native spreadsheet fixture: {e}")))?; | ||
| check_workbook(&native)?; |
There was a problem hiding this comment.
The known XLSB silent loss is documented but not pinned by any test (medium, Bugs / test coverage). The README says the unmodified SheetJS 0.18.5 clean XLSB keeps POINT(1 2) but loses its id and note attribute fields and values, with no notice. The PR body says "Known silent losses are pinned", and the module doc says losses no reader says yet are listed as Expect::Silent. Neither holds for this loss. No original short-cell fixture is committed, and no Silent case refers to it. The committed book-clean.xlsb is the hand re-encoded full-record file, so the "clean gives no notice" check covers a file the default writer doesn't produce.
Adding that case is not a one-line change. check_workbook runs on every sheet fixture at this line and at line 713, and it requires id=7 and note=Null. The original short-cell file would fail here before the case's expectation is read. The harness needs a per-case way to state the expected attribute loss, and then the short-cell fixture can be committed as a Silent case. Until that lands, the PR body's "pinned" wording should be corrected, and the README coverage row should say the loss is untested.
There was a problem hiding this comment.
Pinned in b493947: book-short.xlsb is 1,727 bytes and preserves the original writer’s worksheet records byte for byte. The Silent pair checks exactly one Point(1,2), empty fields and attributes, zero skipped rows and no notices through both native and command imports. The full-record clean side still requires id=7, note=Null and their field types. The corpus, all-target engine Clippy, hooks and full fork CI passed.
Code reviewBugs
Security
Performance
Quality (nits, left for the release quality pass)
AGENTS.md
Prior review threads: 2 left alone.
Change sizeCompared with the base branch: the whole PR against
|
|
The short-cell attribute loss is now pinned by the native/command pair in b493947, and the PR description matches the final fixtures. The SheetJS read-back checks the handwritten full-cell rewrite independently of RustGIS; it is not a second independent conformance check of SheetJS’s own output. The fixture notes now make that narrower claim. The wording/debug-output nits remain left for the release quality pass. |
| let fields = if short_cells { vec![] } else { vec![Field::new("id", FieldType::Integer), Field::new("note", FieldType::Text)] }; | ||
| let attrs = if short_cells { vec![] } else { vec![Value::Int(7), Value::Null] }; |
There was a problem hiding this comment.
Likely cargo fmt --check failure (medium confidence, Quality). rustfmt.toml keeps max_width = 140, so these lines fit that limit. The default single_line_if_else_max_width is 50, though, and both if short_cells { … } else { … } expressions are longer than that on one line, so rustfmt will most likely break them. I couldn't run rustfmt in this review, so please confirm with cargo fmt --check. If it does reflow, this is the expected layout:
| let fields = if short_cells { vec![] } else { vec![Field::new("id", FieldType::Integer), Field::new("note", FieldType::Text)] }; | |
| let attrs = if short_cells { vec![] } else { vec![Value::Int(7), Value::Null] }; | |
| let fields = if short_cells { | |
| vec![] | |
| } else { | |
| vec![Field::new("id", FieldType::Integer), Field::new("note", FieldType::Text)] | |
| }; | |
| let attrs = if short_cells { vec![] } else { vec![Value::Int(7), Value::Null] }; |
Note: the attrs line is also over the 50-character if-else limit, so the suggestion above also breaks it onto the same multi-line layout. Adjust the suggestion if rustfmt's own output differs.
There was a problem hiding this comment.
Confirmed cargo fmt --all --check passes on b493947. The repository sets use_small_heuristics = "Max" alongside max_width = 140, so the default 50-character heuristic does not apply. The exact-head fork CI lint job and commit formatter hook also passed. No reflow is needed.
Code reviewBugs: No new correctness bugs found. I checked the new Security: None found. Test and documentation changes only, with no production code, dependencies, or network use. Confidence: high. Performance: None. The fixtures are about 1.7 to 3.6 KB each. Confidence: high. Quality:
AGENTS.md: The PR's changes match the repo rules as far as I can check them. Fixtures have ATTRIBUTION rows, SheetJS and calamine are named in the PR body, and the README anchors exist. The schema and memory-limit rules don't apply to these changes. I didn't check every row of the new coverage table, only spot-checks, which held. Confidence: medium-high. Prior reviews: Three earlier threads (ATTRIBUTION wording, the undocumented XLSB gap, and the missing pin for the short-cell loss) are all outdated, and the author's replies are reflected in the diff. I left all three alone; none was re-raised. Change sizeCompared with the base branch: the whole PR, merge base 96da316 to head b493947.
|
|
The formatter concern is not reproduced: |
Summary
Add independent valid XLS and XLSB fixture pairs to the reader-loss corpus. Each format now exercises WKT height loss (reported) and loss of later geometry-collection members (currently silent), using its distinct binary workbook parser. Both native reading and
layer.addDatamust retain exactly the expected point, attributes and field types; refusal cannot pass. A fifth case pins the known XLSB short-cell loss: the original worksheet records retain the point but lose all attribute fields and values without a notice.Record the finite local reader-dispatch coverage and remaining loss families in the fixture notes. XLSM shares the XLSX OOXML parser; an extension-only duplicate is deliberately omitted, and macro fidelity remains untested. Known silent losses are pinned, not fixed. No production, dependency, command, schema or CRS-policy changes. Made-up fixtures were generated offline with SheetJS CE 0.18.5. Except in the short-cell fixture, XLSB compact cells were re-encoded using the published MS-XLSB full-cell layout. The short-cell fixture preserves the original worksheet bytes; only unused package parts were removed. The writer and calamine reader were inspected to diagnose the initial mismatch; no third-party implementation code is included.
This checks the shared native reader/command used by desktop, CLI and Python. Browser and phone UI flows are not executed by this filesystem integration test; fork CI still checks wasm. Ribbon, shortcuts, search, Assistant/MCP descriptions, plugins and undo behavior are unchanged.
Testing
cargo test -p rustgis-engine --test never_silent_readingthrough on-box/hq.UI evidence
No visible UI change.
Related issue
Section 3C loss coverage; narrows ROADMAP's reader-loss fixture work. Does not close broader fidelity or CRS work.
Summary by CodeRabbit