* feat(list): bd list's remaining filters over http behind issues.list.filters Over http every `bd list` filter beyond the created bounds and the title, id and no-assignee scope refused (time bounds, priority range, text and external-ref matches, spec, label pattern/regex, exclude-type, no-parent, no-labels, empty-description, pinned/no-pinned, deferred, overdue, mol/wisp type). The library entry already applied all of them: issueops.Reader.List via workapi.BuildListFilter, shared by the CLI and the handler. This adds only the wire. - Server: GET /v0/beads/issues decodes 29 new optional parameters (listFilterParams, decode only; countIssues' names where it already spells the filter) into the existing ListRequest, behind one new behavior token, issues.list.filters. mol_type/wisp_type are closed enums refused by name (an empty value too). wire_revision stays 2; apigen and the wireshape golden are regenerated (additive only). - Every RFC 3339 bound the listing and count decode is normalized to UTC, so an offset-bearing bound selects what its Z twin does on a zone-less timestamp column. - workapi.BuildListFilter refuses PinnedFlag with NoPinnedFlag (ErrValidation, the CLI's own sentence) instead of letting PinnedFlag win; over http that is a 400 on no_pinned. - Client: the encoder sends the members (encode.ListFiltersMembers, one list read by the encoder, the pre-dial gate and a spec-parity test). Against a server not advertising the token, httpReader.List refuses before dialing with ErrUnsupported naming issues.list.filters. The 29 E-ListRequest ledger refusal rows retire; the ledger doc is updated; skew flag mappings added. - Tests: handler decode/parity/enum/UTC/malformed/pinned-pair tests; encode member/gate/spec parity and bound encoding; per-member ride-behind-token and pre-dial skew refusal; two new Reader contract cases on every leg (dolt, embedded, uow, served): the eight time bounds at exact boundaries (strict, whole-second truncation, NULL never matches, +02:00 equals UTC) and one in/out row per remaining family; three served Reader cases unparked; TestE2E_ListFilterParityOverHTTP (served == embedded, masked server refuses naming the token, no dial); five corpus shapes marked pending until the reference server profile advertises the token. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * feat(list): exclude_status on listIssues, the 30th issues.list.filters member issueops.ListRequest gains ExcludeStatus: statuses to leave out of a listing, appended to the default exclusions (never re-admitting what they hide), comma-separated or repeated, and validated against the workspace's statuses by the same rule CountRequest.ExcludeStatus uses (an unknown name is ErrValidation). The rule moves into one shared function, workapi.ParseExcludeStatus, called by both builders. With AllFlag it reads the active set without enumerating every status, so an http-backed caller can list O(active) rows instead of the whole history. - Server: listIssues decodes a repeatable `exclude_status` under the same issues.list.filters token (no new token); an unknown name is a 400 on exclude_status. apigen and the wireshape golden are regenerated (additive). - Client: the encoder sends it and it joins encode.ListFiltersMembers, so the pre-dial gate asks for the token. - It is refused together with ReadyFlag, like the other members the ready query cannot carry. - No `bd list --exclude-status` flag yet (it would need the CLI docs regenerated); the member is reachable through the library and the wire. Tests: builder unit test (append, AllFlag, comma split, unknown name); handler decode and 400; encoder, round-trip and gate; Reader contract cases on every leg (active set under AllFlag, repeated and comma values, adds to the defaults, narrows an explicit Status, unknown name refused). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * fix(list): label_regex compile errors are 400s; review polish for list filters - An invalid `label_regex` on GET /v0/beads/issues, /v0/beads/ready and /v0/beads/ready:count is now `400 invalid_argument` (`invalid_value` on `label_regex`) instead of `500 internal`. The database still compiles the pattern in its own dialect; a request that sent a regex and earned the engine's "regular expression is invalid" refusal is attributed to the parameter (failRegexReadErr). The same text on a request with no regex stays a server fault. - mol_type and wisp_type refuse each other's vocabulary (tests pin `mol_type=heartbeat` and `wisp_type=swarm`), so the call-site allowlist, not just the spec enum, is covered. - exclude_status with a workspace custom status: leg tests on the embedded store and over the served wire (accepted and applied; a name in no vocabulary refused). ReaderFixture cannot configure custom statuses, so these sit beside the count's twin rather than in the contract. - The search e2e gains a positive arm: --desc-contains returns exactly the row whose description carries the token. - Docs: `all` plus `exclude_status` keeps every status not named (pinned, hooked and custom done/frozen included unless named), not "the active set"; label_regex documents its 400. A corpus source line is made neutral; a test message says 30. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * fix(list): compose issues.list.filters with the --title-contains fold #7631, now on main, folds `bd list --title-contains` onto listIssues `title` and refuses the TitleContains left over from a --title and --title-contains pair that differs, because the listing then had one title parameter. This branch publishes `title_contains` behind issues.list.filters, so that leftover now rides it beside `title` and the server applies both. Neither half is dropped, and against a server without the token the pre-dial gate refuses, naming issues.list.filters. - encode.FoldTitleContains still runs first; its doc now says where a differing pair goes. - Tests: the fold table expects `title` plus `title_contains` for a differing pair, including the ſ/s pair strings.EqualFold would match; the differing-pair refusal names issues.list.filters; the list_filters_test sweep pairs its TitleContains probe with a differing TitleSearch, since a lone one asks only for issues.list.title; the e2e differing-pair refusal becomes a listFilterShapes row that answers exactly child-a over http and embedded, and refuses before dialing without the token. - The gc-polecat-closed-after corpus shape's pending reason also names issues.list.title. The CHANGELOG --title-contains entry no longer lists the differing pair and --closed-after as refused. Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Julian Knutsen Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * build(bazel): auto-sync BUILD files Applied from the bazel-sync-patch artifact of https://github.com/gastownhall/beads/actions/runs/39013611268 (`make bazel-sync`: gazelle, tools/bazel/go_srcs.py, bazel mod tidy). Only BUILD.bazel, MODULE.bazel and MODULE.bazel.lock are ever pushed; see scripts/bazel-autofix-push.sh. * fix(list): serve --priority-max in search parity, refuse the parent pair The proxied tier's search parity table still expected a remote `bd search --priority-max 1` to refuse, because listIssues could not carry it. This branch serves priority_max behind issues.list.filters, so the remote route answered and the dolt-race shard went red in TestProxiedServerSearchRoutesAgree. The row now expects the answer on every route. It was the last wireCan=false row; the branch stays, with a comment, for the next flag listIssues cannot carry. - ParentID with NoParent: a served listing now carries no_parent beside parent, and ANDing the two answered only the edge-less rows under the parent's dotted id. BuildListFilter refuses the pair with ErrValidation, in the sentence bd list and BuildCountFilter already use, so issueops.Reader.List refuses it on every backend and the listing answers 400 on no_parent. Pinned by a builder test, a reader conformance case (dolt, embedded, uow, served http) and two httpapi tests. - POST /v0/beads/issues:claimNext shares the ready listing's label_regex but answered a pattern the database cannot compile with 500. It now gives the listing's 400 invalid_value on label_regex, through the helper the listing's mapping is split into. - The descendant walk's ledger rows said listIssues publishes no parameter for members it now serves behind issues.list.filters. They now say the walk does not send them yet, and that --flat or --json asks listIssues directly. The ExcludeStatus, Pinned and ExcludeTypes rows, the parentwalk.go header, the walk table's doc and two walk test comments are corrected the same way, and the ledger doc is regenerated. parentWalkRefusals notes that a member moved off the list must check issues.list.filters itself, because the walk dials past the listing's pre-dial gate. - Spec: the listing's no_parent documents the pair's 400, the count's exclude_status no longer says it has no listing counterpart, and claimNext's label_regex documents its 400. types.gen.go is regenerated. Comment-only: countFilters, and readyScopeFields' ExcludeStatus entry. - CHANGELOG and README say the default `bd list --parent` tree view does not carry the new filters yet; the label_regex entry names claimNext, and a Changed entry records the parent-pair refusal. Second review pass: docs and comments only, no behavior change. - The prose copies of the issues.list.filters member set now match ListFiltersMembers: CapIssuesListFilters and wire.CapListFilters name the status exclusion, and the spec's capabilities text names label-regex. - Every time bound on the listing and the count goes through q.timestamp, which normalizes it to UTC, and sqlbuild compares it strictly at whole-second precision. listIssues' created_before and created_after, and countIssues' created, updated and closed bounds, now say so in the words the new listing bounds use. The count's updated bounds also say what they filter, and its closed bounds say that a NULL closed_at never matches. types.gen.go is regenerated. - README and CHANGELOG: `--flat` or `--json` applies the filters to the parent's direct children, not its whole subtree. - The 29 listRefusal rows this branch serves stay deleted rather than kept as retired rows, as #7550 deleted its TitleSearch, IDFilter and NoAssignee rows when it served them. The CHANGELOG now says the rows are removed, not retired. Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Julian Knutsen Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Co-authored-by: Eddie the Engineer <338826946+gascity-eddie[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
446 lines
23 KiB
Go
446 lines
23 KiB
Go
//go:build cgo
|
|
|
|
// Contributed by gascity from bd-enterprise (internal/enterprise/httpstore/served_reader_test.go@49d1df2f6)
|
|
// to OSS beads under the MIT license.
|
|
|
|
package httpclient
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/steveyegge/beads/backend/conformance"
|
|
"github.com/steveyegge/beads/internal/types"
|
|
"github.com/steveyegge/beads/issueops"
|
|
)
|
|
|
|
// The Reader contract, run through client → in-process bd serve → reference
|
|
// store (design D8 row 1).
|
|
//
|
|
// WHAT THIS WIRING PROVES that no unit test can: the request this client
|
|
// encoded is the request the SERVER's decoder rebuilt, the role behind it is
|
|
// the same shared body a local `bd list` runs, and the page that comes back
|
|
// survives the JSON round trip. The seed handles are the reference store's, so
|
|
// a filter this client dropped answers with rows no case seeded.
|
|
//
|
|
// WHAT IS PARKED: `ListRequest.IDFilter` is the scoping tool almost every List
|
|
// case reaches for, and until S15b listIssues published no id parameter, so
|
|
// those cases parked on E-ListRequest.IDFilter. It now rides `id` behind
|
|
// issues.list.ids, which this in-process server serves, and they run as
|
|
// written. What still parks is a case whose SUBJECT (or one arm) is a member
|
|
// the wire refuses — Offset, ReadyFlag, SkipCounts — and each names that
|
|
// member's row. PinnedFlag, ExcludeTypes and WispType retired from this list
|
|
// with issues.list.filters, which this in-process server also serves. The refusals THEMSELVES are
|
|
// asserted in TestServedReaderRefusesTheFiltersTheWireCannotCarry, so the
|
|
// parking never stands in for an unpinned behaviour.
|
|
|
|
// readParkBead is the bead every READ-side park cites, and it is a different
|
|
// constant from the write side's parkBead because it is a different decision
|
|
// with a different retirement.
|
|
//
|
|
// The write parks retire when the wire grows the members it deliberately
|
|
// withholds, or never. These retire one member at a time as the wire grows a
|
|
// parameter for it; the id scope that held most of them retired with S15b.
|
|
const readParkBead = "ga-pcwtq"
|
|
|
|
func servedReaderFixture(t *testing.T, name string) conformance.ReaderFixture {
|
|
t.Helper()
|
|
c := composition(t)
|
|
f := c.fixture(t)
|
|
reader := bindRole(t, f, func(s *Store) (issueops.Reader, error) { return s.IssueReader() })
|
|
return conformance.ReaderFixture{
|
|
IssuePrefix: servedIssuePrefix + "-" + name,
|
|
Reader: reader,
|
|
CreateIssue: c.seedIssue,
|
|
CreateWisp: c.seedIssue,
|
|
AddDependency: c.seedDependency,
|
|
AddComment: c.seedComment,
|
|
PromoteWisp: c.seedPromotion,
|
|
}
|
|
}
|
|
|
|
func TestServedReaderReadyDefaultTypeExclusionsYieldToAnExplicitType(t *testing.T) {
|
|
conformance.RunReaderReadyDefaultTypeExclusionsYieldToAnExplicitType(t, t.Context(), servedReaderFixture(t, "rdr"))
|
|
}
|
|
|
|
func TestServedReaderReadyDeferredAndEphemeralGates(t *testing.T) {
|
|
conformance.RunReaderReadyDeferredAndEphemeralGates(t, t.Context(), servedReaderFixture(t, "rdr"))
|
|
}
|
|
|
|
func TestServedReaderReadyLimitBoundary(t *testing.T) {
|
|
conformance.RunReaderReadyLimitBoundary(t, t.Context(), servedReaderFixture(t, "rdr"))
|
|
}
|
|
|
|
func TestServedReaderReadySortPoliciesOrderTheSameRows(t *testing.T) {
|
|
conformance.RunReaderReadySortPoliciesOrderTheSameRows(t, t.Context(), servedReaderFixture(t, "rdr"))
|
|
}
|
|
|
|
// The FOUR READY cases that scope themselves with a LABEL rather than an id
|
|
// set, which is the whole reason they run here while their List siblings park:
|
|
// `labels` is a published parameter on listReadyWork and `id` is a published
|
|
// parameter on nothing.
|
|
//
|
|
// What they add over the ready cases above is the PAGE as a promise about an
|
|
// unbounded answer — every bound is asserted to be a prefix of the limitless
|
|
// read, cardinalities included — and that is a stronger claim over this wire
|
|
// than locally. A page and its unbounded reference are two round trips through
|
|
// two encodings here, so a limit this client applied on the wrong side, or a
|
|
// hydration batch the server sized differently from its page, shows up as a
|
|
// prefix that is not one.
|
|
|
|
func TestServedReaderReadyPageIsThePrefixOfTheUnboundedAnswerCountsIncluded(t *testing.T) {
|
|
conformance.RunReaderReadyPageIsThePrefixOfTheUnboundedAnswerCountsIncluded(t, t.Context(), servedReaderFixture(t, "rdr"))
|
|
}
|
|
|
|
// TestServedReaderReadyPageWiderThanTheHydrationBatchIsStillThatPrefix drives
|
|
// a page wider than sqlbuild.QueryBatchSize, so the server's own hydration
|
|
// batching straddles the answer. The two rows it reads the cardinalities of are
|
|
// the last of the first batch and the first of the second.
|
|
func TestServedReaderReadyPageWiderThanTheHydrationBatchIsStillThatPrefix(t *testing.T) {
|
|
conformance.RunReaderReadyPageWiderThanTheHydrationBatchIsStillThatPrefix(t, t.Context(), servedReaderFixture(t, "rdr"))
|
|
}
|
|
|
|
// TestServedReaderReadyEphemeralPageKeepsBothPlanesCountsAtItsBoundary is the
|
|
// merged-plane half: alternating durable and ephemeral rows, every Limit from
|
|
// inside the first run to past the end, and the cuts that land between a wisp
|
|
// and the durable row after it.
|
|
func TestServedReaderReadyEphemeralPageKeepsBothPlanesCountsAtItsBoundary(t *testing.T) {
|
|
conformance.RunReaderReadyEphemeralPageKeepsBothPlanesCountsAtItsBoundary(t, t.Context(), servedReaderFixture(t, "rdr"))
|
|
}
|
|
|
|
func TestServedReaderReadyParentScopesToItsTransitiveDescendants(t *testing.T) {
|
|
conformance.RunReaderReadyParentScopesToItsTransitiveDescendants(t, t.Context(), servedReaderFixture(t, "rdr"))
|
|
}
|
|
|
|
// TestServedReaderListParentReachesEveryDescendantAndOnlyItsOwn is the LIST
|
|
// case that needs no id scope at all — `parent` is its scope, and listIssues
|
|
// publishes it — so it is the one member of the List family here that runs
|
|
// without a park beside it.
|
|
func TestServedReaderListParentReachesEveryDescendantAndOnlyItsOwn(t *testing.T) {
|
|
conformance.RunReaderListParentReachesEveryDescendantAndOnlyItsOwn(t, t.Context(), servedReaderFixture(t, "rdr"))
|
|
}
|
|
|
|
func TestServedReaderReadySetOwnsItsStatusPinnedAndTemplateDecisions(t *testing.T) {
|
|
skipKnownDivergence(t, "E-ListRequest.ReadyFlag", readParkBead,
|
|
"the case asserts the ready set through BOTH doors, and the List --ready door is the blocker-aware "+
|
|
"query listIssues does not publish; the Ready door's half is covered by the ready cases above")
|
|
conformance.RunReaderReadySetOwnsItsStatusPinnedAndTemplateDecisions(t, t.Context(), servedReaderFixture(t, "rdr"))
|
|
}
|
|
|
|
func TestServedReaderOffsetSkipsTheRowsBeforeThePage(t *testing.T) {
|
|
skipKnownDivergence(t, "E-ListRequest.Offset", readParkBead,
|
|
"the case's subject is Offset, which neither listIssues nor listReadyWork publishes (its id scope now "+
|
|
"rides `id`); the Offset refusal this wire answers with instead is pinned by "+
|
|
"TestServedReaderRefusesTheFiltersTheWireCannotCarry")
|
|
conformance.RunReaderOffsetSkipsTheRowsBeforeThePage(t, t.Context(), servedReaderFixture(t, "rdr"))
|
|
}
|
|
|
|
// The two pinned-flag arms ride `pinned` / `no_pinned` behind
|
|
// issues.list.filters, so the case runs as written.
|
|
func TestServedReaderListDefaultExclusionsAndTheirOverrides(t *testing.T) {
|
|
conformance.RunReaderListDefaultExclusionsAndTheirOverrides(t, t.Context(), servedReaderFixture(t, "rdr"))
|
|
}
|
|
|
|
func TestServedReaderListRejectsATypeOutsideTheWorkspaceVocabulary(t *testing.T) {
|
|
conformance.RunReaderListRejectsATypeOutsideTheWorkspaceVocabulary(t, t.Context(), servedReaderFixture(t, "rdr"))
|
|
}
|
|
|
|
func TestServedReaderListNaturalNumericIDSortTrimsAfterTheFetch(t *testing.T) {
|
|
conformance.RunReaderListNaturalNumericIDSortTrimsAfterTheFetch(t, t.Context(), servedReaderFixture(t, "rdr"))
|
|
}
|
|
|
|
func TestServedReaderListKeysetPositionResumesTheCreatedDescIDAscOrder(t *testing.T) {
|
|
conformance.RunReaderListKeysetPositionResumesTheCreatedDescIDAscOrder(t, t.Context(), servedReaderFixture(t, "rdr"))
|
|
}
|
|
|
|
func TestServedReaderListReadyFlagAnswersTheBlockerAwareSet(t *testing.T) {
|
|
skipKnownDivergence(t, "E-ListRequest.ReadyFlag", readParkBead,
|
|
"listIssues does not publish the blocker-aware query; the ready set reaches this client through "+
|
|
"Reader.Ready, which listReadyWork serves")
|
|
conformance.RunReaderListReadyFlagAnswersTheBlockerAwareSet(t, t.Context(), servedReaderFixture(t, "rdr"))
|
|
}
|
|
|
|
func TestServedReaderListReadyFlagRefusesAFilterItCannotCarry(t *testing.T) {
|
|
skipKnownDivergence(t, "E-ListRequest.ReadyFlag", readParkBead,
|
|
"the case asserts ErrValidation naming each dropped field, which is the ready ARM's refusal; over "+
|
|
"this wire ReadyFlag itself refuses first, so the arm is never reached")
|
|
conformance.RunReaderListReadyFlagRefusesAFilterItCannotCarry(t, t.Context(), servedReaderFixture(t, "rdr"))
|
|
}
|
|
|
|
func TestServedReaderListEmptyPageIsWellFormed(t *testing.T) {
|
|
conformance.RunReaderListEmptyPageIsWellFormed(t, t.Context(), servedReaderFixture(t, "rdr"))
|
|
}
|
|
|
|
// TestServedReaderListQueryMatchesTheTitleOrTheID runs the search-text case as
|
|
// written: it scopes itself with a label, and Query rides listIssues' `q`
|
|
// parameter behind issues.list.search, which this in-process server serves.
|
|
func TestServedReaderListQueryMatchesTheTitleOrTheID(t *testing.T) {
|
|
conformance.RunReaderListQueryMatchesTheTitleOrTheID(t, t.Context(), servedReaderFixture(t, "rdr"))
|
|
}
|
|
|
|
func TestServedReaderListMaxRowsIsHonored(t *testing.T) {
|
|
skipKnownDivergence(t, "E-ListRequest.Offset", readParkBead,
|
|
"one arm drives the cap behind an Offset, which listIssues publishes no parameter for (its id scope "+
|
|
"now rides `id`); the cap is honored over this wire and exercised by "+
|
|
"TestServedReaderListMaxRowsBoundsWireRowsFetched")
|
|
conformance.RunReaderListMaxRowsIsHonored(t, t.Context(), servedReaderFixture(t, "rdr"))
|
|
}
|
|
|
|
func TestServedReaderListSkipCountsDropsTheCardinalitiesAndNothingElse(t *testing.T) {
|
|
skipKnownDivergence(t, "E-ListRequest.SkipCounts", readParkBead,
|
|
"the knob is DROPPED rather than refused (the wire hydrates the three cardinalities either way, and "+
|
|
"every text rendering of `bd list` sets it, so refusing would kill the default listing over http); "+
|
|
"its id scope rides `id` (issues.list.ids)")
|
|
conformance.RunReaderListSkipCountsDropsTheCardinalitiesAndNothingElse(t, t.Context(), servedReaderFixture(t, "rdr"))
|
|
}
|
|
|
|
func TestServedReaderListLimitBoundaryUnderASortTheDatabaseCanExpress(t *testing.T) {
|
|
conformance.RunReaderListLimitBoundaryUnderASortTheDatabaseCanExpress(t, t.Context(), servedReaderFixture(t, "rdr"))
|
|
}
|
|
|
|
func TestServedReaderListReadyFlagCarriesTheAssigneeAndPriorityFilters(t *testing.T) {
|
|
skipKnownDivergence(t, "E-ListRequest.ReadyFlag", readParkBead,
|
|
"listIssues does not publish the blocker-aware query")
|
|
conformance.RunReaderListReadyFlagCarriesTheAssigneeAndPriorityFilters(t, t.Context(), servedReaderFixture(t, "rdr"))
|
|
}
|
|
|
|
// TestServedReaderListIncludeEphemeralMergesThePlanesIntoOneOrder is the plane
|
|
// contract client wave ga-mijra brought into range. It scopes itself with
|
|
// IDFilter, which rides listIssues' `id` behind issues.list.ids (S15b), so it
|
|
// runs as written; TestServedReaderListIncludeEphemeralMergesThePlanesUnderALabelScope
|
|
// is the same fixture under a label scope, plus the plane-identity assertion
|
|
// the contract does not make.
|
|
func TestServedReaderListIncludeEphemeralMergesThePlanesIntoOneOrder(t *testing.T) {
|
|
conformance.RunReaderListIncludeEphemeralMergesThePlanesIntoOneOrder(t, t.Context(), servedReaderFixture(t, "rdr"))
|
|
}
|
|
|
|
// The id-scoped List cases that parked on E-ListRequest.IDFilter until S15b
|
|
// put `id` on listIssues (issues.list.ids). They run as written now; the one
|
|
// below them that still parks does so because its SUBJECT is Offset, a member
|
|
// the wire refuses.
|
|
|
|
func TestServedReaderListCountsAreBlocksOnlyWhereGetCountsEveryEdge(t *testing.T) {
|
|
conformance.RunReaderListCountsAreBlocksOnlyWhereGetCountsEveryEdge(t, t.Context(), servedReaderFixture(t, "rdr"))
|
|
}
|
|
|
|
func TestServedReaderListKeysetPositionNarrowsWithoutReplacingTheOtherPredicates(t *testing.T) {
|
|
conformance.RunReaderListKeysetPositionNarrowsWithoutReplacingTheOtherPredicates(t, t.Context(), servedReaderFixture(t, "rdr"))
|
|
}
|
|
|
|
func TestServedReaderListKeysetWalkOverAnOversizedGroupLosesNothingAndRepeatsNothing(t *testing.T) {
|
|
conformance.RunReaderListKeysetWalkOverAnOversizedGroupLosesNothingAndRepeatsNothing(t, t.Context(), servedReaderFixture(t, "rdr"))
|
|
}
|
|
|
|
// The priority-order walk over an oversized equal-key run, page after page:
|
|
// the sort=priority pushdown (TestServedReaderListFallsBackToTheWalkWithoutTheCapability)
|
|
// and one resumed priority keyset position
|
|
// (TestServedReaderListPriorityKeysetPositionResumesThePriorityOrder) do not
|
|
// cover the WALK, which this id-scoped case drives now that `id` is served.
|
|
func TestServedReaderListPriorityKeysetWalkOverAnOversizedEqualKeyRunLosesNothingAndRepeatsNothing(t *testing.T) {
|
|
conformance.RunReaderListPriorityKeysetWalkOverAnOversizedEqualKeyRunLosesNothingAndRepeatsNothing(t, t.Context(), servedReaderFixture(t, "rdr"))
|
|
}
|
|
|
|
// TestServedReaderListMaxRowsBoundaryIsLimitPlusOffset parks on OFFSET: the
|
|
// whole point is to drive the cap along the OFFSET
|
|
// axis with the limit held still, and listIssues publishes no offset parameter.
|
|
// The LIMIT axis of the same boundary runs over this wire in
|
|
// TestServedReaderListMaxRowsBoundsWireRowsFetched.
|
|
func TestServedReaderListMaxRowsBoundaryIsLimitPlusOffset(t *testing.T) {
|
|
skipKnownDivergence(t, "E-ListRequest.Offset", readParkBead,
|
|
"the case moves the cap along the Offset axis, and listIssues publishes no offset parameter; "+
|
|
"the cap's Limit axis is driven over this wire by "+
|
|
"TestServedReaderListMaxRowsBoundsWireRowsFetched")
|
|
conformance.RunReaderListMaxRowsBoundaryIsLimitPlusOffset(t, t.Context(), servedReaderFixture(t, "rdr"))
|
|
}
|
|
|
|
// TestServedReaderListWispTypeNarrowsTheAdmittedPlaneRatherThanAdmittingIt runs
|
|
// as written: the classification predicate rides `wisp_type` behind
|
|
// issues.list.filters beside the served IncludeEphemeral plane knob.
|
|
func TestServedReaderListWispTypeNarrowsTheAdmittedPlaneRatherThanAdmittingIt(t *testing.T) {
|
|
conformance.RunReaderListWispTypeNarrowsTheAdmittedPlaneRatherThanAdmittingIt(t, t.Context(), servedReaderFixture(t, "rdr"))
|
|
}
|
|
|
|
// The list filter families behind issues.list.filters, run through the
|
|
// client's encoder and the server's decode: the eight time bounds at their
|
|
// exact boundaries (whole-second, strict, NULL never matching, an offset bound
|
|
// equal to its UTC twin) and one included and one excluded row per remaining
|
|
// family.
|
|
func TestServedReaderListTimeBoundsAreStrictAndWholeSecond(t *testing.T) {
|
|
conformance.RunReaderListTimeBoundsAreStrictAndWholeSecond(t, t.Context(), servedReaderFixture(t, "rdr"))
|
|
}
|
|
|
|
func TestServedReaderListFilterFamiliesNarrowToTheirRows(t *testing.T) {
|
|
conformance.RunReaderListFilterFamiliesNarrowToTheirRows(t, t.Context(), servedReaderFixture(t, "rdr"))
|
|
}
|
|
|
|
func TestServedReaderListStatusAcceptsACommaSeparatedORSet(t *testing.T) {
|
|
conformance.RunReaderListStatusAcceptsACommaSeparatedORSet(t, t.Context(), servedReaderFixture(t, "rdr"))
|
|
}
|
|
|
|
// The THREE BRIEF CONTRACTS, adopted by client wave ga-f352s.
|
|
//
|
|
// They were reachable before they were wired, and the gap was one thing rather
|
|
// than three: `brief` is a published parameter on both pages (#5586) and
|
|
// `brief_deps` on getIssue (#5546), and this client's encoder sends all three —
|
|
// so the server has been leaving the text columns unselected for a wave already.
|
|
// What was missing is the MARKER. types.Issue.IsLitePartial is `json:"-"`, so a
|
|
// projected row arrives byte-identical to a genuinely textless one, and
|
|
// assertReaderBriefRow hard-fails any leg that answers one with the flag unset.
|
|
//
|
|
// THE CONTRACT IS WHAT FORCED THE STAMP, which is why deferring these to this
|
|
// wave was safe rather than lucky: there is no way to adopt them and not stamp,
|
|
// and no way to stamp and leave a door out — the client sends the parameter from
|
|
// three places (listTable, readyTable and the ready bridge) and all three lift
|
|
// their rows through one function. TestBriefListingsStampTheProjectionMarker
|
|
// asserts that door-by-door; these assert what a projected row must contain.
|
|
|
|
// TestServedReaderListBriefDropsTheFreeFormTextAndNothingElse scopes itself
|
|
// with IDFilter, which rides `id` (issues.list.ids), and the ready sibling below
|
|
// drives the identical assertReaderBriefRow under a label scope.
|
|
func TestServedReaderListBriefDropsTheFreeFormTextAndNothingElse(t *testing.T) {
|
|
conformance.RunReaderListBriefDropsTheFreeFormTextAndNothingElse(t, t.Context(), servedReaderFixture(t, "rdr"))
|
|
}
|
|
|
|
func TestServedReaderReadyBriefDropsTheFreeFormTextAndNothingElse(t *testing.T) {
|
|
conformance.RunReaderReadyBriefDropsTheFreeFormTextAndNothingElse(t, t.Context(), servedReaderFixture(t, "rdr"))
|
|
}
|
|
|
|
// TestServedReaderGetBriefDepsProjectsTheDependencyRows is the third, and the
|
|
// one that needs no marker at all: `brief_deps` projects the rows of the
|
|
// DEPENDENCIES member, and the contract asserts the identity fields survive and
|
|
// the free-form text is gone. The detail view's own row is untouched by it.
|
|
func TestServedReaderGetBriefDepsProjectsTheDependencyRows(t *testing.T) {
|
|
conformance.RunReaderGetBriefDepsProjectsTheDependencyRows(t, t.Context(), servedReaderFixture(t, "rdr"))
|
|
}
|
|
|
|
func TestServedReaderGetResolvesTheExactIDAcrossBothPlanes(t *testing.T) {
|
|
conformance.RunReaderGetResolvesTheExactIDAcrossBothPlanes(t, t.Context(), servedReaderFixture(t, "rdr"))
|
|
}
|
|
|
|
func TestServedReaderGetMissIsNotFoundAndBackendFailureDoesNotDecay(t *testing.T) {
|
|
conformance.RunReaderGetMissIsNotFoundAndBackendFailureDoesNotDecay(t, t.Context(), servedReaderFixture(t, "rdr"))
|
|
}
|
|
|
|
// TestServedReaderGetOptionalRowListsAreOffByDefault is the shared proof of the
|
|
// L4 retirement: the `include_dependents` and `include_comments` parameters this
|
|
// client sends are what put the two row lists on `bd show`'s detail view.
|
|
func TestServedReaderGetOptionalRowListsAreOffByDefault(t *testing.T) {
|
|
conformance.RunReaderGetOptionalRowListsAreOffByDefault(t, t.Context(), servedReaderFixture(t, "rdr"))
|
|
}
|
|
|
|
func TestServedReaderGetDetailShapeMatchesTheSeededIssue(t *testing.T) {
|
|
conformance.RunReaderGetDetailShapeMatchesTheSeededIssue(t, t.Context(), servedReaderFixture(t, "rdr"))
|
|
}
|
|
|
|
// TestServedReaderGetPopulatesRowVersionForAGuardedWrite is HIGH 5's pin.
|
|
//
|
|
// types.Issue.RowVersion is json:"-" (internal/types/types.go), so a bare
|
|
// decode of getIssue's response body leaves it at zero; the wire's only
|
|
// spelling of the token is the detail view's sibling `revision` string, which
|
|
// Reader.Get must stitch back on. A read alone cannot tell a stitched zero
|
|
// from a real one that happens to equal it on a fresh table, so this proves it
|
|
// the way a caller actually consumes RowVersion: by GUARDING A WRITE with
|
|
// whatever Get just answered, over the same wire, and requiring the guard to
|
|
// be real rather than decorative.
|
|
//
|
|
// The second Update reuses the SAME (now-stale) token. If Get had answered 0
|
|
// — the bug this pins against — the first Update's own post-write token would
|
|
// also have nothing to do with it, and there would be no way for this case to
|
|
// tell "the guard matched" from "the guard was never checked". Requiring the
|
|
// REUSE to refuse is what rules that out: it only refuses if the first write
|
|
// really did move the row past the exact version Get reported.
|
|
func TestServedReaderGetPopulatesRowVersionForAGuardedWrite(t *testing.T) {
|
|
env := newServedEnv(t, "rdrv")
|
|
reader, err := env.subject.IssueReader()
|
|
if err != nil {
|
|
t.Fatalf("IssueReader(): %v", err)
|
|
}
|
|
lifecycle, err := env.subject.IssueLifecycle()
|
|
if err != nil {
|
|
t.Fatalf("IssueLifecycle(): %v", err)
|
|
}
|
|
|
|
issue := &types.Issue{Title: "row version round trip", Status: types.StatusOpen, Priority: 2, IssueType: types.TypeTask}
|
|
if err := env.createIssue(t.Context(), issue, "seed"); err != nil {
|
|
t.Fatalf("seed: %v", err)
|
|
}
|
|
|
|
details, err := reader.Get(t.Context(), issueops.GetRequest{ID: issue.ID})
|
|
if err != nil {
|
|
t.Fatalf("Get: %v", err)
|
|
}
|
|
if details.RowVersion == 0 {
|
|
t.Fatalf("Get answered RowVersion 0 (Revision %q); want the row's real token", details.Revision)
|
|
}
|
|
staleVersion := details.RowVersion
|
|
|
|
if _, err := lifecycle.Update(t.Context(), issueops.UpdateRequest{
|
|
Actor: "writer", IssueID: issue.ID, ExpectedVersion: &staleVersion,
|
|
Patch: issueops.IssuePatch{Title: set("first guarded write")},
|
|
}); err != nil {
|
|
t.Fatalf("Update guarded by the token Get answered: %v", err)
|
|
}
|
|
|
|
_, err = lifecycle.Update(t.Context(), issueops.UpdateRequest{
|
|
Actor: "writer", IssueID: issue.ID, ExpectedVersion: &staleVersion,
|
|
Patch: issueops.IssuePatch{Title: set("second guarded write, same stale token")},
|
|
})
|
|
if err == nil {
|
|
t.Fatal("Update reused Get's token after a write moved the row past it; want a version-guard refusal")
|
|
}
|
|
}
|
|
|
|
// The List leg sets ExcludeTypes, which rides `exclude_type` behind
|
|
// issues.list.filters, so the case runs as written.
|
|
func TestServedReaderDoesNotMutateTheCallerRequest(t *testing.T) {
|
|
conformance.RunReaderDoesNotMutateTheCallerRequest(t, t.Context(), servedReaderFixture(t, "rdr"))
|
|
}
|
|
|
|
// TestServedReaderListExcludeStatusAcceptsAWorkspaceCustomStatus is the
|
|
// served twin of the count's custom-status pin: ListRequest.ExcludeStatus is
|
|
// validated against the SERVER workspace's own statuses (status.custom), so a
|
|
// custom status is accepted and applied over the wire, and a name in no
|
|
// vocabulary is still refused. A leg test rather than a conformance case
|
|
// because ReaderFixture has no way to configure a workspace custom status.
|
|
func TestServedReaderListExcludeStatusAcceptsAWorkspaceCustomStatus(t *testing.T) {
|
|
e := newServedEnv(t, "lcs")
|
|
ctx := t.Context()
|
|
if err := e.setConfig(ctx, "status.custom", "review,qa"); err != nil {
|
|
t.Fatalf("SetConfig(status.custom): %v", err)
|
|
}
|
|
const openID, reviewID = "lcs-open", "lcs-review"
|
|
for _, id := range []string{openID, reviewID} {
|
|
if err := e.createIssue(ctx, &types.Issue{ID: id, Title: id, Status: types.StatusOpen, Priority: 2, IssueType: types.TypeTask}, "tester"); err != nil {
|
|
t.Fatalf("CreateIssue(%s): %v", id, err)
|
|
}
|
|
}
|
|
if err := e.reference.UpdateIssue(ctx, reviewID, map[string]interface{}{"status": types.Status("review")}, "tester"); err != nil {
|
|
t.Fatalf("UpdateIssue(%s) to review: %v", reviewID, err)
|
|
}
|
|
reader, err := e.subject.IssueReader()
|
|
if err != nil {
|
|
t.Fatalf("IssueReader(): %v", err)
|
|
}
|
|
|
|
scope := issueops.ListRequest{IDFilter: openID + "," + reviewID}
|
|
page, err := reader.List(ctx, scope)
|
|
if err != nil {
|
|
t.Fatalf("List(unfiltered): %v", err)
|
|
}
|
|
if got := pageIDs(page); len(got) != 2 {
|
|
t.Fatalf("List(unfiltered) = %v, want both rows (a custom status with no category is not a default exclusion)", got)
|
|
}
|
|
|
|
scope.ExcludeStatus = []string{"review"}
|
|
page, err = reader.List(ctx, scope)
|
|
if err != nil {
|
|
t.Fatalf("List(ExcludeStatus=review): %v, want the custom status accepted", err)
|
|
}
|
|
if got := pageIDs(page); len(got) != 1 || got[0] != openID {
|
|
t.Fatalf("List(ExcludeStatus=review) = %v, want [%s]", got, openID)
|
|
}
|
|
|
|
scope.ExcludeStatus = []string{"reveiw"}
|
|
if _, err := reader.List(ctx, scope); err == nil {
|
|
t.Fatal("List(ExcludeStatus=reveiw) answered instead of refusing a status in no vocabulary")
|
|
}
|
|
}
|