--watch forces the pretty listing and returns into the watch loop before the --format branch, so on the direct route `bd list --watch --format X` printed the pretty listing and never mentioned the ignored template. The proxied route already refused the combination in runListProxiedWatch. The refusal now lives in gatherListInput, next to the existing --watch / --brief refusal and ahead of the route split, so both routes give the same usage error. The proxied-only guard is unreachable now and is removed, and its integration test expects the shared message. Agent-Signature: claude-code-opus-5-5-unknown-reasoning on behalf of Harry Miller Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
61ec1d1c38
commit
c2f5029e10
5 changed files with 38 additions and 5 deletions
|
|
@ -9,6 +9,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
|
||||
### Fixed
|
||||
|
||||
- **`bd list --watch --format` is refused instead of silently dropping the
|
||||
format** ([#6277](https://github.com/gastownhall/beads/issues/6277)).
|
||||
`--watch` always re-renders the pretty listing, so on the direct route a
|
||||
`--format` template was ignored without a word, while `--proxied-server`
|
||||
already refused the combination. Both routes now fail with the same
|
||||
`--format cannot be combined with --watch` usage error.
|
||||
|
||||
- **The smart migrate gate no longer auto-migrates a clone whose data is behind
|
||||
the remote, and `bd dolt pull` now works from that state**
|
||||
([#6575](https://github.com/gastownhall/beads/issues/6575)). The gate's
|
||||
|
|
|
|||
|
|
@ -258,6 +258,13 @@ func gatherListInput(cmd *cobra.Command) (listInput, error) {
|
|||
in.prettyFormat = (prettyFormat || treeFormat) && !in.jsonOutput && in.formatStr == ""
|
||||
in.watchMode, _ = cmd.Flags().GetBool("watch")
|
||||
if in.watchMode {
|
||||
// --watch re-renders the pretty listing on every tick, so a --format
|
||||
// template would be dropped without a word (GH#6277). Refused here,
|
||||
// ahead of the route split, so the direct and proxied routes answer
|
||||
// the same way.
|
||||
if in.formatStr != "" {
|
||||
return in, HandleError("--format cannot be combined with --watch; --watch always renders the pretty listing")
|
||||
}
|
||||
in.prettyFormat = true
|
||||
}
|
||||
in.noPager, _ = cmd.Flags().GetBool("no-pager")
|
||||
|
|
|
|||
|
|
@ -719,7 +719,7 @@ func TestProxiedServerList(t *testing.T) {
|
|||
|
||||
t.Run("reject_format_with_watch", func(t *testing.T) {
|
||||
out := bdProxiedListFail(t, bd, p, "--watch", "--format", "dot")
|
||||
if !strings.Contains(out, "--format under --proxied-server --watch is not supported") {
|
||||
if !strings.Contains(out, "--format cannot be combined with --watch") {
|
||||
t.Errorf("expected --format+--watch rejection message, got: %s", out)
|
||||
}
|
||||
})
|
||||
|
|
|
|||
|
|
@ -110,10 +110,7 @@ func runListProxiedPage(ctx context.Context, out io.Writer, in listInput) error
|
|||
}
|
||||
|
||||
func runListProxiedWatch(_ *cobra.Command, ctx context.Context, in listInput) error {
|
||||
if in.formatStr != "" {
|
||||
return errors.New("--format under --proxied-server --watch is not supported")
|
||||
}
|
||||
|
||||
// --format with --watch is refused in gatherListInput, on both routes.
|
||||
uw, filter, err := openAndPrepare(ctx, in)
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
|
|||
|
|
@ -172,6 +172,28 @@ func TestListBriefIsRefusedWhereItCannotBeHonored(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
// TestListWatchRefusesFormat pins GH#6277: --watch always re-renders the pretty
|
||||
// listing, so a --format template would be dropped silently. The refusal lives
|
||||
// in gatherListInput, ahead of the route split, so the direct route answers
|
||||
// the way the proxied route used to on its own.
|
||||
func TestListWatchRefusesFormat(t *testing.T) {
|
||||
pinJSONOutput(t, false)
|
||||
_, err, shown := runGatherListInput(t, newListFlagsCommand(t, "--watch", "--format", "digraph"))
|
||||
if err == nil {
|
||||
t.Fatal("gatherListInput(--watch --format digraph) = nil, want a usage error")
|
||||
}
|
||||
if want := "--format cannot be combined with --watch"; !strings.Contains(shown, want) {
|
||||
t.Errorf("output = %q, want it to name %q", shown, want)
|
||||
}
|
||||
|
||||
// The control: --watch alone and --format alone are both still accepted.
|
||||
for _, args := range [][]string{{"--watch"}, {"--format", "digraph"}} {
|
||||
if _, err := gatherListInput(newListFlagsCommand(t, args...)); err != nil {
|
||||
t.Errorf("gatherListInput(%v) = %v, want no error", args, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TestListBriefIsAcceptedOnThePageRoutes is the negative control: the modes
|
||||
// above are refusals, not a blanket one. --long is here on purpose, since it is
|
||||
// the text rendering that prints an omitted field and is allowed precisely
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue