Report recorded decision evidence and harden the Pi artifacts env

Refinements on top of the human decision stage (a6aff47):

- `pipelines decide` now reports the feedback the server actually stored for
  the chosen option, so a repeated (idempotent) decision shows the recorded
  evidence instead of the ignored request text. A repeated decision is covered
  by a new assertion that also checks the step output does not change.
- The decision option/feedback output keys are defined once in protocol
  (DecisionOptionKey/DecisionFeedbackKey) with a DecisionEvidence reader, and
  the store and CLI use them instead of bare string literals.
- piEnvironment drops any inherited PIPELINES_ARTIFACTS_DIR before spawning Pi,
  so the artifactsDir argument is authoritative and an ambient directory (for
  example Pipelines' own when a stage runs inside another stage) never leaks
  into a child that was given none. Covered by a test with an ambient value set.
This commit is contained in:
2026-10-16 17:25:48 +01:00
parent a6aff47117
commit 98bbc2deac
6 changed files with 63 additions and 4 deletions
+14
View File
@@ -79,6 +79,20 @@ func TestCLIDecideWaitingHumanRun(t *testing.T) {
t.Fatalf("derived verdict missing the decision: %+v", gate.Verdict)
}
// A repeated decision must not double-apply and must report the recorded
// evidence, not the ignored request text.
repeat, err := run("decide", strconv.FormatInt(runID, 10), "gate", "--option", "go", "--feedback", "again")
if err != nil {
t.Fatal(err)
}
if strings.Contains(repeat, "again") || !strings.Contains(repeat, "approved") {
t.Fatalf("repeated decision reported the request, not the recorded evidence: %q", repeat)
}
after := waitFor("succeeded")
if len(after.Steps) != 1 || after.Steps[0].Output["feedback"] != "approved" {
t.Fatalf("repeated decision changed the recorded evidence: %+v", after.Steps)
}
if _, err := run("help", "decide"); err != nil {
t.Fatal(err)
}