Lines 495–501 at 148 (were 495–501 at 147)
496496 /** lamport(a) = 1 + max lamport of its deps; 0 for an atom with no deps (such as a0). */ 497497 lamport(id: AtomId): number { 498− this.atom(id);
498+ if (!this.has(id)) throw new EngineError("unknown-atom", `no atom ${id}`); 499499 return this.#lamport[this.#seq(id)]!; Lines 510–516 at 148 (were 510–516 at 147)
510510 const seq = this.#lineAtom.at(n); 513− atom: this.#atoms[seq]!.id,
513+ atom: this.idOfSeq(seq), 514514 k: n - this.#lineBase[seq]!, 515515 file: this.#paths[this.#lineFile.at(n)]!, 516516 parent: this.#nodeName(this.#lineParent.at(n)), Lines 527–533 at 148 (were 527–533 at 147)
527527 /** The atom that wrote a line, or undefined: line(id).atom without making the record. */ 528528 lineAtom(id: LineId): AtomId | undefined { 529529 const n = this.#lineN(id); 530− return n < 0 ? undefined : this.#atoms[this.#lineAtom.at(n)]!.id;
530+ return n < 0 ? undefined : this.idOfSeq(this.#lineAtom.at(n)); 533533 /** The file a line was written in, or undefined: line(id).file without making the record. */ Lines 586–594 at 148 (were 586–592 at 147)
587587 /** The atom id with this seq, as the graph keeps it. */ 588588 idOfSeq(seq: number): AtomId { 589− return this.#atoms[seq]!.id;
589+ if (!Number.isSafeInteger(seq) || seq < 0 || seq >= this.#atoms.length) 590+ throw new EngineError("unknown-atom", `no atom at sequence ${seq}`); 592594 lamportOfSeq(seq: number): number { Lines 743–749 at 148 (were 741–747 at 147)
741743 /** A line's id from its n. */ 742744 #lineName(n: number): LineId { 743745 const seq = this.#lineAtom.at(n); 744− return `${this.#atoms[seq]!.id}.${n - this.#lineBase[seq]!}`;
746+ return `${this.idOfSeq(seq)}.${n - this.#lineBase[seq]!}`; 747749 /** A node's code: a line's n, or -1 - a path's index for a start node; undefined when unknown. */ Lines 783–789 at 148 (were 781–787 at 147)
781783 deletersOf(line: LineId): readonly AtomId[] { 782784 const n = this.#lineN(line); 783785 if (n < 0) return EMPTY; 784− return [...this.eachDeleterSeqOf(n)].map((seq) => this.#atoms[seq]!.id);
786+ return [...this.eachDeleterSeqOf(n)].map((seq) => this.idOfSeq(seq)); 787789 writersOf(key: Key): readonly AtomId[] { Lines 839–845 at 148 (were 837–843 at 147)
837839 * start node, that file): a set's moves can have taken them elsewhere. 839841 filesOf(id: AtomId): readonly string[] { 840− this.atom(id);
842+ if (!this.has(id)) throw new EngineError("unknown-atom", `no atom ${id}`); 841843 return this.#atomFiles[this.#seq(id)]!;