Skip to content

Record signed-in operators and show the linked SCM login - #428

Merged
artyomsv merged 4 commits into
masterfrom
fix/record-signed-in-operators
Nov 15, 2026
Merged

artyomsv merged 4 commits into
masterfrom
fix/record-signed-in-operators

Conversation

@artyomsv

Copy link
Copy Markdown
Owner

Part of #391.

Found on the first production install (spired.dev).

  • Operators were never recorded. OperatorDirectory.seen had no caller anywhere in the code or in its history. So operator_seen stayed empty, Settings → Operators said "Nobody has signed in yet", and a linked operator showed as its OIDC subject UUID. /api/me now records the operator. The display name comes from the name claim. The username is stored only when it is not an email: on the live realm, preferred_username is an email, and email is never persisted.
  • The linked SCM account showed its numeric id twice. The connect callback now stores the login the forge returned (V116, author_handle, never the email). The dashboard shows the login, with the id under it. A link made by hand, or before V116, falls back as before.

Tests: an /api/me recording test (email username dropped, plain login kept), connect-callback storage, list output, and UI rendering with the id fallback. CI only; nothing ran locally.

OperatorDirectory.seen had no caller, so operator_seen stayed empty on
the first production install: Settings > Operators said nobody had
signed in, the picker was empty, and a linked operator showed as the raw
OIDC subject. /api/me now records the caller once per dashboard load.

Email is never persisted. On that realm preferred_username is the email
address, so OperatorNames drops any value containing '@': the username
is stored empty, the display name is the name claim, and a subject that
is itself an email is not recorded. A recording failure is logged and the
probe still answers.

Part of #391
A linked SCM account showed its numeric id twice on a fresh install,
because the only handle came from authors observed in reviews. The
connect callback has just been told the login by the forge, so V116 keeps
it as operator_identity.author_handle (display data, never a key; never
the email, and dropped if it looks like one). The identity list returns
it; the People table and the My activity chips show it with the id as
fallback. A hand-made link keeps null, and a hand relink of the same
account keeps the observed login.

The People table also names an operator with an empty username by the
display name alone, and shows a name equal to its id only once.

Part of #391
@artyomsv artyomsv added the review: requested the code waits for a reviewer label Nov 15, 2026

@artyomsv artyomsv left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

First review at 5bdf05b. The change does what it says and keeps the privacy rule: OperatorNames drops every value with an '@' (login, principal name and the name claim), the connect callback stores only the forge's username and never the author's email, a subject that is itself an email is not recorded, a failure to record cannot break /api/me, and the V116 column is nullable display data that nothing keys on. The relink SQL is right: in ON CONFLICT DO UPDATE every right-hand side reads the old row, so the CASE keeps a sign-in's handle on a same-account repair and drops it when the account changes. The UI shows the id once when there is no name. CI is green. I found no defect in behaviour. One MEDIUM about the size rule and one LOW.

Findings: 1 MEDIUM, 1 LOW. Reviewed head 5bdf05bb28 as @artyomsv.

@artyomsv artyomsv left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

❌ CHANGES REQUESTED

Posted as a comment: GitHub does not let an account approve or request changes on its own pull request. The label carries the verdict.

Agent findings: 0 resolved, 2 open. CI: 11/14 checks passing. Head 5bdf05bb28, reviewed by @artyomsv.

Open findings:

@artyomsv artyomsv added review: changes-requested Agent review verdict: changes requested and removed review: requested the code waits for a reviewer labels Nov 15, 2026
The live socket's close handler asks /api/me before every reconnect, so
a flapping socket turned operator_seen into a write stream.
RecentOperatorSightings skips an identical sighting of the same subject
within 60 s, in memory; a changed username or display name is written
at once.

The connect-callback handle cases move to OperatorConnectHandleTest, so
OperatorConnectResourceTest returns to its previous size, and the link
construction leaves the callback for linkOf.

Part of #391
@artyomsv artyomsv added review: requested the code waits for a reviewer and removed review: changes-requested Agent review verdict: changes requested labels Nov 15, 2026

@artyomsv artyomsv left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

✅ APPROVED

Posted as a comment: GitHub does not let an account approve or request changes on its own pull request. The label carries the verdict.

Agent findings: 2 resolved, 0 open. CI: 11/14 checks passing. Head b253ea35c4, reviewed by @artyomsv.

