-
Notifications
You must be signed in to change notification settings - Fork 57
Fix session update after leaving organization #781
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
0dca60d
7e0aa92
f6cc124
79d880e
b594764
17272b1
640f0e9
227d3a5
0c46b75
f007dca
dc8088b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -36,7 +36,8 @@ | |
| "@dnd-kit/core": "^6.3.1", | ||
| "@dnd-kit/sortable": "^10.0.0", | ||
| "@dnd-kit/utilities": "^3.2.2", | ||
| "@electric-sql/client": "1.4.0", | ||
| "@electric-sql/client": "https://pkg.pr.new/@electric-sql/client@3724", | ||
| "@hookform/resolvers": "^5.2.2", | ||
|
Comment on lines
+39
to
+40
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -e
echo "=== Checking PR-hosted `@electric-sql/client` package ==="
if curl -Ifs https://pkg.pr.new/@electric-sql/client@3724 > /dev/null 2>&1; then
echo "✓ `@electric-sql/client`@3724 is accessible"
else
echo "✗ `@electric-sql/client`@3724 is NOT accessible"
fi
echo ""
echo "=== Checking npm package availability ==="
# Check each package version
packages=(
"@hookform/[email protected]"
"[email protected]"
"@tanstack/[email protected]"
"@tanstack/[email protected]"
"@vercel/[email protected]"
"[email protected]"
)
if command -v npm >/dev/null 2>&1; then
for pkg in "${packages[@]}"; do
version=$(npm view "$pkg" version 2>/dev/null || echo "NOT FOUND")
echo "$pkg: $version"
done
else
echo "npm not available; checking via curl to registry"
for pkg in "${packages[@]}"; do
pkg_name=$(echo "$pkg" | cut -d'@' -f1-$(echo "$pkg" | grep -o '@' | wc -l))
pkg_version=$(echo "$pkg" | rev | cut -d'@' -f1 | rev)
result=$(curl -s "https://registry.npmjs.org/${pkg_name}/${pkg_version}" | grep -q '"version"' && echo "EXISTS" || echo "NOT FOUND")
echo "$pkg: $result"
done
fiRepository: superset-sh/superset Length of output: 184 🌐 Web query:
💡 Result: Yes — npm install Sources: npm registry / package data. [1][2] References
🌐 Web query:
💡 Result: react-hook-form version 7.71.1 is published on the npm registry. Install with: npm install [email protected] You can verify the published version via the package registry listings. [1][2] Sources:
🌐 Web query:
💡 Result: Yes — You can install it with: Sources:
🌐 Web query:
💡 Result: zod version 4.3.5 is published to the npm registry (published Jan 4, 2026). Install with: npm install [email protected] Sources: [1][2][3] References Citations:
🌐 Web query:
💡 Result: Yes —
Sources: 🌐 Web query:
💡 Result: I’m missing context — do you want the pkg.pr.new preview URL for PR 🌐 Web query:
💡 Result: Yes — Sources:
🌐 Web query:
💡 Result: I couldn't find an npm release for Sources:
🌐 Web query:
💡 Result: I’m not sure what you mean by “pkg.pr.new.” Do you want:
Tell me which and I’ll fetch the exact package name, version, and install command. @tanstack/electric-db-collection version mismatch: 0.2.24 does not exist. Most dependencies verify successfully ( 🤖 Prompt for AI Agents |
||
| "@monaco-editor/react": "^4.7.0", | ||
| "@radix-ui/react-dialog": "^1.1.15", | ||
| "@radix-ui/react-label": "^2.1.8", | ||
|
|
@@ -49,15 +50,16 @@ | |
| "@superset/ui": "workspace:*", | ||
| "@t3-oss/env-core": "^0.13.8", | ||
| "@tanstack/db": "^0.5.16", | ||
| "@tanstack/electric-db-collection": "^0.2.20", | ||
| "@tanstack/react-db": "^0.1.60", | ||
| "@tanstack/electric-db-collection": "0.2.24", | ||
| "@tanstack/react-db": "0.1.64", | ||
| "@tanstack/react-query": "^5.90.10", | ||
| "@tanstack/react-router": "^1.147.3", | ||
| "@tanstack/react-table": "^8.21.3", | ||
| "@trpc/client": "^11.7.1", | ||
| "@trpc/react-query": "^11.7.1", | ||
| "@trpc/server": "^11.7.1", | ||
| "@types/express": "^5.0.5", | ||
| "@vercel/blob": "^2.0.0", | ||
| "@xterm/addon-canvas": "^0.7.0", | ||
| "@xterm/addon-clipboard": "^0.1.0", | ||
| "@xterm/addon-fit": "^0.10.0", | ||
|
|
@@ -107,6 +109,7 @@ | |
| "react-dnd": "^16.0.1", | ||
| "react-dnd-html5-backend": "^16.0.1", | ||
| "react-dom": "^19.2.3", | ||
| "react-hook-form": "^7.71.1", | ||
| "react-icons": "^5.5.0", | ||
| "react-markdown": "^10.1.0", | ||
| "react-mosaic-component": "^6.1.1", | ||
|
|
@@ -124,7 +127,7 @@ | |
| "trpc-electron": "^0.1.2", | ||
| "tw-animate-css": "^1.4.0", | ||
| "unique-names-generator": "^4.7.1", | ||
| "zod": "^4.1.13", | ||
| "zod": "^4.3.5", | ||
| "zustand": "^5.0.8" | ||
| }, | ||
| "devDependencies": { | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -16,9 +16,7 @@ import { | |||||||||||||||
|
|
||||||||||||||||
| export const createAuthRouter = () => { | ||||||||||||||||
| return router({ | ||||||||||||||||
| getStoredToken: publicProcedure.query(async () => { | ||||||||||||||||
| return await loadToken(); | ||||||||||||||||
| }), | ||||||||||||||||
| getStoredToken: publicProcedure.query(() => loadToken()), | ||||||||||||||||
|
|
||||||||||||||||
| persistToken: publicProcedure | ||||||||||||||||
| .input( | ||||||||||||||||
|
|
@@ -63,10 +61,10 @@ export const createAuthRouter = () => { | |||||||||||||||
| const state = crypto.randomBytes(32).toString("base64url"); | ||||||||||||||||
| stateStore.set(state, Date.now()); | ||||||||||||||||
|
|
||||||||||||||||
| // Clean up old states (older than 10 minutes) | ||||||||||||||||
| const tenMinutesAgo = Date.now() - 10 * 60 * 1000; | ||||||||||||||||
| // Clean up expired states (10 minutes) | ||||||||||||||||
| const cutoff = Date.now() - 10 * 60 * 1000; | ||||||||||||||||
| for (const [s, ts] of stateStore) { | ||||||||||||||||
| if (ts < tenMinutesAgo) stateStore.delete(s); | ||||||||||||||||
| if (ts < cutoff) stateStore.delete(s); | ||||||||||||||||
| } | ||||||||||||||||
|
|
||||||||||||||||
| const connectUrl = new URL( | ||||||||||||||||
|
|
@@ -86,9 +84,7 @@ export const createAuthRouter = () => { | |||||||||||||||
| }), | ||||||||||||||||
|
|
||||||||||||||||
| signOut: publicProcedure.mutation(async () => { | ||||||||||||||||
| try { | ||||||||||||||||
| await fs.unlink(TOKEN_FILE); | ||||||||||||||||
| } catch {} | ||||||||||||||||
| await fs.unlink(TOKEN_FILE).catch(() => {}); | ||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: cat -n apps/desktop/src/lib/trpc/routers/auth/index.ts | head -100Repository: superset-sh/superset Length of output: 3227 Don't silently ignore token deletion failures. Swallowing 🐛 Suggested fix (log + fail on unexpected errors)- await fs.unlink(TOKEN_FILE).catch(() => {});
+ await fs.unlink(TOKEN_FILE).catch((err: NodeJS.ErrnoException) => {
+ if (err?.code !== "ENOENT") {
+ console.warn("[auth/signOut] failed to delete token file", err);
+ throw err;
+ }
+ });📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||
| return { success: true }; | ||||||||||||||||
| }), | ||||||||||||||||
| }); | ||||||||||||||||
|
|
||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| import { session } from "electron"; | ||
| import { env } from "main/env.main"; | ||
| import { publicProcedure, router } from "../.."; | ||
|
|
||
| export const createCacheRouter = () => { | ||
| return router({ | ||
| clearElectricCache: publicProcedure.mutation(async () => { | ||
| try { | ||
| // Clear all storage (including HTTP cache) for the API origin only | ||
| // This targets Electric shape responses without clearing app assets | ||
| await session.defaultSession.clearStorageData({ | ||
| origin: env.NEXT_PUBLIC_API_URL, | ||
| }); | ||
|
|
||
| console.log( | ||
| "[cache] Cleared Electric cache for origin:", | ||
| env.NEXT_PUBLIC_API_URL, | ||
| ); | ||
|
|
||
| return { success: true }; | ||
| } catch (error) { | ||
| console.error("[cache] Failed to clear Electric cache:", error); | ||
|
Comment on lines
+11
to
+22
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: cd apps/desktop/src/lib/trpc/routers/cache && cat -n index.ts | head -30Repository: superset-sh/superset Length of output: 1135 🏁 Script executed: rg "\[cache" apps/desktop --type ts --type tsx -A 1 | head -50Repository: superset-sh/superset Length of output: 91 🏁 Script executed: rg "NEXT_PUBLIC_API_URL" --type ts --type tsx | head -20Repository: superset-sh/superset Length of output: 91 🏁 Script executed: rg "\[.*\/.*\]" apps/desktop --type ts -B 1 -A 1 | head -40Repository: superset-sh/superset Length of output: 144 🏁 Script executed: rg "clearStorageData" --type ts -B 3 -A 3Repository: superset-sh/superset Length of output: 659 🏁 Script executed: rg "NEXT_PUBLIC_API_URL" --type ts -B 2 -A 2 | head -30Repository: superset-sh/superset Length of output: 1615 🏁 Script executed: rg "console\.(log|error)" apps/desktop/src/lib/trpc --type ts -A 0 | head -30Repository: superset-sh/superset Length of output: 3024 🏁 Script executed: rg "\[domain.*operation\]|\[.*\/.*\] " apps --type ts -A 0 | head -40Repository: superset-sh/superset Length of output: 189 🏁 Script executed: cat packages/trpc/src/env.ts | grep -A 2 -B 2 "NEXT_PUBLIC_API_URL"Repository: superset-sh/superset Length of output: 265 🏁 Script executed: rg "console\.(log|error)" apps/desktop/src/lib/trpc --type ts -B 1 -A 1 | grep "\[" | head -20Repository: superset-sh/superset Length of output: 2797 🏁 Script executed: cat apps/desktop/src/lib/trpc/routers/workspaces/utils/shell-env.ts | grep console.log | head -5Repository: superset-sh/superset Length of output: 206 🏁 Script executed: python3 << 'EOF'
# Check if NEXT_PUBLIC_API_URL is validated as a full URL
import re
test_urls = [
"https://api.example.com",
"https://api.example.com/path",
"https://api.example.com:3000",
]
for url in test_urls:
parsed = url.split('?')[0].split('#')[0] # Remove query/fragment
origin = parsed.rsplit('/', 1)[0] if '/' in parsed[8:] else parsed # Simple extraction
print(f"URL: {url}")
print(f" Would use origin: {origin}")
print(f" Different from URL: {origin != url}")
print()
EOFRepository: superset-sh/superset Length of output: 150 🏁 Script executed: cat apps/desktop/src/lib/trpc/routers/cache/index.ts | head -35Repository: superset-sh/superset Length of output: 993 🏁 Script executed: cd apps/desktop && cat tsconfig.json | grep -A 20 "paths"Repository: superset-sh/superset Length of output: 322 🏁 Script executed: rg "new URL" apps/desktop --type ts -B 2 -A 2 | head -20Repository: superset-sh/superset Length of output: 1530 Update log prefix to follow Per coding guidelines, log prefixes should use 🛠️ Suggested update- await session.defaultSession.clearStorageData({
- origin: env.NEXT_PUBLIC_API_URL,
- });
-
- console.log(
- "[cache] Cleared Electric cache for origin:",
- env.NEXT_PUBLIC_API_URL,
- );
+ const apiOrigin = new URL(env.NEXT_PUBLIC_API_URL).origin;
+ await session.defaultSession.clearStorageData({ origin: apiOrigin });
+
+ console.log("[cache/clear] Cleared Electric cache for origin:", apiOrigin);🤖 Prompt for AI Agents |
||
| return { | ||
| success: false, | ||
| error: | ||
| error instanceof Error ? error.message : "Failed to clear cache", | ||
| }; | ||
| } | ||
| }), | ||
| }); | ||
| }; | ||
|
|
||
| export type CacheRouter = ReturnType<typeof createCacheRouter>; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| import type { AppRouter } from "@superset/trpc"; | ||
| import { createTRPCProxyClient, httpBatchLink } from "@trpc/client"; | ||
| import { env } from "renderer/env.renderer"; | ||
| import superjson from "superjson"; | ||
| import { getAuthToken } from "./auth-client"; | ||
|
|
||
| /** | ||
| * HTTP tRPC client for calling the API server. | ||
| * Uses bearer token authentication like the auth client. | ||
| * For mutations only - for fetching data we already have electric | ||
| */ | ||
| export const apiTrpcClient = createTRPCProxyClient<AppRouter>({ | ||
| links: [ | ||
| httpBatchLink({ | ||
| url: `${env.NEXT_PUBLIC_API_URL}/api/trpc`, | ||
| transformer: superjson, | ||
| headers: () => { | ||
| const token = getAuthToken(); | ||
| if (token) { | ||
| return { | ||
| Authorization: `Bearer ${token}`, | ||
| }; | ||
| } | ||
| return {}; | ||
| }, | ||
| }), | ||
| ], | ||
| }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: superset-sh/superset
Length of output: 184
🏁 Script executed:
Repository: superset-sh/superset
Length of output: 184
🏁 Script executed:
Repository: superset-sh/superset
Length of output: 184
🏁 Script executed:
Repository: superset-sh/superset
Length of output: 184
🌐 Web query:
pkg.pr.new package registry ephemeral builds dependency💡 Result:
Brief summary — what pkg.pr.new does and how its ephemeral preview packages & dependencies work:
What it is: a GitHub App + CLI that publishes per-commit / per-PR preview releases to a temporary, npm‑compatible registry so you can install unreleased builds without publishing to npm. [1][2]
How to use it: run the CLI (npx pkg-pr-new publish) from a GitHub Actions workflow (supports monorepos/workspaces and templates for StackBlitz). The CLI produces installable URLs like npm i https://pkg.pr.new/@ or shorter compact forms when configured. [2][4]
Ephemeral storage / retention: preview packages are stored in Cloudflare R2; pkg.pr.new is intentionally temporary — unused packages are garbage‑collected (examples: cleanup rules removing packages not downloaded for ~1 month and older-than‑6‑months removals are used in implementations). This means previews are not permanent and may be removed after inactivity/time. [3]
Dependency handling: pkg.pr.new publishes packed artifacts (npm pack style). It has flags to influence packing and dependency behavior (e.g., --pnpm / --yarn, and a --peerDeps option to control how peerDependencies are represented). Installs from the preview registry are npm‑compatible so package managers resolve them the same way as normal tarball URLs. [2][4]
Sources:
🌐 Web query:
zod version 4.3.5 npm registry stability💡 Result:
Short answer: Zod 4.3.5 is part of Zod 4 (declared stable by the author) and has no known direct security vulnerabilities in public vulnerability databases; however there are recent build/packaging issues reported (module-federation warning / package.json metadata) you should test for your use-case. Sources:
References:
[1] https://zod.dev/v4/versioning
[2] https://security.snyk.io/package/npm/zod%404.3.5
[3] colinhacks/zod#4656
[4] https://socket.dev/npm/package/zod
🌐 Web query:
@electric-sql/client npm package versions💡 Result:
Latest published version: 1.0.10 (see npm). [1]
To list all published versions locally run:
@electric-sql/clientversions --jsonSources:
@electric-sql/client. [1]Replace PR-hosted
@electric-sql/clientwith published registry version; validate Zod v4 compatibility.The pkg.pr.new registry publishes ephemeral preview packages with automatic garbage collection (removed after ~1 month of inactivity or 6+ months old), making it unsuitable for stable dependencies. Switch to the latest published version (
@electric-sql/client@1.0.10 or newer from npm registry). Additionally, test Zod v4.3.5 behavior against your schemas to ensure compatibility with any v3→v4 breaking changes.🤖 Prompt for AI Agents