Skip to content

test(cli): handle macOS non-UTF-8 fixture limits - #407

Merged
giswqs merged 3 commits into
mainfrom
ci-fix/9fe6f3d39802
Oct 30, 2026
Merged

giswqs merged 3 commits into
mainfrom
ci-fix/9fe6f3d39802

Conversation

@giswqs

@giswqs giswqs commented Oct 30, 2026 •

Copy link
Copy Markdown
Member

Fixes main's macOS failure in validation_accepts_non_utf8_native_paths: the filesystem rejects the invalid-byte fixture with EILSEQ before the CLI runs. The fixture test now tolerates only that specific macOS error; other errors still fail, and filesystems that accept the name retain the full verdict check.

A separate Unix regression passes a nonexistent non-UTF-8 path directly to the CLI and requires execution-error exit 1, rather than argument-parser exit 2. This retains argument-handling coverage on macOS without requiring an unsupported filename.

Validation: all three Linux GeoPackage CLI/MCP tests, formatting, full pre-commit and workspace Clippy with warnings denied passed in a local environment with GDAL 3.13.3. Native macOS formatting, workspace Clippy/tests and the macOS Python CI job also passed; both the capability-guarded fixture and Unix argument regression passed on macOS.

Failed main run, following #403.

APFS and HFS+ refuse file names that are not valid UTF-8 and fail with
EILSEQ (os error 92), so the fixture for
validation_accepts_non_utf8_native_paths cannot be created on macOS.
Accept only that error on macOS and return early, as the equivalent
test in inspection.rs already does. Other platforms still run the
test, and any other write error still fails it.
@giswqs giswqs added ci:macos Run CI on macOS for this pull request ci-fix Automatic fix for a CI failure on main labels Oct 30, 2026
@coderabbitai

coderabbitai Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 11 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available.

Learn how review limits work.

Review configuration:

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: 8c73324f-b748-409d-9ed6-dd0a120fb44c
Commits

Reviewing files that changed from the base of the PR and between 9fe6f3d and 20fb37b.

Files selected for processing: 1
  • crates/terrio-cli/tests/gpkg_validation.rs
  • 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

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown
Contributor

Code review

Bugs

  • None found. The EILSEQ check is correct: macOS errno 92 is EILSEQ. Other write errors and code 92 on non-macOS still fail the test through the assertion. Confidence: high.

Security

  • None found. The change only touches a test fixture.

Performance

  • None found.

Quality

  • Magic number 92 in crates/terrio-cli/tests/gpkg_validation.rs:51. Use libc::EILSEQ, which the crate already depends on. Same literal in inspection.rs:588. Confidence: high. Inline suggestion posted.
  • Silent early return on macOS: the test reports ok without running the CLI, so the non-UTF-8 path has no macOS coverage. This matches the existing pattern in inspection.rs:582, but the skip is invisible in test output. Confidence: medium. Inline comment posted.

CLAUDE.md

  • The AGENTS.md guidance on validation and tests does not conflict with this change. The PR touches only one test file, so the full workspace validation is not triggered by it. I did not run the tests, since I have no shell access here.

I checked the test file, the matching fixture in inspection.rs, the cfg(not(target_os = "macos")) sub-case in gpkg_update.rs, and the libc dependency in terrio-cli/Cargo.toml. The CI results cited in the PR body are not verifiable from the staged files.

Change size

Compared with main (merge base 9fe6f3d to PR head a62a47d).

Measure Value
Files changed 1 (added 0, modified 1, removed 0, renamed 0)
Size before 2.74 KB (2,806 B)
Size after 2.96 KB (3,033 B)
Total size change +227 B
Path Before After Change
crates/terrio-cli/tests/gpkg_validation.rs 2.74 KB 2.96 KB +227 B

Check that raw GeoPackage path arguments reach filesystem error handling
rather than failing argument parsing, even where macOS cannot create the
invalid-byte filename fixture.
@giswqs giswqs changed the title test(cli): skip non-UTF-8 gpkg-validate path test on macOS test(cli): handle macOS non-UTF-8 fixture limits Oct 30, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Code review

Bugs

  • None found. I traced both new test paths through the code and they hold on Linux, and by reading they should hold on macOS too.
    • Missing-file path: validate_gpkg (crates/terrio/src/gpkg_validate.rs:169-173) returns an I/O error on a missing file. run_on_this_thread (crates/terrio-cli/src/lib.rs:394-397) then prints to stderr and exits 1, with nothing on stdout. Both new assertions match this.
    • macOS sidecar lookup: the -wal and -journal probes return a non-NotFound error for an EILSEQ name, which again exits 1 with empty stdout.
    • The raw_os_error() == Some(92) check matches EILSEQ on Darwin.
    • Confidence: high on the Linux path, medium-high on macOS (read-only, not run).

