Documentation
¶
Overview ¶
The fixtures in this package are representative, non-installable payloads. They are not a versioned release manifest or cache manager.
Index ¶
- Constants
- Variables
- type AcquiredAsset
- type ArchiveFormat
- type ArchiveSource
- type Asset
- type AssetArchive
- type AssetFile
- type AssetIdentity
- type AssetStatus
- type CommandIdentityVerifier
- type CommandRunner
- type Compatibility
- type FeasibilityManifest
- type FeasibilityPublisher
- type FileLocker
- type Fixture
- type GitHubReleaseSource
- type IdentityVerifier
- type IntegerRange
- type Locker
- type Manager
- type Manifest
- type NonRegularCandidateError
- type Platform
- type PublishedFixture
- type Request
- type ResolvedAsset
- type RetentionPolicy
- type Runtime
- type Unlocker
- type VerificationCandidate
- type VerificationKind
- type VersionRange
Constants ¶
const ( // FeasibilitySchemaVersion identifies representative fixture metadata. FeasibilitySchemaVersion = "flowbaton.g001.feasibility.v1" FeasibilityOnlyScope = "representative-fixture-not-release-artifact" )
const ( GitHubRepository = "larchwave/flowbaton" GitHubSignerWorkflow = "larchwave/flowbaton/.github/workflows/release-publish.yml" )
const ManifestSchemaVersion = "flowbaton.assets.v0"
Variables ¶
var ( ErrUnresolvedAsset = errors.New("asset was not resolved by the compatibility contract") ErrArchiveSourceRequired = errors.New("archive source is required") ErrCacheRootRequired = errors.New("asset cache root is required") ErrInvalidAssetCache = errors.New("invalid asset cache") )
var ( ErrInvalidAssetManifest = errors.New("invalid asset manifest") ErrNoCompatibleAsset = errors.New("no compatible asset") ErrAssetNotReleaseEligible = errors.New("asset is not release eligible") )
var ( ErrVerifierRequired = errors.New("identity verifier is required") ErrInvalidManifest = errors.New("invalid feasibility manifest") ErrCompressedSizeMismatch = errors.New("compressed size mismatch") ErrCompressedHashMismatch = errors.New("compressed hash mismatch") ErrPayloadSizeMismatch = errors.New("payload size mismatch") ErrPayloadHashMismatch = errors.New("payload hash mismatch") ErrModeMismatch = errors.New("payload mode mismatch") ErrAlreadyPublished = errors.New("fixture destination already exists") )
Functions ¶
This section is empty.
Types ¶
type AcquiredAsset ¶
type ArchiveFormat ¶
type ArchiveFormat string
const ( ArchiveFormatGZIP ArchiveFormat = "gzip" ArchiveFormatTarGZIP ArchiveFormat = "tar+gzip" )
type ArchiveSource ¶
type Asset ¶
type Asset struct {
ID string `json:"id"`
Status AssetStatus `json:"status"`
HostVersion string `json:"host_version"`
AssetVersion string `json:"asset_version"`
HostOS string `json:"host_os"`
HostArch string `json:"host_arch"`
Platform Platform `json:"platform"`
AssetHash string `json:"asset_hash"`
Archive AssetArchive `json:"archive"`
Files []AssetFile `json:"files"`
Identity AssetIdentity `json:"identity"`
Compatibility Compatibility `json:"compatibility"`
}
type AssetArchive ¶
type AssetArchive struct {
Format ArchiveFormat `json:"format"`
SHA256 string `json:"sha256"`
Size int64 `json:"size"`
UncompressedSHA256 string `json:"uncompressed_sha256"`
UncompressedSize int64 `json:"uncompressed_size"`
}
type AssetIdentity ¶
type AssetIdentity struct {
Kind VerificationKind `json:"kind"`
Value string `json:"value"`
Path string `json:"path"`
}
type AssetStatus ¶
type AssetStatus string
const ( AssetStatusRepresentative AssetStatus = "representative-not-release-artifact" AssetStatusRelease AssetStatus = "release" )
type CommandIdentityVerifier ¶
type CommandIdentityVerifier struct {
Run CommandRunner
}
CommandIdentityVerifier performs the platform-native identity checks after archive hashes and paths have been verified. Android uses apkanalyzer's manifest parser; iOS uses codesign's designated bundle identifier.
func (CommandIdentityVerifier) Verify ¶
func (verifier CommandIdentityVerifier) Verify(ctx context.Context, candidate VerificationCandidate) error
type CommandRunner ¶
CommandRunner runs one external verification command. The injected seam keeps provenance verification testable without trusting a fake gh executable.
type Compatibility ¶
type Compatibility struct {
AndroidAPI IntegerRange `json:"android_api"`
Xcode VersionRange `json:"xcode"`
IOSRuntime VersionRange `json:"ios_runtime"`
}
type FeasibilityManifest ¶
type FeasibilityManifest struct {
SchemaVersion string `json:"schema_version"`
Scope string `json:"scope"`
Platform Platform `json:"platform"`
ArtifactName string `json:"artifact_name"`
Identity string `json:"identity"`
VerificationKind VerificationKind `json:"verification_kind"`
Mode fs.FileMode `json:"mode"`
CompressedSHA256 string `json:"compressed_sha256"`
PayloadSHA256 string `json:"payload_sha256"`
CompressedSize int64 `json:"compressed_size"`
PayloadSize int64 `json:"payload_size"`
BudgetBytes int64 `json:"budget_bytes"`
}
FeasibilityManifest is the minimum metadata needed to test the compressed-payload pipeline.
type FeasibilityPublisher ¶
type FeasibilityPublisher struct {
Verifier IdentityVerifier
}
FeasibilityPublisher performs verified extraction followed by atomic publication in a caller-provided temporary cache. Locking, cache recovery, release selection, and retention policy are outside this bounded component.
func (FeasibilityPublisher) Publish ¶
func (p FeasibilityPublisher) Publish(ctx context.Context, cacheRoot string, fixture Fixture) (PublishedFixture, error)
Publish validates and expands one representative gzip payload into a sibling temporary directory, invokes the identity verifier, rechecks bytes and mode, and publishes the complete directory with one atomic rename.
type FileLocker ¶
type FileLocker struct{}
FileLocker uses an operating-system advisory file lock. The lock is released by the kernel if the owning process terminates, so interrupted acquisitions cannot leave a permanent lock behind.
type Fixture ¶
type Fixture struct {
Manifest FeasibilityManifest
Compressed []byte
}
Fixture pairs deterministic gzip bytes with their feasibility metadata.
func RepresentativeFixtures ¶
func RepresentativeFixtures() []Fixture
RepresentativeFixtures returns fresh copies so a corruption test or caller cannot alter the package's embedded fixture bytes.
type GitHubReleaseSource ¶
type GitHubReleaseSource struct {
Client *http.Client
Run CommandRunner
TempDir string
BaseURL string
}
GitHubReleaseSource downloads driver archives from the release matching the host version and verifies their GitHub build attestation before Manager reads or publishes any bytes.
func (GitHubReleaseSource) DownloadManifest ¶
func (source GitHubReleaseSource) DownloadManifest(ctx context.Context, hostVersion string) ([]byte, error)
DownloadManifest obtains and verifies the release's driver manifest. The manifest is itself an attested release artifact, so it cannot redirect asset selection before provenance has been established.
func (GitHubReleaseSource) Open ¶
func (source GitHubReleaseSource) Open(ctx context.Context, asset Asset) (io.ReadCloser, error)
type IdentityVerifier ¶
type IdentityVerifier interface {
Verify(context.Context, VerificationCandidate) error
}
IdentityVerifier represents the Android package-identity or iOS bundle-signature check required before publication.
type IntegerRange ¶
type Manager ¶
type Manager struct {
// CacheRoot is the drivers directory. Production callers use
// ~/.flowbaton/drivers; tests and isolated tools inject a temporary root.
CacheRoot string
Source ArchiveSource
Verifier IdentityVerifier
Locker Locker
}
func (Manager) Acquire ¶
func (m Manager) Acquire(ctx context.Context, resolved ResolvedAsset) (acquired AcquiredAsset, returnErr error)
func (Manager) Cleanup ¶
func (m Manager) Cleanup(ctx context.Context, policy RetentionPolicy) error
func (Manager) EnsureCacheRoot ¶
EnsureCacheRoot creates and validates the manager's cache boundary without acquiring an asset. Metadata stored beside version directories uses the same no-symlink path contract as archive publication.
type Manifest ¶
type Manifest struct {
SchemaVersion string `json:"schema_version"`
ManifestVersion string `json:"manifest_version"`
Assets []Asset `json:"assets"`
}
func ParseManifest ¶
type NonRegularCandidateError ¶
NonRegularCandidateError reports that the extracted asset was replaced by a symlink, directory, device, or other non-regular filesystem entry. Path and Mode come from Lstat, so inspecting the error never follows the entry.
func (*NonRegularCandidateError) Error ¶
func (e *NonRegularCandidateError) Error() string
type Platform ¶
type Platform string
Platform identifies the device platform represented by a feasibility fixture.
type PublishedFixture ¶
PublishedFixture describes a successfully and atomically published fixture.
type ResolvedAsset ¶
type RetentionPolicy ¶
type RetentionPolicy struct {
ActiveHostVersion string
ActiveAssetHashes []string
PreviousHostVersion string
}
RetentionPolicy keeps the selected asset hashes for the active host version and the complete immediately previous host version. Other directories are removed only when their cache marker proves Flowbaton ownership.
type VerificationCandidate ¶
type VerificationCandidate struct {
Path string
Platform Platform
Identity string
Kind VerificationKind
}
VerificationCandidate is passed to an injected platform-aware verifier after the payload has passed internal hash and mode checks but before publication.
type VerificationKind ¶
type VerificationKind string
VerificationKind identifies the external identity check an artifact requires. The publisher injects this check; it does not implement Android package parsing or Apple code-signature verification itself.
const ( VerificationPackageIdentity VerificationKind = "package-identity" VerificationBundleSignatureIdentity VerificationKind = "bundle-signature-identity" )