@@ -277,13 +277,16 @@ describe("useQueuedRunEdit", () => { |
277 | 277 | ); |
278 | 278 | }); |
279 | 279 |
|
280 | | - it("opens an edit with the thread and machine records its mentions refer to", async () => { |
| 280 | + it("opens an edit with only the thread and machine records its text still mentions", async () => { |
281 | 281 | const { hook } = setup(); |
282 | 282 | const thread = threadContextRecord(THREAD_B, "Support Any File Uploads"); |
283 | 283 | const machine = environmentContextRecord(ENV, "Build box"); |
| 284 | + const unreferenced = threadContextRecord(THREAD_A, "Removed earlier"); |
284 | 285 | const messageId = MessageId.make("message-1"); |
285 | 286 | const text = `wait for ${formatInlineContextReference(threadContextReference(thread))} on ${formatInlineContextReference(environmentContextReference(machine))}`; |
286 | | - const messages = [{ id: messageId, text, context: { version: 1, records: [thread, machine] } }]; |
| 287 | + const messages = [ |
| 288 | + { id: messageId, text, context: { version: 1, records: [thread, machine, unreferenced] } }, |
| 289 | + ]; |
287 | 290 | await using _screen = await render(view(THREAD_A, "queued", hook, messages)); |
288 | 291 |
|
289 | 292 | await act(() => requireHook(hook).beginEdit({ runId: RUN, messageId, text, attachments: [] })); |
@@ -294,21 +297,6 @@ describe("useQueuedRunEdit", () => { |
294 | 297 | expect(draft?.environmentContexts).toEqual([machine]); |
295 | 298 | }); |
296 | 299 |
|
297 | | - it("opens an edit without records the message text no longer mentions", async () => { |
298 | | - const { hook } = setup(); |
299 | | - const unreferenced = threadContextRecord(THREAD_B, "Removed earlier"); |
300 | | - const messageId = MessageId.make("message-1"); |
301 | | - const text = "plain text"; |
302 | | - const messages = [{ id: messageId, text, context: { version: 1, records: [unreferenced] } }]; |
303 | | - await using _screen = await render(view(THREAD_A, "queued", hook, messages)); |
304 | | - |
305 | | - await act(() => requireHook(hook).beginEdit({ runId: RUN, messageId, text, attachments: [] })); |
306 | | - |
307 | | - const draft = useComposerDraftStore.getState().getComposerDraft(requireHook(hook).draftTarget); |
308 | | - expect(draft?.prompt).toBe(text); |
309 | | - expect(draft?.threadContexts).toEqual([]); |
310 | | - }); |
311 | | - |
312 | 300 | it("saves only the thread mentions still in the edited message", async () => { |
313 | 301 | const { hook } = setup(); |
314 | 302 | mocks.editQueuedRun.mockResolvedValue({ _tag: "Success" }); |
|