@artyomsv artyomsv added review: approved Agent review verdict: approved and removed review: requested the code waits for a reviewer labels Nov 15, 2026

@code-spire-beaver code-spire-beaver left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewed b253ea3 against 6f06a07, including the full PR and the follow-up to the author's earlier review. The operator recording, email filtering, proved-login persistence, ownership keys and UI fallbacks are consistent and covered by discriminating tests. The two earlier resolved findings remain fixed. One new project-rule violation remains: SettingsOperators.tsx crosses the mandatory React component-file size limit.

Findings: 1 HIGH. Reviewed head b253ea35c4 as @code-spire-beaver.

@code-spire-beaver code-spire-beaver left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

❌ CHANGES REQUESTED

Reviewed PR #428 at b253ea3, base 6f06a07.

Changes requested for rules/H-1: SettingsOperators.tsx grows from 241 to 266 physical lines, crossing the React rule's 250-line file limit. One inline thread gives the small extraction needed. The prior rules/M-1 and design/L-2 threads remain resolved: the connect test split is present (278 and 143 lines), callback length is unchanged from base, and repeated identical sightings are coalesced for 60 seconds with a changed name written immediately.

Per-lens results:

  • Security: no new finding. Traced the public session probe to the directory write, OAuth state/subject/provider checks to the account link, and admin-only/self-visible reads to the UI. New names filter email-like values before writes; handles remain display data while provider/id determine ownership. Parameterized SQL and React text rendering are retained. No new secrets or dependencies. CI Semgrep OSS, CodeQL and gitleaks pass; no local scan run.
  • Correctness: no new finding. Reviewed same-account versus different-account relinking, null handles for manual links, name/id fallback, anonymous sessions, failure-tolerant recording, and cache timing. V116 is a nullable additive migration; master ends at V115 and no other open PR can clash with V116.
  • Rules: one new finding above. Applied root CLAUDE.md, WIDGETS.md, clean-code-general/java/react, API contract compatibility, secrets-and-env-handling, observability-and-logging, no-synthetic-data, blog-material-capture, no-local-builds and review-label rules. Spring-specific conventions do not apply to this Quarkus service. Existing untouched size debt is not re-raised. No nested CLAUDE.md, matching saved review state, or available prescribed agent-memory entries.
  • QA: read all new tests and reasoned through their pre-change failures. Real database/HTTP coverage records the directory and stores/returns the forge handle; JWT unit cases cover email and anonymous handling; UI assertions cover observed handle and id/name fallbacks without vacuous collection assertions. CI run 43757534360 attempt 1 passed on this exact head: dashboard 127 files / 1,347 tests, typecheck and bundle; fast tests; Java service tests and packaging. Service logs show orchestrator tests executed; no reliable aggregate Java count is printed. Manifest invariants/kind and merge checks are skipped.

Residual risk: no real Keycloak or forge sign-in was exercised here; docs/UNVERIFIED.md records that gap honestly. No local builds, tests, linters or repository modifications were made.

Agent findings: 2 resolved, 1 open. CI: 11/14 checks passing. Head b253ea35c4, reviewed by @code-spire-beaver.

Open findings:

@code-spire-beaver code-spire-beaver added review: changes-requested Agent review verdict: changes requested and removed review: approved Agent review verdict: approved labels Nov 15, 2026
SettingsOperators.tsx grew to 266 lines, over the 250-line component
limit. The new name-with-id cell is a self-contained component, so it
moves to NameWithId.tsx unchanged; the screen is back under the limit.

Part of #391
@artyomsv artyomsv added review: requested the code waits for a reviewer and removed review: changes-requested Agent review verdict: changes requested labels Nov 15, 2026

@artyomsv artyomsv left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

✅ APPROVED

Posted as a comment: GitHub does not let an account approve or request changes on its own pull request. The label carries the verdict.

Agent findings: 3 resolved, 0 open. CI: 11/14 checks passing. Head ff7c92c0d0, reviewed by @artyomsv.

@artyomsv artyomsv added review: approved Agent review verdict: approved and removed review: requested the code waits for a reviewer labels Nov 15, 2026
@artyomsv
artyomsv merged commit 26d3e59 into master Nov 15, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review: approved Agent review verdict: approved

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants