fix(discord): the connector's STOP refusal names the journal by label (#1873)

Re-check 3 found connector.start() still quoted the journal directory in
its STOP refusal, and the CLI passes a DiscordError through unchanged.
It now uses journalLabel like the CLI and journal refusals. The connector
test asserts the path is absent: 22/1 on the old source, 23/0 after.
This commit was merged in pull request #1933.
This commit is contained in:
jason.woltje committed 2026-11-11 10:22:14 -06:00
1 parent 63e2a574af
commit ce4fe048bb
2 files changed
+3 -3

No files matched your search

+2 -2
View File
@@ -35,7 +35,7 @@ import { reloadDiff } from "./binding.mjs";
import { envelope, splitReply } from "./context.mjs";
import {
ensureJournal, appendInbox, readInboxIds, appendOutbox, unresolvedOutbox, appendDrop,
writeTurn, appendAdmission, countAdmissionsOn, appendNotice, noticeOn, utcDate, stopRequested,
writeTurn, appendAdmission, countAdmissionsOn, appendNotice, noticeOn, utcDate, stopRequested, journalLabel,
} from "./journal.mjs";
import { RestOutcome } from "./rest.mjs";
import { DiscordError } from "./errors.mjs";
@@ -596,7 +596,7 @@ ${status === "not-posted" ? APPROVAL_LINES.pressAgain : APPROVAL_LINES.failed}`;
async start() {
processing();
if (state.started) throw new DiscordError("connector already started", 1);
if (stopRequested(journalDir)) throw new DiscordError(`STOP is present in ${journalDir}; remove it to run`, 1);
if (stopRequested(journalDir)) throw new DiscordError(`STOP is present in ${journalLabel(journalDir)}; remove it to run`, 1);
const reconciled = await reconcile();
const approvals = await reconcileApprovals();
processing();
+1 -1
View File
@@ -230,7 +230,7 @@ test("restart: an inbox with three ids and a replay of the same three produces z
test("stop: STOP present refuses start; STOP written while running refuses new turns and the current one finishes", async () => {
const { journalDir, rest, engine, connector } = setup({ replies: [{ text: "done", delayMs: 30 }] });
requestStop(journalDir, "test");
await assert.rejects(connector.start(), /STOP is present/);
await assert.rejects(connector.start(), (err) => /STOP is present/.test(err.message) && !err.message.includes(journalDir));
assert.equal(engine.started, false);
writeFileSync(join(journalDir, "STOP"), ""); // still present; clear it
const { unlinkSync } = await import("node:fs");