Documentation
¶
Index ¶
- func ClearAssigneeIfHumanReview(merged lib.TaskFrontmatter) string
- func ExtractBody(ctx context.Context, content []byte) (string, error)
- func ExtractFrontmatter(ctx context.Context, content []byte) (string, error)
- func FindTaskFilePath(ctx context.Context, gitClient gitclient.GitClient, taskDir string, ...) (string, lib.TaskFrontmatter, error)
- func HealTargetVault(fm lib.TaskFrontmatter, vaultName string)
- type GuardDecision
- type ResultWriter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClearAssigneeIfHumanReview ¶
func ClearAssigneeIfHumanReview(merged lib.TaskFrontmatter) string
ClearAssigneeIfHumanReview enforces the spec-039 / spec-042 doctrine: when merged frontmatter has phase == "human_review", clear assignee via clearAssignee (which captures the prior assignee into previous_assignee if non-empty, then sets assignee to ""). Returns the prior assignee name (empty string when no clear happened OR when the prior assignee was already empty). This is the single chokepoint for the human_review assignee-clear invariant; both the result writer and the partial-update executor (spec 042) route through here.
func ExtractBody ¶
ExtractBody returns the file body — the bytes after the closing "---\n" delimiter. Returns an empty string if the body is empty; error if delimiters are missing.
func ExtractFrontmatter ¶
ExtractFrontmatter returns the YAML frontmatter string between the opening and closing "---" delimiters. Returns an error if delimiters are missing.
func FindTaskFilePath ¶
func FindTaskFilePath( ctx context.Context, gitClient gitclient.GitClient, taskDir string, id lib.TaskIdentifier, ) (string, lib.TaskFrontmatter, error)
FindTaskFilePath lists files in taskDir via gitClient and returns the relative path of the .md file whose frontmatter has task_identifier == id, plus the parsed existing frontmatter. Returns ("", nil, nil) when no match is found (not an error). Returns ("", nil, err) naming both paths when more than one file carries id: the match is ambiguous, so no caller may write. Callers must check the error before treating an empty path as "not found" — the two outcomes mean opposite things.
func HealTargetVault ¶ added in v0.7.0
func HealTargetVault(fm lib.TaskFrontmatter, vaultName string)
HealTargetVault stamps the controller's vaultName into frontmatter when the target_vault key is absent. An existing value (any value) is never overridden. This is the heal-on-write half of the frontmatter-command routing guard: a legacy task file created before target_vault stamping is written by whichever controller owns the write, and this stamp ensures the non-owning controller permanently stops falling through to that file (ShouldProcessResult and ShouldProcessFrontmatterCommand both return false for a mismatched stamp). Mutates fm in place; no-op when the key is already present.
Types ¶
type GuardDecision ¶ added in v0.6.2
GuardDecision records a single ownership-guard discard: the merge kept the on-disk value of a controller-owned field (or the pinned terminal status) and rejected a differing incoming value. Equal values produce no decision.
func MergeFrontmatter ¶ added in v0.6.2
func MergeFrontmatter( existing, incoming lib.TaskFrontmatter, ) (lib.TaskFrontmatter, []GuardDecision)
MergeFrontmatter returns a new frontmatter map with all keys from existing, overridden by all keys from incoming, then applies the field-ownership guard: controller-owned counters take the on-disk value when present on disk and are absent from the result when not; a terminal on-disk status is pinned; and operator-owned routing fields (assignee, previous_assignee) take the on-disk value when present on disk, with an incoming empty assignee always applied as the deliverer's clear exception. The returned decisions name every field whose differing incoming value was discarded (equal values produce no decision). Neither input map is modified.
type ResultWriter ¶
ResultWriter writes a Task back to the vault task file.
func NewResultWriter ¶
func NewResultWriter( gitClient gitclient.GitClient, taskDir string, vaultName string, currentDateTime libtime.CurrentDateTimeGetter, m metrics.Metrics, waiter libtime.WaiterDuration, ) ResultWriter
NewResultWriter creates a ResultWriter that locates task files in the vault and writes the result, committing via gitClient. vaultName is the controller's VAULT_NAME, used to heal legacy task files that lack a target_vault stamp.