Reconcile COG write stability across registry, contract, and docstring#2520
Merged
Conversation
#2513) SUPPORTED_FEATURES['writer.cog'] in the runtime registry reports 'stable', and the release contract and reference docs agree. The to_geotiff() docstring did not: it listed cog=True under the [advanced] tier block and tagged the cog parameter as [advanced]. This picks option (a) from the issue. The COG layout is stable. Only the pyramid customisation knobs (overview_levels, overview_resampling) stay advanced, because writer.overviews is the separately tracked advanced sub-behaviour. What changed: to_geotiff docstring: cog=True moves to the [stable] tier bullet with an inline reference to SUPPORTED_FEATURES['writer.cog'], and the cog parameter marker flips from [advanced] to [stable]. The overview_levels and overview_resampling markers stay [advanced], matching writer.overviews. docs/source/reference/geotiff.rst: the "Stable COG contract" section now spells out that the pyramid-customisation knobs stay advanced under writer.overviews even though the COG layout itself is stable. docs/source/reference/geotiff_release_contract.md: the writer.cog and writer.overviews rows name the split explicitly. xrspatial/geotiff/tests/release_gates/test_stable_features.py: four tripwire gates pin the resolution. writer.cog stays stable, writer.overviews stays advanced, the docstring lists cog=True under [stable], and overview_levels / overview_resampling stay [advanced]. If any of those pins drops, the gate fails before release.
brendancol
commented
May 27, 2026
Contributor
Author
brendancol
left a comment
There was a problem hiding this comment.
PR Review: Reconcile COG write stability across registry, contract, and docstring
Blockers (must fix before merge)
None. Docs-and-contract reconciliation. The four new tripwire gates pass locally on Python 3.14, and the geotiff suite stays green.
Suggestions (should fix, not blocking)
-
xrspatial/geotiff/tests/release_gates/test_stable_features.py:2657,2704: the new tripwire tests regex againstto_geotiff.__doc__. Python 3.13 trims leading whitespace from docstrings at compile time, but Python 3.12 (still supported persetup.cfg'spython_requires = >=3.12) does not. The current regexes anchor at column 0 (r"^cog : bool\n \["), which works on 3.13 / 3.14 and breaks on 3.12 because every body line keeps its 4-space indent. PR CI only runs 3.14, so this PR lands green, but a 3.12 user runningpytestlocally trips a false positive. Wrap the docstring ininspect.getdoc(to_geotiff)(orinspect.cleandoc(to_geotiff.__doc__ or "")) before regexing; that normalises indent across every supported Python.
Nits (optional improvements)
-
xrspatial/geotiff/tests/release_gates/test_stable_features.py:2655,2702: the two docstring tests do a localfrom xrspatial.geotiff import to_geotiff. The same name is already imported at module scope around line 81. Hoist for consistency with the rest of the file. -
xrspatial/geotiff/tests/release_gates/test_stable_features.py:2673-2674: the comment "Python strips the common leading indent on__doc__" is only true on 3.13+. Drop or rewrite if you stay on raw__doc__; if you move toinspect.getdoc, the comment goes away anyway.
What looks good
- The three surfaces (runtime registry, contract md, reference rst) now agree:
writer.cog = stable,writer.overviews = advanced. The docstring tier markers match. - The "COG layout is stable, pyramid customisation is advanced" split is spelled out in all three places using the same
SUPPORTED_FEATURES['writer.overviews']reference. - Function-level
[stable]bullet listscog=True. Per-parameter[stable]marker oncogmatches. - Four tripwire gates pin every surface, so a future drift trips a release gate instead of shipping silently.
- No code paths touched; the geotiff suite remains green (5917 passed locally).
- The release contract's
writer.overviewsrow names both the customisation knobs and the resampling output, so the boundary againstwriter.cogis unambiguous.
Checklist
- Algorithm matches reference/paper (N/A, docs only)
- All implemented backends produce consistent results (N/A, no backend code touched)
- NaN handling is correct (N/A)
- Edge cases are covered by tests
- Dask chunk boundaries handled correctly (N/A)
- No premature materialization or unnecessary copies (N/A)
- Benchmark exists or is not needed (not needed)
- README feature matrix updated (not needed; no new function)
- Docstrings present and accurate
…#2513) The two docstring tripwires read to_geotiff.__doc__ and regex against it. That works on Python 3.13+ (which dedents docstrings at compile time) but fails on Python 3.12 (still supported per setup.cfg's python_requires = >=3.12), because every body line keeps its 4-space source indent and the column-0 anchors miss. Switch the tests to inspect.getdoc(to_geotiff), which normalises indent on every supported Python version. PR CI only runs 3.14, so the difference would not have shown up in CI, but a 3.12 user running pytest locally would have tripped a false positive. Also fold the local "from xrspatial.geotiff import to_geotiff" into the module-scope import already used elsewhere in the file, and reword the misleading comment about __doc__ indent stripping.
brendancol
commented
May 27, 2026
Contributor
Author
brendancol
left a comment
There was a problem hiding this comment.
PR Review (follow-up after e75bd44)
Blockers
None.
Suggestions
None remaining.
Nits
None remaining.
What looks good
- The earlier Suggestion is addressed. Both docstring gates now go through
inspect.getdoc(to_geotiff), so the regex anchors line up on Python 3.12, 3.13, and 3.14. - The duplicate local imports are gone. The tests use the module-scope
to_geotiffimport at line 81. - The misleading "Python strips the common leading indent on
__doc__" comment is replaced with a docstring note that explains whyinspect.getdocis used. - Tripwire gates still pass locally.
- No code paths touched. The surface change is still docs and tests only.
Checklist
- Algorithm matches reference/paper (N/A, docs only)
- All implemented backends produce consistent results (N/A, no backend code touched)
- NaN handling is correct (N/A)
- Edge cases are covered by tests
- Dask chunk boundaries handled correctly (N/A)
- No premature materialization or unnecessary copies (N/A)
- Benchmark exists or is not needed (not needed)
- README feature matrix updated (not needed; no new function)
- Docstrings present and accurate
# Conflicts: # xrspatial/geotiff/_writers/eager.py
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.
Closes #2513.
Summary
The registry, the release contract, and the reference docs already declared COG writes stable under
SUPPORTED_FEATURES['writer.cog']. Theto_geotiff()docstring disagreed: it putcog=Trueand overview generation under[advanced]and tagged thecogparameter[advanced].This PR picks option (a) from the issue. The COG layout is stable. The
to_geotiff()docstring now listscog=Trueunder the[stable]tier bullet with an inline link toSUPPORTED_FEATURES['writer.cog'], and thecogparameter marker flips to[stable]. Theoverview_levelsandoverview_resamplingknobs stay[advanced]because they map to the separately trackedwriter.overviewssub-behaviour.geotiff.rstandgeotiff_release_contract.mdnow spell that split out so the docs page agrees with the docstring.Four tripwire gates land in
test_stable_features.py:writer.cogstays stable,writer.overviewsstays advanced, the docstring listscog=Trueunder[stable], and the overview knobs stay[advanced]. If any of those pins drops, the release gate fails before release.Backend coverage
Docs and contract only. No code paths touched, no backend matrix to update.
Test plan
pytest -q xrspatial/geotiff/tests -m 'not slow'(5917 passed, 74 skipped, 1 xfailed)pytest xrspatial/geotiff/tests/release_gates/test_stable_features.py -k "writer_cog_stays_stable or writer_overviews_stays_advanced or docstring_marks_cog_stable or docstring_marks_overview_knobs_advanced"