currentstatecoord

package
v0.41.0 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2026 License: AGPL-3.0 Imports: 28 Imported by: 0

Documentation

Overview

Package currentstatecoord coordinates current-state transition operations over explicitly selected immutable repository universes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompleteContext

func CompleteContext(prep *ContextPreparation, corpus adr.Corpus, topics topic.Corpus, plans []plan.Plan, declarations []outputplan.Declaration) contextinput.Input

CompleteContext consumes Publisher's defensive semantic projections. The coordinator deliberately depends only on neutral values, never Publisher.

func QueryTopic

func QueryTopic(root string, repo *awfgit.Repo, ctx context.Context, selector string, opts topic.QueryOptions) (topic.QueryResult, error)

QueryTopic selects and validates one working authority universe before delegating topic query semantics to topic.

func ReadPlan

func ReadPlan(root, name, selector string) ([]byte, error)

ReadPlan selects one plan from the working filesystem and completes its plan-v2 authority projection. Parsing, selection, closure, and rendering remain owned by plan and plancheck.

Types

type CommitAuthorizationResult

type CommitAuthorizationResult struct {
	Category          string
	Condition         string
	ChangedIndex      bool
	ChangedMessage    bool
	ChangedMergeState bool
	NextActions       []string
}

CommitAuthorizationResult is the non-mutating outcome of definitive commit-message stale-merge authorization.

func CheckCommitAuthorization

func CheckCommitAuthorization(root string, repo *awfgit.Repo, ctx context.Context, msg commitmsg.Message) (CommitAuthorizationResult, error)

CheckCommitAuthorization validates the index, first parent, every incoming MERGE_HEAD parent, and the cleaned final message without mutating any axis.

type ContextPreparation

type ContextPreparation struct {
	State  *projectstate.ProjectState
	Config *config.Config
	Reader outputplan.TreeReader
	// contains filtered or unexported fields
}

ContextPreparation selects one immutable tree, config, lock, reader, and publisher state. Publisher receives these exact values and completion never reparses their ADR, topic, or plan corpora.

func PrepareFocusedWorkingContext added in v0.41.0

func PrepareFocusedWorkingContext(state *projectstate.ProjectState, repo *awfgit.Repo, ctx context.Context, requests []string) (*ContextPreparation, error)

PrepareFocusedWorkingContext captures complete live metadata while reading only the bytes needed by the ordinary answer. Config and lock form the operation's initial frozen facts; the second read is a delta, never a new configuration universe.

func PrepareStagedContext

func PrepareStagedContext(ctx context.Context, root string) (*ContextPreparation, error)

PrepareStagedContext selects only the index universe for staged context output. It never consults working-tree configuration or locks.

func PrepareWorkingContext

func PrepareWorkingContext(state *projectstate.ProjectState, repo *awfgit.Repo, ctx context.Context) (*ContextPreparation, error)

PrepareWorkingContext selects the working universe once for context output.

func (*ContextPreparation) Lock

func (p *ContextPreparation) Lock() *manifest.Lock

Lock returns a defensive projection for a project-owned comparison.

func (*ContextPreparation) Tree

func (p *ContextPreparation) Tree() *snapshot.Tree

Tree returns the immutable selected snapshot for a project-owned comparison.

type CurrentStateReport

type CurrentStateReport struct {
	Static      []currentstate.Finding
	Provisional []currentstate.Introduction
	Coverage    []topic.CoverageFinding
	PlanDrift   []manifest.Drift
	PlanNotes   []string
	// PlanResult retains PlanChecker classification while PlanDrift and
	// PlanNotes remain compatibility projections.
	PlanResult checkresult.Result
	// CurrentResult and PlanArtifactResult retain disjoint typed partitions for
	// command presentation. OwnerResult is their immutable aggregate. Legacy
	// slices remain compatibility projections.
	CurrentResult      checkresult.Result
	PlanArtifactResult checkresult.Result
	OwnerResult        checkresult.Result
}

