Skip to content

refactor(world_editor): dedup set-if-absent write helpers - #1073

Merged
louis-e merged 1 commit into
mainfrom
refactor/world-editor-write-dedup
May 31, 2026
Merged

louis-e merged 1 commit into
mainfrom
refactor/world-editor-write-dedup

Conversation

@louis-e

@louis-e louis-e commented May 31, 2026

Copy link
Copy Markdown
Owner

Follow-up to #1067. That PR added set_with_props_if_absent but left it duplicating the region/chunk/section descent from the existing set_block_if_absent.

This collapses the duplication: set_block_if_absent now delegates to set_with_props_if_absent with properties: None. The two are behaviourally identical for the no-props case (both write + clear stale properties only when the cell is AIR), and #[inline] on both means the wrapper compiles away — no perf cost.

Adds unit tests for the shared write-if-absent path: write-then-protect-occupied, the delegating wrapper's semantics, and property store/omit handling.

No behaviour change; full suite green, clippy clean.

🤖 Generated with Claude Code

set_block_if_absent now delegates to set_with_props_if_absent (from #1067)
instead of duplicating the region/chunk/section descent. Behaviourally
identical for the no-props case; `#[inline]` keeps it free. Adds unit tests
for the shared write-if-absent path.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Copilot AI review requested due to automatic review settings May 31, 2026 09:47

Copilot AI left a comment

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.

Pull request overview

This PR refactors the world editor’s set-if-absent write path by making set_block_if_absent delegate to the existing property-aware helper, reducing duplicated traversal logic while preserving behavior.

Changes:

  • Replaced the duplicated set_block_if_absent implementation with a thin wrapper around set_with_props_if_absent.
  • Updated helper documentation.
  • Added unit tests covering write-if-absent behavior, wrapper semantics, and property storage/omission.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions

Copy link
Copy Markdown

⏱️ Benchmark run finished in 0m 57s
🏗️ Generation time: 29s (excl. data fetching)
🧠 Peak memory usage: 901 MB

📈 Compared against baseline: 27s time, 900 MB memory
🧮 Delta: 30s time, 1 MB memory
🔢 Commit: c797459

🟢 Generation time is unchanged.
🟢 Peak memory is unchanged.

📅 Last benchmark: 2026-05-31 09:53:18 UTC

You can retrigger the benchmark by commenting retrigger-benchmark.

@louis-e
louis-e merged commit 0a9c4f7 into main May 31, 2026
4 checks passed
@louis-e
louis-e deleted the refactor/world-editor-write-dedup branch May 31, 2026 09:58
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.

2 participants