Skip to content

fix(data): a .dbf in a declared multibyte code page says how much of its text isn't valid in it (#2614) - #2673

Merged
Mavrick-F merged 4 commits into
opengeos:mainfrom
choupeanut:fix/2614-dbf-multibyte-notice
Nov 22, 2026
Merged

Mavrick-F merged 4 commits into
opengeos:mainfrom
choupeanut:fix/2614-dbf-multibyte-notice

Conversation

@choupeanut

@choupeanut choupeanut commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Summary

A .dbf that declares a multibyte code page (by a .cpg, or by its language driver byte) and holds bytes that aren't valid in it was read with U+FFFD in their place and no notice: #2325 counted only text read as UTF-8.

The count now asks the declared decoder (DbfEncoding::malformed, on encoding_rs) instead of from_utf8, for field names and values, on the whole read (dbf_reader: a loose or zipped Shapefile, a standalone .dbf, the browser) and on the read in place (ShpSource, Table::values, the chunked read). The notice names the declared code page:

places: 3 text values aren't valid Shift_JIS and were read with U+FFFD in place of the bytes that can't be read, in 'name'; the .cpg or the .dbf's language driver declares Shift_JIS

Field names say the same (Shapefile: 1 field name isn't valid Shift_JIS …, in field 1; …). Exports and data.convert of such a layer name the same page (Exported.not_utf8_in, from the new FeatureSource::text_encoding). UTF-8 notices read exactly as before, clean text in a declared page says nothing, and deleted records still aren't counted (the count runs before take_deleted). The DOS pages (437, 850, 852, 861, 865) map every byte to a character, so nothing in them is replaced and nothing is said; the user guide says so.

Reaches desktop, CLI, Python, the Assistant and MCP through the existing notice path, and the browser through the whole read. No command, parameter or ribbon change; the way back is reopening the layer with the right .cpg. Memory: no new copy of a layer; one extra decode per non-ASCII text value in a streamed read.

Testing

  • malformed_multibyte_fields_replace_bytes_and_say_so (it was malformed_multibyte_fields_replace_bytes_without_dropping_records, which pinned the gap) and malformed_values_are_counted_per_value_and_clean_text_says_nothing, in crates/data/tests/integration/shapefile_encoding.rs: names and values in 932, 936, 949 and 950 by language driver and by .cpg, through the ZIP, loose-file, in-place, sampled, complete and chunked reads; a field-filling value ending in a lead byte, also through a standalone .dbf and a read in place; clean multibyte text says nothing. Both failed on main (no notes); pass now.
  • a_streamed_shapefile_says_text_that_isnt_utf8_once_and_in_its_exports (engine) gains a Big5 case: the view read, share.exportLayer and data.convert each say "isn't valid Big5" with the declared-page clause, and valid Big5 says nothing. It fails with not_utf8_in set to "UTF-8".
  • Unit tests of DbfEncoding::malformed and the names note in dbf.rs.
  • cargo test -p rustgis-data (lib 1748 passed, integration 70 passed), cargo test -p rustgis-map --lib (452 passed), the engine's a_streamed_shapefile and hostile_params filters, clippy with -D warnings on data, map and engine.
  • Local gate on origin/main (fb77d77) with this branch and three other branches of mine (fix/2615-window-counts, fix/2447-terrain-block-keys and fix/2620-qgis-style-read-thread) merged: pre-commit on every file, cargo fmt --check, clippy with -D warnings, cargo test --workspace (8721 passed, 0 failed), cargo xtask layers, cargo xtask schema --check with the fixtures checked against the schema and test hygiene, cargo xtask rows, and the Python package's tests (maturin + pytest, 44 passed). Not run here: the wasm32 build (no clang on this machine; CI's Web app job checks it), macOS and Windows.

UI evidence

No visible UI change.

Related issue

Closes #2614

Summary by CodeRabbit

  • Bug Fixes

    • Invalid text in Shapefiles and DBF files is now detected according to the selected encoding, including supported multibyte encodings.
    • Notices name the encoding and report affected field names and value counts. Valid text remains unreported, and records are not discarded.
    • Export notices now identify the source text encoding.
  • Documentation

    • Updated the data-format and Shapefile guides with details about encoding-specific text notices and encoding selection.

