fix: biomodel search no longer fails for signed-in users without a linked VCell account - #115
Merged
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.
Summary
Biomodel search returned nothing at all — not even public models — for a user who was signed in but hadn't linked a VCell account. Logged-out users were unaffected, which made it look like an auth problem when it was the opposite: having a token was what broke it.
Browsing public biomodels now works in every auth state, and results say whether they include private data.
Root cause
fetch_biomodelsexchanged the Auth0 token for a legacy VCell token whenever any token was present:VCell only issues a legacy token to a linked login.
UserRestService.getUserFromIdentitythrowsNotAuthenticatedWebExceptionwhen the caller has noUserIdentityrow, so/api/v1/users/bearerTokenanswers an authenticated-but-unlinked caller with:{ "exceptionType": "NotAuthenticatedWebException", "message": "User is not authenticated." }raise_for_status()turned that into an exception that propagated out before the biomodel query was ever issued, so the controller returned401 {"detail": "Error fetching biomodels."}and zero models. Logged-out users skipped the exchange entirely, which is why only signed-in users saw the failure.The fix
get_legacy_vcell_tokennow returnsOptional[str]—Nonewhen a token can't be obtained — instead of raising, and both call sites attach the header only if they got one:Any exchange failure degrades to public-only, not just 401/403 — a 401/403 logs at info (expected: not linked), anything else logs at warning. Browsing must not depend on an auth endpoint being healthy.
fetch_biomodelsalso now returnsincludes_privatein its metadata, so callers can tell "you have no private models" apart from "we couldn't check". The search page uses it to show a hint linking to/profilewhen you're signed in but seeing public-only results.Behaviour after this change
LLM features require sign-in only, not linking. This was considered and deliberately rejected: enforcing it meant a
mappedUsercall on every LLM request, measured at ~1–1.5s, to guard something any user can satisfy in seconds by linking. Not worth the latency on every message.