review

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package review implements the PM review gate: structured, auditable edits that flow back into the assessment IR (an override, or a new assessment cycle) — never a direct edit to a rendered/compiled report (prism-roadmap PRD FR13: "the rendered report is never directly edited; narrative-slot text is the sole PM-editable rendering element").

Applying edits and recompiling are deliberately separate steps: Apply never touches a compile.Store's ReportDataset, so every dataset stays a pure function of the IR at the moment it was compiled. Callers apply edits, then call compile.Compile explicitly to see them reflected.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Apply

func Apply(ctx context.Context, s Store, edit Edit) error

Apply validates and persists one review edit.

func ApplyBatch

func ApplyBatch(ctx context.Context, s Store, edits []Edit) error

ApplyBatch applies a sequence of edits in order, stopping at the first failure. Callers typically follow a batch with a single compile.Compile call rather than recompiling after each individual edit.

Types

type Edit

type Edit struct {
	Kind EditKind

	// AssessmentID is required for EditClearOverride; ignored otherwise
	// (Override/Assessment/Profile already carry their own ID).
	AssessmentID string

	Override   *assessment.RankOverride
	Assessment *assessment.OpportunityAssessment
	Profile    *assessment.ProfileAssignment
}

Edit is one structured, auditable review action. Exactly one of Override, Assessment, or Profile is set, matching Kind.

func (Edit) Validate

func (e Edit) Validate() error

Validate returns an error if the edit is not well-formed for its Kind.

type EditKind

type EditKind string

EditKind identifies what a review edit changes.

const (
	// EditOverride records a governance override moving an opportunity to
	// an explicit final rank, with rationale — new evidence for the
	// ranking decision, never a reweighting of RICE/MoSCoW inputs to
	// manufacture a desired number (ideation doc).
	EditOverride EditKind = "override"

	// EditClearOverride removes a previously-recorded override, reverting
	// the opportunity to its calculated rank on the next compile.
	EditClearOverride EditKind = "clear_override"

	// EditAssessment records a new assessment cycle: a corrected effort
	// estimate, a reclassified dimension, or any other judgment change —
	// including a "defer" (a cycle whose MoSCoW resolves to Won't). This
	// is the mechanism for prism-roadmap PRD FR13's "corrected effort",
	// "reclassification", and "defer/suppress": all are new
	// evidence-backed judgments, not overrides, and belong in a new
	// NextCycle rather than mutating a past assessment (prism-roadmap TRD
	// D1) — there is no separate EditKind for defer because it is not a
	// structurally different persistence path, just a particular outcome
	// of a new cycle's MoSCoWAnswers.
	EditAssessment EditKind = "assessment"

	// EditProfile records a change to an opportunity's COMPASS-RICE
	// profile assignment: a PM confirming or rejecting a judge's
	// proposal, or assigning a profile directly. Status lives on the
	// record itself (assessment.ProfileAssignment.Status), so this one
	// edit kind covers propose/confirm/reject/override — there is no
	// separate EditKind per transition, matching EditAssessment's "the
	// outcome varies, the persistence path doesn't" reasoning. A PM's
	// acceptance of a NeedsHumanReview-flagged CompassAssessment is NOT
	// this kind — that rides EditAssessment (a new cycle with
	// CompassAssessment.HumanReview set), since it is a judgment change
	// on the assessment record, not the profile assignment.
	EditProfile EditKind = "profile"
)

type Store

type Store interface {
	SaveRankOverride(ctx context.Context, o assessment.RankOverride) error
	DeleteRankOverride(ctx context.Context, assessmentID string) error
	SaveOpportunityAssessment(ctx context.Context, a assessment.OpportunityAssessment) error
	SaveProfileAssignment(ctx context.Context, p assessment.ProfileAssignment) error
}

Store is the persistence surface Apply needs.

Jump to

Keyboard shortcuts

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