{"draft":null,"from":147,"to":148,"files":[{"path":"src/engine/graph.ts","added":9,"removed":7,"diff":"--- a/src/engine/graph.ts\n+++ b/src/engine/graph.ts\n@@ -495,7 +495,7 @@\n \n \t/** lamport(a) = 1 + max lamport of its deps; 0 for an atom with no deps (such as a0). */\n \tlamport(id: AtomId): number {\n-\t\tthis.atom(id);\n+\t\tif (!this.has(id)) throw new EngineError(\"unknown-atom\", `no atom ${id}`);\n \t\treturn this.#lamport[this.#seq(id)]!;\n \t}\n \n@@ -510,7 +510,7 @@\n \t\tconst seq = this.#lineAtom.at(n);\n \t\treturn {\n \t\t\tid,\n-\t\t\tatom: this.#atoms[seq]!.id,\n+\t\t\tatom: this.idOfSeq(seq),\n \t\t\tk: n - this.#lineBase[seq]!,\n \t\t\tfile: this.#paths[this.#lineFile.at(n)]!,\n \t\t\tparent: this.#nodeName(this.#lineParent.at(n)),\n@@ -527,7 +527,7 @@\n \t/** The atom that wrote a line, or undefined: line(id).atom without making the record. */\n \tlineAtom(id: LineId): AtomId | undefined {\n \t\tconst n = this.#lineN(id);\n-\t\treturn n < 0 ? undefined : this.#atoms[this.#lineAtom.at(n)]!.id;\n+\t\treturn n < 0 ? undefined : this.idOfSeq(this.#lineAtom.at(n));\n \t}\n \n \t/** The file a line was written in, or undefined: line(id).file without making the record. */\n@@ -586,7 +586,9 @@\n \n \t/** The atom id with this seq, as the graph keeps it. */\n \tidOfSeq(seq: number): AtomId {\n-\t\treturn this.#atoms[seq]!.id;\n+\t\tif (!Number.isSafeInteger(seq) || seq < 0 || seq >= this.#atoms.length)\n+\t\t\tthrow new EngineError(\"unknown-atom\", `no atom at sequence ${seq}`);\n+\t\treturn atomId(seq);\n \t}\n \n \tlamportOfSeq(seq: number): number {\n@@ -741,7 +743,7 @@\n \t/** A line's id from its n. */\n \t#lineName(n: number): LineId {\n \t\tconst seq = this.#lineAtom.at(n);\n-\t\treturn `${this.#atoms[seq]!.id}.${n - this.#lineBase[seq]!}`;\n+\t\treturn `${this.idOfSeq(seq)}.${n - this.#lineBase[seq]!}`;\n \t}\n \n \t/** A node's code: a line's n, or -1 - a path's index for a start node; undefined when unknown. */\n@@ -781,7 +783,7 @@\n \tdeletersOf(line: LineId): readonly AtomId[] {\n \t\tconst n = this.#lineN(line);\n \t\tif (n < 0) return EMPTY;\n-\t\treturn [...this.eachDeleterSeqOf(n)].map((seq) => this.#atoms[seq]!.id);\n+\t\treturn [...this.eachDeleterSeqOf(n)].map((seq) => this.idOfSeq(seq));\n \t}\n \n \twritersOf(key: Key): readonly AtomId[] {\n@@ -837,7 +839,7 @@\n \t * start node, that file): a set's moves can have taken them elsewhere.\n \t */\n \tfilesOf(id: AtomId): readonly string[] {\n-\t\tthis.atom(id);\n+\t\tif (!this.has(id)) throw new EngineError(\"unknown-atom\", `no atom ${id}`);\n \t\treturn this.#atomFiles[this.#seq(id)]!;\n \t}\n "}],"unmatched":[]}