oficina / equipo Public

Clone
git clone https://amadan.net/oficina/equipo

Plain git — no account needed to clone.

Download

Download this file

1package team
2
3import (
4 "encoding/json"
5 "strings"
6 "testing"
7)
8
9func TestApprovedBeyondProfilePublication(t *testing.T) {
10 g := newGitEnv(t)
11 var raw map[string]any
12 must(t, json.Unmarshal(mustJSON(g.observed.Isolation), &raw))
13 raw["profile_approvals"] = []any{map[string]any{"question_id": "q", "request_id": "7", "item_id": "item", "turn_id": "turn", "session_id": "session", "person": "owner@example.com", "label": "approved beyond profile", "request": json.RawMessage(`{"id":7,"command":"printf hello","cwd":"/workspace"}`)}}
14 must(t, json.Unmarshal(mustJSON(raw), &g.observed.Isolation))
15 g.build()
16 // Independent review inherits the builder's approval evidence.
17 delete(raw, "profile_approvals")
18 g.observed.Isolation = IsolationSnapshot{}
19 must(t, json.Unmarshal(mustJSON(raw), &g.observed.Isolation))
20 g.review()
21 g.verify(true)
22 h := g.claimStep("publish")
23 p, err := g.store.Publication(g.ctx, g.scope, h)
24 must(t, err)
25 if !strings.Contains(p.Description, "approved beyond profile") || !strings.Contains(p.Description, "owner@example.com") || !strings.Contains(p.Description, "printf hello") {
26 t.Fatal("publication lost approved profile evidence", p.Description)
27 }
28 var d PublicationDescription
29 must(t, json.Unmarshal([]byte(p.Description), &d))
30 for _, e := range d.Evidence {
31 if !strings.Contains(string(mustJSON(e.Provenance.Isolation)), "approved beyond profile") {
32 t.Fatal("review evidence lost approval", e.Role)
33 }
34 }
35 var stripped IsolationSnapshot
36 must(t, json.Unmarshal(mustJSON(raw), &stripped))
37 if IsolationContains(stripped, p.Isolation) {
38 t.Fatal("label stripping accepted")
39 }
40}
41