@@ -26,6 +26,7 @@ describe("candidateBoundary", () => {
2626 const candidate = buildEngagementCandidate ( raw ) ;
2727 const bundle = maybeBuildConversationBundle ( {
2828 candidate,
29+ parentRef : raw . parentRef ,
2930 sourceTweet : {
3031 tweetId : candidate . tweetId ,
3132 conversationId : candidate . conversationId ,
@@ -50,10 +51,16 @@ describe("candidateBoundary", () => {
5051 expect ( candidate . parentRef ?. tweetId ) . toBe ( "parent-mention-1" ) ;
5152 expect ( bundle ?. sourceTweet ?. tweetId ) . toBe ( "mention-1" ) ;
5253 expect ( bundle ?. parentRef ?. tweetId ) . toBe ( "parent-mention-1" ) ;
54+ expect ( bundle ?. parentRef ?. authorId ) . toBe ( "bot-1" ) ;
5355 expect ( bundle ?. authorContext ?. authorHandle ) . toBe ( "Alice" ) ;
5456 expect ( canonical . event_id ) . toBe ( "mention-1" ) ;
5557 expect ( canonical . trigger_type ) . toBe ( "mention" ) ;
5658 expect ( canonical . author_handle ) . toBe ( "@alice" ) ;
59+ expect ( canonical . conversation_context ) . toEqual ( [
60+ "parent_tweet_id:parent-mention-1" ,
61+ "parent_conversation_id:conv-1" ,
62+ "parent_author_id:bot-1" ,
63+ ] ) ;
5764 expect ( canonical . context ) . toBeUndefined ( ) ;
5865 } ) ;
5966
@@ -98,6 +105,7 @@ describe("candidateBoundary", () => {
98105 const candidate = buildEngagementCandidate ( raw ) ;
99106 const bundle = maybeBuildConversationBundle ( {
100107 candidate,
108+ parentRef : raw . parentRef ,
101109 sourceTweet : {
102110 tweetId : candidate . tweetId ,
103111 conversationId : candidate . conversationId ,
@@ -126,6 +134,10 @@ describe("candidateBoundary", () => {
126134 expect ( canonical . event_id ) . toBe ( "timeline:tweet-1" ) ;
127135 expect ( canonical . trigger_type ) . toBe ( "reply" ) ;
128136 expect ( canonical . author_handle ) . toBe ( "@bob" ) ;
137+ expect ( canonical . conversation_context ) . toEqual ( [
138+ "parent_tweet_id:parent-tweet-1" ,
139+ "parent_conversation_id:conv-2" ,
140+ ] ) ;
129141 expect ( canonical . context ) . toBeUndefined ( ) ;
130142 } ) ;
131143
@@ -154,6 +166,10 @@ describe("candidateBoundary", () => {
154166 expect ( bundle ?. parentRef ?. tweetId ) . toBe ( "parent-2" ) ;
155167 expect ( bundle ?. authorContext ?. authorId ) . toBe ( "author-3" ) ;
156168 expect ( bundle ?. sourceMetadata ?. authorHandle ) . toBe ( "alice" ) ;
169+ expect ( toCanonicalExecutionInput ( candidate , bundle ) . conversation_context ) . toEqual ( [
170+ "parent_tweet_id:parent-2" ,
171+ "parent_conversation_id:conv-3" ,
172+ ] ) ;
157173 } ) ;
158174
159175 it ( "keeps the bundle sparse when no cheap parent hint is present" , ( ) => {
@@ -185,6 +201,7 @@ describe("candidateBoundary", () => {
185201 expect ( candidate . parentRef ) . toBeUndefined ( ) ;
186202 expect ( bundle ?. parentRef ) . toBeUndefined ( ) ;
187203 expect ( bundle ?. sourceTweet ?. tweetId ) . toBe ( "mention-3" ) ;
204+ expect ( toCanonicalExecutionInput ( candidate , bundle ) . conversation_context ) . toEqual ( [ ] ) ;
188205 } ) ;
189206
190207 it ( "keeps mention discoveredAt conservative when created_at is missing" , ( ) => {
0 commit comments