fix(proto): dedicated reject code for orgs with no cache (#302) - #308
Merged
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.
Closes #302.
Problem
When a worker connected to a server whose organization had no subscribed cache, the handshake failed with a generic
401 Unauthorized. The token actually validated fine — the connection was refused only because the org has no cache — so401was misleading and gave no actionable reason.Fix
decide_authnow distinguishes the two cases. When the worker authenticated (at least one token validated) but every authorized peer was demoted because its organization has no cache, the handshake is rejected with a dedicated495 organization has no cache subscribed("incomplete server setup"). A genuine token failure still returns401 no valid peer tokens provided.perform_authcomputesemptied_by_missing_cachefrom the token-validation and cache-filter steps and threads it into the puredecide_authpolicy function. The worker surfaces the code+reason verbatim, so the operator sees the real cause.Tests (TDD)
auth_decision_tests::registered_emptied_by_missing_cache— new case asserting495.decide_authcases updated for the new parameter;registered_but_no_valid_tokenconfirms genuine failures stay401.Docs
docs/src/development/proto.md— handshake description + error-code table (495).docs/src/tests.md— updated reject behaviour and test inventory.