Security

  • None. The change is test-only and touches no production input handling.

Performance

  • None. Two small test fixtures.

Quality

  • Inline comment posted on crates/terrio-cli/tests/gpkg_validation.rs:71. !output.stderr.is_empty() is loose; asserting the terrio: prefix pins the execution-error path. Low confidence this matters.
  • Coverage note: on macOS the first test returns early after the EILSEQ check, so it no longer asserts the verdict. The second test covers the CLI error path there, so this is acceptable. Confidence: high.
  • PR description accuracy: it says the new Unix test runs "without requiring an unsupported filename". The fixture is still a non-UTF-8 name, which the description itself says macOS refuses. The test is still valid, because the OS error exits 1 as traced above. The description should say that instead. Confidence: high.

CLAUDE.md / AGENTS.md

  • The change adds a regression test, as the repo asks. I did not check NOTICE or pre-commit results. The PR says formatting, pre-commit and Clippy passed locally on Linux. macOS CI has not been run in this review (only requested via the ci:macos label), so the macOS behaviour above is unverified by execution.

Change size

Compared with the base branch: the whole PR against main (merge base 9fe6f3d to PR head 1cbfbc9).

Measure Value
Files changed 1 (added 0, modified 1, removed 0, renamed 0)
Size before 2.7 KB
Size after 3.6 KB
Total size change +929 B
Path Before After Change
crates/terrio-cli/tests/gpkg_validation.rs 2.7 KB 3.6 KB +929 B

@github-actions

Copy link
Copy Markdown
Contributor

Code review

I found no correctness defects. Two test-quality nits were posted inline.

Bugs: None found. I traced the new Linux test through validate_gpkg: a missing non-UTF-8 path hits std::fs::metadata and returns Err. The CLI then prints terrio: … to stderr and exits 1 with empty stdout, which matches the assertions. If macOS stat returns EILSEQ rather than ENOENT, the path still goes to the error branch, so the test still passes. Confidence: high.

Security: None found. The change is test-only.

Performance: None found.

Quality:

  • validation_accepts_non_utf8_native_paths can now return early on macOS without running the CLI, so its name overstates what it checks. Inline comment posted on line 50 (the suggestion there is a no-op; the rename belongs on the fn line 45, which is outside the diff hunk). Confidence: high.
  • The new test's assert!(!output.stderr.is_empty()) would also pass for unrelated stderr output, such as a clap usage error. Asserting the terrio: prefix is tighter. Inline comment posted on line 71. Confidence: medium.

CLAUDE.md (AGENTS.md): The change is test-only, so no behavior regression is required. libc is a cfg(unix) dependency, so the cfg(unix) gating of the new tests is consistent. Line lengths are within rustfmt.toml's max_width = 140. Confidence: high.

Change size

Compared: the whole PR against main (merge base 9fe6f3d to PR head 20fb37b).

Measure Value
Files changed 1 (added 0, modified 1, removed 0, renamed 0)
Size before 2.74 KB (2,806 B)
Size after 3.66 KB (3,745 B)
Total size change +939 B
Path Before After Change
crates/terrio-cli/tests/gpkg_validation.rs 2.74 KB 3.66 KB +939 B

@giswqs
giswqs merged commit 070051c into main Oct 30, 2026
18 checks passed
@giswqs
giswqs deleted the ci-fix/9fe6f3d39802 branch October 30, 2026 16:28
gmoralessanchez added a commit to gmoralessanchez/terrio that referenced this pull request Oct 30, 2026
This resolves the conflicts with the six commits on main since 626cfc8 (opengeos#402, opengeos#403, opengeos#407, opengeos#404,
opengeos#408, opengeos#409). Where both sides changed the same code, main's version is kept unless something the
pull request states depends on the branch's.

- validate_gpkg and validate_gpkg_bytes check the driver allow-lists, as the other entry points
  do. The SOZip bindings release the GIL through the panic guard.
- main's SOZip writer writes through the branch's Sink trait, and main's call to the central
  directory reader takes the branch's bounded one.
- GRIB: each band's metadata items are in the dataset's metadata again as BAND_<n>#<key>, as
  main's driver gave them, besides the band's own metadata. main's GRIB metadata tests are
  restored.
- A paletted band written to GeoTIFF or COG with JPEG compression is written as a grey band
  without its colour table, as on main. main's tests for it run again.
- The unsafe allow-list counts main's new unsafe calls in vsi/sozip.rs and vsi/sozip/native.rs.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:macos Run CI on macOS for this pull request ci-fix Automatic fix for a CI failure on main

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant