Lines 10–16 at 318 (were 10–16 at 316)
1010// made when a caller asks for them, and the latest asked for is kept. 1212import type { Graph, RelocationInfo } from "./graph.ts"; 13−import { isStartNode, lineId, seqOf } from "./keys.ts";
13+import { atomId, isStartNode, lineId, seqOf } from "./keys.ts"; 1414import { resolveScratchMoves, scratchLayoutNodes } from "./relocation-scratch.ts"; 1515import { isClosedSet, StableSet } from "./state-source.ts"; 1616import { joinLines } from "./text.ts"; Lines 1112–1118 at 318 (were 1112–1118 at 316)
11131113 id: graph.lineIdOf(n), 11141114 text: graph.textOf(n), 1115− atom: graph.idOfSeq(graph.writerSeqOf(n)),
1115+ atom: atomId(graph.writerSeqOf(n)), Lines 1126–1137 at 318 (were 1126–1137 at 316)
11261126 const n = vis[i]!; 11271127 const packed = visText?.[i]; 1129− id: visWriter && visK ? lineId(graph.idOfSeq(visWriter[i]!), visK[i]!) : graph.lineIdOf(n),
1129+ id: visWriter && visK ? lineId(atomId(visWriter[i]!), visK[i]!) : graph.lineIdOf(n), 11301130 textChunks: () => graph.textChunks(n), 11321132 return packed ?? graph.textOf(n); 1134− atom: graph.idOfSeq(visWriter ? visWriter[i]! : graph.writerSeqOf(n)),
1134+ atom: atomId(visWriter ? visWriter[i]! : graph.writerSeqOf(n)), Lines 1143–1156 at 318 (were 1143–1154 at 316)
11431143 const graph = this.graph; 11441144 const { vis, visText, visWriter, visK } = this.#file(path); 11451145 const lines: VisibleLine[] = new Array(vis.length); 1146+ // Writer seqs come from the graph's own layout, so they're named with atomId, not checked by idOfSeq (abso 738): 1147+ // on a stored graph its check read the atom count once a line, about 0.9 s of a warm draft-state on abso. 11461148 for (let i = 0; i < vis.length; i++) { 11471149 const n = vis[i]!; 1149− id: visWriter && visK ? lineId(graph.idOfSeq(visWriter[i]!), visK[i]!) : graph.lineIdOf(n),
1151+ id: visWriter && visK ? lineId(atomId(visWriter[i]!), visK[i]!) : graph.lineIdOf(n), 11501152 text: visText?.[i] ?? graph.textOf(n), 1151− atom: graph.idOfSeq(visWriter ? visWriter[i]! : graph.writerSeqOf(n)),
1153+ atom: atomId(visWriter ? visWriter[i]! : graph.writerSeqOf(n)), 11541156 this.#linesCache = { path, lines }; Lines 1172–1184 at 318 (were 1170–1182 at 316)
11701172 const writer = seqWriter ? seqWriter[i]! : graph.writerSeqOf(n); 11711173 let text: string | undefined; 1173− id: seqWriter && seqK ? lineId(graph.idOfSeq(writer), seqK[i]!) : graph.lineIdOf(n),
1175+ id: seqWriter && seqK ? lineId(atomId(writer), seqK[i]!) : graph.lineIdOf(n), 11751177 text ??= graph.textOf(n); 1178− atom: graph.idOfSeq(writer),
1179− deletedBy: by ? by.map((s) => graph.idOfSeq(s)) : NONE,
1180+ atom: atomId(writer), 1181+ deletedBy: by ? by.map((s) => atomId(s)) : NONE, 11801182 visible: by === undefined, Lines 68–74 at 318 (were 68–74 at 316)
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 316)
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 316)
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 316)
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 3218–3236 at 318 (were 3218–3232 at 316)
32183218 const base = agent.mine.some((id) => at.has(id)) 32193219 ? this.#view(differenceSet(at, new StableOverlaySet(agent.mine))) 32203220 : this.#viewAt(space, agent.base); 3221+ const to = version ?? last(space); 32213222 return this.#definitionRule.collisions( 32233224 this.#agentView(agent), 3225− this.#viewAt(space, version ?? last(space)),
3226+ this.#viewAt(space, to), 3231+ // Where the space changed since the agent's base, from each version's kept files on a stored writer, as land's 3232+ // (abso 714): walking every newer atom for them was 6.5 s of a publish 770 versions behind on abso. 3233+ () => (this.#writerStorage ? this.#paths.keptChangesSince(space, agent.base, to) : undefined),