packconformance

package
v0.5.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 25, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package packconformance implements the Pack contract v1 conformance test framework: a Pack author, official or custom, can run the same machine-checkable requirements against their Pack directory that CI runs against the official Packs.

Deliberately at the MODULE ROOT (github.com/novshi-tech/boid/ packconformance), not under internal/ — a package under internal/ is importable only from within github.com/novshi-tech/boid/... (Go's internal-package import rule), so a custom Pack author's own, completely separate Go module could never `import` it. testutil/ (this repo's existing test-helper package) sits at the module root for the identical reason.

ConformancePack is the single entry point: given the directory of ONE Pack version (a directory that itself contains integration.yaml — integrationpack.Pack.Dir's shape, NOT the multi-pack installation root integrationpack.LoadPacks walks; see ConformancePack's own doc comment for why this package deliberately does not call LoadPacks), it runs every machine-checkable requirement as an independent t.Run subtest:

  • manifest: integration.yaml parses via the existing integrationpack.ParseManifest — no parsing logic of this package's own
  • skill: no skills/**/SKILL.md or skills/**/references/*.md file mentions a boid CLI command or names a builtin skill
  • connector: every declared connectors[].executable exists and is executable (hard requirement), and, best-effort and skippable, actually launches without crashing or hanging when given the contract's env and a deliberately-unreachable BOID_API_BASE
  • no extension escape — a light grep guard: no .go source files, no literal reference to boid's own internal/ import path, anywhere in the Pack directory

A custom (non-official) Pack author runs the exact same checks locally, from their OWN Go module (a plain `go get github.com/novshi-tech/boid@latest` away — this package is at the module root specifically so that works):

import "github.com/novshi-tech/boid/packconformance"

func TestConformance(t *testing.T) {
    packconformance.ConformancePack(t, "/path/to/my-pack/1.0.0")
}

officialpacks_test.go is the CI-facing half: an env-var-gated sweep (BOID_API_SKILLS_DIR) that discovers every Pack directory in a checked-out boid-api-skills tree and runs ConformancePack against each.

Index

Constants

View Source
const DefaultLaunchTimeout = 10 * time.Second

DefaultLaunchTimeout bounds how long the connector-launch smoke check (checkConnectorLaunchable) waits for a connector process to exit before killing it and failing that connector's subtest. Generous relative to what it's actually exercising — a connector reacting to an immediately- refused BOID_API_BASE connection (§5.3) — because a Pack author's local `go test` run may take longer to start an interpreter than CI does.

Variables

This section is empty.

Functions

func ConformancePack

func ConformancePack(t *testing.T, dir string)

ConformancePack runs every machine-checkable Pack contract requirement against the Pack VERSION directory at dir — a directory that itself contains integration.yaml, i.e. one <pack-name>/<version>/ directory such as integrationpack.Pack.Dir, NOT the multi-pack installation root integrationpack.LoadPacks walks (<integrations.dir>/<pack>/<version>/).

This deliberately does NOT call LoadPacks: LoadPacks treats every entry of its root directory as a Pack directory, which breaks on a Pack REPO checkout root specifically because of that checkout's own .git/ directory — LoadPacks goes looking for "<root>/.git/<version>/integration.yaml", finds nothing, and returns a hard error. ConformancePack sidesteps that failure mode entirely by taking a single, already-known-good Pack directory rather than a root to enumerate. officialpacks_test.go's own discovery (walking for integration.yaml files, explicitly skipping dot-directories) avoids the same bug the same way — see its own doc comment.

Every requirement runs as its own t.Run subtest so one failing check does not hide the rest.

func ConformancePackOpts

func ConformancePackOpts(t *testing.T, dir string, opts Options)

ConformancePackOpts is ConformancePack with explicit Options — see Options' own doc comment for what each field relaxes and why a Pack author might need to.

Types

type Options

type Options struct {
	// LaunchTimeout overrides DefaultLaunchTimeout for the connector-launch
	// smoke check. Zero (the default) means DefaultLaunchTimeout.
	LaunchTimeout time.Duration

	// SkipLaunch disables the connector-launch smoke check entirely. The
	// existence/executable-bit check always runs regardless of this flag —
	// only the "actually run it and confirm it doesn't immediately crash or
	// hang" best-effort half is optional.
	//
	// Use this when the environment running the conformance test cannot
	// provide a connector's own runtime dependency (e.g. no python3 on a
	// Pack author's machine, or a stripped-down CI image), which is not
	// necessarily the same image the connector actually runs in.
	SkipLaunch bool
}

Options configures ConformancePackOpts. The zero Options is what ConformancePack uses.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL