Repository navigation
Fix charts and expired sessions, stop the double embed load, add dark mode, pinning and Intel builds - #5
Merged
Conversation
ThoughtSpot draws charts in an iframe on its own chart host, which sends `frame-ancestors *`. In CSP, `*` only matches network schemes, so the file:// page the renderer runs on is never an allowed ancestor and Chromium blocks the frame. The embed then shows "Cannot display the chart", while the same answer renders fine in a browser. For subframes on other origins, drop only frame-ancestors and X-Frame-Options and keep the rest of their policy. Header names are now matched case-insensitively instead of by listing spellings. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The SDK's React wrapper deep-compares its listeners, and when any of them changes identity it destroys the iframe and builds a new one. The handler maps were rebuilt on every render, and mergeHandlers made new wrappers too, so once auth and Orgs settled the app threw away a half-loaded ThoughtSpot and started over. Each launch aborted 25-41 CDN requests. A later re-render would also wipe the conversation on screen. Memoize each hook's handler map and the merged result. The embed now loads once and nothing is aborted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Nothing in the app, its build or CI imports it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Native Spotter ships pinning on, but embeds have it off unless spotterChatPinConfig asks for it (26.10+). Older clusters ignore the setting. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The only check ran at launch, so a dock app left open for days sat on an old build. Check every six hours, and 30 seconds after wake, since a long sleep has most likely skipped one. Each version is announced once, so a dismissed banner does not keep coming back. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The app's own screens were light only, while the embedded Spotter follows the system appearance, so dark-mode users got a white flash at launch and a mismatched frame. Add dark tokens for the app and the sign-in splash, and make the native window background follow the appearance too, since it shows through on resize and reload. Setting the embed's theme from the host (isDarkMode, HostEvent.UpdateTheme) needs ThoughtSpot 26.12, so the embed keeps following the system for now. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Releases were arm64 only, so Intel Macs could not run them. electron-updater picks the zip that matches the running Mac. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The chart fix dropped frame-ancestors and X-Frame-Options from every cross-origin subframe. That also stripped the identity provider's protection: Okta sends frame-ancestors with an explicit host list, and once a session expired its username and password form rendered inside the embed, with no address bar showing whose page it was. On main, Chromium blocked it. Drop the directive only when its sources include *. That case fails here only because * does not match the file:// top page, and a browser would allow it. X-Frame-Options goes only alongside a dropped wildcard, since CSP takes precedence over it. Charts still render through the chart host. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The persisted loggedIn flag was trusted on launch, and with AuthType.None the SDK reports success without checking anything, so an expired session skipped sign-in. ThoughtSpot then sent the embed to the identity provider, which either refused to be framed or failed with an error. Mid-use expiry ended the same way: the SDK swallows auth failures for AuthType.None, so onAuthLost never ran, and the flag stayed set across relaunches. - On launch, check /callosum/v1/session/isactive on the embed's cookie jar before skipping sign-in. If the cluster can't be reached, keep the user signed in: offline is not signed out. - Stop the embed frame from navigating off the ThoughtSpot origin and treat that as an expiry. Nested chart frames are not affected. - Also listen for the embed's AuthFailure, AuthExpire and IdleSessionTimeout events. - Return to the sign-in screen with a notice saying the session expired, and track Session Expired with the signal that caught it. Signing out and switching instance are not reported as expiry. Verified on a copy of the profile with the ThoughtSpot cookies removed, at launch and mid-session. A valid session stays signed in. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Why
Spotter answers showed "Cannot display the chart" in the desktop app, even though the same answers render fine in a browser. While tracking that down, I found that the embed was also loading twice on every launch.
What changed
Each item is its own commit, so the PR can be reviewed one commit at a time.
Fixes
Charts render again. ThoughtSpot draws charts in an iframe on its chart host (
hc-advanced.pdom.thoughtspot.com), which sendsframe-ancestors *. In CSP,*only matches network schemes, so thefile://page the renderer runs on is never an allowed ancestor, and Chromium blocks the frame. For subframes on other origins, the app now dropsframe-ancestorsonly when its sources include*. That case fails here only because*doesn't matchfile://, and a browser would allow it. A policy that names its ancestors is a real refusal and is left alone, as isX-Frame-Optionsalongside it. My first version stripped the directive from every cross-origin subframe, which let Okta's sign-in form render inside the embed; a follow-up commit fixes that. Header names are now matched case-insensitively.The embed loads once per launch, not twice. The SDK's React wrapper deep-compares its listeners, and when any of them changes identity it destroys and rebuilds the iframe. The handler maps were rebuilt on every render, so each launch threw away a half-loaded ThoughtSpot (25–41 aborted CDN requests), and any later re-render would have wiped the conversation on screen. The handler maps are now memoized.
Expired sessions go back to sign-in instead of a broken embed. With
AuthType.Nonethe SDK reports success without checking anything, and it swallows auth failures. So an expired session skipped sign-in at launch, the embed was sent to the identity provider (which either refused to be framed or showed an error), andloggedInstayed set across relaunches. Now:/callosum/v1/session/isactivebefore skipping sign-in. If the cluster can't be reached, the user stays signed in: offline is not signed out.AuthFailure,AuthExpireandIdleSessionTimeoutevents.Session Expiredis tracked with the signal that caught it. Signing out and switching instance aren't reported as expiry.Upgrades: Visual Embed SDK 1.52.0 → 1.53.1, Electron 44.4.1 → 44.9.0.
Enhancements
spotterChatPinConfig, 26.10+; older clusters ignore it).isDarkMode,HostEvent.UpdateTheme) needs ThoughtSpot 26.12, so for now the embed keeps following the system appearance.arm64andx64. Until now, releases were Apple Silicon only.playwright-coredependency.Testing
Tested on the dev build against
champagne.thoughtspotstaging.cloud(26.11):frame-ancestorsviolation and the chart showed the error. After it, the chart iframe completes itsInitializeCompletehandshake and renders. Re-checked after the SDK/Electron upgrade.nativeTheme.themeSource.loggedInis cleared. A valid session stays signed in.arm64andx64withelectron-builder --dir; the binaries are the right architecture.npm run lintand the production webpack build pass.Not verified:
🤖 Generated with Claude Code