Skip to content

Commit fa53827

Browse files
fix(web): discard completed project rename drafts
1 parent 3b321d3 commit fa53827

4 files changed

Lines changed: 25 additions & 3 deletions

File tree

‎apps/server/src/persistence/Migrations/055_OrchestrationV2.test.ts‎

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ layer("055_OrchestrationV2", (it) => {
1313
Effect.sync(() => {
1414
assert.deepStrictEqual(
1515
migrationEntries.map(([id]) => id),
16-
Array.from({ length: 64 }, (_, index) => index + 1),
16+
Array.from({ length: 65 }, (_, index) => index + 1),
1717
);
1818
}),
1919
);
@@ -22,6 +22,14 @@ layer("055_OrchestrationV2", (it) => {
2222
Effect.gen(function* () {
2323
const sql = yield* SqlClient.SqlClient;
2424
yield* runMigrations({ toMigrationInclusive: 53 });
25+
yield* sql`
26+
INSERT INTO projection_projects (
27+
project_id, title, workspace_root, scripts_json, created_at, updated_at
28+
) VALUES (
29+
'project:existing', 'Existing project', '/work/existing', '[]',
30+
'2026-06-19T00:00:00.000Z', '2026-06-20T00:00:00.000Z'
31+
)
32+
`;
2533

2634
const executed = yield* runMigrations();
2735
assert.deepStrictEqual(executed, [
@@ -36,8 +44,16 @@ layer("055_OrchestrationV2", (it) => {
3644
[62, "ThreadFailureLookupIndex"],
3745
[63, "DropUnusedV1Projections"],
3846
[64, "CanonicalizeThreadPullRequestLinks"],
47+
[65, "ProjectionProjectExplicitTitle"],
3948
]);
4049
assert.deepStrictEqual(yield* runMigrations(), []);
50+
assert.deepStrictEqual(
51+
yield* sql`
52+
SELECT title, title_is_explicit FROM projection_projects
53+
WHERE project_id = 'project:existing'
54+
`,
55+
[{ title: "Existing project", title_is_explicit: 0 }],
56+
);
4157

4258
const migrations = yield* sql<{
4359
readonly migration_id: number;
@@ -66,6 +82,7 @@ layer("055_OrchestrationV2", (it) => {
6682
{ migration_id: 62, name: "ThreadFailureLookupIndex" },
6783
{ migration_id: 63, name: "DropUnusedV1Projections" },
6884
{ migration_id: 64, name: "CanonicalizeThreadPullRequestLinks" },
85+
{ migration_id: 65, name: "ProjectionProjectExplicitTitle" },
6986
]);
7087

7188
const tables = yield* sql<{ readonly name: string }>`

‎apps/server/src/persistence/Migrations/064_CanonicalizeThreadPullRequestLinks.test.ts‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,10 @@ layer("064_CanonicalizeThreadPullRequestLinks", (it) => {
123123
'user', ${v1Payload}, '{}', 1)
124124
`;
125125

126-
assert.deepEqual(yield* runMigrations(), [[64, "CanonicalizeThreadPullRequestLinks"]]);
127-
assert.deepEqual(yield* runMigrations(), []);
126+
assert.deepEqual(yield* runMigrations({ toMigrationInclusive: 64 }), [
127+
[64, "CanonicalizeThreadPullRequestLinks"],
128+
]);
129+
assert.deepEqual(yield* runMigrations({ toMigrationInclusive: 64 }), []);
128130
const rows = yield* sql<{ readonly thread_id: string; readonly payload_json: string }>`
129131
SELECT thread_id, payload_json FROM orchestration_v2_projection_threads
130132
`;

‎apps/server/src/persistence/reconcileV2PreviewMigration.test.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ describe("V2 preview upgrade", () => {
4444
[62, "ThreadFailureLookupIndex"],
4545
[63, "DropUnusedV1Projections"],
4646
[64, "CanonicalizeThreadPullRequestLinks"],
47+
[65, "ProjectionProjectExplicitTitle"],
4748
]);
4849
assert.deepStrictEqual(yield* runMigrations(), []);
4950
assert.deepStrictEqual(yield* sql`SELECT * FROM orchestration_v2_legacy_imports`, imports);
@@ -131,6 +132,7 @@ describe("V2 preview upgrade", () => {
131132
[62, "ThreadFailureLookupIndex"],
132133
[63, "DropUnusedV1Projections"],
133134
[64, "CanonicalizeThreadPullRequestLinks"],
135+
[65, "ProjectionProjectExplicitTitle"],
134136
]);
135137
}).pipe(Effect.provide(NodeSqliteClient.layer({ filename: ":memory:" }))),
136138
);

‎apps/web/src/components/settings/ProjectSettingsPanel.tsx‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,7 @@ function ProjectDetail({
281281
return;
282282
}
283283
if (!projectGroupTitleNeedsUpdate(group.memberProjects, title, wasEdited)) {
284+
setDraftName(null);
284285
return;
285286
}
286287
const result = await updateAllMembers({ title }, "Failed to rename project");

0 commit comments

Comments
 (0)