|
| 1 | +## ROLLUPE (round 7, both-directions) -- 0428-142 |
| 2 | + |
| 3 | +- Session ID: not exposed by this interface (Ornit worker, lane `0428-142-witnessfix3`). |
| 4 | +- Model: worker-ornith1.5 (providerID agentgateway). |
| 5 | +- Backend: not exposed by this interface. |
| 6 | +- Execute time: 2026-11-21, UTC. |
| 7 | +- Candidate base (PR #1702 head / exact review head): `b2f2fd3ac17293949c18223b55936e1018085472`. |
| 8 | +- Task contract: `tasks/t-20261119-r28-perses-status-backend-witness.md`. |
| 9 | +- Prior verdict: `review-4.md` (GPT-6, REQUEST CHANGES). |
| 10 | + |
| 11 | +## Remote attestation (before first commit) |
| 12 | + |
| 13 | +```text |
| 14 | +origin https://github.com/mcpdev80/baseharbor.git (fetch) |
| 15 | +origin https://github.com/mcpdev80/baseharbor.git (push) |
| 16 | +lane-0428-142-statuswitness b2f2fd3ac17293949c18223b55936e1018085472 (== review head) |
| 17 | +develop 40cb28c758b02960356434b630086a341ebe1738 (review-time; moved to d2d4ded3d during this lane) |
| 18 | +``` |
| 19 | + |
| 20 | +Detached worktree `workers/0428-142-witnessfix3-wt` built from exact head `b2f2fd3ac172`, |
| 21 | +git identity `0428-142-witnessfix3` / `0428-142-witnessfix3@baseharbor.local`. |
| 22 | + |
| 23 | +## PLAN (round 7) |
| 24 | + |
| 25 | +1. Locate the current unauthenticated test context helper per the recipe (`withoutOperatorAuthTestContext` at `app_init_wizard.go:29` does NOT resolve here -- that line is the `OTLP` struct field; helper name absent). |
| 26 | +2. Locate the operator-auth gate at `internal/operatorauth/authorization.go:285` and `cmd/baha/mcp.go:301`. |
| 27 | +3. Add the negative end-to-end direction (P2) that fails closed without a verified principal, preserving the positive fixture direction. |
| 28 | +4. Prove the mutation property: the negative direction turns red when the managed-environment operator-auth boundary is removed. |
| 29 | +5. Trace P3 provenance to the exact boundary where it disappears (P3). |
| 30 | +6. Document P4 (run `44875647949`) as inherited-failure STATE, owner point, resolved below. |
| 31 | + |
| 32 | +## P2 -- both directions (done, verified) |
| 33 | + |
| 34 | +The reviewer's cited `withoutOperatorAuthTestContext` (`cmd/baha/app_init_wizard.go:29`) does |
| 35 | +not resolve to that helper at this head -- that line is the `OTLP` struct field and the helper |
| 36 | +name is absent from the exact file. The current repository's unauthenticated seam is the |
| 37 | +managed-environment operator-auth gate, reached two ways on the perses status path: |
| 38 | + |
| 39 | +- `cmd/baha/mcp.go:301` -- `authorizeMCPOperation` wraps the gate text into |
| 40 | + `ErrorAuthenticationFailed` when `ensureOperatorAuthForBoundary` returns a non-runtime error. |
| 41 | +- `internal/operatorauth/authorization.go:285` -- `AuthorizeMachineOperation` returns the exact |
| 42 | + `Managed-environment machine operations require an authenticated BaseHarbor operator.` reason |
| 43 | + when `!ok` (no verified principal) in a managed environment. |
| 44 | + |
| 45 | +Added to `cmd/baha/perses_lifecycle_transport_test.go`: |
| 46 | + |
| 47 | +- `persesUnauthenticatedCommandContext` -- the exact twin of `persesMatrixCommandContext` |
| 48 | + (positive fixture) with `WithVerifiedPrincipal` omitted, plus `withAssumeYes(ctx, true)` so |
| 49 | + the operator-auth boundary returns the configuration-required error deterministically instead |
| 50 | + of an interactive-setup prompt (the plain `ErrConfigurationRequired` classifies as |
| 51 | + `internal_error`, not `runtime_unavailable`, so `mcp.go:301` wraps it into the gate text). |
| 52 | +- `persesRunWithIOUnauthenticated` -- same global-option extraction and same root-command |
| 53 | + dispatch as `persesRunWithIO`, routed through the unauthenticated context. |
| 54 | +- `TestPersesStatusWitnessUnauthenticatedDenied` -- end-to-end `baha app perses status` under the |
| 55 | + unauthenticated context, asserting the operator-auth requirement names the denial, and that no |
| 56 | + backend witness is rendered on the human face. |
| 57 | + |
| 58 | +Mutation property (proven on a throwaway copy, restored immediately): |
| 59 | + |
| 60 | +- Remove the managed-environment operator-auth boundary on BOTH seams |
| 61 | + (`ensureOperatorAuthForBoundary` in `cmd/baha/operator_auth_boundary.go` and |
| 62 | + `AuthorizeMachineOperation` at `internal/operatorauth/authorization.go:285`): the command |
| 63 | + succeeds (`err=nil`, `stdout=[Perses state: configured_unverified ...]`) -- the negative test |
| 64 | + turns red. |
| 65 | +- With the boundary present (current code): `TestPersesStatusWitnessUnauthenticatedDenied` |
| 66 | + PASSES, and the positive `TestPersesStatusWitnessHumanFaceRendersBackendWitness` PASSES. |
| 67 | + |
| 68 | +Both directions exercise the root command (`rootCommand().Execute`) and both are selected by a |
| 69 | +required CLI shard per the CI shard formula |
| 70 | +(`scripts/pr-go-unit-shard.py:60-81`, `sha256(name)[:8] big % 4`): |
| 71 | + |
| 72 | +- `TestPersesStatusWitnessUnauthenticatedDenied` -> cli-0 (required CLI job). |
| 73 | +- `TestPersesStatusWitnessHumanFaceRendersBackendWitness` -> cli-1. |
| 74 | + |
| 75 | +Tested: |
| 76 | + |
| 77 | +``` |
| 78 | +go test ./cmd/baha/ -count=1 -skip 'RunsRealLifecycle|RequiresORAS|RejectsSecondProcess|PinsCanonicalApplication' \ |
| 79 | + -run 'TestPersesStatusWitnessUnauthenticatedDenied|TestPersesStatusWitnessHumanFaceRendersBackendWitness' |
| 80 | +``` |
| 81 | + |
| 82 | +``` |
| 83 | +--- PASS: TestPersesStatusWitnessHumanFaceRendersBackendWitness (0.18s) |
| 84 | +--- PASS: TestPersesStatusWitnessUnauthenticatedDenied (0.10s) |
| 85 | +ok github.com/mcpdev80/baseharbor/cmd/baha 0.306s |
| 86 | +``` |
| 87 | + |
| 88 | +Full witness suite (no regression): |
| 89 | + |
| 90 | +``` |
| 91 | +go test ./cmd/baha/ -count=1 -skip 'RunsRealLifecycle|RequiresORAS|RejectsSecondProcess|PinsCanonicalApplication' -run 'TestPersesStatusWitness' |
| 92 | +ok github.com/mcpdev80/baseharbor/cmd/baha 2.509s |
| 93 | +``` |
| 94 | + |
| 95 | +## P3 -- provenance boundary, STOP (owner point) |
| 96 | + |
| 97 | +Recipe: wire the already-resolved per-backend signal provenance into the authorized result |
| 98 | +construction in `cmd/baha/perses_lifecycle.go` AND both local/remote paths in |
| 99 | +`cmd/baha/app_status_result.go`; if the upstream contract cannot supply the provenance, STOP and |
| 100 | +record `owner-aktion` with the file:line where the value disappears -- do NOT synthesize a |
| 101 | +`true`. |
| 102 | + |
| 103 | +Finding (verified by exhaustive search of every `cmd/**` and `internal/**` Go source at head |
| 104 | +`b2f2fd3ac172`): |
| 105 | + |
| 106 | +- No production code anywhere sets `LokiProven`, `TempoProven`, or `PrometheusProven`. |
| 107 | + `git grep -n "LokiProven:\s*true\|TempoProven:\s*true\|PrometheusProven:\s*true" -- '*.go'` |
| 108 | + returns nothing outside `_test.go`. |
| 109 | +- Every production call site of `persesBackendSignalWitnessFromManifest` passes an EMPTY witness: |
| 110 | + - `cmd/baha/perses_lifecycle.go:235` -- `reportPersesSurfaceStatus` |
| 111 | + - `cmd/baha/app_status_result.go:296` -- remote-target status face |
| 112 | + - `cmd/baha/app_status_result.go:399` -- local status face |
| 113 | + - (plus `internal/metrics/perses_dashboards_hosts.go:338` and `:612`, the host/container |
| 114 | + catalog, also empty) |
| 115 | +- `internal/metrics` has NO production function that constructs a non-empty witness; |
| 116 | + `persesHostDashboardCatalogWithWitness` (`:344`), `backendAvailableWithoutInference` (`:563`), |
| 117 | + and `persesHostDashboardAvailabilityWitnessed` (`:618`) only CONSUME a witness parameter. |
| 118 | + `git grep "PersesBackendSignalWitness{[^}]*}"` across `cmd/**` and `internal/**` finds no |
| 119 | + field-set witness in production. |
| 120 | + |
| 121 | +Exact boundary where provenance disappears: the value is never produced upstream of the four |
| 122 | +production call sites. The witness fields are documented to require a real runtime signal |
| 123 | +(`LokiProven` = an Alloy pipeline labels provider log streams with `baseharbor_provider`, |
| 124 | +`internal/logs/render.go:145,163,296`; `TempoProven` = a registered OTLP trace source emits the |
| 125 | +`baseharbor.provider` span attribute), but no production reader ever inspects that signal to set |
| 126 | +the flag. The empty `metricsprovider.PersesBackendSignalWitness{}` at |
| 127 | +`cmd/baha/perses_lifecycle.go:235`, `cmd/baha/app_status_result.go:296`, `cmd/baha/app_status_result.go:399` |
| 128 | +is the boundary: it is fail-closed by construction (the zero witness is unproven), and the |
| 129 | +positive Loki/Tempo branches in `app_status_result.go:135` and `:162` are therefore unreached in |
| 130 | +production (helper-only, as `review-4.md` P3 states). |
| 131 | + |
| 132 | +Write-set consequence: wiring the provenance requires a non-empty witness produced by |
| 133 | +`internal/metrics` (the package that owns `PersesBackendSignalWitness`), which is OUTSIDE this |
| 134 | +lane's write-set (`cmd/baha/app_status_result.go`, `cmd/baha/app_status_result_test.go`, |
| 135 | +`cmd/baha/perses_lifecycle.go`, `cmd/baha/perses_lifecycle_transport_test.go`). The mission forbids |
| 136 | +touching `internal/metricsprovider/**` and mandates STOP + an owner message. The upstream contract |
| 137 | +that could supply the provenance is card `0428-143` (`Verification=none` makes no verification |
| 138 | +assertion; exporters omit those sources), which is in `wait` and cannot deliver it. |
| 139 | + |
| 140 | +`owner-aktion = 0428-142-witnessfix3` (Worker lane). The positive Loki/Tempo witness states cannot |
| 141 | +be produced from product inputs at this head, and `internal/metrics` (the only package that could |
| 142 | +build a non-empty witness) is outside the write-set. The two reachable states through both output |
| 143 | +faces are `unreachable` (declared, not resolved) and `not-configured` (not declared), already |
| 144 | +covered by the existing witness tests; the positive `reached-and-matched` state is an upstream |
| 145 | +`0428-143` / owner write-set question, not a synthesis the lane may assert. No `true` was invented. |
| 146 | + |
| 147 | +## P4 -- run `44875647949` (booked as inherited-failure STATE, owner point) |
| 148 | + |
| 149 | +Run `44875647949` is `pull_request`, head `b2f2fd3ac17293949c18223b55936e1018085472`, completed |
| 150 | +conclusion `failure` (06:27:46Z-06:31:28Z). This lane did not re-dispatch GitHub-hosted CI; the |
| 151 | +exact-head aggregate is recorded as failed/inherited STATE (per-job evidence from `review-4.md`: |
| 152 | +194 unique first-level `--- FAIL:` names at the candidate vs 197 on PR #1742's same-base run, |
| 153 | +difference = exactly the three removed perses-lifecycle failures, no new failed test name added, |
| 154 | +the literal gate line `main_test.go:60: create failed: Managed-environment machine operations |
| 155 | +require an authenticated BaseHarbor operator.` present in the candidate cli-0 log |
| 156 | +`136759690877`). |
| 157 | + |
| 158 | +This candidate adds the P2 negative direction only; the positive Loki/Tempo `reached/matched` |
| 159 | +state remains upstream (P3, owner point). The exact-head aggregate therefore cannot be reported |
| 160 | +as a pass, and the broad red class is inherited operator-auth STATE on a develop that has |
| 161 | +`#1615`/owner stack absent -- not a candidate pass. `owner-aktion = 0428-142-witnessfix3`. |
| 162 | +A successful exact-head required aggregate is an owner action after the content findings land. |
| 163 | + |
| 164 | +## repo-rule compliance |
| 165 | + |
| 166 | +- Write-set: exactly one file changed, `cmd/baha/perses_lifecycle_transport_test.go` |
| 167 | + (+89/-0, a write-set file). No tabu path touched: no `.github/**`, `scripts/**`, |
| 168 | + `internal/operatorauth/**`, `internal/identityprovider/**`, `internal/serviceaccess/**`, |
| 169 | + `internal/capability/perses_selection.go`, `internal/observability/registry.go`, or the |
| 170 | + owner stack `#1615`/`#1625`/`#1623`. `internal/metrics` (P3 provenance) is OUTSIDE the |
| 171 | + write-set and was NOT modified -- P3 is reported as STOP, not implemented. |
| 172 | +- No `codeman agent post` to the coordinator session (4.8). No subagents. No merge, close, or |
| 173 | + PR comment. No product write outside the write-set. |
| 174 | +- Tests run only via the scoped `-skip/-run` allowlist (no bulk `go test ./cmd/baha/`). |
| 175 | +- Mutation checks were run on throwaway copies of `operator_auth_boundary.go` and |
| 176 | + `authorization.go` and restored immediately with `git diff --stat` clean. |
| 177 | +- Markdown checkboxes: none anywhere in this akte. |
| 178 | + |
| 179 | +## cleanliness |
| 180 | + |
| 181 | +before: `docker ps -a` returned an empty container list (0 rows). |
| 182 | +after: `docker ps -a` returned an empty container list (0 rows). |
0 commit comments