@@ -27,6 +27,35 @@ const seedPreview = Effect.gen(function* () {
2727} ) ;
2828
2929describe ( "V2 preview upgrade" , ( ) => {
30+ it . effect ( "preserves recorded project renames when adding custom-title state" , ( ) =>
31+ Effect . gen ( function * ( ) {
32+ const sql = yield * SqlClient . SqlClient ;
33+ yield * runMigrations ( { toMigrationInclusive : 69 } ) ;
34+ for ( const projectId of [ "renamed" , "untouched" ] ) {
35+ yield * sql `
36+ INSERT INTO projection_projects
37+ (project_id, title, workspace_root, scripts_json, created_at, updated_at)
38+ VALUES (${ projectId } , 'repo', ${ "/tmp/" + projectId } , '[]', '2026-10-01', '2026-10-01')
39+ ` ;
40+ yield * sql `
41+ INSERT INTO orchestration_events
42+ (event_id, aggregate_kind, stream_id, stream_version, event_type, occurred_at,
43+ actor_kind, payload_json, metadata_json, application_event_version)
44+ VALUES (${ projectId } , 'project', ${ projectId } , 1, 'project.meta-updated', '2026-10-01',
45+ 'client', ${ JSON . stringify ( projectId === "renamed" ? { title : "repo" } : { autoPull : true } ) } , '{}', 2)
46+ ` ;
47+ }
48+ yield * runMigrations ( ) ;
49+ assert . deepStrictEqual (
50+ yield * sql `SELECT project_id, has_custom_title FROM projection_projects ORDER BY project_id` ,
51+ [
52+ { project_id : "renamed" , has_custom_title : 1 } ,
53+ { project_id : "untouched" , has_custom_title : 0 } ,
54+ ] ,
55+ ) ;
56+ } ) . pipe ( Effect . provide ( NodeSqliteClient . layer ( { filename : ":memory:" } ) ) ) ,
57+ ) ;
58+
3059 it . effect ( "upgrades a published preview without replaying V2 or losing import progress" , ( ) =>
3160 Effect . gen ( function * ( ) {
3261 const sql = yield * SqlClient . SqlClient ;
0 commit comments