Documentation
¶
Overview ¶
Package projection computes the user-facing projections — Current Understanding (§5), Recommended Next Move (§6), and What Changed (§7) — deterministically from relational state. They are projections, not a source of truth, and every statement retains provenance.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DedupDecisions ¶ added in v0.5.0
DedupDecisions is dedupDecisionsForDisplay for callers outside the package: the decisions endpoint the UI reads applies it too, so the page and the guidance agree on how many decisions there are.
func SameQuestion ¶ added in v0.5.0
SameQuestion reports whether two decision questions are the same question for display: equal after normalizeDecisionQuestion.
Types ¶
type ChangeGroup ¶
ChangeGroup is one grouped category of changes.
type Changed ¶
type Changed struct {
Groups []ChangeGroup `json:"groups"`
Through int64 `json:"through"`
}
Changed is the grouped What Changed projection. Through is the highest event sequence actually consumed by this projection (or the caller's cursor when no events matched) — the client echoes it back to the read-cursor write so that exactly what was shown is marked seen, never events that arrived mid-read.
type DecisionView ¶
type DecisionView struct {
ID string `json:"id"`
Code string `json:"code"`
Question string `json:"question"`
Recommendation string `json:"recommendation"`
Options []string `json:"options"`
Resolution string `json:"resolution,omitempty"`
Status domain.DecisionStatus `json:"status"`
HasDissent bool `json:"has_dissent"`
Dissents []DissentView `json:"dissents"`
Synthesis string `json:"synthesis,omitempty"`
}
DecisionView is a decision in the projection (with dissent presence).
type DissentView ¶
type DissentView struct {
ProponentRole string `json:"proponent_role"`
Position string `json:"position"`
}
DissentView is one dissenting position on a decision (§8).
type Guidance ¶
type Guidance struct {
Action string `json:"action"`
Why string `json:"why"`
Affected []string `json:"affected"`
// NextTask is the task Execute would run next, omitted when there is none
// (the Build contract's `next_task`, reusing workflow's nextReadyTask).
// Omitted rather than null: every other daemon endpoint's contract is
// "never emit a null field" (TestNoEndpointEmitsANullArray), and this is
// the same rule applied to a single optional object instead of a slice.
// BuildGuidance leaves this nil: it stays a pure function of Understanding
// with no engine/task-store access, so the daemon handler populates it
// after calling BuildGuidance (via Engine.NextReadyTask).
NextTask *NextTaskRef `json:"next_task,omitempty"`
// RunBlockedReason is empty (and so omitted) when Execute could start
// right now for this initiative, otherwise a user-facing sentence naming
// the fix (the Build contract's `run_blocked_reason`): another change set
// still open, an operation already running, the plan not approved yet, or
// -- composed in by the daemon handler, not here -- the executor not
// being ready. Same population note as NextTask.
RunBlockedReason string `json:"run_blocked_reason,omitempty"`
}
Guidance is the Recommended Next Move projection.
func BuildGuidance ¶
func BuildGuidance(ini domain.Initiative, understanding Understanding) Guidance
BuildGuidance computes the Recommended Next Move with deterministic precedence: judgment items outrank stage advancement (§6, §9).
type NextTaskRef ¶ added in v0.5.0
type NextTaskRef struct {
ID string `json:"id"`
HumanID string `json:"human_id"`
Title string `json:"title"`
}
NextTaskRef is the Build contract's `next_task` shape: enough to name and link the task without exposing the full domain.Task.
type QuestionView ¶
type QuestionView struct {
ID string `json:"id"`
Question string `json:"question"`
Status domain.QuestionStatus `json:"status"`
}
QuestionView is an open question in the projection.
type RequirementView ¶
type RequirementView struct {
ID string `json:"id"`
Code string `json:"code"`
Statement string `json:"statement"`
Priority domain.RequirementPriority `json:"priority"`
Status domain.RequirementStatus `json:"status"`
AcceptanceCriteria []domain.AcceptanceCriterion `json:"acceptance_criteria"`
}
RequirementView is a requirement in the projection.
type Understanding ¶
type Understanding struct {
Title string `json:"title"`
Description string `json:"description"`
Status domain.InitiativeStatus `json:"status"`
FailureReason string `json:"failure_reason,omitempty"`
Summary string `json:"summary"`
NeedsJudgment []string `json:"needs_judgment"`
Assertions []UnderstandingItem `json:"assertions"`
Requirements []RequirementView `json:"requirements"`
Decisions []DecisionView `json:"decisions"`
Questions []QuestionView `json:"questions"`
}
Understanding is the Current Understanding projection.
func BuildUnderstanding ¶
func BuildUnderstanding(ctx context.Context, db *store.DB, ini domain.Initiative) (Understanding, error)
BuildUnderstanding assembles the Current Understanding projection.
type UnderstandingItem ¶
type UnderstandingItem struct {
ID string `json:"id"`
Type domain.AssertionType `json:"type"`
Status domain.AssertionStatus `json:"status"`
Statement string `json:"statement"`
Confidence domain.Confidence `json:"confidence"`
Source string `json:"source"`
Provenance []domain.ProvenanceRef `json:"provenance"`
ProducedByRun string `json:"produced_by_run"`
}
UnderstandingItem is one provenance-backed statement.