Skip to content

Fix SSO dataset error on site wide org - #1721

Open
vaimdevs wants to merge 10 commits into
masterfrom
fix/site-wide-org-dataset-error
Open

Fix SSO dataset error on site wide org#1721
vaimdevs wants to merge 10 commits into
masterfrom
fix/site-wide-org-dataset-error

Conversation

@vaimdevs

Copy link
Copy Markdown
Contributor
##Fix
* If get the SITE org from Graphistry, change to personal org with message
* If no org return, change to personal org

@vaimdevs vaimdevs changed the title Fix SSO dataset on site wide org Fix SSO dataset error on site wide org Jul 10, 2026
vaimdev added 2 commits July 10, 2026 21:26
…false success

switch_org() treated any status=='OK' response as a completed switch, but
the server overloads that status for two different outcomes: a real switch
(data has pk/org_name/organization_slug) and an SSO re-authentication
challenge (data['idp'] populated) for members of SSO-protected orgs who
aren't the owner/admin. The challenge case never actually updates the
server-side active org, so treating it as success silently left callers on
their previous org while locally claiming to have switched.

Now raises with the idp names and a pointer to sso_login(org_name=...) as
the alternative, instead of logging a false "Switched to organization" and
setting self.session.org_name to a value the server never accepted.
@vaimdev
vaimdev requested a review from aucahuasi July 17, 2026 15:36
vaimdev and others added 2 commits July 22, 2026 17:54
_switch_org wrote _last_switched_org_token unconditionally after the
POST, so a 403/500 or an SSO-challenge response (200 + data['idp'])
got recorded as a completed switch. That poisoned memo made
_maybe_switch_org short-circuit later, skipping switch_org() -- the
only implementation that validates the response and raises on an SSO
challenge. Now _switch_org returns without writing the memo on a
non-2xx status or an idp challenge.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
vaimdev and others added 2 commits August 28, 2026 11:32
…ogic

ArrowUploader._switch_org and GraphistryClient.switch_org each POSTed to
the same org-switch endpoint with their own copy of the HTTP-status,
body-status, and SSO-idp-challenge checks. Extract the shared logic into
switch_org_request() in graphistry/utils/requests.py, raising
OrgSwitchError / OrgSwitchIdpChallenge. Each caller keeps its own
success/failure policy (ArrowUploader logs+swallows, GraphistryClient
raises) since that divergence is intentional API contract, not
duplication.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TNGYwRNwAFQdYDucbwgtUm
…quests.py

Type-hygiene guard flagged missing __init__ return annotations and a bare
dict for OrgSwitchIdpChallenge's idp param.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GgDZr3AgU9uKz5EWcVZZVY
@vaimdev
vaimdev force-pushed the fix/site-wide-org-dataset-error branch from 75c3b4f to f043c72 Compare August 28, 2026 08:21
Guard baseline already sat at max cast() count; cast() would've pushed it
over. Use a localized type: ignore instead, per DEVELOP.md guidance.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GgDZr3AgU9uKz5EWcVZZVY
@vaimdev
vaimdev force-pushed the fix/site-wide-org-dataset-error branch from f043c72 to 4a9d63e Compare August 28, 2026 08:50
vaimdev and others added 2 commits August 28, 2026 17:55
Adds direct unit tests for graphistry/utils/requests.py's switch_org_request
(success, HTTP error, non-OK body w/ detail, unparseable JSON, SSO idp
challenge) and ArrowUploader._switch_org (no-op guards, dedup cache,
OrgSwitchError/OrgSwitchIdpChallenge/generic-exception swallow paths),
raising changed-line coverage on the switch-org refactor.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GgDZr3AgU9uKz5EWcVZZVY
mock.patch("graphistry.utils.requests.requests.post") failed under the
full suite (AttributeError: module 'graphistry' has no attribute 'utils')
because some other test's import juggling leaves the parent package's
'utils' attribute unset. mock.patch.object against the imported module
sidesteps the string-resolution path entirely.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GgDZr3AgU9uKz5EWcVZZVY
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.

2 participants