Skip to content

fix: write goal flags as booleans and record their provenance - #382

Merged
bborbe merged 4 commits into
masterfrom
fix/goal-set-flag-boolean-provenance
Nov 17, 2026
Merged

bborbe merged 4 commits into
masterfrom
fix/goal-set-flag-boolean-provenance

Conversation

@bborbe

@bborbe bborbe commented Nov 17, 2026

Copy link
Copy Markdown
Owner

What

vault-cli goal set <goal> flag true wrote flag: "true" — a quoted string — and had no way to record who set the flag. task set has written an unquoted boolean plus flag_set_by / flag_set_at since the flag-provenance change; the goal verb never got the same treatment.

Why

scripts/flagged-rows.py in claude-supervisor refuses a goal flag carrying no flag_set_by (agent-set-flag), so an agent-set goal flag opens nothing. The quoted form only survives because that script's FLAG_TRUTHY tolerates it — any strict reader (flag is True) silently drops the row. Hand-fixing the frontmatter does not stick: the next goal set rewrites it.

Change

  • GoalFrontmatter: setFlagField / SetFlag / ClearFlag, a case "flag" in SetField, and provenance cleanup in ClearField — a mirror of the task path.
  • writeFlagProvenance lifted from a method on *frontmatterSetOperation to a package-level helper over *domain.FrontmatterMap, taking the entity type so both verbs share one truthiness switch.
  • flagProvenanceSetRefusal takes the entity type, so a goal refusal names vault-cli goal set.
  • EntitySetOperation.Execute carries actor; theme / objective / vision / topic ignore it.
  • --by registered for goal only, with the task verb's non-flag-key guard.
  • Tests at domain, ops and CLI (integration/cli_test.go); docs/goal-writing.md; ## Unreleased bullet.

Evidence

Fixture vault, freshly built binary:

$ vault-cli goal set "Flag Target" flag true
2:flag: true

$ vault-cli goal set "Flag Target" flag false
2:flag: false

$ vault-cli goal set "Flag Target" flag true --by operator
2:flag: true
3:flag_set_at: 2026-11-17T04:31:28.201004+01:00
4:flag_set_by: operator

$ vault-cli goal set "Flag Target" flag_set_by x
Error: refusing to set "flag_set_by" on "Flag Target": flag_set_by is written only by the
same invocation that sets the flag; use `vault-cli goal set "Flag Target" flag true --by <actor>`

$ vault-cli goal clear "Flag Target" flag
0        # flag, flag_set_by and flag_set_at all removed

$ vault-cli goal set "Flag Target" phase execution
2:flag: true
5:phase: execution   # a non-boolean field is written exactly as before

make precommit green on the branch.

Task: 7c1e4b2a-3f6d-4e8a-9b51-2d0a6c8f4e17

@bborbe
bborbe marked this pull request as ready for review November 17, 2026 03:37

@ben-s-pull-request-reviewer ben-s-pull-request-reviewer Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change correctly writes a goal's flag as an unquoted YAML boolean and composes flag_set_by/flag_set_at onto the same map so the single WriteGoal persists all three together, mirroring the established task set contract; I verified the ordering, the set-path refusal, the clear routing, and the generated mock against the worktree and found no blocking defect. Non-blocking gaps remain: a clear-path hole that can still produce an unattributed flagged goal despite the new documented invariant, and missing tests for the new flag-value parsing and the goal-specific --by guard.

@bborbe
bborbe merged commit 80280cb into master Nov 17, 2026
8 checks passed
@bborbe
bborbe deleted the fix/goal-set-flag-boolean-provenance branch November 17, 2026 03:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant