Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions apps/desktop/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,15 @@
"clean": "git clean -xdf .cache .turbo dist dist-electron release node_modules",
"start": "electron-vite preview",
"generate:icons": "bun run scripts/generate-file-icons.ts",
"prepare:mastracode-dependency": "bun run ../../scripts/patch-mastracode-dependency.ts",
"predev": "cross-env NODE_ENV=development bun run clean:dev && bun run generate:icons && cross-env NODE_ENV=development bun run scripts/clean-launch-services.ts && cross-env NODE_ENV=development bun run scripts/patch-dev-protocol.ts",
"dev": "cross-env NODE_ENV=development electron-vite dev --watch",
"compile:app": "cross-env NODE_OPTIONS=--max-old-space-size=8192 electron-vite build",
"copy:native-modules": "bun run scripts/copy-native-modules.ts",
"validate:native-runtime": "bun run scripts/validate-native-runtime.ts",
"prebuild": "bun run clean:dev && bun run generate:icons && bun run compile:app && bun run copy:native-modules && bun run validate:native-runtime",
"prebuild": "bun run clean:dev && bun run generate:icons && bun run compile:app && bun run copy:native-modules && bun run prepare:mastracode-dependency && bun run validate:native-runtime",
"build": "cross-env CSC_IDENTITY_AUTO_DISCOVERY=false electron-builder --publish never",
"prepackage": "bun run copy:native-modules && bun run validate:native-runtime",
"prepackage": "bun run copy:native-modules && bun run prepare:mastracode-dependency && bun run validate:native-runtime",
"package": "electron-builder --config electron-builder.ts",
"install:deps": "electron-builder install-app-deps",
"release": "electron-builder --publish always",
Expand Down Expand Up @@ -71,13 +72,13 @@
"@hono/node-server": "^1.14.1",
"@hookform/resolvers": "^5.2.2",
"@lezer/highlight": "^1.2.3",
"@mastra/core": "^1.3.0",
"@mastra/core": "1.8.0-superset.2",
"@parcel/watcher": "^2.5.6",
"@pierre/diffs": "^1.0.10",
"@pierre/diffs": "1.1.7",
"@radix-ui/react-dialog": "^1.1.15",
"@radix-ui/react-label": "^2.1.8",
"@sentry/electron": "^7.7.0",
"@streamdown/mermaid": "^1.0.2",
"@streamdown/mermaid": "1.0.2",
"@superset/auth": "workspace:*",
"@superset/chat": "workspace:*",
"@superset/db": "workspace:*",
Expand Down Expand Up @@ -178,7 +179,7 @@
"lowdb": "^7.0.1",
"lowlight": "^3.3.0",
"lucide-react": "^0.563.0",
"mastracode": "^0.4.0",
"mastracode": "0.4.0-superset.12",
"nanoid": "^5.1.6",
"node-addon-api": "^7.1.0",
"node-pty": "1.1.0",
Expand All @@ -205,7 +206,7 @@
"shell-env": "^4.0.3",
"shell-quote": "^1.8.3",
"simple-git": "^3.30.0",
"streamdown": "^2.2.0",
"streamdown": "2.5.0",
"strip-ansi": "^7.1.2",
"superjson": "^2.2.5",
"tailwind-merge": "^3.4.0",
Expand Down
25 changes: 23 additions & 2 deletions apps/desktop/scripts/validate-native-runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,14 @@
* 3) required native runtime packages are missing from apps/desktop/node_modules
*/

import { existsSync, readdirSync, readFileSync } from "node:fs";
import { existsSync, lstatSync, readdirSync, readFileSync } from "node:fs";
import { builtinModules } from "node:module";
import { join } from "node:path";
import ts from "typescript";
import { mainExternalizedDependencies } from "../runtime-dependencies";
import {
mainExternalizedDependencies,
requiredMaterializedNodeModules,
} from "../runtime-dependencies";

const projectRoot = join(import.meta.dirname, "..");
const allowedBareRequirePackages = new Set([
Expand Down Expand Up @@ -360,6 +363,24 @@ function validateNativeModulesPrepared(): void {
);
}

for (const moduleName of requiredMaterializedNodeModules) {
const modulePath = join(nodeModulesDir, moduleName);
assertExists(
modulePath,
"Required materialized runtime dependency is missing.",
);
if (lstatSync(modulePath).isSymbolicLink()) {
fail(
[
"Required materialized runtime dependency is still a symlink.",
`Dependency: ${moduleName}`,
`Path: ${modulePath}`,
"Run `bun run copy:native-modules` and ensure Bun store symlinks are replaced with real files.",
].join("\n"),
);
}
}

const platformCandidates = getPlatformLibsqlCandidates();
if (platformCandidates.length === 0) {
console.warn(
Expand Down
46 changes: 46 additions & 0 deletions apps/desktop/src/lib/trpc/routers/changes/git-operations.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
import {
getExistingPRHeadRepoUrl,
resolveRemoteNameForExistingPRHead,
shouldRetargetPushToExistingPRHead,
} from "./utils/existing-pr-push-target";

describe("git-operations error handling", () => {
Expand Down Expand Up @@ -183,4 +184,49 @@ describe("existing PR push target resolution", () => {
}),
).toBe("https://github.com/kitenite/superset");
});

test("retargets push when the tracked branch differs from the linked PR head", () => {
expect(
shouldRetargetPushToExistingPRHead({
trackingRef: {
remoteName: "origin",
branchName: "feature/local-branch",
},
target: {
remote: "origin",
targetBranch: "feature/pr-branch",
},
}),
).toBe(true);
});

test("retargets push when the tracked remote differs from the linked PR head repo", () => {
expect(
shouldRetargetPushToExistingPRHead({
trackingRef: {
remoteName: "origin",
branchName: "feature/pr-branch",
},
target: {
remote: "kitenite",
targetBranch: "feature/pr-branch",
},
}),
).toBe(true);
});

test("keeps plain push when tracking already matches the linked PR head", () => {
expect(
shouldRetargetPushToExistingPRHead({
trackingRef: {
remoteName: "kitenite",
branchName: "feature/pr-branch",
},
target: {
remote: "kitenite",
targetBranch: "feature/pr-branch",
},
}),
).toBe(false);
});
});
Loading
Loading