test(cmd/bd): take the flag-reset baseline after a reset, not from live values (#7190) (#7194)

TestResetCommandFlagsRestoresEveryFlag read its expected values from the
live flag variables. The root pre-run fills some of those from config
without marking the flag Changed (doltAutoCommit, main.go:1224), so when
an in-process command ran earlier in the binary the baseline for
--dolt-auto-commit was "on", and the reset under test correctly put it
back to "". PR Core (wrapper timing) has failed on that assertion on
every fork PR since #7185.

The test now calls resetCommandFlags before taking its baseline.

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
Bee 2026-10-04 20:00:37 -07:00 • committed by GitHub
commit 4524f4a428
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -200,6 +200,13 @@ func TestResetCommandFlagsRestoresEveryFlag(t *testing.T) {
// shared command tree.
t.Cleanup(func() { resetCommandFlags(rootCmd) })
// Start from the registered baseline, not from whatever an earlier
// in-process command left behind: the root pre-run fills flag variables
// such as doltAutoCommit from config without marking them Changed, and a
// baseline read from that live value is one a reset correctly does not
// restore (gastownhall/beads#7190).
resetCommandFlags(rootCmd)
type state struct {
value string
changed bool