- MCP
- code on this site's /mcp
- CLI
- none: the JSON below is the answer
- JSON
- /christopher/abso-core/files/client/test/queue-waiting.test.ts?format=json
50 linespinch 86% · rename 14%Last change rename in version 100, 2 versions changed it
1// What abso waiting --mine says about your own publishes in the merge queue: where each stands, a pause, and how
2// the outcome comes. Nothing when none of yours waits.
4import assert from "node:assert/strict";
5import { describe, it } from "node:test";
6import type { QueueItem, QueueState } from "../src/api.ts";
7import { queuedLines } from "../src/queue.ts";
9const item = (id: number, agent: string, checking = false): QueueItem => ({
10 id,
11 agent,
12 message: `push ${id}`,
13 time: 0,
14 changes: 1,
15 checking,
16});
17const state = (items: QueueItem[], paused: QueueState["paused"] = null): QueueState =>
18 ({ items, paused }) as unknown as QueueState;
20describe("waiting: your pushes in the merge queue", () => {
21 it("says nothing when none of yours waits, or there's no queue to read", () => {
22 assert.deepEqual(queuedLines(undefined, "ann"), []);
23 assert.deepEqual(queuedLines(state([]), "ann"), []);
24 assert.deepEqual(queuedLines(state([item(1, "bob")]), "ann"), []);
25 });
27 it("says where yours stands, and how the outcome comes", () => {
28 assert.deepEqual(queuedLines(state([item(1, "bob", true), item(2, "ann")]), "ann"), [
29 'Your push 2 ("push 2") is in the merge queue: waiting, 1 push ahead of it.',
30 "It lands or is turned back once the project's check runs on it; the outcome comes as news, and abso unqueue takes it back.",
31 ]);
32 assert.deepEqual(queuedLines(state([item(3, "ann", true), item(4, "bob", true), item(5, "ann")]), "ann"), [
33 'Your push 3 ("push 3") is in the merge queue: being checked in a batch of 2.',
34 'Your push 5 ("push 5") is in the merge queue: waiting, 2 pushes ahead of it.',
35 "Each lands or is turned back once the project's check runs on it; the outcome comes as news, and abso unqueue takes them back.",
36 ]);
37 });
39 it("says when the queue is paused", () => {
40 const paused = {
41 reason: "the box failed twice",
42 since: "2026-01-01T00:00:00.000Z",
43 nextTry: "2026-01-01T00:05:00.000Z",
44 };
45 assert.equal(
46 queuedLines(state([item(1, "ann")], paused), "ann")[1],
47 "The merge queue is paused: the box failed twice.",
48 );
49 });
50});