* fix(storage): include custom active-category statuses in bd ready (#5831) (#5918) bd ready pins WorkFilter.Status to StatusOpen. BuildReadyWorkWhere treated that pin as an exact match, so issues in a custom status with category active never appeared — even though bd statuses --help, the ready_issues view (migration 0025), and ClaimableSourceStatusesInTx all treat that category as ready-eligible. Widen the singular StatusOpen clause to the same predicate the view uses: status = ? OR status IN (SELECT name FROM custom_statuses WHERE category = 'active') Non-open singular statuses stay exact. Built-in open still matches. Custom wip/done/frozen/unspecified statuses stay out, matching claim's GH-3570 anti-steal set. Reported by Justin Clemens (@justin-candor). Addresses #5831 (cherry picked from commit66aa73bb99) * fix(cli): `bd list --wisp-type` cannot match a row — register the plane knob it needs (#6098) `bd list --wisp-type heartbeat` returns an empty listing for EVERY input, and `bd list` exposes no flag that changes that. ListRequest.WispType is a predicate, not a plane selector — its own doc says so, and RunReaderListWispTypeNarrowsTheAdmittedPlaneRatherThanAdmittingIt pins it. That contract is right and this does not touch it. The doc also names the way out: The combination that answers with rows is IncludeEphemeral (or IncludeInfra) plus this, and it is lawful rather than refused. `bd list` registers neither `--include-ephemeral` nor `--all-types`. So of the two combinations the doc names, the CLI can express only IncludeInfra — which admits the plane AND lifts the infra-type exclusions AND changes the template treatment, three decisions a caller who wanted one classification did not ask for. The narrow knob the doc names FIRST has no flag at all. That is the whole defect: the API composes correctly, and the CLI is missing the other half of the pair. ## What this does 1. Registers `--include-ephemeral` on `bd list`, wired to `ListRequest.IncludeEphemeral` — the plane knob alone, off by default, so the default listing is byte-identical. 2. Refuses `--wisp-type` when no plane is admitted, with the fix in the hint, instead of printing an empty listing. The refusal is at the CLI layer ONLY. At the API layer the combination stays lawful and still composes to an empty page: that is the pinned contract, and a programmatic caller composing filters may legitimately land on it. A human typing `--wisp-type heartbeat` cannot have meant "prove to me that durable rows carry no classification", so the CLI is where the guess is safe to make. An explicit `--type` is deliberately left alone: an infra type routes to the plane by itself, so the request may well be satisfiable, and this layer cannot tell which types those are without loading the workspace's infra vocabulary. Refusing there would reject lawful, answerable requests. ## Verification --- PASS: TestListRegistersIncludeEphemeral --- PASS: TestGatherListInput_WispTypeWithoutAPlaneIsRefused --- PASS: TestGatherListInput_WispTypeWithAPlaneIsAccepted (3 subtests) --- PASS: TestGatherListInput_IncludeEphemeralReachesTheRequest The pair discriminates rather than being trivially green: a guard that refused every `--wisp-type` would pass the refusal test and fail all three acceptance subtests, one per route that admits the plane. `ok github.com/steveyegge/beads/cmd/bd`, `ok github.com/steveyegge/beads/internal/workapi`, `go build ./...` and `go vet` clean. `internal/workapi/list.go` and the golden corpus are untouched. docs/CLI_REFERENCE.md is not regenerated here: the docs pipeline builds from the release tag in docs/cli-docs.pin (v1.2.2), not from this checkout, so the new flag appears at the next release bump. Claude-Session: https://claude.ai/code/session_01X1jMLQTSrCwtzFRS1xeUC6 (cherry picked from commitcbf84cb1c0) * fix(list): honor --status when combined with --ready (#5924) * fix(list): honor --status when combined with --ready (#5832) `bd list --status X --ready` silently dropped --status and returned the unfiltered ready set (typically open issues). BuildListFilter pinned StatusOpen whenever ReadyFlag was set, and ReadyFilterFromIssueFilter hard-coded the same pin, so a custom status or in_progress selector never reached GetReadyWork. --ready without --status still defaults to open. An explicit --status is now the ready-work status selector, matching how other list filters already compose with --ready. `--status all` remains the no-filter spelling and keeps the open default. * fix(list): status-aware --ready footer and honor-path contract docs (#5832) The query intersection from the prior commit is unchanged. Round-1 review asked the ReadyFlag/Statuses contract comments and the text footer to describe the honor path: default --ready is still open, an explicit --status is named instead of "excludes in_progress". (cherry picked from commitf5a20fb66b) * fix(doctor): ignore the generated dolt-server-config.yaml (#5978) doltserver.Start() writes .beads/dolt-server-config.yaml when the resolved dolt binary supports auto_gc_behavior.archive_level. Its own doc comment says the file "lives alongside the other gitignored server state files in beadsDir", but the hyphenated name falls outside the "dolt-server." prefix shared by the other five entries, so both GitignoreTemplate and requiredPatterns missed it. The file holds an absolute cfg_dir and a per-machine port, so committing it breaks every other clone -- the same reason the template already gives for 'redirect'. It shows up as untracked in every consumer repo whose dolt supports archive_level. This repo does not see it because its own root .gitignore has a blanket .beads/* rule. Add the pattern to requiredPatterns as well as the template: the template only helps repos initialised after this change, while requiredPatterns is what missingGitignorePatterns() iterates, so it is what lets bd doctor --fix append the rule to an existing .beads/.gitignore. Co-authored-by: Adam Spiers <ai@adamspiers.org> (cherry picked from commit671db6560d) * fix(storage): stop recommending an inert config.yaml key for a missing prefix (#5936) ReadConfigPrefix gates on the database's config table row `issue_prefix`. When that row is absent its error told the operator that, "if using config.yaml, use key 'issue-prefix', not 'issue_prefix'" — but this gate never consults config.yaml. The YAML value is read one line above the error solely to populate a debug.Logf diagnostic; it is discarded, so setting `issue-prefix` in config.yaml leaves the gate failing exactly as before. Following the advice produces a tracked config field that changes nothing and misleads the next reader. Point the message at what actually writes the row — `bd init --prefix` or `bd bootstrap`, both of which it already named — and say plainly that the check reads the database's config table so the config.yaml key does not satisfy it. No resolution behavior changes; this is the error text only. Reported-by: @ncljesus Closes #5916 (cherry picked from commit61ec85181f) * fix(create): say --file is one issue per ## heading (#5921) bd create --file/-f is a batch-import route: it creates one issue per H2 ("##") heading, and ### subsections attach fields to that issue. The old Usage was "Create multiple issues from markdown file", which never named those semantics or --body-file. Callers who wanted "one issue, description loaded from a file" reached for the shortest flag and got a silent bulk import instead -- reported by @seanmartinsmith with a 3-section briefing file (## Problem / ## Context / ## Acceptance Criteria) that became 3 issues instead of one. gatherCreateInput already rejects a positional title combined with --file. That is the reporter's literal repro, so this keeps the rejection and adds a --body-file hint on the error they actually see. The remaining trap -- --file used alone on a section-headed file -- is unchanged, because bd cannot tell that apart from a genuine batch file by content. Tests: parseMarkdownFile reproduces the trap file; gatherCreateInput locks in the title+--file rejection and --body-file hint; flag Usage names the per-heading behavior. The existing TestCreateFromMarkdownFile binary path already covers well-formed --file creates. (cherry picked from commit67b066b58e) * fix(list): stop truncation hint padding a blank TTY line (#5927) printTruncationHint fed surrounding newlines through ui.RenderWarn. lipgloss treats that as a block, pads the blank lines to the widest-line width (alignTextHorizontal shortAmount = widestLine - lineWidth), and drops the trailing newline (GH#5685). The next shell prompt then prints on the same line as a run of spaces. Keep the newlines outside RenderWarn so the hint is one colored line with a real trailing newline. Tests construct an explicitly styled lipgloss Style so the padded blank-line shape fails if the helper is reverted. Fixes #5685. (cherry picked from commit766c0bd15a) * fix(setup/claude): keep settings.json's trailing newline and skip no-op rewrites (#5944) * fix(setup/claude): keep settings.json's trailing newline and skip no-op rewrites (#5693) bd setup claude (and bd init, which calls it) marshalled the Claude settings map with json.MarshalIndent and wrote it unconditionally. MarshalIndent emits no trailing newline, so every run stripped the one Claude Code's own writes leave behind, and re-wrote the file even when no hook changed. Because bd init git-adds .claude/settings.json, that surfaced as a staged diff with no semantic content. The same marshal-then-write pattern appears at four call sites in claude.go: installClaude's settings write and its settings.local.json migration, and removeClaude's settings write and its settings.local.json cleanup. Fixing one would have left the bug live in the other three, so both halves are now shared helpers -- marshalSettings appends the newline, writeSettingsIfChanged compares against the bytes already on disk and returns early when they match -- and all four sites go through them. Reported by @maphew. * chore(setup/claude): use the repo spelling "marshaled" in the new comments The misspell linter flags British "marshalled"; CI pins golangci-lint v2.10.1 and runs it with --new-from-merge-base, so both new comment lines are in scope. Comment text only, no behaviour change. (cherry picked from commitcad7e17d70) * fix(gate): evaluate cross-rig bead gates via prefix routes (#5859) * fix(gate): route cross-rig bead checks (#5857) Evaluate historical rig:bead gate targets through the current read-only prefix routing seam in direct and proxied-server modes. Preserve local bead gates, reject malformed cross-rig values, and cover the real two-store route with a Dolt integration test. Agent-Signature: codex-unknown-model-unknown-reasoning on behalf of Klas Hesselman * fix(gate): address cross-rig review feedback (#5857) Preserve the original local not-found error when prefix routing is unavailable, document the user-visible behavior, and lock the proxied error contract with a regression test. Agent-Signature: codex-unknown-model-unknown-reasoning on behalf of Klas Hesselman (cherry picked from commitcbfc505e39) * fix(storage/uow): retry transient ping failures during openDB bootstrap (#6003) * test(uow): red — pingWithRetry does not exist yet for openDB's boot-time ping Adds TestPingWithRetryRecoversFromATransientBadConn (be-x49l6): a fake pinger exercising three cases — transient error retries then recovers, non-transient error fails without retrying, and an already-cancelled context fails promptly. Fails to compile until pingWithRetry/pinger are added to dolt_sql_provider.go. * feat: green — Fix: unretried ping in uow openDB turns a transient Dolt connection drop into a hard CI failure (refs be-x49l6) * refactor: drop what-comment on pingWithRetry (self-review, refs be-x49l6) Self-review flagged it as restating the function's own signature/behavior rather than explaining a non-obvious why; the pinger and isTransientPingError comments stay since they carry rationale the code doesn't otherwise convey. * test(uow): red — a hung boot ping is not bounded per attempt Adds the two behaviours review #6003 asked for, both failing: - a_hung_ping_is_capped_per_attempt_and_retried: blockingPinger stalls until its context is cancelled. backoff.Retry bounds only the gap between attempts, so with the caller's context handed straight to PingContext the call never returns at all. The subtest runs the call off-goroutine so this reports as "never returned" instead of a package timeout. - connection-level_net_error_retries_then_recovers: a *net.OpError (connection refused / reset / broken pipe) is currently classified non-transient and fails the boot ping outright. the_caller's_own_deadline_fails_without_retrying passes already and is kept as the regression guard for the trap #6000 fell into: making context.DeadlineExceeded retryable must not make the caller's own expiry retryable too. pingWithRetry takes attemptTimeout here but does not honour it yet, so the red is behavioural rather than a compile error. Refs be-g1i7n. * fix(uow): bound each boot ping attempt and widen the transient classifier Review #6003, point 1. backoff.Retry bounds the gap between attempts but cannot interrupt one in flight, and the DSN sets a dial Timeout (5s) with no ReadTimeout — so a server that accepts TCP and then stalls mid-handshake blocked for the caller's entire context, which is the exact scenario the PR summary claims to fix. Each attempt now runs under its own context.WithTimeout (pingAttemptTimeout, 10s — above the 5s dial timeout so a real dial timeout still surfaces as itself), and context.DeadlineExceeded is classified transient so the retry loop actually continues. pingWithRetry checks the caller's context *before* classifying. That is what keeps the retryable DeadlineExceeded from swallowing the caller's own expiry — the inverse of the regression #6000 introduced by capping each attempt and then treating the resulting DeadlineExceeded as permanent. Covered from both sides: a_hung_ping_is_capped_per_attempt_and_retried and the_caller's_own_deadline_fails_without_retrying. Review #6003, point 2. isTransientPingError stays separate from internal/storage/dolt's isRetryableError, and now says why in full: that one is a query-time classifier matching on error text, admitting migration-lock, read-only and MySQL-1105 shapes a boot ping cannot be in because nothing has executed on the connection yet. The coverage gap the review named is closed on this side instead — *net.OpError is transient, which is refused/reset/broken-pipe portably and by type rather than by substring, with permanent DNS failures excluded so an unresolvable host still fails fast instead of spending the whole budget. Refs be-g1i7n. (cherry picked from commitc0d8da42de) * fix(deps): bump dolt/go past upstream manifest-missing-chunk defense (#4070) (#5931) * fix(deps): bump dolt/go past upstream manifest-missing-chunk defense (#4070) Pin github.com/dolthub/dolt/go to 796d074977417da931df65202a79e0a7f532a3db. That hop includes: - 23ccbf9442275166f168939277a5b4a348a63c9d — reject a file manifest update that references a missing table file (the defense itself) - 796d074977417da931df65202a79e0a7f532a3db — doc/test follow-up to the defense commit (no production-semantics change) A non-atomic backup sync can leave the backup manifest ahead of chunk files; subsequent syncs then fail with "table file not found" and stay broken. The upstream defense turns that silent corruption into a loud failed sync. Beads' previous pin (a6690826d767, 2026-07-15) predates both commits. Minimal-churn pin: do not bump to today's dolt tip. go mod tidy did not force a later version. This is a mitigation, not a root-cause fix: backup file+manifest publish remains non-atomic, and backups already in the manifest-ahead state are not repaired by this change. Mitigates #4070 * fix(nix): update vendorHash for the dolt/go bump The go.mod/go.sum bump in this PR invalidates the pinned vendorHash, so `nix build .#default` fails with a fixed-output hash mismatch. Update it to the value CI computed: specified: sha256-D+KDoLFJHpt9D9rCrtE3NMfL4fgK7UxpdKlCxp5yz5Y= got: sha256-wDU1tw/4t2CetwQl4+zUhlDI70dSasLLI2Gy66ZyhQQ= The repo documents this coupling in .github/dependabot.yml; the existing "Update vendorHash for dependabot Go bumps" workflow only fires for dependabot PRs, so a manual bump is needed here. (cherry picked from commit851aa2f20a) * docs(changelog): record the 1.3.1 cherry-pick behaviour deltas Documents all eleven picks under the existing `## [1.3.1]` heading. The six behaviour deltas go under Changed, including the two that are not pure wins and that a user is most likely to hit without knowing why: - bd doctor now warns on every pre-existing workspace until --fix appends the new .beads/dolt-server-config.yaml gitignore rule. - opening a store against a dead server takes up to ~30s to fail instead of failing instantly, because the boot ping is retried. Also called out as non-obvious: the ready set grows where custom active-category statuses exist, bare --wisp-type becomes a refusal rather than an empty success, and the Dolt bump converts a quietly corrupting backup sync into a loud failing one without repairing backups already in that state. The dated `## [1.3.0]` section is shipped and is left byte-identical: the diff is 165 insertions and 0 deletions, and the [1.3.0]-to-EOF region still hashes to 798a2ee0b0f0b7a3f0fc017ae01c919807740348a34f5ea8719b82a008533d00. The `## [1.3.1]` date is left for a later release prep to restamp. * fix(nix): recompute vendorHash for the release-branch dependency set The #5931 cherry-pick (510675948) bumps four dolt module pins, which invalidates the pinned vendorHash. Neither side's value was usable: the release branch already carried its own dependency bump (d594092eb), so this pick lands on a vendor set that has existed on neither release/1.3.0 nor main, and #5931's own hash was computed against main's graph. Taken from the `got:` value the nix-build lane reported for this branch: specified: sha256-wDU1tw/4t2CetwQl4+zUhlDI70dSasLLI2Gy66ZyhQQ= got: sha256-DQdauEx5g48Xbxrz4wGLx4vkrQoYQX3FUx+7N/Y6YV4= go mod tidy after the pick was a no-op, and the dependency delta against the release tip is exactly the four intended pins, so this hash covers that change and nothing else. * docs(changelog): scope the #6003 open-latency entry and correct its bound The 1.3.1 entry for the openDB bootstrap-ping retry said "up to ~30s" and named no topology. Both were misleading: - 30s is the retry BUDGET, not the wall-clock bound. backoff stops scheduling new attempts at 30s (MaxElapsedTime, dolt_sql_provider.go) but cannot cancel one in flight, and pingAttemptTimeout caps an attempt at 10s — so a single open can take ~40s. openAndInitSchema pings twice, each with a fresh budget, so the narrow case where the backend satisfies the first ping and the schema init and is then unreachable for the second reaches ~80s. - Only unit-of-work provider construction takes that ping, which is a minority of topologies: proxied-server (local and external) on every command, plus `bd serve` in server/external-server/shared-server workspaces, which funnels through newSQLServerUOWProvider. Embedded never reaches it (bd serve refuses embedded outright), and an ordinary CLI command in a server or shared-server workspace opens a DoltStore that takes no such ping. An embedded reader of the old entry would have triaged a slowdown that cannot affect them. CHANGELOG only; the dated [1.3.0] section is unchanged (verified byte-identical, sha256 798a2ee0…, 9169 lines). --------- Co-authored-by: Vishnu J <vishnuj81093@gmail.com> Co-authored-by: Karel Bourgois <karel@voxist.com> Co-authored-by: Adam Spiers <github@adamspiers.org> Co-authored-by: Adam Spiers <ai@adamspiers.org> Co-authored-by: swedeinasia-flow <klas@flownetworks.io> Co-authored-by: Jim Wordelman <jim@wordelman.name>
133 lines
7.3 KiB
Go
133 lines
7.3 KiB
Go
package issueops
|
|
|
|
import (
|
|
"fmt"
|
|
"strings"
|
|
)
|
|
|
|
// readyScopeField is one ListRequest field the ReadyFlag arm cannot carry,
|
|
// paired with the `bd list` flag that sets it. Naming both is the point of the
|
|
// refusal: a library caller looks for the struct field and a CLI caller for
|
|
// the flag, and neither should have to map one onto the other to learn which
|
|
// part of their request could not be honored.
|
|
type readyScopeField struct {
|
|
name string
|
|
flag string
|
|
set func(ListRequest) bool
|
|
}
|
|
|
|
// readyScopeFields is the drop set: every field a list request can set that
|
|
// does not survive the trip to the blocker-aware ready query.
|
|
//
|
|
// It was read off the two functions between this request and that query —
|
|
// internal/workapi.BuildListFilter, which turns the request into a storage
|
|
// filter, and internal/workapi.ReadyFilterFromIssueFilter, which projects that
|
|
// filter onto the narrower ready-work filter — and it is exactly the
|
|
// intersection: fields the builder copies onto the filter and the projection
|
|
// then discards.
|
|
//
|
|
// Four groups are deliberately ABSENT, because listing them here would refuse
|
|
// requests that are answered correctly today:
|
|
//
|
|
// - What the projection carries: Status/Statuses (GH#5832), IssueType, all five label forms, Assignee,
|
|
// NoAssignee, the exact Priority, ParentID, MolType, WispType,
|
|
// MetadataFields, HasMetadataKey, ExcludeTypes (and with it IncludeGates
|
|
// and IncludeInfra's type suppression), IncludeEphemeral (and with it
|
|
// IncludeInfra's plane half, which the ready query admits through its own
|
|
// ephemeral gate), Limit, Offset, and the MaxRows cap with its
|
|
// attribution.
|
|
//
|
|
// - THE HYDRATION KNOBS, SkipLabels and SkipCounts. They are the one group
|
|
// the "exactly the intersection" rule above would otherwise sweep in: the
|
|
// builder does copy them onto the filter and the projection does discard
|
|
// them. They stay out because they select what is HYDRATED rather than
|
|
// which rows match, so a ReadyFlag request that sets one is answered with
|
|
// the rows it asked for and merely pays for a column it did not want.
|
|
// Refusing that would be refusing a correct answer over its cost, and the
|
|
// promise is already stated where a caller reads it (ListRequest.ReadyFlag).
|
|
//
|
|
// - AllFlag, and `--status all`. The builder resolves both to "open" under
|
|
// ReadyFlag before the projection ever runs (`all` is the no-filter
|
|
// spelling). An explicit --status is carried: BuildListFilter writes it
|
|
// onto IssueFilter and ReadyFilterFromIssueFilter copies Status/Statuses
|
|
// onto the ready-work filter, so `bd list --status X --ready` is the
|
|
// intersection rather than the unfiltered ready set (GH#5832). Status is
|
|
// therefore ABSENT from this drop set because it is honored, not because
|
|
// it is overridden. The default-open pin is the golden
|
|
// `ready_flag` case; the honor path is `ready_flag_honors_status`.
|
|
//
|
|
// - NoPinnedFlag. Pinned is dropped by the projection, but the ready-work
|
|
// WHERE clause excludes pinned rows unconditionally
|
|
// (internal/storage/sqlbuild/ready.go), so a caller who asks for the
|
|
// pinned rows to be left out gets exactly that. The opposite request,
|
|
// PinnedFlag, asks for pinned rows only and would be answered with a set
|
|
// that can never contain one — it is in the list below.
|
|
var readyScopeFields = []readyScopeField{
|
|
{"IDFilter", "--id", func(r ListRequest) bool { return r.IDFilter != "" }},
|
|
{"TitleSearch", "--title", func(r ListRequest) bool { return r.TitleSearch != "" }},
|
|
{"SpecPrefix", "--spec", func(r ListRequest) bool { return r.SpecPrefix != "" }},
|
|
|
|
{"TitleContains", "--title-contains", func(r ListRequest) bool { return r.TitleContains != "" }},
|
|
{"DescContains", "--desc-contains", func(r ListRequest) bool { return r.DescContains != "" }},
|
|
{"NotesContains", "--notes-contains", func(r ListRequest) bool { return r.NotesContains != "" }},
|
|
{"ExternalContains", "--external-contains", func(r ListRequest) bool { return r.ExternalContains != "" }},
|
|
{"ExternalRef", "--external-ref", func(r ListRequest) bool { return r.ExternalRef != "" }},
|
|
|
|
{"CreatedAfter", "--created-after", func(r ListRequest) bool { return r.CreatedAfter != nil }},
|
|
{"CreatedBefore", "--created-before", func(r ListRequest) bool { return r.CreatedBefore != nil }},
|
|
{"UpdatedAfter", "--updated-after", func(r ListRequest) bool { return r.UpdatedAfter != nil }},
|
|
{"UpdatedBefore", "--updated-before", func(r ListRequest) bool { return r.UpdatedBefore != nil }},
|
|
{"ClosedAfter", "--closed-after", func(r ListRequest) bool { return r.ClosedAfter != nil }},
|
|
{"ClosedBefore", "--closed-before", func(r ListRequest) bool { return r.ClosedBefore != nil }},
|
|
{"DeferAfter", "--defer-after", func(r ListRequest) bool { return r.DeferAfter != nil }},
|
|
{"DeferBefore", "--defer-before", func(r ListRequest) bool { return r.DeferBefore != nil }},
|
|
{"DueAfter", "--due-after", func(r ListRequest) bool { return r.DueAfter != nil }},
|
|
{"DueBefore", "--due-before", func(r ListRequest) bool { return r.DueBefore != nil }},
|
|
|
|
{"DeferredFlag", "--deferred", func(r ListRequest) bool { return r.DeferredFlag }},
|
|
{"OverdueFlag", "--overdue", func(r ListRequest) bool { return r.OverdueFlag }},
|
|
{"EmptyDesc", "--empty-description", func(r ListRequest) bool { return r.EmptyDesc }},
|
|
{"NoLabels", "--no-labels", func(r ListRequest) bool { return r.NoLabels }},
|
|
{"NoParent", "--no-parent", func(r ListRequest) bool { return r.NoParent }},
|
|
{"PinnedFlag", "--pinned", func(r ListRequest) bool { return r.PinnedFlag }},
|
|
|
|
{"PriorityMin", "--priority-min", func(r ListRequest) bool { return r.PriorityMin != nil }},
|
|
{"PriorityMax", "--priority-max", func(r ListRequest) bool { return r.PriorityMax != nil }},
|
|
|
|
// The keyset position is a tuple and only the timestamp half decides
|
|
// whether one was supplied; neither AfterID nor AfterPriority alone is a
|
|
// position. All three are named in the refusal because a caller who dropped
|
|
// only the ones named would still be sending part of a position.
|
|
{"AfterCreatedAt/AfterID/AfterPriority", "cursor", func(r ListRequest) bool { return r.AfterCreatedAt != nil }},
|
|
}
|
|
|
|
// ValidateReadyFlagScope refuses a list request that combines ReadyFlag with a
|
|
// filter the blocker-aware ready query cannot carry, naming every field it
|
|
// could not honor. A generic refusal would leave the caller to bisect their
|
|
// own request.
|
|
//
|
|
// This is the enforcement half of ListRequest.ReadyFlag's promise; the other
|
|
// half is the doc comment there. It lives beside that promise rather than in
|
|
// any implementation, and it is called from the single builder every
|
|
// implementation of Reader runs (internal/workapi.BuildListFilter), so no
|
|
// backend can be missing it — a per-backend copy is the drift this role exists
|
|
// to remove.
|
|
//
|
|
// A request without ReadyFlag is never refused here: every field below is
|
|
// honored by the ordinary listing.
|
|
func ValidateReadyFlagScope(req ListRequest) error {
|
|
if !req.ReadyFlag {
|
|
return nil
|
|
}
|
|
var named []string
|
|
for _, f := range readyScopeFields {
|
|
if f.set(req) {
|
|
named = append(named, f.name+" ("+f.flag+")")
|
|
}
|
|
}
|
|
if len(named) == 0 {
|
|
return nil
|
|
}
|
|
return fmt.Errorf("%w: --ready cannot filter on %s; the blocker-aware ready query carries only part of the list vocabulary, so answering would return every ready issue rather than the ones asked for — drop --ready, or drop what it cannot carry",
|
|
ErrValidation, strings.Join(named, ", "))
|
|
}
|