surface SMTP delivery failures and add interactive rotor compass target

This commit is contained in:
Deploy
2026-04-08 03:08:53 +02:00
parent e95519a4ea
commit 2bcf6ab1e5
6 changed files with 257 additions and 27 deletions

View File

@@ -1020,6 +1020,67 @@ test("new users default to smtp-link and outbox uses smtp relay plugin", async (
}
});
test("request-access returns error when SMTP delivery fails", async (t) => {
const rootDir = path.resolve(__dirname, "..");
const dataDir = await fs.mkdtemp(path.join(os.tmpdir(), "rms-smtp-fail-test-"));
const port = randomPort();
const baseUrl = `http://127.0.0.1:${port}`;
const server = spawn(process.execPath, ["server/index.js"], {
cwd: rootDir,
env: {
...process.env,
PORT: String(port),
DATA_DIR: dataDir,
ADMIN_EMAILS: "admin@arcg.at",
PRIMARY_EMAIL_DOMAIN: "arcg.at",
PUBLIC_BASE_URL: baseUrl,
SMTP_HOST: "127.0.0.1",
SMTP_PORT: "1",
SMTP_SECURE: "false"
},
stdio: ["ignore", "pipe", "pipe"]
});
let serverStdErr = "";
server.stderr.on("data", (chunk) => {
serverStdErr += String(chunk);
});
t.after(async () => {
if (!server.killed) {
server.kill("SIGTERM");
}
await fs.rm(dataDir, { recursive: true, force: true });
});
await waitForServer(baseUrl);
let deliveryError = null;
try {
await requestJson(baseUrl, "/v1/auth/request-access", {
method: "POST",
body: { email: "deliveryfail@arcg.at" }
});
} catch (error) {
deliveryError = error;
}
assert.ok(deliveryError, "request-access should fail on smtp delivery error");
assert.equal(deliveryError.status, 502);
assert.equal(deliveryError.payload.error.code, "auth.challenge_delivery_failed");
const outbox = await readOutbox(dataDir);
const failed = [...outbox].reverse().find((entry) => entry.to === "deliveryfail@arcg.at" && entry.via === "rms.auth.smtp_relay" && entry.delivered === false);
assert.ok(failed, "failed smtp outbox entry expected");
assert.equal(failed.transport, "outbox-fallback");
assert.ok(String(failed.smtpError || "").length > 0, "smtp error must be recorded");
if (server.exitCode !== null && server.exitCode !== 0) {
throw new Error(`Server exited unexpectedly: ${server.exitCode}\n${serverStdErr}`);
}
});
test("public auth methods expose smtp-link first with 'per Mail' label", async (t) => {
const rootDir = path.resolve(__dirname, "..");
const dataDir = await fs.mkdtemp(path.join(os.tmpdir(), "rms-public-methods-test-"));