Skip to content

Commit 573a425

Browse files
j15zclaude
andcommitted
chore(db): biome-format drizzle artifacts for migration 0255
Also document the fork-rewrite timeline invariant on rewriteMessageFileRefs: a kept message can only reference chat-owned files born at-or-before the cut, which are always in the rewrite maps — so unmapped pass-through cannot leave the fork pointing at uncopied chat-owned files. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent e43fe9c commit 573a425

3 files changed

Lines changed: 410 additions & 1266 deletions

File tree

apps/sim/lib/copilot/chat/rewrite-file-references.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,15 @@ function rewriteText(text: string, maps: ChatFileRefMaps): string {
2929
* in the maps (shared workspace files, workflows, other chats) pass through
3030
* unchanged. Pure; returns the input array untouched when there is nothing to
3131
* rewrite.
32+
*
33+
* Pass-through cannot leave the fork pointing at uncopied CHAT-OWNED files:
34+
* a message can only reference files that existed when it was written, every
35+
* chat-owned file is stamped with the user message of the turn it was born in
36+
* (NULL-stamped legacy rows are copied into every fork), and the fork copies
37+
* every chat-owned file born at-or-before the cut — so any chat-owned file a
38+
* kept message references is always in the maps. The only reachable leftovers
39+
* are files soft-deleted before the fork, whose links are equally dead in the
40+
* source chat.
3241
*/
3342
export function rewriteMessageFileRefs(
3443
messages: PersistedMessage[],

0 commit comments

Comments
 (0)