Skip to content

commands: Rebuild assets also mounted as static - #15567

Merged
bep merged 3 commits into
gohugoio:masterfrom
xndvaz:xndvaz/fix-mounted-resource-rebuild-7740
Nov 11, 2026
Merged

bep merged 3 commits into
gohugoio:masterfrom
xndvaz:xndvaz/fix-mounted-resource-rebuild-7740

Conversation

@xndvaz

@xndvaz xndvaz commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Files mounted into both static and assets are classified only as static changes by the server watcher. Editing them copies the static file but leaves cached resources and their consumers unchanged, so fingerprinted CSS keeps its old URL and content until a full build.

Keep static synchronization and also rebuild when the changed file belongs to the assets filesystem. Add server regression tests for both mount directions, covering edits and deletion while checking the page URL and both published CSS files.

This intentionally does not change fingerprint semantics, mount precedence, or the handling of files used only as static resources. The pre-existing missing-resource cache behavior after deleting and recreating an asset is outside this change.

Validation on macOS arm64 with Go 1.27.2:

  • ./check.sh
  • staticcheck ./... (2026.2.2)
  • CI_LOCAL=true go test . -run '^TestServer$' -parallel 2 -count=1
  • CI_LOCAL=true go test -race . -run 'TestServer/server__mounted_resource_' -parallel 2 -count=3
  • HTTP and WebSocket checks confirmed updated HTML and a LiveReload page-reload notification in both mount directions, with Fast Render enabled and disabled.

Both regression cases fail on base bdde5aa51 at the updated fingerprint assertion. Windows CI passed. Ubuntu passed the main and commands test suites, but the job failed in TestTailwindCSSImportContext during npm install with ENOTEMPTY while removing node_modules/tapable/lib, before the Tailwind assertion ran. Failed job. A rerun requires upstream permissions.

The regression cases are adapted from the reports by @divinerites and @jmooring; both are credited as co-authors.

OpenAI Codex was used for investigation, implementation, regression tests, automated validation, and preparation of this PR.

Fixes #7740

Keep static synchronization and also invalidate assets when a changed
file belongs to both filesystems. Cover both mount directions with
server tests for edits and deletion.

Fixes gohugoio#7740

Co-authored-by: Didier Divinerites <divinerites@gmail.com>
Co-authored-by: Joe Mooring <joe.mooring@veriphor.com>
@xndvaz

xndvaz commented Nov 10, 2026

Copy link
Copy Markdown
Contributor Author

The Ubuntu job stopped during npm install in TestTailwindCSSImportContext with ENOTEMPTY. The main and commands test suites passed on Ubuntu, and Windows CI passed.

Investigation uncovered an independently reproducible defect: TestOptWithNpmInstall changes the process working directory until cleanup, although its callers include parallel tests. I opened #15568 and a separate fix in #15569. The regression fails on master and passes with the fix; the parallel Tailwind cases also passed locally with -race. This does not establish that the directory change caused this exact npm failure.

Could a maintainer rerun the failed Ubuntu job and triage #15568? My account cannot rerun upstream workflows or apply the Bug label. This PR remains scoped to #7740.

@bep
bep merged commit b755c9d into gohugoio:master Nov 11, 2026
4 checks passed
@xndvaz
xndvaz deleted the xndvaz/fix-mounted-resource-rebuild-7740 branch November 11, 2026 16:13
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.

CSS resources refresh problem when "static" is mounted on "assets" (with example repo)

2 participants