Skip to content

abso-core

Public

abso is version control for agents: the client, the engine and a server you can run on your own Cloudflare account.

Check passed

Versions 215 to 216

Compare

+55 −5 in 6 places
Lines 295–302 at 216 (were 295–300 at 215)
295295 */
296296 #relocations(): Map<LineId, RelocationInfo> {
297297 if (this.#relocs) return this.#relocs;
298+ this.#takeShared();
299+ if (this.#relocs) return this.#relocs;
298300 const graph = this.graph;
299301 const skeleton = skeletonOf(graph);
300302 const stronger = (a: RelocationInfo, b: RelocationInfo): boolean => graph.comparePriority(a.atom, b.atom) > 0;
Lines 367–391 at 216 (were 365–377 at 215)
365367 return this.#relocs;
366368 }
367369
370+ /** The view whose moves this one may take, until it needs them all; then the view it took them from. */
371+ #movesFrom: View | undefined;
372+ #movesTaken: View | undefined;
368374 /**
369375 * Take another view's resolved moves (abso Capacity), when both sets hold the very same atoms that move lines: the
370− * moves then resolve the same, and every line sits where it sits there. Checked here, so any caller may ask.
376+ * moves then resolve the same, and every line sits where it sits there. Checked when this view first needs all its
377+ * moves, so any caller may ask, and a view that only finds a few lines' files never resolves them.
371378 */
372379 shareMoves(from: View): void {
373− if (from.graph !== this.graph || from.#hasMoves !== this.#hasMoves || !this.#hasMoves) return;
374− if (this.#relocs || from.#scratchMoves()) return;
380+ if (from.graph !== this.graph || from.#hasMoves !== this.#hasMoves || !this.#hasMoves || this.#relocs) return;
381+ this.#movesFrom = from;
382+ }
384+ #takeShared(): void {
385+ const from = this.#movesFrom;
386+ if (!from) return;
387+ this.#movesFrom = undefined;
388+ if (from.#scratchMoves()) return;
375389 for (const id of this.graph.movers()) {
376390 const seq = seqOf(id);
377391 if (this.#has(seq) !== from.#has(seq)) return;
Lines 393–421 at 216 (were 379–387 at 215)
379393 this.#relocs = from.#relocations();
380394 this.#relocsN = from.#relocationsN();
381395 this.#movesOnDisk = false;
382− this.#movedFrom = from.#movedInFrom();
396+ this.#movesTaken = from;
383397 }
384398
399+ /** Moved lines' relocations picked one at a time, before the view resolves them all (null: not moved here). */
400+ readonly #picked = new Map<number, MoveEntry | null>();
402+ /**
403+ * The relocation of moved line n that counts here, as #relocations picks it before any loop: right whenever the
404+ * walk that reached n goes on to a file's start, since only lines on a loop have their relocation set aside.
405+ */
406+ #pickOne(n: number): MoveEntry | undefined {
407+ let picked = this.#picked.get(n);
408+ if (picked === undefined) {
409+ const graph = this.graph;
410+ let best: MoveEntry | undefined;
411+ for (const e of skeletonOf(graph).byLine.get(n) ?? []) {
412+ if (this.#has(seqOf(e.r.atom)) && (!best || graph.comparePriority(e.r.atom, best.r.atom) > 0)) best = e;
413+ }
414+ this.#picked.set(n, (picked = best ?? null));
415+ }
416+ return picked ?? undefined;
417+ }
385419 /** Whether moves are resolved on disk for each layout: only a stored graph's view with more than MOVED_LINES_KEPT. */
386420 #scratchMoves(): boolean {
387421 if (!this.#hasMoves || !this.graph.hasOrderedChildren) return false;
Lines 487–507 at 216 (were 453–460 at 215)
453487 /** The file a node sits in, in this set: up by where lines were written, through the moves that count here. */
454488 #fileOfCode(code: number): string {
455489 const graph = this.graph;
456− const relocs = this.#relocationsN();
457490 const skeleton = skeletonOf(graph);
491+ if (!this.#relocsN) {
492+ // One moved line at a time, until a walk comes back to a line it passed: then moves loop, and are resolved whole.
493+ const passed = new Set<number>();
494+ let c = code;
495+ for (;;) {
496+ c = skeleton.climb(c);
497+ if (c < 0) return graph.nodeOf(c).slice(1);
498+ if (passed.has(c)) break;
499+ passed.add(c);
500+ const e = this.#pickOne(c);
501+ c = e ? e.parent : graph.parentCodeOf(c);
502+ }
503+ }
504+ const relocs = this.#relocationsN();
458505 let c = code;
459506 for (;;) {
460507 c = skeleton.climb(c);
Lines 616–623 at 216 (were 569–574 at 215)
569616 #movedFrom: Map<string, Set<number>> | undefined;
570617 #movedInFrom(): Map<string, Set<number>> {
571618 if (this.#movedFrom) return this.#movedFrom;
619+ this.#relocations();
620+ if (this.#movesTaken) return (this.#movedFrom = this.#movesTaken.#movedInFrom());
572621 const graph = this.graph;
573622 const out = new Map<string, Set<number>>();
574623 if (this.#hasMoves) {
Lines 1011–1017 at 216 (were 962–967 at 215)
9621011 if (this.#knownList) n += ARRAY_HEADER_BYTES + REFERENCE_BYTES * this.#knownList.length;
9631012 if (this.#relocs) n += MAP_HEADER_BYTES + MAP_ENTRY_BYTES * this.#relocs.size;
9641013 if (this.#relocsN) n += MAP_HEADER_BYTES + (MAP_ENTRY_BYTES + OBJECT_BYTES) * this.#relocsN.size;
1014+ n += MAP_ENTRY_BYTES * this.#picked.size;
9651015 for (const f of this.#files.values()) {
9661016 n += MAP_ENTRY_BYTES;
9671017 if (f !== NO_FILE) {
MCP
compare on this site's /mcp
CLI
abso diff 215 216 src/engine/view.ts --json
JSON
/christopher/abso-core/compare/215..216?file=src%2Fengine%2Fview.ts&format=json