Skip to content

refactor: pin CLI output and rename path fields - #711

Merged
moonD4rk merged 3 commits into
mainfrom
refactor/cli-goldens-and-renames
Nov 21, 2026
Merged

moonD4rk merged 3 commits into
mainfrom
refactor/cli-goldens-and-renames

Conversation

@moonD4rk

@moonD4rk moonD4rk commented Nov 21, 2026 •

Copy link
Copy Markdown
Owner

Summary

Part of #710. Step 1 of 4: preparation only, no behavior change.

Tests that pin what a run prints, added before the refactor moves every command's entry code:

  • help.golden: the rendered -h of the root command and the six subcommands.
  • errors.golden: thirteen failing invocations, each with its error line and whether the usage was printed.
  • TestNothingFound: with no browser on the machine, dump and archive create nothing, list says so, and dumpkeys prints a key file without vaults.

Both goldens replace the OS's browser names with a placeholder, so one file serves every OS. help.golden records today's [=true|false] on bool flags as it is; fixing that will show up as a golden diff.

Renames, with no logic change:

Before After
Platform.UserDataDirs Platform.UserDataDirPaths
Source.Path, Source.Paths() Source.RelativePath, Source.RelativePaths()
snapshot.Temp() snapshot.NewRoot()
app.Output app.OutputOptions
report, announceExport in cmd printSummary, printExported
parameter dir of export.NewWriter, checkOutputDir, zipfile.Extract outputDir, outputDir, targetDir

The two rules behind them are added to RFC-001: a field named for a thing holds the thing itself, and a path is absolute unless its name says it is relative.

Existing golden files are unchanged, and a full run with HBD_UPDATE_GOLDEN=1 rewrites none of them.

Checklist

  • Pull request targets the main branch
  • All CI checks pass (lint, test, build)
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)
  • go.mod directive remains go 1.20 (do not bump)

The next refactor moves every command's entry code. These tests show that what a run prints and leaves behind stays the same.
A field named for a thing now holds the thing itself and Path means an absolute path, so a default location, a found user data dir and a relative path no longer share a name.
@moonD4rk moonD4rk added the refactor Code restructuring without changing external behavior label Nov 21, 2026
Copilot AI balanced review requested due to automatic review settings November 21, 2026 11:08

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@moonD4rk moonD4rk added the refactor Code restructuring without changing external behavior label Nov 21, 2026
@moonD4rk
moonD4rk merged commit 6ddfe48 into main Nov 21, 2026
9 checks passed
@moonD4rk
moonD4rk deleted the refactor/cli-goldens-and-renames branch November 21, 2026 11:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactor Code restructuring without changing external behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants