Documentation
¶
Overview ¶
Package querytest provides adversarial, real-Git fixtures shared by the review application and its transport integration tests.
Index ¶
- Constants
- type CursorAttack
- type FileState
- type Fixture
- func (f *Fixture) AddActiveFragments() (htmlTarget, svgTarget string)
- func (f *Fixture) AddAmbiguousTargets()
- func (f *Fixture) AddEscapingAssetSymlink() string
- func (f *Fixture) AddEscapingEntrypointSymlink() string
- func (f *Fixture) AddLargeFragment(size int) string
- func (f *Fixture) AdvanceSagaSnapshot()
- func (f *Fixture) AssertNoAbsolutePaths(output string)
- func (f *Fixture) AssertUnchanged(before TreeState)
- func (f *Fixture) LeakedAbsolutePath(output string) string
- func (f *Fixture) MakeInvalidManifest()
- func (f *Fixture) State() TreeState
- func (f *Fixture) WriteSaga(relative, content string)
- func (f *Fixture) WriteSource(relative, content string)
- type TreeState
Constants ¶
const ( Repository = "https://example.test/acme/query-security.git" OverviewTarget = "urn:change-saga:security:fragment:overview" LargeTarget = "urn:change-saga:security:fragment:large" ActiveHTMLTarget = "urn:change-saga:security:fragment:active-html" ActiveSVGTarget = "urn:change-saga:security:fragment:active-svg" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CursorAttack ¶
CursorAttack is a syntactically hostile derivative of a valid opaque cursor.
func TamperedCursors ¶
func TamperedCursors(valid string) []CursorAttack
TamperedCursors returns transport-safe cursor corruptions. The query API must classify all of them as invalid_argument and must not panic or expose cursor internals. Snapshot staleness is tested separately with AdvanceSagaSnapshot.
type Fixture ¶
type Fixture struct {
SourceDir string
SagaRepo string
SagaRoot string
BaseOID string
// contains filtered or unexported fields
}
Fixture keeps the saga and its compared source in different Git worktrees. Query tests should always pass SourceDir explicitly; accidentally loading the source from SagaRepo makes this fixture fail instead of masking the bug.
func New ¶
New creates two independent, clean Git repositories. The source repository has a base commit and one product commit. The saga repository contains a minimal valid v2 saga which compares those source revisions.
func (*Fixture) AddActiveFragments ¶
AddActiveFragments creates HTML and SVG whose scripts have obvious sentinel effects if evaluated. Read APIs must return bounded inert bytes; they must never load either document into an executing renderer.
func (*Fixture) AddAmbiguousTargets ¶
func (f *Fixture) AddAmbiguousTargets()
AddAmbiguousTargets creates two structurally distinct fragments with the same public target. A session must reject the saga instead of selecting one according to traversal order.
func (*Fixture) AddEscapingAssetSymlink ¶
AddEscapingAssetSymlink adds a non-entrypoint asset link. This distinction is important: the saga loader can remain valid while an asset enumerator still has to omit or reject the escaping link. This phase has no asset-content read operation, so callers should test metadata enumeration only.
func (*Fixture) AddEscapingEntrypointSymlink ¶
AddEscapingEntrypointSymlink replaces the overview entrypoint with a link to a secret outside the saga. Session opening must reject this as invalid_saga without returning the secret.
func (*Fixture) AddLargeFragment ¶
AddLargeFragment creates deterministic content without requiring a large checked-in fixture. Tests should request at least 1 MiB+1 to cross the documented maximum fragment chunk size.
func (*Fixture) AdvanceSagaSnapshot ¶
func (f *Fixture) AdvanceSagaSnapshot()
AdvanceSagaSnapshot changes relevant fragment content without committing it. A cursor obtained before this call must not be accepted against the new snapshot.
func (*Fixture) AssertNoAbsolutePaths ¶
AssertNoAbsolutePaths checks the default diagnostic privacy contract.
func (*Fixture) AssertUnchanged ¶
AssertUnchanged fails if a read operation changed either worktree, staged content, or created a commit.
func (*Fixture) LeakedAbsolutePath ¶
LeakedAbsolutePath returns the fixture root exposed by an application or CLI error, including its slash-normalized and JSON-escaped spelling. Empty means the output contains none of the fixture's absolute paths.
func (*Fixture) MakeInvalidManifest ¶
func (f *Fixture) MakeInvalidManifest()
MakeInvalidManifest adds an unknown field. saga.Load returns a decode error for this case, which the query boundary must normalize to invalid_saga.
func (*Fixture) WriteSource ¶
WriteSource writes a slash-relative path below the source worktree.
type TreeState ¶
type TreeState struct {
Files []FileState
SourceHEAD string
SagaHEAD string
SourceStatus string
SagaStatus string
}
TreeState captures observable worktree and Git state while ignoring Git's mutable internal bookkeeping. It detects content changes, new files, permission changes, staging, and commits caused by a read request.