Documentation
¶
Overview ¶
Package adaptertest is the PRD §23 shared parity layer both host adapters' plugin tests consume: fixtures (the committed §10 role profiles) and assertion helpers (skill/manifest drift pins) so cross-host invariants — the run-verb allowlist, the four anti-forgery statement literals, the plan/merge gate option text, the setup interview's terminal forms, hook command portability, matcher/ guard parity, the routed-selection prompt cue, and the blast-radius acceptance criterion the engine contributes to a risk-domain issue — have exactly one source instead of a copy per adapter that can silently drift apart.
This package carries no Test functions and tests nothing of its own; it is test-support only, imported by adapters/claude/plugin_test.go and adapters/codex/plugin_test.go. Every exported Check* helper takes a *testing.T and calls t.Helper(), and reads files relative to the caller's own working directory — the same assumption each adapter's plugin_test.go already makes, since `go test` runs a package's tests with that package's directory as the process cwd.
These helpers pin the presence of instruction text in shipped skill markdown; they cannot pin its meaning. Every prose-phrase comparison runs through NormalizeWhitespace on both sides deliberately, so a pinned phrase that a markdown reflow happens to hard-wrap across a line break still counts as present — the pins track whether the words are there, not how the file happens to be line-wrapped.
It may import internal/run (the four statement constants) and internal/guard (a caller may pass guard.ClaudeTools()/CodexTools() into CheckMatcherEqualsGuardTools) and nothing else in this module — it is a leaf test-support package, not a place for adapter-specific or engine policy code.
Index ¶
- func CheckBlastRadiusCriterionGuidance(t *testing.T, paths ...string)
- func CheckBranchScopeVerificationGuidance(t *testing.T, deliverySkillPath string)
- func CheckHookCommandPortability(t *testing.T, commands []string)
- func CheckMatcherEqualsGuardTools(t *testing.T, matcher string, want []string)
- func CheckMergeGateOptions(t *testing.T, deliverySkillPath string)
- func CheckPlanGateOptions(t *testing.T, deliverySkillPath string)
- func CheckRoutedSelectionCue(t *testing.T, skillPath string)
- func CheckRunVerbTokens(t *testing.T, skillGlob string)
- func CheckSetupTerminalForms(t *testing.T, setupSkillPath string)
- func CheckStatementLiterals(t *testing.T, skillGlob string)
- func NormalizeWhitespace(s string) string
- func Profile(host string) map[string]RoleSpec
- type RoleSpec
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckBlastRadiusCriterionGuidance ¶ added in v0.6.1
CheckBlastRadiusCriterionGuidance pins each path's whole text against run.BlastRadiusCriterion's clauses and the evidence sentence above. Callers pass their own host's delivery skill and both reviewer agent definitions; the files are read raw, so a Codex definition's prose inside a TOML string is checked the same way a Claude definition's markdown body is.
Comparison runs on whitespace-normalized text on both sides, so a clause a markdown reflow or a TOML line wrap happens to split across a line break still counts as present. As with every pin in this package, it catches deletion or rewording of the words and nothing more: no check here observes whether an executor or reviewer that reads the criterion acts on it.
func CheckBranchScopeVerificationGuidance ¶ added in v0.5.7
CheckBranchScopeVerificationGuidance pins deliverySkillPath's entire text against the exact branch-scope naming and resubmission guidance above, wherever in the file each phrase appears. The comparison runs on whitespace-normalized text on both sides, so a phrase a markdown reflow happens to hard-wrap across a line break still counts as present.
func CheckHookCommandPortability ¶
CheckHookCommandPortability asserts none of commands contains a shell metacharacter.
func CheckMatcherEqualsGuardTools ¶
CheckMatcherEqualsGuardTools asserts matcher (a "|"-joined hook matcher string) names exactly the tools in want, in both directions: the matcher must name every guard-handled tool, and name nothing else, since guard denies any other tool_name by default (broadening the matcher without extending guard would hard-deny at the hook, never reaching guard's own decision).
func CheckMergeGateOptions ¶
CheckMergeGateOptions pins deliverySkillPath's documented merge-gate question options against the exact two-option set. The comparison runs on whitespace-normalized text on both sides, so an option string a markdown reflow happens to hard-wrap across a line break still counts as present.
func CheckPlanGateOptions ¶
CheckPlanGateOptions pins deliverySkillPath's documented plan-gate question options against the exact PRD §8 four-option set. The comparison runs on whitespace-normalized text on both sides, so an option string a markdown reflow happens to hard-wrap across a line break still counts as present.
func CheckRoutedSelectionCue ¶ added in v0.5.4
CheckRoutedSelectionCue pins skillPath's documented spawn/dispatch prompt against the exact routed-selection opening line every issue's executor (and reviewer) prompt must open with. The comparison runs on whitespace-normalized text on both sides, so the cue would still count as present even if a markdown reflow hard-wrapped it across a line break.
func CheckRunVerbTokens ¶
CheckRunVerbTokens drift-pins every `orch run <verb>` token mentioned in a skill (found by skillGlob, e.g. "skills/*/SKILL.md") against the real verb set: a renamed or removed verb that a skill still mentions fails the test instead of silently documenting a dead command.
func CheckSetupTerminalForms ¶
CheckSetupTerminalForms pins setupSkillPath's documented terminal forms against the exact three commands each interview ends with. The comparison runs on whitespace-normalized text on both sides, so a terminal form a markdown reflow happens to hard-wrap across a line break still counts as present.
func CheckStatementLiterals ¶
CheckStatementLiterals asserts every `"statement": "..."` literal quoted in a skill (found by skillGlob) equals one of the internal/run approval/statement constants, and that every constant appears at least once across the matched skills — so a skill can never silently drop or misquote one of the anti-forgery statements the engine requires verbatim.
func NormalizeWhitespace ¶ added in v0.5.5
NormalizeWhitespace exports normalizeWhitespace for the two adapters' own plugin_test.go prose-phrase checks (TestDeliverySkillStatesFrontmatterMatchRule, TestDeliverySkillStatesTOMLMatchRule, and the Codex adapter's TestAgentTOMLs read-only sentinel check), which live outside this package and so cannot call the unexported form directly. It performs no normalization logic of its own beyond delegating to normalizeWhitespace.
func Profile ¶
Profile returns the committed §10 profile for host ("claude" or "codex"), keyed by role: "scout", "implementer", "specialist", "reviewer", "reviewer-safe". Every adapter's agent roster is asserted equal to this map so the two hosts' plugin tests and the committed §10 table can never silently diverge from one another.
An unrecognized host is a programming error in the caller (a typo, or a new host added to the module without updating this fixture) — Profile panics rather than returning a zero value a test might silently pass against.