Fix panic on server atomic save edits on MacOS - #15132
Merged
Merged
Conversation
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
bep
force-pushed
the
fix/panicrename-15130
branch
from
July 24, 2026 20:07
28fa1f0 to
c0a111a
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a hugo server rebuild panic on macOS/kqueue triggered by atomic-save editor behavior (temp write + rename-over), ensuring file watcher events don’t incorrectly delete taxonomy subtrees and that taxonomy creation checks don’t shift unassembled nodes.
Changes:
- Treat
fsnotify.Remove/Renameas an update when the path still exists (atomic-save behavior on macOS/kqueue). - Avoid shifting during rebuild taxonomy checks by using
GetRaw, and add integration coverage for atomic-save rebuild scenarios. - Refactor content-node helpers (seq conversions / auto-node detection) and move
contentWeightlogic intopageMetaSource.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| hugolib/site.go | Reclassifies Remove/Rename events as “removed” only when Stat fails, preventing false deletes on atomic saves. |
| hugolib/rebuild_test.go | Adds rebuild integration tests covering atomic-save edits for section bundles and content-backed taxonomy roots. |
| hugolib/page.go | Delegates pageState.contentWeight() to pageMetaSource. |
| hugolib/page__meta.go | Introduces pageMetaSource.contentWeight() to centralize content weight logic. |
| hugolib/integrationtest_builder.go | Adds test harness support for simulating atomic-save watcher events. |
| hugolib/content_map_page_contentnodeshifter.go | Switches helper calls to the helperContentNode receiver-based APIs. |
| hugolib/content_map_page_contentnode.go | Adds helper methods for seq conversion and auto-node detection, and wires pageMetaSource into weight provider interface. |
| hugolib/content_map_page_assembler.go | Uses GetRaw + auto-node detection to avoid shifting unassembled nodes during rebuild taxonomy creation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
An atomic save (write temp file, rename into place) unlinks the inode the watcher holds, so kqueue reports Remove for a file that's still on disk. That took the delete branch and wiped the entire taxonomy subtree; the following assemble then panicked in createMissingTaxonomies, where the shifting tree.Get hit a not yet assembled *pageMetaSource. Treat Remove of a path that still exists as an update, and use the non-shifting GetRaw when checking for the auto created taxonomy node. Fixes gohugoio#15130 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
bep
force-pushed
the
fix/panicrename-15130
branch
from
July 26, 2026 09:55
180ad2e to
cde8282
Compare
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.
An atomic save (write temp file, rename into place) unlinks the inode the
watcher holds, so kqueue reports Remove for a file that's still on disk.
That took the delete branch and wiped the entire taxonomy subtree; the
following assemble then panicked in createMissingTaxonomies, where the
shifting tree.Get hit a not yet assembled *pageMetaSource.
Treat Remove of a path that still exists as an update, and use the
non-shifting GetRaw when checking for the auto created taxonomy node.
Fixes #15130
Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com