Skip to content

fix: biomodel search no longer fails for signed-in users without a linked VCell account - #115

Merged
androemeda merged 1 commit into
mainfrom
fix/public-biomodels-when-unlinked
Sep 8, 2026
Merged

fix: biomodel search no longer fails for signed-in users without a linked VCell account#115
androemeda merged 1 commit into
mainfrom
fix/public-biomodels-when-unlinked

Conversation

@androemeda

Copy link
Copy Markdown
Collaborator

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_biomodels exchanged the Auth0 token for a legacy VCell token whenever any token was present:

VCell only issues a legacy token to a linked login. UserRestService.getUserFromIdentity throws NotAuthenticatedWebException when the caller has no UserIdentity row, so /api/v1/users/bearerToken answers 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 returned 401 {"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_token now returns Optional[str]None when 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_biomodels also now returns includes_private in 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 /profile when you're signed in but seeing public-only results.

Behaviour after this change

State Biomodel search & diagrams Private / shared models LLM features
Logged out ✅ public models ❌ 401
Signed in, not linked ✅ public models + hint to link ✅ works, public model data
Signed in, linked ✅ public models ✅ included ✅ works, private model data

LLM features require sign-in only, not linking. This was considered and deliberately rejected: enforcing it meant a mappedUser call 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.

@androemeda
androemeda merged commit 9d6ea21 into main Sep 8, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant