identity

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// StoryRunTriggerTokenAnnotation carries the caller-provided trigger token for idempotent StoryRun creation.
	StoryRunTriggerTokenAnnotation = contracts.StoryRunTriggerTokenAnnotation
	// StoryRunTriggerInputHashAnnotation optionally carries a hash of the inputs for token-based validation.
	StoryRunTriggerInputHashAnnotation = "storyrun.bubustack.io/trigger-input-hash"
	// StoryRunRedriveTokenAnnotation requests a full redrive of the StoryRun when changed.
	StoryRunRedriveTokenAnnotation = "storyrun.bubustack.io/redrive-token"
	// StoryRunRedriveObservedAnnotation records the last redrive token processed by the controller.
	StoryRunRedriveObservedAnnotation = "storyrun.bubustack.io/redrive-observed"
	// StoryRunRedriveFromStepAnnotation requests a partial rerun starting from a step.
	// Format: "<step-name>:<token>" (token must change to retrigger).
	StoryRunRedriveFromStepAnnotation = "storyrun.bubustack.io/redrive-from-step"
	// StoryRunRedriveFromStepObservedAnnotation records the last redrive-from-step token processed.
	StoryRunRedriveFromStepObservedAnnotation = "storyrun.bubustack.io/redrive-from-step-observed"
)
View Source
const (
	// StoryRunTriggerRequestNameAnnotation records the originating StoryTrigger name on StoryRuns created
	// through the durable trigger request path.
	StoryRunTriggerRequestNameAnnotation = "storyrun.bubustack.io/trigger-request-name"
	// StoryRunTriggerRequestUIDAnnotation records the originating StoryTrigger UID on StoryRuns created
	// through the durable trigger request path.
	StoryRunTriggerRequestUIDAnnotation = "storyrun.bubustack.io/trigger-request-uid"
)

Variables

This section is empty.

Functions

func ComputeTriggerInputHash

func ComputeTriggerInputHash(raw []byte) (string, error)

ComputeTriggerInputHash returns a stable sha256 hash of trigger inputs. Inputs are decoded into JSON and re-encoded to ensure a canonical ordering.

func ComputeTriggerInputHashFromRawExtension

func ComputeTriggerInputHashFromRawExtension(inputs *runtime.RawExtension) (string, error)

ComputeTriggerInputHashFromRawExtension returns the trigger input hash from a RawExtension.

func ComputeTriggerInputHashFromValue

func ComputeTriggerInputHashFromValue(value any) (string, error)

ComputeTriggerInputHashFromValue returns a stable sha256 hash of the provided trigger input value. Nil values are treated as an empty JSON object to match ComputeTriggerInputHash(nil).

func DeriveEffectClaimName

func DeriveEffectClaimName(stepRunNamespace, stepRunName, effectKey string) string

DeriveEffectClaimName returns the deterministic EffectClaim name for the provided StepRun namespace/name and effect key.

func DeriveStoryRunName

func DeriveStoryRunName(storyNamespace, storyName, token string) string

DeriveStoryRunName returns the deterministic StoryRun name for the trigger token. This matches the SDK naming algorithm so server-side validation stays consistent.

func DeriveStoryTriggerName

func DeriveStoryTriggerName(storyNamespace, storyName, key, submissionID string) string

DeriveStoryTriggerName returns the deterministic StoryTrigger name for the provided story namespace/name and trigger identity.

func SelectorLabels

func SelectorLabels(storyRun string) map[string]string

SelectorLabels returns a copy of the deterministic StoryRun selector labels.

func ServiceAccountName

func ServiceAccountName(storyRun string) string

ServiceAccountName exposes the canonical `<storyRun>-engram-runner` name.

func ServiceAccountSubject

func ServiceAccountSubject(name, namespace string) rbacv1.Subject

ServiceAccountSubject returns an RBAC subject for the ServiceAccount in namespace.

func StepRunIdempotencyKey

func StepRunIdempotencyKey(namespace, storyRunName, stepID string) string

StepRunIdempotencyKey builds a stable idempotency key for a step execution. The key is derived from namespace, StoryRun name, and Step ID, and is trimmed to the API's max length by falling back to a hash when needed.

func StoryTriggerIdentity

func StoryTriggerIdentity(key, submissionID string) string

StoryTriggerIdentity returns the durable business identity for a trigger request. The key wins when present; otherwise the per-submission identifier is used.

Types

type EngramRunner

type EngramRunner struct {
	// contains filtered or unexported fields
}

EngramRunner captures the shared metadata for the `<storyRun>-engram-runner` contract.

func NewEngramRunner

func NewEngramRunner(storyRun string) EngramRunner

NewEngramRunner constructs a new EngramRunner helper.

func (EngramRunner) SelectorLabels

func (e EngramRunner) SelectorLabels() map[string]string

SelectorLabels returns a copy of the deterministic selector labels controllers share.

func (EngramRunner) ServiceAccountName

func (e EngramRunner) ServiceAccountName() string

ServiceAccountName exposes the canonical `<storyRun>-engram-runner` ServiceAccount.

func (EngramRunner) StoryRun

func (e EngramRunner) StoryRun() string

StoryRun returns the owning StoryRun name.

func (EngramRunner) Subject

func (e EngramRunner) Subject(namespace string) rbacv1.Subject

Subject builds the RBAC Subject pointing at the runner ServiceAccount.

Jump to

Keyboard shortcuts

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