…+FFFD (opengeos#2614)

A .dbf in Shift_JIS, GBK, EUC-KR, Big5 or another code page encoding_rs decodes was
read with U+FFFD in place of bytes that aren't valid in it, with no notice: opengeos#2325
counted only text read as UTF-8. Names and values are now counted with the declared
decoder, on the whole read and on the read in place, and the notice names the code
page the .cpg or the .dbf's language driver declares.
…os#2614)

The streamed-shapefile engine test gains a Big5 case (language driver 0x4F) whose
view read, export and conversion notices must name Big5, so Exported.not_utf8_in is
tested, and a valid Big5 case that says nothing. A lead byte filling its field is
also checked through a standalone .dbf and a read in place. The docs name the right
test file.
@coderabbitai

coderabbitai Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

DBF readers now check field names and values for malformed text under the selected encoding. Read, materialization, map, and export paths carry the encoding name into invalid-text notices. Tests and documentation cover reporting for supported encodings.

Changes: DBF encoding-aware notices

Layer / File(s) Summary
Encoding-based detection and DBF decoding
crates/data/src/dbf.rs, crates/data/src/source/shp.rs
DbfEncoding checks malformed bytes according to the selected decoder. ShpSource uses that check for DBF names and values.
Encoding metadata through read and export paths
crates/data/src/io.rs, crates/data/src/source/mod.rs, crates/data/src/export.rs, crates/map/src/source.rs
DBF reads, feature sources, exported results, and map state carry the encoding name. Invalid-text notices use that name.
Notice call sites and coverage
crates/data/tests/integration/shapefile_encoding.rs, crates/engine/src/cmd/share.rs, crates/engine/src/cmd/workflows.rs, crates/engine/src/tests.rs, docs/user-guide/*
Streamed export call sites pass the encoding to notice construction. Tests and user guides cover encoding-specific notices.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Bug fix · Severity of issue fixed: Medium

Sequence Diagram(s)

sequenceDiagram
  participant DBFReader
  participant DbfEncoding
  participant NoticeBuilder
  participant Export
  DBFReader->>DbfEncoding: Check DBF bytes against selected encoding
  DbfEncoding-->>DBFReader: Return malformed-text counts and encoding name
  DBFReader->>NoticeBuilder: Pass counts and encoding name
  NoticeBuilder-->>Export: Return encoding-specific notice
Loading

Possibly related issues

  • opengeos/RustGIS#2615: The issue concerns duplicate streamed-layer counts. This change updates related counting paths, but the supplied evidence does not show that it fixes the reported double counting.

Possibly related PRs

  • opengeos/RustGIS#713: Defines the .cpg and DBF language-driver encoding selection used by this change.
  • opengeos/RustGIS#2325: Adds UTF-8 malformed-text counting and notices in the same read paths that this change extends to declared encodings.

Suggested reviewers: ro9er117911, giswqs

Merge Risk: Minimal · up to e2ec9

Malformed text in DBFs using multibyte code pages now produces a notice that names the declared code page, and exports carry the same encoding. No concrete merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: a .dbf declared as a multibyte code page now reports how much of its text is invalid in that page. It matches the changeset, which adds declared-decoder malformed-text…
Description check Passed The description follows the template. It has Summary, Testing, UI evidence, and Related issue sections. The UI section states 'No visible UI change.', which the template allows. The Summary explains t…
Linked Issues check Passed Directly linked issue #2614 has these coding requirements: (1) malformed text in a .dbf that declares code page 932, 936, 949, or 950 produces a notice; (2) the count uses the declared decoder, not fr…
Out of Scope Changes check Passed The listed changes support the #2614 objective: dbf.rs (malformed detection, encoding-aware notice text, and the cause clause), io.rs and source/shp.rs (pass the encoding on read), source/mod.rs (note…
Full details: Title check

Explanation

The title names the main change: a .dbf declared as a multibyte code page now reports how much of its text is invalid in that page. It matches the changeset, which adds declared-decoder malformed-text counting and notices for DBF and Shapefile reads. The title has 103 characters and 20 words, which is long but still one clear sentence. It references #2614, which the description closes.

Full details: Description check

Explanation

The description follows the template. It has Summary, Testing, UI evidence, and Related issue sections. The UI section states 'No visible UI change.', which the template allows. The Summary explains the problem, the fix, the notice text, the read paths, and the DOS-page exception. The Testing section lists specific tests, commands, and the unverified platforms. The Related issue section reads 'Closes #2614'. The description is thorough and complete.

Full details: Linked Issues check

Explanation

Directly linked issue #2614 has these coding requirements: (1) malformed text in a .dbf that declares code page 932, 936, 949, or 950 produces a notice; (2) the count uses the declared decoder, not from_utf8; (3) the count covers the whole-read path (dbf_reader) and the in-place path (ShpSource, Table::values); (4) the cause clause names the declared code page; (5) the tests that pinned the gap expect a notice. Evidence at the reviewed head, read from the dbf.rs diff against the merge base: DbfEncoding::malformed calls encoding_rs decode and returns its had_errors flag for non-UTF-8 standard encodings, and it skips ASCII-only text. DOS pages return false. cause(encoding) names the declared page, and not_utf8_names_note takes the encoding. The unit tests cover Shift_JIS, GBK, EUC-KR, and Big5 detection, and the field-name note for Big5. The call-site wiring in io.rs, source/shp.rs, and map/source.rs could not be read as diffs (the diff tool returned no content for io.rs). Their wiring rests on the change summary and the PR's reported test results, which were not re-run. The requirements are met by the code that was read. The wiring is supported by the summary but not independently confirmed.

Full details: Out of Scope Changes check

Explanation

The listed changes support the #2614 objective: dbf.rs (malformed detection, encoding-aware notice text, and the cause clause), io.rs and source/shp.rs (pass the encoding on read), source/mod.rs (note text and FeatureSource::text_encoding), export.rs and export/tests.rs (Exported::not_utf8_in), engine cmd/share.rs and cmd/workflows.rs (pass the encoding to the notice), engine tests.rs (Big5 coverage of the same notice), map source.rs (keeps the encoding with pending counts), integration shapefile_encoding tests, and the user guide pages that describe the notice. The notice path now covers any encoding_rs page, but it reports only values the decoder marks malformed. No unrelated feature or refactor appears in the summary. The PR description's local gate merges other branches; those merges are not part of this PR's diff and were not treated as changes here. io.rs could not be read as a diff, so its contents rest on the summary.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

A rabbit checks each byte with care
And names the code page in the air
When text is malformed, counts appear
The fields and values become clear
The export carries names along
And every notice tells its song

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 962c4e00-a38e-4053-bcdc-e55434db2609
Commits

Reviewing files that changed from the base of the PR and between a9050d7 and e2ec967.

Files selected for processing: 6

  • crates/data/src/export.rs
  • crates/data/src/io.rs
  • crates/engine/src/cmd/workflows.rs
  • crates/engine/src/tests.rs
  • crates/map/src/source.rs
  • docs/user-guide/shapefile-encoding.md

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.

Comment thread crates/map/src/source.rs Resolved
Comment thread crates/data/src/dbf.rs
pub(crate) fn malformed(&self, text: &[u8]) -> bool {
match self {
Self::Standard(encoding) => *encoding == rs::UTF_8,
Self::Standard(encoding) if *encoding != rs::UTF_8 => !text.is_ascii() && encoding.decode(text).2,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Encoding::decode in encoding_rs sniffs a leading UTF-8 or UTF-16 byte order mark and switches decoders, so a value that starts with EF BB BF, FF FE or FE FF is judged by UTF-8 or UTF-16 rules here. The doc comment on malformed says this asks the decoder dbase calls, and that only matches if dbase's adapter sniffs the BOM the same way. I could not check that from this checkout, so confidence is low. If the adapter does not sniff, the count can differ from the replaced bytes on those rare values.

decode_without_bom_handling returns the same error flag without the sniffing, and it would make the match exact on either side:

Suggested change
Self::Standard(encoding) if *encoding != rs::UTF_8 => !text.is_ascii() && encoding.decode(text).2,
Self::Standard(encoding) if *encoding != rs::UTF_8 => !text.is_ascii() && encoding.decode_without_bom_handling(text).1,

Category: bug

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude autofix (unclear): Not changed. Whether decode_without_bom_handling is the right call depends on whether dbase's EncodingRs adapter sniffs a BOM, and the dbase source is not in this checkout, so I can't confirm it. If the adapter does not sniff, the suggested change matches it; if it does, the current decode call is right. A maintainer should check the adapter.

@github-actions

Copy link
Copy Markdown
Contributor

Code review

PR #2673 closes #2614. It makes a .dbf in a declared multibyte code page (Shift_JIS, GBK, EUC-KR, Big5) count and name the text values and field names that aren't valid in it, instead of replacing them silently. The change is well scoped and the tests cover both directions. I found two candidate bugs, both posted inline. Neither is confirmed by a run.

Bugs

  • Notice can name the wrong encoding (crates/map/src/source.rs:848, medium-low confidence). take_not_utf8 looks up the encoding from self.handle when the note is taken, not when the counts were saved. If the handle is gone or replaced in between, the counts are reported as "isn't valid UTF-8". The open() path clears handle without clearing the pending not_utf8 counts. Suggested fix: store the encoding name with the counts.
  • Count may use a different decoder than the replacement (crates/data/src/dbf.rs:36, low confidence). malformed calls encoding.decode, which sniffs a UTF-8 or UTF-16 BOM. The doc comment says it matches dbase's decoder, and I could not verify that from this checkout. Suggested decode_without_bom_handling(text).1 in the inline comment.

Security

  • None found.

Performance

  • Low: dbf_reader now runs not_utf8 over every .dbf, including DOS pages where it can never report anything. Before, non-UTF-8 files skipped the pass. Gating it on the encoding would avoid one full pass per file.
  • Low: malformed allocates a String for each non-ASCII value in declared pages, per record in streamed reads. The PR body already acknowledges one extra decode per value.

Quality

  • DbfEncoding::name() returns "a DOS code page" for Oem, which would read "isn't valid a DOS code page" if it were ever reached. It is unreachable today, so a comment or a separate branch would make that clearer.
  • The same encoding-name plumbing is repeated in io.rs, shp.rs, export.rs and share.rs. It works, but a small helper would reduce the repetition.

AGENTS.md

  • None found. The changes stay in L1 and L4, add no unwrap, panic or unsafe, keep wasm gating, and update the docs. The PR body gives a memory note and reach statement.

Already raised: 0. There were no prior review threads.

Change size

Compared with the base branch (merge base 5fa6a02 to PR head 4536e71): the whole PR against main.

Measure Value
Files changed 13 (0 added, 13 modified, 0 removed, 0 renamed)
Size before 4.41 MB
Size after 4.42 MB
Total size change +8.1 KB
Path Before After Change
crates/data/tests/integration/shapefile_encoding.rs 35.0 KB 37.8 KB +2.8 KB
crates/data/src/dbf.rs 28.6 KB 31.4 KB +2.8 KB
crates/engine/src/tests.rs 3.35 MB 3.35 MB +939 B
docs/user-guide/shapefile-encoding.md 4.6 KB 5.1 KB +511 B
crates/data/src/source/mod.rs 61.8 KB 62.2 KB +462 B
crates/data/src/io.rs 475.5 KB 476.0 KB +306 B
crates/data/src/export.rs 19.0 KB 19.2 KB +185 B
docs/user-guide/data-formats.md 110.6 KB 110.7 KB +128 B
crates/engine/src/cmd/workflows.rs 115.7 KB 115.7 KB +72 B
crates/engine/src/cmd/share.rs 45.7 KB 45.8 KB +67 B
crates/map/src/source.rs 110.6 KB 110.7 KB +61 B
crates/data/src/source/shp.rs 41.0 KB 40.9 KB −49 B
crates/data/src/export/tests.rs 34.1 KB 34.2 KB +42 B

@github-actions

github-actions Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

📖 Docs preview

Item Value
Preview https://preview.rustgis.app/pr-2673/
Web app https://preview.rustgis.app/pr-2673/app/
Commit e2ec967

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 preview label (once per commit).

@giswqs giswqs added the claude-autofix Apply to have Claude merge the base, resolve conflicts and fix review comments (re-add to run again) label Nov 22, 2026
The note for text values that aren't valid UTF-8 took its encoding from
the source handle at the time it was said, not from the handle the
counts were kept from. If the source was opened again in between, a
Big5 or Shift_JIS layer's counts could be reported as not valid UTF-8.

Record the encoding with the counts when they are kept, use it when the
note is taken, and clear it in reopen with the counts. Counts from a
different encoding replace the pending ones rather than adding to them.

Applied by the claude-autofix workflow.
@github-actions

Copy link
Copy Markdown
Contributor

Claude autofix

  • Review threads: 1 fixed, 1 unclear.

@github-actions github-actions Bot removed the claude-autofix Apply to have Claude merge the base, resolve conflicts and fix review comments (re-add to run again) label Nov 22, 2026
&& std::str::from_utf8(padded(b)).is_err()
{
super::not_utf8_at(counts, k);
if matches!(v, Value::Text(_)) && declared.malformed(padded(b)) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the in-place read, each non-ASCII text value is now transcoded twice. value(c, b, decoder) decodes it (line 739), then declared.malformed(padded(b)) decodes the same bytes again and allocates a second String through encoding_rs's decode. On a national layer with accented or CJK names, that doubles the transcoding work and the allocations for every streamed read, and the whole-file path does the same thing (dbf::not_utf8 decodes each value once, then dbf_attrs decodes it again).

One way to avoid it: have value return the decoder's error flag next to the text (for example by decoding with decode_without_bom_handling and keeping had_errors), so values reads the flag instead of decoding again. The PR body's note of "one extra decode per non-ASCII text value" understates this, because the value is decoded once more on top of the one the read already does.

Category: performance

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude autofix (unclear): Not changed here. The second decode only costs an allocation when the declared code page isn't UTF-8: for UTF-8, DbfEncoding::malformed is a from_utf8 check, and for other code pages it runs encoding_rs decode again on each non-ASCII text value (crates/data/src/dbf.rs:34). Removing that means value returns the decoder's error flag, which changes the decoder path, and I can't build or measure it in this environment. A maintainer should decide that, ideally with cargo xtask memory numbers on an accented or CJK layer.

Comment thread crates/map/src/source.rs
/// [`SourceLayer::take_not_utf8`] says it, as [`SourceLayer::saw_unread_dates`] does for dates.
pub fn saw_not_utf8(&mut self, counts: &[usize]) {
if !self.not_utf8_said && counts.iter().any(|n| *n > 0) {
let encoding = self.handle.as_ref().map_or("UTF-8", |h| h.text_encoding());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a new point, following the earlier thread on this lookup. The fix records the encoding when the counts are kept, but the lookup still falls back to "UTF-8" when self.handle is None, and that fallback is stored with the counts. If counts arrive while the handle is absent, a Big5 or Shift_JIS layer's counts are labelled as UTF-8 and get the "no .cpg names another encoding" clause, which is the mislabel the earlier thread described. The fallback hides the case rather than reporting it.

Confidence is low (about 20%): the callers in crates/map/src/lib.rs (lines 693 to 712) poll the source that holds the handle, so I could not find a path where it is None here. If it can't happen, the fallback is still a silent guess. Carrying the encoding in Batch next to not_utf8 would remove the lookup entirely.

Category: bug

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude autofix (declined): Not changed. The "UTF-8" fallback at crates/map/src/source.rs:892 isn't reached here: Polled::Done only comes from a read started with a handle (start returns early without one, source.rs:1822), and every path that clears handle also clears pending (reset_window at source.rs:1786, reached from reset and reopen). So a finished batch always has its handle, and carrying the encoding in Batch would be a data-crate API change for no reachable case.

@github-actions

Copy link
Copy Markdown
Contributor

Code review

I read the full diff, the earlier review threads, and the callers of every changed signature across the workspace. I could not build or run the tests in this environment, so the findings below come from reading the code.

Bugs

  • Low confidence (about 20%): saw_not_utf8 falls back to "UTF-8" when the handle is None. The fallback is stored with the counts, so a Big5 or Shift_JIS layer could be labelled as UTF-8. Callers in crates/map/src/lib.rs appear to hold the handle, so I could not find a path that triggers it. Inline comment posted (crates/map/src/source.rs:840).

Security

  • None found.

Performance

  • Each non-ASCII text value in an in-place read is transcoded twice. value() decodes it, then DbfEncoding::malformed decodes the same bytes again and allocates a second string. The whole-file path has the same double decode. The PR's note of "one extra decode" understates this. Inline comment posted (crates/data/src/source/shp.rs:745).

Quality

  • DbfEncoding::name() returns "a DOS code page" for Oem. That reads wrongly inside "isn't valid …", but it is unreachable because malformed returns false for Oem. Worth a comment or a guard so a future change doesn't hit it.
  • Some doc lines run past 100 characters (for example the not_utf8 doc in crates/data/tests/integration/shapefile_encoding.rs), and the new paragraph in docs/user-guide/data-formats.md (lines 825–827) is wrapped unevenly. Grouped here rather than as separate comments.

AGENTS.md

  • No breaks of the repository rules found. Notices are said through the existing notice path, the signatures are updated at every caller, no project saves changed (so no schema update is needed), and the new fields are serde(skip).

Earlier concerns left alone

  • 1 left alone. The encoding_rs BOM-sniffing thread on crates/data/src/dbf.rs:36 still applies to unchanged code. The dbf.rs decoder comment suggests the dbase adapter does strip byte-order marks for non-UTF-8 pages, which would make the current decode call the right one. I did not re-raise it.
  • The earlier map/source.rs thread was marked resolved and outdated. I raised only the new fallback point above.

Change size

Compared with main (merge base 5fa6a02 to PR head a9050d7).

Measure Value
Files changed 13 (0 added, 13 modified, 0 removed, 0 renamed)
Size before 4.41 MB
Size after 4.42 MB
Total size change +8.6 KB
File Before After Change
crates/data/tests/integration/shapefile_encoding.rs 35.0 KB 37.8 KB +2.8 KB
crates/data/src/dbf.rs 28.6 KB 31.4 KB +2.8 KB
crates/engine/src/tests.rs 3.35 MB 3.35 MB +939 B
crates/map/src/source.rs 110.6 KB 111.2 KB +644 B
docs/user-guide/shapefile-encoding.md 4.55 KB 5.05 KB +511 B
crates/data/src/source/mod.rs 61.8 KB 62.2 KB +462 B
crates/data/src/io.rs 475.5 KB 475.8 KB +306 B
crates/data/src/export.rs 19.0 KB 19.2 KB +185 B
docs/user-guide/data-formats.md 110.6 KB 110.7 KB +128 B
crates/engine/src/cmd/workflows.rs 115.7 KB 115.7 KB +72 B
crates/engine/src/cmd/share.rs 45.7 KB 45.8 KB +67 B
crates/data/src/source/shp.rs 41.0 KB 40.9 KB −49 B
crates/data/src/export/tests.rs 34.1 KB 34.2 KB +42 B

@giswqs giswqs added the claude-autofix Apply to have Claude merge the base, resolve conflicts and fix review comments (re-add to run again) label Nov 22, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Claude autofix

  • Merged main and resolved conflicts in 1 file(s).
  • Review threads: 1 declined, 1 unclear.
  • No fix commit was pushed.

@github-actions github-actions Bot removed the claude-autofix Apply to have Claude merge the base, resolve conflicts and fix review comments (re-add to run again) label Nov 22, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Code review

Bugs. No new defect found in the changed code. I checked the decode-and-count paths in dbf.rs, shp.rs, io.rs, source/mod.rs, map/src/source.rs and the engine notice call sites. Bounds are handled with get, chunks_exact is never given a zero size, and the BOM-sniffing question is covered by an open thread. Confidence in "no new bug": high. I could not build or run tests in this environment.

Security. None found. Field and value bytes are only read through get/split, and nothing is indexed or allocated from file-controlled sizes. Confidence: high.

Performance. Nothing new. The double decode of non-ASCII text values is already raised on crates/data/src/source/shp.rs:745.

Quality (not posted inline; for the release quality pass):

  • DbfEncoding::name() returns "a DOS code page" for Oem. That would read "isn't valid a DOS code page" if it ever surfaced. It can't today, because malformed is always false for DOS pages (crates/data/src/dbf.rs:27). A short comment would help. Confidence: high.
  • docs/user-guide/data-formats.md:825-828 is hard to parse ("a byte that isn't valid in the Shift_JIS, GBK, EUC-KR or Big5 a file declares") and runs past the paragraph's wrap width. Confidence: high.
  • shapefile_encoding.rs repeats cause and NO_OTHER_ENCODING wording from production code, so a wording change needs test edits too. That is a fair pin, but a comment would say so. Confidence: medium.

AGENTS.md. No rule break found:

  • No unwrap, expect, panic, or unsafe in non-test code.
  • The wasm32 gating holds: not_utf8_at and ShpSource stay desktop-only, and the new trait method is forwarded by Fetching.
  • Exported has one construction site, which is updated.
  • Notices go through the existing path with one note per kind and a count.
  • not_utf8_in is serde(skip), so no schema change is needed.
  • Both lossy and clean cases are tested.

Earlier concerns left alone (already raised, so not re-posted): dbf.rs:36 (BOM sniffing in malformed, unresolved), shp.rs:745 (double decode, performance), and map/src/source.rs:892 (the "UTF-8" fallback when handle is None; the only reply is a bot's, so it is context and not an answer). source.rs:848 is resolved and outdated, and its fix (not_utf8_in recorded when the counts are kept) is in place. Four earlier concerns in total, none re-posted. No inline comments were posted because I found nothing new that clears the bar.

Change size

Compared: the whole PR against main (merge base 626e080 to PR head e2ec967).

Measure Value
Files changed 13 (0 added, 13 modified, 0 removed, 0 renamed)
Size before 4.44 MB
Size after 4.45 MB
Total size change +8.8 KB
Path Before After Change
crates/data/tests/integration/shapefile_encoding.rs 35.0 KB 37.9 KB +2.8 KB
crates/data/src/dbf.rs 28.6 KB 31.4 KB +2.8 KB
crates/engine/src/tests.rs 3.38 MB 3.38 MB +939 B
crates/map/src/source.rs 114.5 KB 115.2 KB +656 B
docs/user-guide/shapefile-encoding.md 4.6 KB 5.1 KB +499 B
crates/data/src/source/mod.rs 61.8 KB 62.2 KB +462 B
crates/data/src/io.rs 478.2 KB 478.5 KB +306 B
crates/data/src/export.rs 18.7 KB 18.9 KB +185 B
docs/user-guide/data-formats.md 111.1 KB 111.2 KB +128 B
crates/engine/src/cmd/workflows.rs 117.2 KB 117.2 KB +72 B
crates/engine/src/cmd/share.rs 45.7 KB 45.8 KB +67 B
crates/data/src/source/shp.rs 41.0 KB 40.9 KB −49 B
crates/data/src/export/tests.rs 34.1 KB 34.2 KB +42 B

@Mavrick-F
Mavrick-F added this pull request to the merge queue Nov 22, 2026
Merged via the queue into opengeos:main with commit 8f375db Nov 22, 2026
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A .dbf in a declared multibyte code page (932, 936, 949, 950) replaces malformed bytes with U+FFFD without a notice

3 participants