Lines 68–74 at 318 (were 68–74 at 218)
6969 for (const key of claimsOf(atom)) streams.push(g.eachWriterOf(key)); 7070 const theirs: AtomId[] = []; 71− for (const id of orderedClaimants(g, streams)) if (against.has(id)) theirs.push(id);
71+ for (const id of orderedClaimants(streams)) if (against.has(id)) theirs.push(id); 7272 out.set(yours, theirs); Lines 136–142 at 318 (were 136–142 at 218)
137137/** Claim indexes append in canonical seq order. Merge one cursor per current 138138 * atom key, retaining no candidate set proportional to historical claims. */ 139−function* orderedClaimants(g: Graph, streams: IterableIterator<AtomId>[]): IterableIterator<AtomId> {
139+function* orderedClaimants(streams: IterableIterator<AtomId>[]): IterableIterator<AtomId> { 141141 type Head = { id: AtomId; seq: number; stream: number }; 142142 const heap: Head[] = []; Lines 152–162 at 318 (were 152–160 at 218)
155+ // Each claimant's seq from its id, as the graph reads it (abso 738): loading the stored atom for it read a row a 156+ // claimant, most of a warm draft-state's pairing on abso. 155157 const advance = (stream: number) => { 156158 const next = streams[stream]!.next(); 157− if (!next.done) push({ id: next.value, seq: g.atom(next.value).seq, stream });
159+ if (!next.done) push({ id: next.value, seq: seqOf(next.value), stream }); 159161 for (let stream = 0; stream < streams.length; stream++) advance(stream); 160162 let previous = -1; Lines 192–199 at 318 (were 190–197 at 218)
190192 let a = left.next(); 191193 let b = right.next(); 192194 while (!a.done && !b.done) { 193− const x = g.atom(a.value).seq;
194− const y = g.atom(b.value).seq;
195+ const x = seqOf(a.value); 196+ const y = seqOf(b.value); 195197 if (x === y && settled.has(a.value)) return true; 196198 if (x <= y) a = left.next(); 197199 if (y <= x) b = right.next(); Lines 284–339 at 318 (were 282–298 at 218)
282284 for (const file of g.filesOf(id)) out.add(file); 283285 if (moved.length === 0) continue; 284286 const atom = g.atom(id); 285− const lines: string[] = [...g.deletedLines(id)];
287+ const lines: string[] = []; 286288 for (const run of atom.inserts) if (!run.parent.startsWith("^")) lines.push(run.parent); 287289 for (const m of atom.moves ?? []) { 288290 lines.push(m.line); 289291 if (!m.parent.startsWith("^")) lines.push(m.parent); 291− for (const v of moved) for (const line of lines) out.add(v.fileOf(line));
293+ for (const v of moved) { 294+ for (const line of lines) out.add(v.fileOf(line)); 295+ // Deleted lines by number where the view can (abso Capacity): a draft deleting a big file has thousands, and 296+ // making each one's id only to look its number up again was most of collisions on website. 297+ const byNumber = (v as { fileOfNumber?: (n: number) => string }).fileOfNumber; 298+ if (byNumber) for (const n of g.deletedNumbers(id)) out.add(byNumber.call(v, n)); 299+ else for (const line of g.deletedLines(id)) out.add(v.fileOf(line)); 306+ * The files a view over `below` plus `mine` can lay out differently from `below` (abso Capacity, View.shareFiles), or 307+ * undefined when any of it moves lines and `placedDifferently` can't say where those land differently. A view's set is closed under dependencies, so it holds `mine` and whatever 308+ * `mine` depends on that `below` lacks; each of those can change a file, so all of them count. Counting `mine` alone 309+ * missed the files of work the draft depends on (Testing's typescript-rs diff for cloud-ts-01, core 235). 311+export function touchedBeyond( 313+ below: ReadonlySet<AtomId>, 314+ mine: Iterable<AtomId>, 315+ views: readonly ReadView[], 316+ placedDifferently?: () => ReadonlySet<string> | undefined, 317+): Set<string> | undefined { 318+ const beyond = new Set<AtomId>(); 319+ const stack = [...mine]; 320+ while (stack.length) { 321+ const id = stack.pop()!; 322+ if (beyond.has(id) || below.has(id)) continue; 324+ for (const dep of g.atom(id).deps) if (!beyond.has(dep) && !below.has(dep)) stack.push(dep); 326+ const files = touchedFiles(g, beyond, views); 327+ // Moves change more than the files their atoms name only where a moved line lands differently (View.placedDifferently, 328+ // abso Capacity); without that comparison, a draft that moves lines shares nothing. 329+ if ([...beyond].some((id) => (g.atom(id).moves?.length ?? 0) > 0)) { 330+ const placed = placedDifferently?.(); 331+ if (!placed) return undefined; 332+ for (const file of placed) files.add(file); 296337/** The atom's visible lines in a file of a view, or where it acted when none are left. */ 297338export function describeSide(view: ReadView, atom: AtomId, file: string, keys: readonly string[]): CollisionSide { 298339 const visible = view.lines(file);