Skip to content

Consolidate bug fixes, resource-safety cleanups, and tests from AI/Copilot autofix branches (Jun-Jul 2026) - #689

Open
echoix wants to merge 15 commits into
mainfrom
claude/grass-bugfix-consolidation-dbl67u
Open

Consolidate bug fixes, resource-safety cleanups, and tests from AI/Copilot autofix branches (Jun-Jul 2026)#689
echoix wants to merge 15 commits into
mainfrom
claude/grass-bugfix-consolidation-dbl67u

Conversation

@echoix

@echoix echoix commented Sep 5, 2026

Copy link
Copy Markdown
Owner

Description

Consolidates multiple small behavior-relevant fixes, resource-safety cleanups, and test additions from ai-findings-autofix/*, alert-autofix-*, and finding-autofix-* branches (Copilot Autofix / CodeQL / bot suggestions, Jun-Jul 2026, echoix/echoix-org forks). Each cherry-picked with -x for traceability.

Bug fixes (4)
  • python/grass/temporal/metadata.py: STR3DSMetadata._print_info_body printed top/bottom resolution using get_ewres_min/max() instead of get_tbres_min/max() — wrong values in t.info/t.rast3d.info output.
  • scripts/r.in.wms/wms_cap_parsers.py: inverted boolean condition (!===) when deciding whether to copy elements from the parent WMS layer.
  • raster/r.what.color/main.c: removed an uncontrolled-format-string fprintf(stdout, fmt, ...) path in favor of the existing safe %s path (CodeQL alert CI(OSGeo4W): Windows 2022 ci 3 #467). A similar pattern still exists elsewhere in the file, untouched — possible follow-up.
  • gui/wxpython/lmgr/layertree.py: removed an unreachable/no-op branch in a sibling-walk loop.
Resource-safety cleanups (4) — manual open/close → context manager
  • scripts/i.oif/i.oif.py, scripts/v.import/v.import.py, scripts/r.in.wms/wms_gdal_drv.py: open()/close()with open(...) as f:
  • scripts/m.proj/m.proj.py: manual open/write/close → Path(tmpfile).write_text(...) (import already present)
Other (3)
  • docker/debian/Dockerfile: grass symlink was hardcoded to grass86; now detects the installed grass* dir dynamically (no edit needed on version bumps).
  • scripts/d.correlate/tests/d_correlate_test.py: adds a test for the primary two-map case.
  • temporal/t.vect.import/tests/t_vect_import_test.py: adds start_time/end_time assertions.
Branches checked but left out, and why
  • finding-autofix-960 (python/grass/temporal/univar_statistics.py, "file is not always closed"): not included on purpose. It only wraps the header-writing section in a with open(...) as out_file: block, but the same function writes to out_file again afterward for the CSV/JSON body and calls out_file.close() at the end — both would raise ValueError: I/O operation on closed file once the with block exits. Needs a proper rewrite, not a cherry-pick; left for a follow-up.
  • alert-autofix-153/200/239 (sscanf checks, URL/email sanitization) and finding-autofix-382 (unused exception object): already fixed independently on main since these branches were created.

How has this been tested?

Each commit is a small, isolated diff taken as-is from the original suggestion; no test suite was run in this environment. metadata.py and wms_cap_parsers.py are the two most worth a closer look since they change program behavior.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • PR title starts with a pre-defined prefix
  • Follows code style (each hunk taken as-is from the original suggestion)
  • Tests added (2 of the picked commits add test coverage)

🤖 Generated with Claude Code

https://claude.ai/code/session_01FWZbrtWRkJPgkvEbtB1q6p

echoix and others added 11 commits September 5, 2026 08:47
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
(cherry picked from commit 8e43a8a)
(cherry picked from commit 747a574)
…tofix

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
(cherry picked from commit 03693ae)
(cherry picked from commit 6db17e7)
… Autofix

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
(cherry picked from commit 2da7b27)
(cherry picked from commit 80eccc9)
…from Copilot Autofix

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
(cherry picked from commit e58bf3e)
(cherry picked from commit 81d1a36)
…ot Autofix

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
(cherry picked from commit 576f29c)
(cherry picked from commit ce14dc1)
…t.py from Copilot Autofix

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
(cherry picked from commit cdbdb08)
(cherry picked from commit 7771c7b)
…ring

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
(cherry picked from commit 56e5765)
(cherry picked from commit 954c4ad)
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
(cherry picked from commit 029f79c)
(cherry picked from commit 5b1cca0)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
(cherry picked from commit 4cf2459)
(cherry picked from commit 767d24a)
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
(cherry picked from commit 3f3f1b2)
(cherry picked from commit c9c21fa)
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
(cherry picked from commit 1264044)
(cherry picked from commit 8351522)
echoix and others added 4 commits September 5, 2026 07:42
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
(cherry picked from commit f98c0a5)
Add a pytest test covering the tileIndex bounds check in
Rast3d_write_tile: an index equal to nTiles must be rejected as out of
range, and the last valid index must be accepted. The invalid call runs
in a subprocess using the grass.lib.raster3d ctypes bindings because the
rejection is a fatal error which exits the calling process.

The out-of-range test fails without the bounds check change in this
branch and passes with it.

The test was written by Claude Code using the Claude Fable 5 model.

(cherry picked from commit 4693358)
…ofix

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
(cherry picked from commit 8ec6ef9)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants