Backtestshugorun-20260930-140149#15223
commands: Fix "hugo config --lang" flag help text
Our patch was judged on par with the merged fix.
In this judgment, Patch B = our agent, Patch A = the merged fix.
The two diffs are byte-for-byte identical, down to the index hashes (59433b359..d8f20b50b). Each changes the --lang flag help text in commands/config.go to exactly the wording the issue suggests: 'the language to display config for (default is the default content language)'. This fixes the reported mismatch at its root. The problem was purely the misleading help text, and the command already uses the default content language when the flag is empty. Neither patch adds tests, which is reasonable for a help-string change. Both have the same minimal scope and the same craft. No criterion separates them.
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
15m 7s13 turns
Wall-clock time in the container
Full test suite
No new failures
3,708 passed · 99 skipped · 3,816 total
Contamination audit
Clean
No sign the agent saw the real fix
Patch size
2vs 2 merged
Changed lines, ours vs merged
The issue
View on GitHubThe --lang flag help says "Defaults to the first language defined", but when
the flag is empty the command uses the default content language:
https://github.com/gohugoio/hugo/blob/master/commands/config.go#L74-L76
These differ when defaultContentLanguage is not first by weight.
Suggested text: "the language to display config for (default is the default content language)"
The two patches
commands/config.goindex 59433b359..d8f20b50b 100644@@ -116,7 +116,7 @@ func (c *configCommand) Init(cd *simplecobra.Commandeer) error { cmd.Long = `Display project configuration, both default and custom settings.` cmd.Flags().StringVar(&c.format, "format", "toml", "preferred file format (toml, yaml or json)") _ = cmd.RegisterFlagCompletionFunc("format", cobra.FixedCompletions([]string{"toml", "yaml", "json"}, cobra.ShellCompDirectiveNoFileComp))- cmd.Flags().StringVar(&c.lang, "lang", "", "the language to display config for. Defaults to the first language defined.")+ cmd.Flags().StringVar(&c.lang, "lang", "", "the language to display config for (default is the default content language)") cmd.Flags().BoolVar(&c.printZero, "printZero", false, `include config options with zero values (e.g. false, 0, "") in the output`) _ = cmd.RegisterFlagCompletionFunc("lang", cobra.NoFileCompletions) applyLocalFlagsBuildConfig(cmd, c.r)
commands/config.goindex 59433b359..d8f20b50b 100644@@ -116,7 +116,7 @@ func (c *configCommand) Init(cd *simplecobra.Commandeer) error { cmd.Long = `Display project configuration, both default and custom settings.` cmd.Flags().StringVar(&c.format, "format", "toml", "preferred file format (toml, yaml or json)") _ = cmd.RegisterFlagCompletionFunc("format", cobra.FixedCompletions([]string{"toml", "yaml", "json"}, cobra.ShellCompDirectiveNoFileComp))- cmd.Flags().StringVar(&c.lang, "lang", "", "the language to display config for. Defaults to the first language defined.")+ cmd.Flags().StringVar(&c.lang, "lang", "", "the language to display config for (default is the default content language)") cmd.Flags().BoolVar(&c.printZero, "printZero", false, `include config options with zero values (e.g. false, 0, "") in the output`) _ = cmd.RegisterFlagCompletionFunc("lang", cobra.NoFileCompletions) applyLocalFlagsBuildConfig(cmd, c.r)
What the agent reported
I fixed the --lang help text, but couldn't test it: Hugo won't build in this environment, and no regression test is included.
What was wrong: In commands/config.go:119 the flag help said "Defaults to the first language defined". When --lang is empty, Run() actually uses conf.configs.Base.DefaultContentLanguage (commands/config.go:74-76). So the help was wrong whenever defaultContentLanguage isn't the first language by weight.
What I changed: One line in commands/config.go:119. The help text is now exactly the suggested wording: "the language to display config for (default is the default content language)". The flag's default is empty, so cobra won't add its own (default …) note after it. Nothing else changed; the AGENTS.md/CLAUDE.md deletions were already in the working tree before I started and I left them alone.
Test evidence: None. ./bt-test . -run 'TestCommands/config' exited 1 with FAIL github.com/gohugoio/hugo [setup failed]. Every Go dependency download failed (Forbidden or a DNS failure from proxy.golang.org), and the local module cache has only metadata, not the module sources. So the package can't be built or tested here, with or without my change.
Tests dropped: I wrote two testscript checks, but neither could be run, so I removed both rather than ship tests I hadn't seen pass. That leaves no test in the diff, which the brief required; I chose that over including unverified tests. Once dependencies can be downloaded, the checks to add are:
- Help text, in
testscripts/commands/config.txtafterhugo config -h:stdout 'the language to display config for \(default is the default content language\)'and! stdout 'Defaults to the first language defined'. This fails before the fix and should pass after. - Fallback behaviour, in a new
testscripts/commands/config__lang.txt: setdefaultContentLanguage = "nn", withenat weight 1 andnnat weight 2. Thenhugo config --format jsonshould print a top-level"title": "Nynorsk Title", and adding--lang enshould give"English Title". This checks existing behaviour, so it would also pass before the fix.
Requirements:
- Help text should describe the actual default: done (see the change above). Not tested, for the reason above.
- Use the suggested wording: done. The reviewer confirmed it matches character for character.
- Scenario where
defaultContentLanguageisn't first by weight: the code already does the right thing (commands/config.go:74-76). The test for it couldn't run and was removed.
Also out of date: the generated docs page docs/content/en/commands/hugo_config.md:26 still has the old wording. I didn't edit it because it's generated hugo gen doc output; it should be regenerated rather than edited by hand.