* feat(list): bd list --no-assignee, --title and --id over http behind per-parameter tokens (S15b) Over http `bd list --no-assignee`, `--title` and `--id` refused: the list encoder had no listIssues parameter for ListRequest.NoAssignee, TitleSearch or IDFilter (B3 #11). All three are maintainer-city cutover blockers: gc's default on_boot hook runs `bd list --no-assignee --status=in_progress ...` on every agent boot, the PR-intake formula lists by `--title "$SUBJECT"`, and the pr-review skill by `--id <ids>`. The library entry is unchanged: issueops.Reader.List, whose bodies already apply all three through workapi.BuildListFilter, the same entry the local route reads through. - Server: GET /v0/beads/issues decodes `no_assignee`, `title` and `id` into those ListRequest members (`id` handed over as written; the role splits, trims and de-duplicates, as countIssues already does). Each is behind its own new behavior token, issues.list.noAssignee, issues.list.title and issues.list.id (additive, wire_revision stays 2): each is a separate caller's dependency, and a refusal names exactly the one it needed. The spec parameters cite their tokens; apigen and the wire-shape golden are regenerated. - Client: the encoder maps the three members to their parameters, and httpReader.List refuses a request carrying one BEFORE dialing, with ErrUnsupported{Capability: <token>}, unless the handshake advertises that token (refuseUnservedSearch generalised to one table, tokenedListFilters, with bd search's `q`). Never a round trip an older server answers unknown_parameter, never a wider listing. - ErrHTTPUnsupported's text names the capability when it has one, as the portable sentinel does, so `bd list` says which token the server lacks. - The three E-ListRequest ledger rows retire; the ledger is re-rendered. The id scope unparks the served Reader contract: the sixteen cases parked on E-ListRequest.IDFilter now run against the in-process server. Twelve pass as written; four still park, each now on the member it actually needs (Offset twice, PinnedFlag, ExcludeTypes). The served refusal sweep asserts SpecPrefix where it asserted IDFilter. Tests (failing first): handler test that each parameter reaches the storage filter; client tests that each member rides its parameter behind its token and refuses pre-dial, zero dials, naming its token, against a server lacking it; round-trip and vocabulary gates; capability lists. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(backend/http): the four maintainer-city list shapes end to end; corpus marks relabelled SRV-1 (S15b) TestE2E_ListScopeFiltersOverHTTP runs the corpus shapes gc-list-on-boot, gc-list-on-boot-workflow, mc-list-title and mc-list-id through the real bd against the in-process server (which advertises the three new tokens) and requires each to answer an embedded workspace's rows and exactly the rows it names: --no-assignee leaves out an assigned in-progress row on the same lane, --title is case-insensitive, --id lists a closed id under --all. Against the MC production server's handshake shape each shape exits non-zero naming its token and never dials listIssues. The corpus suite masks the served side to reference_server.json, the deployed bd 1.3.0 surface, which advertises none of the tokens, so the four shapes now get the named pre-dial refusal there. Their marks move from S6c+S15b to SRV-1 with that reason, like mc-search. With a scratch profile that adds the three tokens and parameters (not committed) exactly these four shapes report "now passes; remove the pending mark" and nothing else changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(list): adopt bd-enterprise's listIssues `id` contract: repeatable, issues.list.ids (S15b) bd-enterprise already publishes listIssues `id` (E9-S2): a REPEATABLE parameter, one id per value, behind `issues.list.ids`, with its client sending IDFilter split into one value per member. The first cut of S15b took ONE comma-separated `id` behind `issues.list.id`, so the same parameter name had two incompatible meanings: an OSS client's "a,b" is a 400 on an enterprise server, and the enterprise rebase onto main would collide. OSS now publishes enterprise's contract unchanged: - Server: listIDFilter (ported verbatim) decodes the repeated `id` into ListRequest.IDFilter's comma set; more than 200 values, an empty value, a comma, leading or trailing whitespace, a control character or an over-long id is a 400 `invalid_argument` on `id`. The spec parameter is enterprise's (array, maxItems 200); apigen and the wireshape golden are regenerated. - Token: CapListIDs = "issues.list.ids", the enterprise spelling and name on both sides. - Client: the encoder splits the set the way the role does (splitIDSet) and sends one `id` per member; the pre-dial gate fires only when the set names an id. - Tests: list_ids_test.go is enterprise's id cases (the exact set reaches storage, the 200 bound is served, every refusal beside its control, the spec bound matches the constant); the handler, client, round-trip and e2e cases move to the repeated shape and the new token. `no_assignee` and `title` are unchanged. Served tier, http e2e (including TestE2E_ListScopeFiltersOverHTTP) and corpus_served_test pass; with a scratch reference profile advertising the three tokens exactly the four S15b shapes report "now passes". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
391 lines
20 KiB
Go
391 lines
20 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, PinnedFlag, ExcludeTypes, WispType,
|
|
// SkipCounts — and each names that member's row. 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"))
|
|
}
|
|
|
|
func TestServedReaderListDefaultExclusionsAndTheirOverrides(t *testing.T) {
|
|
skipKnownDivergence(t, "E-ListRequest.PinnedFlag", readParkBead,
|
|
"two arms set PinnedFlag/NoPinnedFlag, which listIssues publishes no parameters for (the id scope "+
|
|
"every arm uses now rides `id`)")
|
|
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 two
|
|
// below them still park, because their SUBJECT is 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
|
|
// names WISPTYPE for the same reason: the classification predicate IS the
|
|
// subject, and listIssues publishes no parameter for it, so no rescoping saves
|
|
// the case. The plane knob it composes against — IncludeEphemeral — is served,
|
|
// and its own half is asserted by
|
|
// TestServedReaderListIncludeEphemeralMergesThePlanesUnderALabelScope.
|
|
func TestServedReaderListWispTypeNarrowsTheAdmittedPlaneRatherThanAdmittingIt(t *testing.T) {
|
|
skipKnownDivergence(t, "E-ListRequest.WispType", readParkBead,
|
|
"the wisp classification predicate is the case's subject and listIssues publishes no parameter for "+
|
|
"it; the client refuses it rather than answering the whole admitted plane, which is the reading "+
|
|
"the case exists to rule out")
|
|
conformance.RunReaderListWispTypeNarrowsTheAdmittedPlaneRatherThanAdmittingIt(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")
|
|
}
|
|
}
|
|
|
|
func TestServedReaderDoesNotMutateTheCallerRequest(t *testing.T) {
|
|
skipKnownDivergence(t, "E-ListRequest.ExcludeTypes", readParkBead,
|
|
"the List leg of the tripwire sets ExcludeTypes, which listIssues publishes no parameter for (its id "+
|
|
"scope now rides `id`); the promise is exercised over this wire by "+
|
|
"TestServedReaderDoesNotMutateTheCallerRequestOverTheWire")
|
|
conformance.RunReaderDoesNotMutateTheCallerRequest(t, t.Context(), servedReaderFixture(t, "rdr"))
|
|
}
|