Unverified 提交 968c654c authored 作者: Mohamed Aziz Mejri's avatar Mohamed Aziz Mejri 提交者: GitHub

Changing preview branch endpoint to read-write (#3257)

<!-- devin-review-badge-begin --> --- <a href="https://app.devin.ai/review/dyad-sh/dyad/pull/3257" target="_blank"> <picture> <source media="(prefers-color-scheme: dark)" srcset="https://static.devin.ai/assets/gh-open-in-devin-review-dark.svg?v=1"> <img src="https://static.devin.ai/assets/gh-open-in-devin-review-light.svg?v=1" alt="Open in Devin Review"> </picture> </a> <!-- devin-review-badge-end -->
上级 98b540e6
...@@ -169,7 +169,7 @@ export function registerNeonHandlers() { ...@@ -169,7 +169,7 @@ export function registerNeonHandlers() {
const previewBranchResponse = await retryOnLocked( const previewBranchResponse = await retryOnLocked(
() => () =>
neonClient.createProjectBranch(project.id, { neonClient.createProjectBranch(project.id, {
endpoints: [{ type: EndpointType.ReadOnly }], endpoints: [{ type: EndpointType.ReadWrite }],
branch: { branch: {
name: "preview", name: "preview",
parent_id: developmentBranch.id, parent_id: developmentBranch.id,
...@@ -651,7 +651,7 @@ export function registerNeonHandlers() { ...@@ -651,7 +651,7 @@ export function registerNeonHandlers() {
if (branchId === appData.neonPreviewBranchId) { if (branchId === appData.neonPreviewBranchId) {
throw new DyadError( throw new DyadError(
"Preview branches are read-only and cannot be selected as the active Neon branch.", "Preview branches are used for historical rollback and cannot be selected as the active Neon branch.",
DyadErrorKind.Precondition, DyadErrorKind.Precondition,
); );
} }
......
...@@ -4,10 +4,12 @@ import { getErrorMessage } from "./errors"; ...@@ -4,10 +4,12 @@ import { getErrorMessage } from "./errors";
describe("getErrorMessage", () => { describe("getErrorMessage", () => {
it("strips the Electron IPC wrapper from Error messages", () => { it("strips the Electron IPC wrapper from Error messages", () => {
const error = new Error( const error = new Error(
"Error invoking remote method 'neon:set-active-branch': Error: Preview branches are read-only.", "Error invoking remote method 'neon:set-active-branch': Error: Preview branches are used for historical rollback.",
); );
expect(getErrorMessage(error)).toBe("Preview branches are read-only."); expect(getErrorMessage(error)).toBe(
"Preview branches are used for historical rollback.",
);
}); });
it("prefers a message field on plain objects", () => { it("prefers a message field on plain objects", () => {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论