finish

package
v1.17.2 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package finish ships Harbor's stub Planner — a planner that always returns Finish{Reason: Goal}. The stub exists to prove the Planner interface holds end-to-end:

  • It compiles against `internal/planner.Planner`.
  • It demonstrates the §13 import-graph contract (no `internal/runtime/...` imports).
  • It exercises the concurrent-reuse contract — a shared stub instance handles N=128 concurrent Next calls under -race without races, context bleed, cancel cross-talk, or goroutine leaks.

Production planner concretes land (ReAct) and the Deterministic work (Deterministic). The stub stays in V1 as a test fixture for the conformance pack + integration tests that need a deterministic terminal result.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*Planner)

Option is the functional-options constructor knob set.

func WithMetadata

func WithMetadata(metadata map[string]any) Option

WithMetadata sets the fixed Finish.Metadata template. The Next path shallow-copies the map and adds a `run_id` entry sourced from RunContext.Quadruple.RunID so the conformance pack (and the concurrent-reuse test) can assert per-call identity round-trip.

Default: nil (no metadata).

func WithPayload

func WithPayload(payload any) Option

WithPayload sets the fixed Finish.Payload value. Default: nil.

type Planner

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

Planner is the stub planner. It always returns Finish{Reason: Goal}; the optional payload is configurable via WithPayload / WithMetadata. The planner is goroutine-safe: no per-run mutable state lives on the receiver.

Implements planner.WakeAware → WakePush (the safe default for a concrete that never spawns non-retain-turn tasks).

func New

func New(opts ...Option) *Planner

New constructs a stub planner. The returned value satisfies planner.Planner and planner.WakeAware.

The stub is safe for concurrent reuse — no per-call state lives on the receiver.

func (*Planner) Next

Next is the planner contract. The stub always returns Finish{Reason: planner.FinishGoal} with the configured payload + per-call metadata (including the run's RunID).

Honours ctx.Err() — when the context is cancelled before Next runs, returns nil + ctx.Err() so the runtime executor can surface the cancellation as the standard ctx-derived error rather than a stub- invented one.

func (*Planner) WakeMode

func (p *Planner) WakeMode() planner.WakeMode

WakeMode declares the stub's wake-on-resolution strategy. The stub never spawns non-retain-turn tasks, so the choice is structurally irrelevant; WakePush is the documented default the conformance pack assumes for non-WakeAware planners (the stub implements the interface explicitly so the conformance pack can exercise the WakeAware code path).

Jump to

Keyboard shortcuts

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