surface eval errors + disambiguate auth failures #minor#72
Draft
BradenBug wants to merge 5 commits into
Draft
Conversation
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.
Summary
Batch 2 (service side) of lab-deliverable-framework production readiness. Stops the deployed service hiding actionable, non-secret information from labs: real error messages on the legacy 500 path, and the six distinct auth-failure reasons surfaced as distinct, non-secret messages instead of one opaque
401.Changes
/evaluate-response/+/final-score/global handler now returns{"detail": "Evaluation failed", "errors": [str(exc)]}(mirroring the existing/v1errors[]), with the traceback kept server-side only. Withheld from trial tenants (fail-closed: an unknown/unset tenant also withholds).resolve_descope_tenantnow returns a typedAuthResult(tenant, failure); the middleware + websocket auth map eachAuthFailureto a distinct status+detail — allowlist-miss → 403 ("contact the service operator to request access"), the rest → 401 with specific messages. MissingDESCOPE_PROJECT_IDbecomes a startup hard-fail (a server-config bug, not a per-request 401).AuthResultso a reject always carries a failure (the illegal "rejected butfailure=None" state is unrepresentable;ok = failure is None);AuthResult/AuthFailureexported for service authors who override the auth hook.Author self-review
ok=Falsewith a failure reason;_failure_responseindexes an exhaustive table; no reject can return a 2xx (verified). The legacy booleancheck_auth-override bridge still works.errors[]; messages name no company or product (framework-clean).AuthResultillegal-state and a trial-tenant info-leak on the 500 path before this PR.Related PRs
Type of Change
Testing
Checklist