Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
21c9584
fix(composer): don't send attached threads to a machine that can't re…
NikitaMGrimm Oct 9, 2026
babc682
fix(mobile): drop pasted threads owned by another machine
NikitaMGrimm Oct 9, 2026
4894986
fix(web): blame attached threads only when no machine owns them
NikitaMGrimm Oct 9, 2026
ab2c9e2
fix(mobile): explain dropped foreign threads and don't count them aga…
NikitaMGrimm Oct 9, 2026
e15c511
fix(mobile): show attachment and thread paste warnings together
NikitaMGrimm Oct 9, 2026
7584e35
fix(mobile): keep pasted threads when the destination machine is unknown
NikitaMGrimm Oct 11, 2026
aa958fa
refactor(web): leave the web half to its own pull request
NikitaMGrimm Oct 11, 2026
beda35d
fix(mobile): clarify unavailable thread warnings
NikitaMGrimm Oct 11, 2026
b241e2a
Merge remote-tracking branch 'origin/main' into resubmit/reference-ma…
NikitaMGrimm Oct 15, 2026
0af3440
Merge remote-tracking branch 'origin/main' into resubmit/reference-ma…
NikitaMGrimm Oct 15, 2026
6a1784c
Merge remote-tracking branch 'origin/main' into resubmit/reference-ma…
NikitaMGrimm Oct 16, 2026
c19def9
Merge remote-tracking branch 'origin/main' into pr18322
NikitaMGrimm Oct 18, 2026
633d504
Merge remote-tracking branch 'origin/main' into resubmit/reference-ma…
juliusmarminge Oct 19, 2026
c28e806
test(mobile): cover mixed context paste across machines
juliusmarminge Oct 19, 2026
b326cfb
refactor(mobile): share attached thread validation when pasting
juliusmarminge Oct 19, 2026
1ecea4f
fix(mobile): keep skipped pasted thread references unavailable
juliusmarminge Oct 19, 2026
2d4b2d7
Merge remote-tracking branch 'origin/main' into L70-18322
juliusmarminge Oct 20, 2026
703f36b
Merge remote-tracking branch 'origin/main' into L70-18322
juliusmarminge Oct 20, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix(mobile): keep skipped pasted thread references unavailable
  • Loading branch information
juliusmarminge committed Oct 19, 2026
commit 1ecea4f87290930f89a8e906504c9524158fb30f
23 changes: 15 additions & 8 deletions apps/mobile/src/lib/composerContextClipboard.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ vi.mock("./composerImages", () => ({
vi.mock("./uuid", () => ({ uuidv4: () => `import-${++mocks.sequence}` }));

import { importComposerContextClipboard } from "./composerContextClipboard";
import { createComposerContextHistory } from "./composerContext";

const image = {
version: 1 as const,
Expand Down Expand Up @@ -88,15 +89,15 @@ const clipboard = {
const localThread = {
version: 1 as const,
kind: "thread" as const,
contextId: ComposerContextId.make("local-thread"),
contextId: ComposerContextId.make("thread_local-thread"),
label: "Local discussion",
environmentId: EnvironmentId.make("destination"),
threadId: ThreadId.make("local-thread"),
title: "Local discussion",
};
const foreignThread = {
...localThread,
contextId: ComposerContextId.make("foreign-thread"),
contextId: ComposerContextId.make("thread_foreign-thread"),
label: "Remote discussion",
environmentId: EnvironmentId.make("source"),
threadId: ThreadId.make("foreign-thread"),
Expand All @@ -112,7 +113,8 @@ const mixedClipboard = {
...mixedRecords,
{
...foreignThread,
contextId: ComposerContextId.make("uncopied-thread"),
contextId: ComposerContextId.make("thread_uncopied-thread"),
threadId: ThreadId.make("uncopied-thread"),
title: "Not in the copied selection",
},
],
Expand Down Expand Up @@ -213,17 +215,22 @@ describe("mobile context clipboard imports", () => {
references.slice(1).map((reference) => reference.contextId),
);
expect(
references
.slice(1)
.every(
(reference) => !mixedRecords.some((record) => record.contextId === reference.contextId),
),
references.every(
(reference) => !mixedRecords.some((record) => record.contextId === reference.contextId),
),
).toBe(true);
expect(
result!.context.records.some((record) => record.contextId === references[0]!.contextId),
).toBe(false);
expect(result!.text).toMatch(/^Compare these findings: .* before changing anything\.$/);

const restoreHistory = createComposerContextHistory();
restoreHistory(formatComposerContextReference(foreignThread), {
version: 1,
records: [foreignThread],
});
expect(restoreHistory(`${result!.text} Next step`, result!.context)).toEqual(result!.context);

mocks.download.mockClear();
await expect(
importComposerContextClipboard(
Expand Down
10 changes: 5 additions & 5 deletions apps/mobile/src/lib/composerContextClipboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,24 +72,24 @@ export async function importComposerContextClipboard(
decodeComposerContextFragment(input.fragment) ?? decodeComposerContextClipboardHtml(input.html);
if (!fragment) return null;
const selected = referencedComposerContext(input.text, { version: 1, records: fragment.records });
const imported = reidentifyComposerContext(input.text, selected?.records ?? [], uuidv4);
const skippedThreads =
destinationEnvironmentId === undefined
? []
: threadContextsOutsideEnvironment({
text: input.text,
records: selected?.records ?? [],
text: imported.text,
records: imported.context.records,
environmentId: destinationEnvironmentId,
});
const skippedIds = new Set(skippedThreads.map((record) => record.contextId));
const retained = (selected?.records ?? []).filter((record) => !skippedIds.has(record.contextId));
const retained = imported.context.records.filter((record) => !skippedIds.has(record.contextId));
if (existingContextCount + retained.length > COMPOSER_CONTEXT_MAX_RECORDS)
throw new Error("Remove some context items from the draft before pasting more.");
const imported = reidentifyComposerContext(input.text, retained, uuidv4);
const attachments: DraftComposerAttachment[] = [];
const records: ComposerContextRecord[] = [];
const failures: string[] = [];
try {
for (const record of imported.context.records) {
for (const record of retained) {
checkAborted(signal);
if (!("attachmentId" in record)) {
records.push(record);
Expand Down
Loading