@@ -123,9 +123,36 @@ layer("064_CanonicalizeThreadPullRequestLinks", (it) => {
123123 'user', ${ v1Payload } , '{}', 1)
124124 ` ;
125125
126+ yield * sql `
127+ INSERT INTO orchestration_v2_projection_threads (
128+ thread_id, project_id, title, default_provider, runtime_mode, interaction_mode,
129+ created_at, updated_at, payload_json
130+ ) VALUES (
131+ 'damaged', 'project-1', 'damaged', 'codex', 'full-access', 'default',
132+ ${ updatedAt } , ${ updatedAt } , ''
133+ )
134+ ` ;
135+ yield * sql `
136+ INSERT INTO orchestration_events (
137+ event_id, aggregate_kind, stream_id, stream_version, event_type, occurred_at,
138+ actor_kind, payload_json, metadata_json, application_event_version
139+ ) VALUES ('event:damaged', 'thread', 'damaged', 0, 'thread.created', ${ updatedAt } ,
140+ 'user', '', '{}', 2)
141+ ` ;
142+
126143 assert . deepEqual ( yield * runMigrations ( { toMigrationInclusive : 64 } ) , [
127144 [ 64 , "CanonicalizeThreadPullRequestLinks" ] ,
128145 ] ) ;
146+ const [ damagedThread ] = yield * sql < { readonly payload_json : string } > `
147+ SELECT payload_json FROM orchestration_v2_projection_threads WHERE thread_id = 'damaged'
148+ ` ;
149+ const [ damagedEvent ] = yield * sql < { readonly payload_json : string } > `
150+ SELECT payload_json FROM orchestration_events WHERE event_id = 'event:damaged'
151+ ` ;
152+ assert . equal ( damagedThread ?. payload_json , "" ) ;
153+ assert . equal ( damagedEvent ?. payload_json , "" ) ;
154+ yield * sql `DELETE FROM orchestration_v2_projection_threads WHERE thread_id = 'damaged'` ;
155+ yield * sql `DELETE FROM orchestration_events WHERE event_id = 'event:damaged'` ;
129156 assert . deepEqual ( yield * runMigrations ( { toMigrationInclusive : 64 } ) , [ ] ) ;
130157 const rows = yield * sql < { readonly thread_id : string ; readonly payload_json : string } > `
131158 SELECT thread_id, payload_json FROM orchestration_v2_projection_threads
0 commit comments