Backtestshugorun-20261013-011256#15116
common/hugo: Include aom, dav1d, and libavif in commands/env output
Our patch was judged better than the merged fix.
In this judgment, Patch A = our agent, Patch B = the merged fix.
Patch A does what the issue asks. It adds libavif v1.4.1, aom v3.14.1 and dav1d 1.5.3 next to libwebp in GetDependencyListNonGo, and notes that these versions must stay in sync with the genwebp and genavif Makefiles. Its unit test reads the version variables from those Makefiles and asserts each formatted dependency appears in the output. That test fails before the change and also catches later drift, which is a real check rather than a tautology. Its testscript checks the exact version strings in `hugo env` output. Patch B routes the versions through a new warpc.GetWASMDeps(), which makes common/hugo import internal/warpc. That is a new cross-package dependency from a low-level common package into an internal subsystem, with some risk of import cycles or heavier coupling. It also adds a KaTeX entry the issue did not ask for, with a hardcoded version that nothing checks against js/package.json. It reformats unrelated code in warpc.go (dispatcher closures, WithImportResolver), which obscures the fix. Its constants are still hand-maintained with only 'keep in sync' comments, and its testscript checks only module paths, not versions, so it would not catch wrong versions. A is narrower, lower-risk, and better tested.
The judge saw only the two patches, labelled A and B in random order, with issue links and version numbers removed. The reasoning above is shown verbatim.
Solve
17m 6s
Wall-clock time in the container
Full test suite
No new failures
1,064 passed · 58 skipped · 1,148 total
Contamination audit
Clean
No sign the agent saw the real fix
Patch size
48vs 51 merged
Changed lines, ours vs merged
The issue
View on GitHubCurrently, the hugo env command prints:
hugo v0.164.0-ce2470e7012b5ab5fc4e10ebe4027e9f8d9e00dc+withdeploy linux/amd64 BuildDate=2026-07-06T16:39:30Z VendorInfo=gohugoio
GOOS="linux"
GOARCH="amd64"
GOVERSION="go1.26.3"
github.com/webmproject/libwebp="v1.6.0"
github.com/sass/dart-sass/protocol="3.2.0"
github.com/sass/dart-sass/compiler="1.101.0"
github.com/sass/dart-sass/implementation="1.101.0"
I think it would make sense to also list...
aomedia.googlesource.com/aom="v3.14.1"
code.videolan.org/videolan/dav1d="1.5.3"
github.com/AOMediaCodec/libavif="v.14.1"
...assuming I have the correct source strings.
See:
<https://github.com/gohugoio/hugo/blob/a198116669fdfba2eeda4f1d63c055001a10142f/common/hugo/hugo.go#L213-L214>.
The two patches
common/hugo/hugo.goindex 28f8b9393..692d586da 100644@@ -211,7 +211,14 @@ func GetDependencyList() []string { // GetDependencyListNonGo returns a list of non-Go dependencies. func GetDependencyListNonGo() []string {- deps := []string{formatDep("github.com/webmproject/libwebp", "v1.6.0")} // via WASM. TODO(bep) get versions from the plugin setup.+ // Via WASM. TODO(bep) get versions from the plugin setup.+ // These must be kept in sync with the versions in internal/warpc/genwebp/Makefile and internal/warpc/genavif/Makefile.+ deps := []string{+ formatDep("github.com/webmproject/libwebp", "v1.6.0"),+ formatDep("github.com/AOMediaCodec/libavif", "v1.4.1"),+ formatDep("aomedia.googlesource.com/aom", "v3.14.1"),+ formatDep("code.videolan.org/videolan/dav1d", "1.5.3"),+ } if IsExtended { deps = append(common/hugo/hugo_test.goindex a572f74d4..a41f0a1f9 100644@@ -15,6 +15,10 @@ package hugo import ( "context"+ "os"+ "path/filepath"+ "regexp"+ "slices" "testing" "github.com/bep/logg"@@ -59,3 +63,26 @@ func TestGetBuildInfo(t *testing.T) { c.Assert(bi.GoVersion, qt.Not(qt.Equals), "") } }++func TestGetDependencyListNonGoWASMLibs(t *testing.T) {+ c := qt.New(t)++ readMakefileVar := func(filename, name string) string {+ b, err := os.ReadFile(filepath.Join("..", "..", "internal", "warpc", filename, "Makefile"))+ c.Assert(err, qt.IsNil)+ m := regexp.MustCompile(`(?m)^` + name + `\s*=\s*(\S+)\s*$`).FindStringSubmatch(string(b))+ c.Assert(m, qt.HasLen, 2, qt.Commentf("%s not found in %s/Makefile", name, filename))+ return m[1]+ }++ deps := GetDependencyListNonGo()++ for _, want := range []string{+ formatDep("github.com/webmproject/libwebp", readMakefileVar("genwebp", "LIBWEBP_VERSION")),+ formatDep("github.com/AOMediaCodec/libavif", readMakefileVar("genavif", "LIBAVIF_VERSION")),+ formatDep("aomedia.googlesource.com/aom", readMakefileVar("genavif", "AOM_VERSION")),+ formatDep("code.videolan.org/videolan/dav1d", readMakefileVar("genavif", "DAV1D_VERSION")),+ } {+ c.Assert(slices.Contains(deps, want), qt.IsTrue, qt.Commentf("missing %s in %v", want, deps))+ }+}testscripts/commands/env.txtindex 742e05ffc..50c4ff2c3 100644@@ -2,4 +2,14 @@ hugo env stdout 'GOARCH'-! stderr .\ No newline at end of file+stdout 'github.com/webmproject/libwebp="v1\.6\.0"'+stdout 'github.com/AOMediaCodec/libavif="v1\.4\.1"'+stdout 'aomedia.googlesource.com/aom="v3\.14\.1"'+stdout 'code.videolan.org/videolan/dav1d="1\.5\.3"'+! stderr .++hugo env --logLevel info+stdout 'github.com/webmproject/libwebp="v1\.6\.0"'+stdout 'github.com/AOMediaCodec/libavif="v1\.4\.1"'+stdout 'aomedia.googlesource.com/aom="v3\.14\.1"'+stdout 'code.videolan.org/videolan/dav1d="1\.5\.3"'
common/hugo/hugo.goindex 28f8b9393..ac490a84b 100644@@ -33,6 +33,7 @@ import ( "github.com/gohugoio/hugo/common/loggers" "github.com/gohugoio/hugo/common/version" "github.com/gohugoio/hugo/hugofs/files"+ "github.com/gohugoio/hugo/internal/warpc" "github.com/spf13/afero" @@ -211,7 +212,10 @@ func GetDependencyList() []string { // GetDependencyListNonGo returns a list of non-Go dependencies. func GetDependencyListNonGo() []string {- deps := []string{formatDep("github.com/webmproject/libwebp", "v1.6.0")} // via WASM. TODO(bep) get versions from the plugin setup.+ var deps []string+ for _, dep := range warpc.GetWASMDeps() {+ deps = append(deps, formatDep(dep[0], dep[1]))+ } if IsExtended { deps = append(@@ -225,7 +229,8 @@ func GetDependencyListNonGo() []string { if IsDartSassGeV2() { dartSassPath = "github.com/sass/dart-sass" }- deps = append(deps,+ deps = append(+ deps, formatDep(dartSassPath+"/protocol", dartSass.ProtocolVersion), formatDep(dartSassPath+"/compiler", dartSass.CompilerVersion), formatDep(dartSassPath+"/implementation", dartSass.ImplementationVersion),internal/warpc/avif.goindex baadaadd7..f080b87b1 100644@@ -25,6 +25,13 @@ import ( "github.com/gohugoio/hugo/common/hugio" ) +// Keep in sync with genavif/Makefile.+const (+ libavifVersion = "v1.4.1"+ aomVersion = "v3.14.1"+ dav1dVersion = "1.5.3"+)+ var ( _ SourceProvider = AvifInput{} _ DestinationProvider = AvifInput{}internal/warpc/katex.goindex 75c20117f..627f18e3a 100644@@ -17,6 +17,9 @@ import ( _ "embed" ) +// Keep in sync with js/package.json.+const katexVersion = "0.16.21"+ //go:embed wasm/renderkatex.wasm var katexWasm []byte internal/warpc/warpc.goindex b7763e782..be8e48bb5 100644@@ -48,6 +48,17 @@ const ( const currentVersion = 1 +// GetWASMDeps returns version information for the C libraries bundled as WASM.+func GetWASMDeps() [][2]string {+ return [][2]string{+ {"aomedia.googlesource.com/aom", aomVersion},+ {"code.videolan.org/videolan/dav1d", dav1dVersion},+ {"github.com/AOMediaCodec/libavif", libavifVersion},+ {"github.com/KaTeX/KaTeX", katexVersion},+ {"github.com/webmproject/libwebp", libwebpVersion},+ }+}+ //go:embed wasm/quickjs.wasm var quickjsWasm []byte @@ -348,7 +359,8 @@ func (d *dispatcher[Q, R]) inputBlobs() error { call.done() } return nil- }); err != nil {+ },+ ); err != nil { inputErr = err break }@@ -384,7 +396,8 @@ func (d *dispatcher[Q, R]) inputJSON() error { call.done() } return nil- }); err != nil {+ },+ ); err != nil { inputErr = err break }@@ -679,7 +692,8 @@ func newDispatcher[Q, R any](opts Options) (*dispatcherPool[Q, R], error) { if err != nil { return toErr("quickjs", errBuff, err) }- ctx = experimental.WithImportResolver(ctx,+ ctx = experimental.WithImportResolver(+ ctx, func(name string) api.Module { if name == opts.Runtime.Name { return runtimeInstanceinternal/warpc/webp.goindex 35ee98899..2c2be0bd4 100644@@ -28,6 +28,9 @@ import ( "github.com/gohugoio/hugo/common/hugio" ) +// Keep in sync with genwebp/Makefile.+const libwebpVersion = "v1.6.0"+ var ( _ SourceProvider = WebpInput{} _ DestinationProvider = WebpInput{}testscripts/commands/env.txtindex 742e05ffc..1ae628c6c 100644@@ -1,5 +1,12 @@ # Test the hugo env command. hugo env+stdout 'GOOS' stdout 'GOARCH'-! stderr .\ No newline at end of file+stdout 'GOVERSION'+stdout 'aomedia\.googlesource\.com/aom'+stdout 'code\.videolan\.org/videolan/dav1d'+stdout 'github\.com/AOMediaCodec/libavif'+stdout 'github\.com/KaTeX/KaTeX'+stdout 'github\.com/webmproject/libwebp'+! stderr .