CurrentStateReport is the routed outcome of a current-state check over one snapshot: the static ADR-to-claim handshake findings (all blocking), staged older-format introductions awaiting commit-message evidence, and the coverage/fan-out findings, which carry ranks fixed in code rather than configured - coverage at error, fan-out at warn (ADR-0183). Findings and Notes split the report into blocking lines and non-failing note lines so the command layer never re-derives the routing.

func CheckStaged

func CheckStaged(root string, repo *awfgit.Repo, ctx context.Context) (CurrentStateReport, error)

CheckStaged loads the HEAD (before) and staged index (after) current-state universes and runs the snapshot-diff transition check between them plus the coverage/fan-out evaluator over the index (ADR-0135, ADR-0134). Both sides are committed or index universes, so a dirty working tree never affects the result. The before side is the empty universe on a repository with no commit yet, and the after config, policy, and eligible paths all come from the index tree so the staged check reads one universe. Coverage and fan-out always evaluate, whether or not the staged config declares a currentState policy (ADR-0192).

func CheckStagedRoot

func CheckStagedRoot(ctx context.Context, root string) (CurrentStateReport, error)

CheckStagedRoot validates the staged current-state transition without opening working-tree project configuration. The staged command must remain operable when a valid adopted index deliberately deletes or lacks the working config.

func CheckWorking

func CheckWorking(root string, repo *awfgit.Repo, ctx context.Context) (CurrentStateReport, error)

CheckWorking loads the working-tree current-state view and runs the static ADR-to-claim handshake and the coverage/fan-out evaluator over it (ADR-0135, ADR-0134). It reads exactly one working Tree, so the two checks never mix a working and an index universe. Coverage and fan-out always evaluate, whether or not the project configures a currentState policy (ADR-0192).

func (CurrentStateReport) Information

func (r CurrentStateReport) Information() []string

Information returns unranked provisional introductions. They are not findings because the staged boundary lacks definitive merge-parent and message evidence; every independently derivable finding remains blocking.

func (CurrentStateReport) Result

Result returns the completed owner-classified result captured by the current-state coordinator. Compatibility slices cannot change it afterward.

type NumberAssignment

type NumberAssignment struct {
	Slug   string
	Number string
}

NumberAssignment is one pending record's slug and the number numbering gave it.

type NumberingEffect added in v0.41.0

type NumberingEffect struct {
	Kind string
	Path string
}

NumberingEffect is one exact root-relative path fact committed before a later numbering failure.

type NumberingReport

type NumberingReport struct {
	Assignments []NumberAssignment
}

NumberingReport is the mapping one numbering run assigned, in assignment order, so its caller can present it after a partial completion.

func NumberPendingADRsLeased added in v0.41.0

func NumberPendingADRsLeased(root string, slugs []string, publish func() (PublicationOutcome, error), lease *filesystem.Lease) (NumberingReport, error)

NumberPendingADRsLeased loads the pre-mutation authority universe through the selected-root handle, numbers its pending records, substitutes topic provenance, and then runs publish against the separately selected post-mutation universe. The caller retains the covering lease through presentation of the returned complete or partial outcome.

func (NumberingReport) Document

func (r NumberingReport) Document() (presentation.Document, error)

Document maps numbering assignments to their semantic presentation.

type PartialNumberingError added in v0.41.0

type PartialNumberingError struct {
	Report      NumberingReport
	Effects     []NumberingEffect
	Publication PublicationOutcome
	Cause       error
	Recovery    []string
}

PartialNumberingError retains exact numbering, provenance, and Publisher effects after numbering has crossed its first mutation. It preserves the mechanism cause and supplies a residue-first recovery boundary.

func (*PartialNumberingError) Document added in v0.41.0

func (*PartialNumberingError) Error added in v0.41.0

func (e *PartialNumberingError) Error() string

func (*PartialNumberingError) Unwrap added in v0.41.0

func (e *PartialNumberingError) Unwrap() error

type PublicationOutcome added in v0.41.0

type PublicationOutcome interface {
	HasCommittedEffects() bool
	PartialMutation() (presentation.Mutation, error)
}

PublicationOutcome is the owner-rendered Publisher result retained by ADR numbering when publication crosses its own mutation boundary.

Jump to

Keyboard shortcuts

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