Skip to content

Add the terrain store: region grids and tile cache - #55

Merged
mouftz merged 6 commits into
mainfrom
store-region-grids
Sep 15, 2026
Merged

mouftz merged 6 commits into
mainfrom
store-region-grids

Conversation

@mouftz

@mouftz mouftz commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

Summary

Implements the Terrain Store (#31) — all six sub-tickets in one PR, since
the two halves are small and share a module.

Adds numpy (2.5.2) as the project's first runtime dependency, per
CONTRIBUTING: pyproject.toml and uv.lock are both committed.

Validation

  • scripts/quality-check.sh passes locally
  • Appropriate /test commands were run and are passing (e.g. /test gpu)
  • Unit tests were added / e2e tests were added where applicable
  • Manual testing, if applicable (describe further):

27 tests in tests/test_store.py, covering every assertion listed in
#40#45. The overlap test uses the worked 1×6 example from #31 directly.
Full suite is 68 passed.

Checklist

  • The change is focused and easy to review.
  • Tests were added or updated for behaviour changes.
  • No secrets, generated files, or files that only make sense on my machine are included.
  • Relevant documentation is updated.

Additional Comments

Two decisions worth a second opinion:

  • put copies the incoming array so the generator can reuse its buffer,
    but get hands back the cache's own grid rather than a copy — copying
    on every read would undo the point of caching. Callers should treat a
    returned tile as read-only. Happy to change this if you would rather it
    be defensive on both sides.
  • Disk persistence is mentioned in the module docstring but has no
    sub-ticket, so it is not implemented here.

Closes #40, #41, #42, #43, #44, #45

@mouftz mouftz self-assigned this Aug 23, 2026
@coveralls

coveralls commented Aug 23, 2026

Copy link
Copy Markdown

Coverage Report for CI Build 34997107256

Coverage increased (+0.8%) to 98.593%

Details

  • Coverage increased (+0.8%) from the base build.
  • Patch coverage: 277 of 277 lines across 2 files are fully covered (100%).
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 782
Covered Lines: 771
Line Coverage: 98.59%
Coverage Strength: 0.99 hits per line

💛 - Coveralls

@mouftz
mouftz force-pushed the store-region-grids branch from d974f1c to 1ea3053 Compare August 23, 2026 15:07
@mouftz
mouftz requested a review from KurbyDoo August 23, 2026 18:28

@KurbyDoo KurbyDoo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I changed some of the specifications of the original tickets since they don't really match what I'm thinking anymore, could you update this PR accordingly? Thanks

Comment thread src/terrain_diffusion/store.py Outdated
Comment thread src/terrain_diffusion/store.py Outdated
@mouftz
mouftz requested a review from KurbyDoo September 5, 2026 21:32

@KurbyDoo KurbyDoo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

structure looks good overall!

please remove all comments that are not nessasary, it makes the code hard to read and confusing / misleading for future editors. ideally behaviour should be obvious from variable and function names and comments should only be used for when the reason for doing something is not clear. comments should also not reference issue numbers or talk about things that do not exist in the codebase / are not implemented yet

also add the coverage file to gitignore thanks

Comment thread src/terrain_diffusion/store.py Outdated
Comment thread tests/test_store.py Outdated
Comment thread tests/test_store.py Outdated
Comment thread src/terrain_diffusion/store.py
Comment thread tests/test_store.py Outdated
Comment thread tests/test_store.py Outdated
@mouftz
mouftz requested a review from KurbyDoo September 11, 2026 04:19

@KurbyDoo KurbyDoo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nice looks good thanks!

Comment thread src/terrain_diffusion/store.py Outdated

@KurbyDoo KurbyDoo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm!

@mouftz
mouftz merged commit 2b324c6 into main Sep 15, 2026
4 checks passed
@mouftz
mouftz deleted the store-region-grids branch September 15, 2026 17:30
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.

Create empty sum and weight grids for a region

3 participants