test(e2e): report what the gateway refused - #14
Merged
Conversation
A console scenario that fails on a control it cannot find has usually left the console for the login, and the page goes there because something answered one of its fetches 401. Which fetch, and why, decided nothing the scenario could show. The gateway already counts it. profgate_auth_failures_total carries the mode and the reason, and the vocabulary is the one auth.Reasons names, so session, csrf, and the callback reasons are told apart at the point of failure. Nothing read the counter before this. Both console scenarios now forward the ops port and log every non-zero counter, but only when the scenario failed: a passing run says nothing and keeps its output as it was. Three passing runs put the baseline at one refusal, reason missing, counted during the first load, which carries no session and is meant to be refused. The count across the second load is zero, so an extra refusal there is the anomaly and its reason is the answer. Proven both ways against a scenario that navigates to the login before choosing: the failing run logged the counter, and the passing run logged nothing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What a console failure could not say
A console scenario that fails on a control it cannot find has usually left the
console for the login. The page goes there because
request()(
internal/ui/static/app.js:401) got a 401 and calledsignIn(), which setsphasetonavigatingand empties.panels.Which fetch was refused, and why, decided nothing the scenario could show.
The merged
chooseOptionchange names where the page went; this names whyit went there.
The counter already existed
profgate_auth_failures_total{mode,reason}(
internal/metrics/prometheus.go:103) counts every request the auth layerrefused. The reason vocabulary is
auth.Reasons()(internal/auth/auth.go:76),so
session(the cookie would not open or had expired),csrf(
Sec-Fetch-Site), and the callback reasons are told apart at the point offailure.
No test read it before this.
The change
Both console scenarios forward the ops port and log every non-zero counter —
only when the scenario failed. A passing run logs nothing and its output is
unchanged.
The port-forward is registered for cleanup before the scrape is, so the scrape
runs first and still has a forward.
h.forwardbinds its lifetime tostopChrather than to the caller's context, so it survives into cleanup; the scrape
carries a context of its own because the test's is cancelled by then.
The baseline this establishes
Three passing runs, scraped before and after the second load:
One refusal, reason
missing, counted during the first load — whichcarries no session and is meant to be refused. The count across the second
load is zero. So an extra refusal there is the anomaly, and its reason is the
answer to why
console-oidcfails on the lane.Proof
The full suite on the
currentlane logged no counter at all across everyscenario.
Validation
mise run lint(0 issues),mise run test,mise run check, andsemlf --base origin/mainpass.mise run test:e2eran green on thecurrentlanein 696.9s.