@@ -1121,21 +1121,17 @@ describe("V1Migration database workflow", () => {
11211121 } )
11221122
11231123 test . each ( [
1124- { worktree : "/repo" , directory : "\\child" , expected : "/repo/\\child" } ,
1124+ { worktree : "/repo" , directory : "." , expected : "/repo" } ,
1125+ { worktree : "/repo" , directory : "src" , expected : "/repo" } ,
11251126 { worktree : "C:/repo" , directory : "." , expected : "C:/repo" } ,
1126- { worktree : "C:/repo" , directory : "src\\client" , expected : "C:/repo/src/client" } ,
1127- { worktree : "C:/repo" , directory : "\\child" , expected : "C:/child" } ,
1128- { worktree : "C:/repo" , directory : "C:child" , expected : "C:/repo/child" } ,
1129- { worktree : "D:/repo" , directory : "C:child" , expected : "C:/child" } ,
1130- { worktree : "//server/share/repo" , directory : "\\child" , expected : "//server/share/child" } ,
1131- { worktree : "/repo" , directory : "C:\\other" , expected : "C:/other" } ,
1132- { worktree : "/repo" , directory : "\\\\server\\share\\other" , expected : "//server/share/other" } ,
1127+ { worktree : "//server/share/repo" , directory : "." , expected : "//server/share/repo" } ,
1128+ { worktree : "/repo" , directory : "C:/other" , expected : "C:/other" } ,
1129+ { worktree : "/repo" , directory : "//server/share/other" , expected : "//server/share/other" } ,
11331130 { worktree : "/repo" , directory : "" , expected : "" } ,
11341131 ] ) ( "migrates $directory in $worktree" , async ( input ) => {
11351132 await database (
11361133 Effect . gen ( function * ( ) {
1137- const database = yield * Database . Service
1138- const db = database . db
1134+ const { db } = yield * Database . Service
11391135 yield * db . run ( sql `
11401136 INSERT INTO project (id, worktree, time_created, time_updated, sandboxes)
11411137 VALUES ('saved-project', ${ input . worktree } , 1, 2, '[]')
@@ -1149,6 +1145,9 @@ describe("V1Migration database workflow", () => {
11491145 expect ( yield * db . get ( sql `SELECT directory FROM session_v2 WHERE id = 'ses_test'` ) ) . toEqual ( {
11501146 directory : input . expected ,
11511147 } )
1148+ expect ( yield * db . get ( sql `SELECT directory FROM session WHERE id = 'ses_test'` ) ) . toEqual ( {
1149+ directory : input . directory ,
1150+ } )
11521151 } ) ,
11531152 )
11541153 } )
@@ -1179,7 +1178,7 @@ describe("V1Migration database workflow", () => {
11791178 )
11801179 } )
11811180
1182- test ( "migrates relative directories and preserves V1 history " , async ( ) => {
1181+ test ( "replaces projections containing apostrophes and checkpoints completion " , async ( ) => {
11831182 await database (
11841183 Effect . gen ( function * ( ) {
11851184 const { db } = yield * Database . Service
@@ -1191,7 +1190,7 @@ describe("V1Migration database workflow", () => {
11911190 tokens_cache_read, tokens_cache_write, revert, agent, model, metadata, time_created, time_updated,
11921191 time_compacting, time_archived
11931192 ) VALUES (
1194- 'ses_test', 'global', 'test', '. ', 'Test', '1', 99, 99, 99, 99, 99, 99, '{}', 'preserved',
1193+ 'ses_test', 'global', 'test', '/tmp/test ', 'Test', '1', 99, 99, 99, 99, 99, 99, '{}', 'preserved',
11951194 '{"id":"selected","providerID":"selected-provider","variant":"selected-variant"}', '{"keep":true}',
11961195 1, 2, 3, 4
11971196 )` )
@@ -1229,10 +1228,9 @@ describe("V1Migration database workflow", () => {
12291228 expect ( yield * db . all ( sql `SELECT id FROM event` ) ) . toEqual ( [ ] )
12301229 expect (
12311230 yield * db . get (
1232- sql `SELECT directory, agent, model, metadata, cost, tokens_input, tokens_output, tokens_reasoning, tokens_cache_read, tokens_cache_write, revert, time_created, time_updated, time_compacting, time_archived FROM session_v2 WHERE id = 'ses_test'` ,
1231+ sql `SELECT agent, model, metadata, cost, tokens_input, tokens_output, tokens_reasoning, tokens_cache_read, tokens_cache_write, revert, time_created, time_updated, time_compacting, time_archived FROM session_v2 WHERE id = 'ses_test'` ,
12331232 ) ,
12341233 ) . toEqual ( {
1235- directory : "/tmp/test" ,
12361234 agent : "preserved" ,
12371235 model : '{"id":"selected","providerID":"selected-provider","variant":"selected-variant"}' ,
12381236 metadata : '{"keep":true}' ,
@@ -1248,10 +1246,7 @@ describe("V1Migration database workflow", () => {
12481246 time_compacting : null ,
12491247 time_archived : 4 ,
12501248 } )
1251- expect (
1252- yield * db . get ( sql `SELECT directory, cost, revert, time_compacting FROM session WHERE id = 'ses_test'` ) ,
1253- ) . toEqual ( {
1254- directory : "." ,
1249+ expect ( yield * db . get ( sql `SELECT cost, revert, time_compacting FROM session WHERE id = 'ses_test'` ) ) . toEqual ( {
12551250 cost : 99 ,
12561251 revert : "{}" ,
12571252 time_compacting : 3 ,
@@ -1272,7 +1267,7 @@ describe("V1Migration database workflow", () => {
12721267 )
12731268 yield * Effect . forEach ( [ "ses_a" , "ses_b" , "ses_c" ] , ( id ) =>
12741269 db . run (
1275- sql `INSERT INTO session (id, project_id, slug, directory, title, version, cost, time_created, time_updated) VALUES (${ id } , 'global', ${ id } , ${ id === "ses_b" ? "." : " /tmp/test" } , 'Test', '1', 99, 1, 2)` ,
1270+ sql `INSERT INTO session (id, project_id, slug, directory, title, version, cost, time_created, time_updated) VALUES (${ id } , 'global', ${ id } , ' /tmp/test' , 'Test', '1', 99, 1, 2)` ,
12761271 ) ,
12771272 )
12781273 yield * db . run (
@@ -1328,10 +1323,7 @@ describe("V1Migration database workflow", () => {
13281323 Effect . filterOrFail ( ( status ) => status . status === "completed" ) ,
13291324 Effect . retry ( Schedule . spaced ( "10 millis" ) ) ,
13301325 )
1331- expect ( yield * db . get ( sql `SELECT directory, cost FROM session_v2 WHERE id = 'ses_b'` ) ) . toEqual ( {
1332- directory : "/tmp/test" ,
1333- cost : 0 ,
1334- } )
1326+ expect ( yield * db . get ( sql `SELECT cost FROM session_v2 WHERE id = 'ses_b'` ) ) . toEqual ( { cost : 0 } )
13351327 expect ( yield * db . all ( sql `SELECT id FROM session_message WHERE session_id = 'ses_b'` ) ) . toEqual ( [ ] )
13361328 expect ( yield * db . get ( sql `SELECT seq, owner_id FROM event_sequence WHERE aggregate_id = 'ses_b'` ) ) . toEqual ( {
13371329 seq : - 1 ,
0 commit comments