PPT-2536: liveness-probe DB short-circuit + login-form reload on failure#6
Open
camreeves wants to merge 2 commits into
Open
PPT-2536: liveness-probe DB short-circuit + login-form reload on failure#6camreeves wants to merge 2 commits into
camreeves wants to merge 2 commits into
Conversation
/auth/authority?health hit current_authority (Authority.find_by_domain) BEFORE the health short-circuit. That query RAISES (not returns nil) when Postgres is unreachable, so a transient DB blip 500'd the probe and risked a pod-restart storm. Move the short-circuit ahead of the DB call: a ?health caller now always gets an empty process-is-up 200 without touching the DB. (Divergence from Ruby, which let ?health fail on DB-down / returned the authority JSON — but that's exactly what you want for a LIVENESS probe.) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
A wrong/absent password on the browser login FORM returned a raw 401 JSON body instead of reloading the page. Mirror Ruby SessionsController: route the password-failure branches through login_failure, which reloads the referring page when a continue param is present (browser form) and keeps the 401 for API/XHR callers (no continue). user-not-found and soft-deleted stay 401 in all cases, exactly as Ruby (head :unauthorized before the authenticate call). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
The two remaining minor drop-in items (both auth.cr-only, verified against the Ruby source).
Authority.find_by_domainraises when Postgres is unreachable, so a blip 500'd/auth/authority?healthand risked a k8s pod-restart storm. Short-circuit moved ahead of the DB call → empty 200, no DB touch. (Correct liveness semantics; noted divergence from Ruby's readiness-ish behaviour.)login_failurehelper that reloads the referrer when acontinueis present (browser form) and keeps 401 for API/XHR callers. user-not-found / soft-deleted stay 401 (Ruby parity:head :unauthorizedbeforeauthenticate).Specs:
?healthreturns empty 200 even for a matching host (no DB lookup); wrong password + continue → 303 to referrer; unknown email + continue → still 401. Full suite validated in CI.🤖 Generated with Claude Code