Skip to content

Show the Castle payload and verdict in the UI across all flows#25

Merged
bartes merged 4 commits into
mainfrom
feature/castle-response-transparency
Jun 11, 2026
Merged

Show the Castle payload and verdict in the UI across all flows#25
bartes merged 4 commits into
mainfrom
feature/castle-response-transparency

Conversation

@bartes

@bartes bartes commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds an in-app view of what each Castle call does, across the whole demo.

  • Add a CastleReporting controller concern that records every Castle call made during a request — the endpoint, the request payload and the response — and exposes them to the views.
  • Add a shared Castle activity panel rendered on each flow: an endpoint badge, a verdict banner (policy action, risk score and signal names), and the payload/response JSON.
  • Carry results from flows that redirect (login, sign up, profile update, logout, custom event) across the redirect via the flash, compacted to the verdict summary (with signal names and a truncated request token) so they always fit the cookie-backed session. The login surfaces both the $login/$attempted filter step and the $succeeded risk step.
  • Replace the per-page API result partial on the lists, privacy and password-reset pages with the shared panel, and add the result-panel component styles.
  • Send user.id to Castle as a string on the risk, log and matching_user_id calls.
  • Add specs covering the reporting concern (compaction and cookie-budget handling) and the rendered panel.

bartes added 4 commits June 11, 2026 14:22
Add a CastleReporting controller concern that records each Castle call
(endpoint, request payload and response) during a request and renders it
in a shared "Castle activity" panel: an endpoint badge, a verdict banner
with the policy action, risk score and signal names, and the payload and
response JSON. Results from flows that redirect (login, sign up, profile
update, logout, custom event) are carried over the redirect through the
flash, compacted to the verdict summary so they always fit the cookie
session; the login surfaces both the filter and risk steps.

Replace the per-page API result partial with the shared panel on the
lists, privacy and password-reset pages, and add the result-panel
component styles.

Send user.id to Castle as a string on the risk, log and matching_user_id
calls.

Add specs covering the reporting concern (compaction and cookie budget)
and the rendered panel.
Raise the puma requirement to ~> 7.2 and update the lockfile to puma
7.2.1 and net-imap 0.6.4.1. Also bump the remaining gems within the
existing constraints: msgpack 1.8.3, sqlite3 2.9.5, websocket-driver
0.8.1, web-console 4.3.0 and rspec-rails 8.0.4.
Mirror the Node/Python/PHP example apps by adding "valid user + pw",
"valid user, bad pw" and "invalid username" quick-fill buttons to the
sign-in page. Credentials are centralized in DemoAccount (env-overridable,
Devise-valid defaults) and used by db/seeds.rb to seed the Clark Kent demo
user so the "valid user + pw" flow actually signs in.
Mirror the other example apps with "new user" (lois.lane@dailyplanet.com)
and "existing email" (the seeded clark.kent@dailyplanet.com) quick-fill
buttons, demonstrating $registration / $attempted vs / $failed.
@bartes bartes merged commit def3cbe into main Jun 11, 2026
1 check passed
@bartes bartes deleted the feature/castle-response-transparency branch June 11, 2026 13:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant