* wy-j2upyy: render the derived GATED decoration on bd show and bd list
A bead an open gate blocks is excluded from `bd ready` but rendered
`[P2 · OPEN]` by `bd show` and with a plain ○ by `bd list`, so the human
surfaces disagreed with the readiness query.
The decoration is DERIVED, never stored: no status write, no --status
filter change, no existing JSON field reshaped.
- internal/types/gated.go: IsActiveGate, the ONE predicate — a gate-typed
dependency reached over a blocking edge (blocks / conditional-blocks /
waits-for) whose status is neither closed nor pinned. That is the
is_blocked recompute's blocking leg restricted to gates, so a rendered
GATED and a `bd ready` exclusion cannot disagree. GateDescription /
GateReason own the reason's round trip with `bd gate create`.
- bd show: `[P2 · OPEN · GATED]` plus one `Gated by: <id> (<type>[:
<reason>][, awaiting <await-id>])` line per gate, beside Deferred:. The
dependency read the DEPENDS ON section already made is hoisted, so the
decoration costs no extra query.
- bd list: ⊘ in the glyph column (circle family, distinct from ○ and ❄),
and a legend entry when the page carries one. Batched by id set —
at most two extra queries per listing, one in the tree view where the
edge map is already loaded.
- --json: additive `gated_by: [{id,type,reason}]` on the detail view,
omitted when empty; documented in the OpenAPI IssueDetails schema.
Tests (red first): cmd/bd/gated_render_embedded_test.go drives real
bd show/list/--json over an embedded rig — gated, resolved, deferred+gated,
JSON additivity — plus pure unit tests for the predicate and formatters.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* wy-j2upyy: document the additive gated_by field in the JSON schema reference
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* wy-j2upyy: cover the flat list route's own batched gate read
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* wy-j2upyy: make GATED the readiness rule's gate clause, both halves
The adversarial review found the "one predicate shared with bd ready" claim
false on two axes, and both were reproducible by hand:
BLOCKER 1 — waits-for is not the status rule. The is_blocked recompute applies
"target not closed and not pinned" only to its blocks / conditional-blocks
legs; the waits-for leg goes through waitsForGateBlockedSQL, a fanout over the
target's open parent-child children (or an also_blocks spawner). A plain
`bd dep add X G -t waits-for` onto an open childless gate therefore leaves X
in `bd ready` while every new surface called it GATED. Mirroring that leg in
Go would be a second implementation of a rule the database owns, so the edge
clause now names the two legs it really mirrors (types.IsGateEdge) and the
test that pinned the wrong direction is flipped.
BLOCKER 2 — the subject half was missing and spelled three different ways.
unmarkAllBlockedSQL forces is_blocked=0 for a closed or pinned subject
whatever its edges say, so `bd ready` never withholds one on a gate's account;
show and workapi filtered nothing, cmd/bd/gated.go filtered closed only, and
list_format.go filtered closed at two more sites. A force-closed bead rendered
[CLOSED · GATED] with gated_by on show while list showed a plain row — show
and list disagreeing about one bead, which is the drift this was meant to
prevent. The clause is now types.SubjectCanBeGated, asked once in
types.GatesHolding (which replaces ActiveGates and takes the subject) and once
in the listing helper that has no hydrated deps; the formatters re-ask the SAME
exported predicate rather than inventing a fourth spelling.
SHOULD 3 — agent mode computed the gate reads and threw them away, in every
CLAUDE_CODE seat, i.e. the population that filed the bug. Decorating it is the
real fix, so gatesByIssueID now returns the gate IDS and formatAgentIssue
carries "gated by: <id>" in the parenthetical it already prints. A gate is
also a blocker, so its id appears under both "blocked by" and "gated by": the
first says what to wait on, the second says which of those nobody can clear by
doing more work. --long and --format render no gate and no longer pay for the
reads.
NOTE 5 — a pinned+gated row kept ⊘ instead of 📌; with the subject clause a
pinned bead is not gated at all, so the pin survives by construction.
NOTE 6 — the cost comments claimed "two queries" / "exactly ONE"; the id-set
readers are a few round trips each. The bound that is real (per page, never
per row) is what the comments now say.
Tests, red-first: the flipped waits-for case; TestGatesHoldingSubjectStatus and
TestSubjectCanBeGated (open/in_progress/deferred yes, closed/pinned/nil no);
TestFormatIssueCompactGated and TestFormatAgentIssueGated; and four embedded
arms — a waits-for edge that bd ready lists and no surface decorates, a
force-closed subject and a pinned subject that render nothing and publish no
gated_by, and the agent line naming its gate. Each was watched to fail against
the pre-fix predicate before it passed.
Ran: go test ./internal/types/ -run 'TestGateIsHolding|TestGatesHolding|
TestSubjectCanBeGated|TestGateDescriptionRoundTrip|TestGateRefsProjection';
go test ./cmd/bd/ -run 'TestFormat*Gated|TestFormatIssueCompact*|
TestFormatDependencyInfoWithParent|TestListRoles*|TestDisplayPrettyList*';
BEADS_TEST_EMBEDDED_DOLT=1 go test ./cmd/bd/ -run TestEmbeddedGatedRendering
(11/11 subtests); gofmt -l (empty), go vet and golangci-lint on cmd/bd,
internal/types, internal/ui, internal/workapi; scripts/ci/pr-policy.sh.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* wy-j2upyy: render GATED on the proxied `bd show` text route
SHOULD 4 of the review, and required for this rig: the constellation runs
proxied-server, where `bd show --json` already carried gated_by (uow
issue_reader -> workapi.BuildIssueDetails) while the TEXT renderer called the
plain formatters. The same bead read two ways from the same server disagreed.
proxiedRenderIssue now hoists the outgoing-edge read it already did for the
DEPENDS ON section above the header — the gates are the gate-typed subset of
that very set, so the decoration costs no extra query — and passes them to
formatIssueHeaderWithGates / formatIssueMetadataWithGates. The proxied LIST
routes were wired in the previous commit.
TestProxiedServerGatedRendering covers all five text surfaces plus the JSON
one beside them (header + Gated by line, pretty glyph, compact glyph + "gated
by", agent line, and a closed subject that renders nothing). Watched red first
with the proxied decoration stubbed out: four of six subtests failed, and the
--json arm passed, which is exactly the asymmetry the review reported.
Ran: BEADS_TEST_PROXIED_SERVER=1 go test ./cmd/bd/
-run TestProxiedServerGatedRendering -count=1 (6/6, 37.8s).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* wy-j2upyy: put cmd/bd/state.go on the shared "Reason:" marker
NOTE 7 of the review: types' gateReasonMarker was not gate-private —
cmd/bd/state.go wrote the same "\n\nReason: " into state-change EVENT
descriptions from its own literal. No live collision (events are not
gate-typed), but the constant's doc claimed GateReason returns "" for every
gate not made by `bd gate create`, and that is false for any description
carrying the marker.
The previous commit exported the constant as types.ReasonMarker, reworded
GateReason to say what the pair really guarantees (a round trip, not a
provenance check) and pinned the honest behavior in
TestGateDescriptionRoundTrip. This commit is the second writer: state.go now
builds its event description from the same constant, so the two cannot drift
apart by accident.
Ran: go build ./...; go test ./internal/types/ -run TestGateDescriptionRoundTrip
-count=1; gofmt -l cmd/bd/state.go (empty); go vet ./cmd/bd/.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* wy-j2upyy: alias types.GateRef in package backend
gated_by on IssueDetails makes GateRef reachable from the public backend
contract; TestPublicSurfaceComplete requires every such type to carry an
alias here.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* wy-j2upyy: build(bazel): register gated.go and its tests in cmd/bd and internal/types
The rebase onto e766da5ed carried the new source files but not their
BUILD.bazel entries, so every Bazel lane failed to compile internal/types
(undefined: GateRef). This is CI's own bazel-sync patch for 9ad7eb96c3,
applied unchanged.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* wy-j2upyy: compute gated_by AFTER the dependencies read in BuildIssueDetails
The be-lpi merge (#6352) moved src.Dependencies() below the cardinality
counts so the unresolvable-edge delta reads count-first. That hunk merged
cleanly, which left details.GatedBy computed on the still-nil slice, and
both CI shards' show_json…carries_gated_by subtests went red (PR Risk
Embedded Dolt Cmd 20/20, Proxied Dolt Cmd 4/15 at d21237f3dc).
Move the GatedBy line to directly after details.Dependencies = deps, still
before the BriefDeps trim that rewrites the slice, and pin the ordering with
a workapi unit test over both DetailSource seams and BriefDeps on/off (red
on the pre-fix code, green after).
Ran: go test ./internal/workapi; go vet ./internal/workapi;
BEADS_TEST_EMBEDDED_DOLT=1 go test ./cmd/bd -run TestEmbeddedGatedRendering;
BEADS_TEST_PROXIED_SERVER=1 go test ./cmd/bd -run TestProxiedServerGatedRendering.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* ci: register #6606's gated-rendering tests and gated_by wire shape with main's generated gates
Maintainer fixup for adopt-pr #6606. The adopted head merges the PR head
(c43eb567d2) into main (800d43eb8d). The PR's merge-base (02f05340f6)
predates three generated artifacts on main that every PR adding a cmd/bd
tier test or a wire member has to keep current, so the merged tree is red
on them even though the PR's own CI cannot see them:
- .github/scripts/embedded-cmd-test-shards.txt: the Bazel-only 50-shard
block must name every TestEmbedded* test exactly once, or
TestCmdEmbeddedShardManifestGeneratorNotStale fails `go test ./scripts/`.
`gen_embedded_cmd_shard_manifest.py 50 --weights=duration --write`
(incremental) placed TestEmbeddedGatedRendering on shard 16 and moved
no existing assignment; the frozen 20-shard block is untouched.
- .github/scripts/proxied-cmd-test-shards.txt: likewise for the 30-shard
block and TestProxiedServerGatedRendering (shard 2), via
`gen_proxied_shard_manifest.py 30 --weights=duration --write`, so
TestProxiedShardManifestGeneratorNotStale passes.
- internal/httpapi/wireshape/testdata/golden.json: TestWireShapeDigest
(#7182) pins every response member. `go run
./internal/httpapi/wireshape/cmd/gendigest` recorded the PR's new
IssueDetails.gated_by array and its id/type/reason members as four pure
additions (+25/-0), so no wire_revision bump is owed.
The PR's own files are unchanged.
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Gas City Adopt-PR
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* docs(gated): state gated_by one way, mark --watch as undecorated, fix stale refs
Review follow-ups for #6606. Comment and doc text only; no behavior change.
- gated_by is now documented in one direction. internal/types/types.go,
internal/types/gated.go and docs/reference/json-schema.md said the list
is nonempty EXACTLY when `bd ready` withholds the issue on a gate's
account. Only one direction holds: the is_blocked recompute also blocks
a child whose parent is blocked (its parent-child legs), so a child of a
gated parent leaves `bd ready` with an empty gated_by. All three now say
"nonempty means withheld", as the OpenAPI text already did, and name the
parent-child case.
- bd list --watch passes a nil gated map on both routes
(runListProxiedWatch, displayWatchedIssueList), so a bead the one-shot
listing marks with the gated glyph keeps its plain status glyph while
watched. Watch is out of this PR's scope; the three call sites now say
so instead of reading as a forgotten argument.
- show_format.go named types.ActiveGates, which does not exist; the
predicate is types.GatesHolding.
- gated.go's best-effort note compared the gate read with `bd list`'s
blocking annotation, which only the direct route swallows. It now scopes
that comparison to the direct route and names the proxied route's
failing read (A-blk-1).
- proxiedGatedIssueIDsOwnUOW now notes that its unit of work is a second
snapshot, so one render can name a just-resolved gate under "blocked by:"
but not "gated by:".
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Gas City Adopt-PR
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(list): hydrate proxied gate candidates from both planes (bd-p8k7dm)
The proxied list resolved gate candidates through the use case's
GetIssuesByIDs, which reads the issues table only, while the edges it
resolved came from GetForIssueIDs, which reads both dependency tables.
A wisp gate (`bd mol wisp` clones a formula's gates as wisps, held to a
wisp step by a blocks edge) therefore hydrated to nothing. Its step
listed undecorated in pretty, --flat and agent output while `bd show`,
`--json` and `bd ready` called it gated.
Read the wisps beside the issues, the two-plane idiom
ready_proxied_server.go and uowMolReader already use. A failed wisps
read keeps the durable candidates. Correct the cost-bound comment that
claimed the id-set readers partition the planes on both routes.
Tests: a wisp-step + wisp-gate case in TestProxiedServerGatedRendering
and TestEmbeddedGatedRendering asserts the pretty, --flat and
CLAUDE_CODE=1 rows of `bd list --include-ephemeral`, and
TestProxiedGatedIssueIDsHydratesBothPlanes pins both planes plus the
failed-wisps-read fallback.
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Gas City Adopt-PR
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-authored-by: Eddie the Engineer <adopt-pr@gascity.com>
285 lines
12 KiB
Go
285 lines
12 KiB
Go
package main
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"regexp"
|
|
"strconv"
|
|
"strings"
|
|
"testing"
|
|
|
|
"github.com/steveyegge/beads/internal/types"
|
|
)
|
|
|
|
// A count printed next to a noun is read as a fact about the database, not as a
|
|
// property of whatever subset happened to survive the filters. When the two
|
|
// diverge the message is worse than silence: "0 in progress" answers "is
|
|
// anything in progress?" with a confident no, and the reader has no way to tell
|
|
// that the rows which would have said otherwise were removed before counting.
|
|
//
|
|
// These tests are the general guard on that class. Every integer a summary line
|
|
// asserts must be justified by the fixture it was rendered from — so a future
|
|
// edit that introduces a new number has to declare what the number means, or
|
|
// fail here.
|
|
|
|
// footerFacts are the quantities a summary line is allowed to state, keyed by
|
|
// what they mean. assertEveryNumberIsJustified fails on any number in the line
|
|
// that is not one of these values, which is what forces a new number to be
|
|
// declared rather than smuggled in.
|
|
type footerFacts map[string]int
|
|
|
|
// assertEveryNumberIsJustified checks that each integer appearing in line is
|
|
// explained by facts. It deliberately does NOT check that every fact appears:
|
|
// omitting a count is fine (that is the fix in this very file), asserting an
|
|
// unexplained one is not.
|
|
func assertEveryNumberIsJustified(t *testing.T, line string, facts footerFacts) {
|
|
t.Helper()
|
|
allowed := map[int][]string{}
|
|
for name, v := range facts {
|
|
allowed[v] = append(allowed[v], name)
|
|
}
|
|
for _, tok := range regexp.MustCompile(`\d+`).FindAllString(line, -1) {
|
|
n, err := strconv.Atoi(tok)
|
|
if err != nil {
|
|
t.Fatalf("unparseable integer %q in summary %q", tok, line)
|
|
}
|
|
if _, ok := allowed[n]; !ok {
|
|
t.Errorf("summary asserts the number %d, which no fact about the data explains.\n summary: %q\n known facts: %v\n"+
|
|
"If this number is legitimate, add it to footerFacts so it is checked; if it is a count of something the query filtered out, it should not be asserted at all.",
|
|
n, line, facts)
|
|
}
|
|
}
|
|
}
|
|
|
|
// The scenarios below are the cross-product that matters: whether the page was
|
|
// cut by --limit, and whether --ready pinned the query to open issues.
|
|
func TestListFooterLineCountsAreJustified(t *testing.T) {
|
|
tests := []struct {
|
|
name string
|
|
total, open, inProgress int
|
|
truncated, readyFiltered bool
|
|
statusSelector string
|
|
facts footerFacts
|
|
}{
|
|
{
|
|
name: "mixed statuses, whole result set",
|
|
// A plain listing may state the breakdown: the query could have
|
|
// returned any status, so each count is a real finding.
|
|
total: 9, open: 6, inProgress: 3,
|
|
facts: footerFacts{"total": 9, "open": 6, "in_progress": 3},
|
|
},
|
|
{
|
|
name: "mixed statuses, page cut by --limit",
|
|
total: 2, open: 1, inProgress: 1, truncated: true,
|
|
facts: footerFacts{"total": 2, "open": 1, "in_progress": 1, "limit-hint": 0},
|
|
},
|
|
{
|
|
// The regression this file exists for. --ready pins the filter to
|
|
// open, so inProgress is 0 by construction for ANY database. The
|
|
// summary must not assert it.
|
|
name: "ready-filtered, whole result set",
|
|
total: 6, open: 6, inProgress: 0, readyFiltered: true,
|
|
facts: footerFacts{"total": 6},
|
|
},
|
|
{
|
|
name: "ready-filtered and truncated",
|
|
total: 5, open: 5, inProgress: 0, readyFiltered: true, truncated: true,
|
|
facts: footerFacts{"total": 5, "limit-hint": 0},
|
|
},
|
|
{
|
|
name: "empty result set",
|
|
total: 0, open: 0, inProgress: 0,
|
|
facts: footerFacts{"total": 0, "open": 0, "in_progress": 0},
|
|
},
|
|
{
|
|
// Explicit --status under --ready is a different pin. The footer
|
|
// names that selector and must not reuse the default-open sentence.
|
|
name: "ready-filtered, explicit in_progress",
|
|
total: 3, open: 0, inProgress: 3, readyFiltered: true,
|
|
statusSelector: "in_progress",
|
|
facts: footerFacts{"total": 3},
|
|
},
|
|
}
|
|
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
line := listFooterLine(tt.total, tt.open, tt.inProgress, tt.truncated, tt.readyFiltered, tt.statusSelector)
|
|
assertEveryNumberIsJustified(t, line, tt.facts)
|
|
|
|
// The headline count always describes the rows actually rendered.
|
|
if !strings.Contains(line, fmt.Sprintf("%d", tt.total)) {
|
|
t.Errorf("summary %q omits the rendered row count %d", line, tt.total)
|
|
}
|
|
})
|
|
}
|
|
}
|
|
|
|
// The specific claim: under --ready the summary must not report an in-progress
|
|
// count, because the filter guarantees it is zero regardless of the data. A
|
|
// reader cannot distinguish "none exist" from "none survived the filter".
|
|
func TestListFooterLineReadyOmitsVacuousInProgressCount(t *testing.T) {
|
|
// 40 in-progress issues match the same query; --ready removed them all.
|
|
line := listFooterLine(6, 6, 0, false, true, "")
|
|
|
|
if strings.Contains(line, "in progress)") {
|
|
t.Errorf("--ready summary asserts an in-progress count that the filter forced to zero: %q", line)
|
|
}
|
|
if !strings.Contains(line, "excludes in_progress") {
|
|
t.Errorf("--ready summary must disclose what it filtered, got: %q", line)
|
|
}
|
|
if strings.Contains(line, "0") {
|
|
t.Errorf("--ready summary states a zero the data does not support: %q", line)
|
|
}
|
|
}
|
|
|
|
// Without --ready the breakdown is a genuine finding and must survive: this is
|
|
// the half of the behaviour the fix must not regress.
|
|
func TestListFooterLineUnfilteredKeepsBreakdown(t *testing.T) {
|
|
line := listFooterLine(9, 6, 3, false, false, "")
|
|
for _, want := range []string{"Total: 9 issues", "6 open", "3 in progress"} {
|
|
if !strings.Contains(line, want) {
|
|
t.Errorf("unfiltered summary lost %q, got: %q", want, line)
|
|
}
|
|
}
|
|
}
|
|
|
|
// The footer is correct as a pure function only if every renderer actually
|
|
// tells it that --ready is in force. The display wrappers are where that can be
|
|
// lost: they take readyFiltered as a parameter, and a caller that omits it (or
|
|
// a wrapper that defaults it) silently restores the vacuous count with
|
|
// listFooterLine itself still passing every test above.
|
|
//
|
|
// These two tests pin the wrappers the --watch paths display through — the
|
|
// surface where a stale "0 in progress" is most likely to be read as a live
|
|
// fact, because it is re-rendered every two seconds under a heading that says
|
|
// the data is current.
|
|
//
|
|
// bd list --ready --watch (direct) → displayWatchedIssueList.
|
|
func TestDisplayWatchedIssueListReadyFooterDisclosesFilter(t *testing.T) {
|
|
// Open by construction: --ready pinned the query, so these are all the
|
|
// rows any database could return here.
|
|
issues := []*types.Issue{
|
|
{ID: "bd-1", Title: "A", Status: types.StatusOpen, Priority: 1, IssueType: types.TypeTask},
|
|
{ID: "bd-2", Title: "B", Status: types.StatusOpen, Priority: 2, IssueType: types.TypeTask},
|
|
}
|
|
// A nil store is the no-dependency-data arm the function already guards
|
|
// for; the footer is what is under test, and this keeps the file free of
|
|
// the cgo-tagged stub so it still compiles under CGO_ENABLED=0.
|
|
out := captureStdout(t, func() error {
|
|
displayWatchedIssueList(context.Background(), nil, issues, false, true, "", "", false)
|
|
return nil
|
|
})
|
|
|
|
if strings.Contains(out, "in progress)") {
|
|
t.Errorf("--ready --watch summary asserts an in-progress count its own filter forced to zero: %q", out)
|
|
}
|
|
if !strings.Contains(out, "excludes in_progress") {
|
|
t.Errorf("--ready --watch summary must disclose what it filtered, got: %q", out)
|
|
}
|
|
}
|
|
|
|
// bd list --ready --watch (proxied) displays through displayPrettyListWithDeps
|
|
// directly, so the parameter has to survive that wrapper too.
|
|
func TestDisplayPrettyListWithDepsReadyFooterDisclosesFilter(t *testing.T) {
|
|
issues := []*types.Issue{
|
|
{ID: "bd-1", Title: "A", Status: types.StatusOpen, Priority: 1, IssueType: types.TypeTask},
|
|
}
|
|
|
|
out := captureStdout(t, func() error {
|
|
displayPrettyListWithDeps(issues, false, nil, false, true, "")
|
|
return nil
|
|
})
|
|
if strings.Contains(out, "in progress)") {
|
|
t.Errorf("proxied --ready --watch summary asserts a filtered-out count: %q", out)
|
|
}
|
|
if !strings.Contains(out, "excludes in_progress") {
|
|
t.Errorf("proxied --ready --watch summary must disclose its filter, got: %q", out)
|
|
}
|
|
|
|
// The other half: without --ready the same wrapper must keep the breakdown,
|
|
// so the fix cannot be "never print counts".
|
|
plain := captureStdout(t, func() error {
|
|
displayPrettyListWithDeps(issues, false, nil, false, false, "")
|
|
return nil
|
|
})
|
|
if !strings.Contains(plain, "in progress)") {
|
|
t.Errorf("unfiltered listing lost its status breakdown: %q", plain)
|
|
}
|
|
}
|
|
|
|
// Truncation and readiness are independent scopes and both must be disclosed
|
|
// when both apply — neither may silently mask the other.
|
|
func TestListFooterLineTruncationDisclosedAlongsideReady(t *testing.T) {
|
|
line := listFooterLine(5, 5, 0, true, true, "")
|
|
if !strings.Contains(line, "truncated by --limit") {
|
|
t.Errorf("truncated page must say so even under --ready, got: %q", line)
|
|
}
|
|
if !strings.Contains(line, "excludes in_progress") {
|
|
t.Errorf("--ready must still disclose its filter when truncated, got: %q", line)
|
|
}
|
|
if strings.Contains(line, "Total:") {
|
|
t.Errorf("a truncated page must never be labelled Total: %q", line)
|
|
}
|
|
}
|
|
|
|
// GH#5832: an explicit --status under --ready is a different pin. The default
|
|
// "open only — --ready excludes in_progress" sentence must not be reused.
|
|
func TestListFooterLineReadyExplicitStatusNamesSelector(t *testing.T) {
|
|
line := listFooterLine(3, 0, 3, false, true, "in_progress")
|
|
if strings.Contains(line, "open only") || strings.Contains(line, "excludes in_progress") {
|
|
t.Errorf("explicit --status must not reuse the default-open sentence: %q", line)
|
|
}
|
|
if !strings.Contains(line, "in_progress only") {
|
|
t.Errorf("explicit --status footer must name the selected status, got: %q", line)
|
|
}
|
|
if strings.Contains(line, "in progress)") {
|
|
t.Errorf("--ready summary must still omit the vacuous in-progress count: %q", line)
|
|
}
|
|
}
|
|
|
|
// --pretty/--tree/--deps share displayPrettyListWithDepsMode; --watch uses
|
|
// displayWatchedIssueList. Both must thread the explicit selector so the
|
|
// default-open sentence cannot leak through a wrapper.
|
|
func TestDisplayPrettyListWithDepsReadyExplicitStatusFooter(t *testing.T) {
|
|
issues := []*types.Issue{
|
|
{ID: "bd-1", Title: "A", Status: types.StatusInProgress, Priority: 1, IssueType: types.TypeTask},
|
|
}
|
|
|
|
out := captureStdout(t, func() error {
|
|
displayPrettyListWithDeps(issues, false, nil, false, true, "in_progress")
|
|
return nil
|
|
})
|
|
if strings.Contains(out, "open only") || strings.Contains(out, "excludes in_progress") {
|
|
t.Errorf("--status in_progress --ready --pretty reused the default-open sentence: %q", out)
|
|
}
|
|
if !strings.Contains(out, "in_progress only") {
|
|
t.Errorf("--status in_progress --ready --pretty must name the selected status, got: %q", out)
|
|
}
|
|
|
|
depsOut := captureStdout(t, func() error {
|
|
displayPrettyListWithDepsMode(issues, false, nil, "scheduling", false, true, "in_progress", "", false, nil)
|
|
return nil
|
|
})
|
|
if strings.Contains(depsOut, "open only") || strings.Contains(depsOut, "excludes in_progress") {
|
|
t.Errorf("--status in_progress --ready --deps reused the default-open sentence: %q", depsOut)
|
|
}
|
|
if !strings.Contains(depsOut, "in_progress only") {
|
|
t.Errorf("--status in_progress --ready --deps must name the selected status, got: %q", depsOut)
|
|
}
|
|
}
|
|
|
|
func TestDisplayWatchedIssueListReadyExplicitStatusFooter(t *testing.T) {
|
|
issues := []*types.Issue{
|
|
{ID: "bd-1", Title: "A", Status: types.StatusInProgress, Priority: 1, IssueType: types.TypeTask},
|
|
}
|
|
out := captureStdout(t, func() error {
|
|
displayWatchedIssueList(context.Background(), nil, issues, false, true, "in_progress", "", false)
|
|
return nil
|
|
})
|
|
if strings.Contains(out, "open only") || strings.Contains(out, "excludes in_progress") {
|
|
t.Errorf("--status in_progress --ready --watch reused the default-open sentence: %q", out)
|
|
}
|
|
if !strings.Contains(out, "in_progress only") {
|
|
t.Errorf("--status in_progress --ready --watch must name the selected status, got: %q", out)
|
|
}
|
|
}
|