mirror of
https://github.com/severian-dev/sucker.severian.dev.git
synced 2026-10-18 01:20:29 +00:00
Name the setting that did not come through
The instructions mark exactly two steps REQUIRED, and the two markers sucker looks for are those two steps. So a failure can say which one is missing — the custom prompt, the persona, or both — instead of sending someone back to re-read a page they have already followed. Truncation causes the same symptom, so it is still named, but second: it only applies once the settings really are set. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NX2SsmUqQftWTZAY4BDuFa
This commit is contained in:
+22
-6
@@ -10,16 +10,32 @@ import {
|
||||
NO_GREETING,
|
||||
SuckerError,
|
||||
TOO_FEW_MESSAGES,
|
||||
TRUNCATED_CARD,
|
||||
missingSetup,
|
||||
isImpossibleRequest,
|
||||
isSuckerError,
|
||||
userFacingMessage,
|
||||
} from "../src/lib/errors.ts";
|
||||
|
||||
test("the one fixable failure is shown as written, with the advice that fixes it", () => {
|
||||
assert.equal(userFacingMessage(TRUNCATED_CARD), TRUNCATED_CARD.message);
|
||||
assert.match(TRUNCATED_CARD.message, /Context Size/);
|
||||
assert.ok(TRUNCATED_CARD.message.includes(CONTACT));
|
||||
test("a missing setting is named, not left to the reader to find", () => {
|
||||
const noPrompt = missingSetup(false, true).message;
|
||||
assert.match(noPrompt, /custom prompt is not coming through as <\.>/);
|
||||
assert.ok(!/persona needs the name/.test(noPrompt), "must not blame the setting that is fine");
|
||||
|
||||
const noPersona = missingSetup(true, false).message;
|
||||
assert.match(noPersona, /persona is not coming through/);
|
||||
assert.ok(!/custom prompt is not coming through/.test(noPersona));
|
||||
|
||||
const neither = missingSetup(false, false).message;
|
||||
assert.match(neither, /neither of the two required settings/);
|
||||
});
|
||||
|
||||
test("every setup message still offers truncation as the second cause", () => {
|
||||
for (const m of [missingSetup(false, true), missingSetup(true, false), missingSetup(false, false)]) {
|
||||
assert.match(m.message, /Context Size/);
|
||||
assert.ok(m.message.includes(CONTACT));
|
||||
// Shown verbatim: this is the one class of failure a user can act on.
|
||||
assert.equal(userFacingMessage(m), m.message);
|
||||
}
|
||||
});
|
||||
|
||||
test("shapes Janitor cannot produce never tell the user to fix them", () => {
|
||||
@@ -47,7 +63,7 @@ test("a genuine bug reports itself without leaking internals", () => {
|
||||
});
|
||||
|
||||
test("nobody is called a dingus", () => {
|
||||
for (const e of [TRUNCATED_CARD, NO_CARD, NO_GREETING, TOO_FEW_MESSAGES, new Error("x")]) {
|
||||
for (const e of [missingSetup(false, false), NO_CARD, NO_GREETING, TOO_FEW_MESSAGES, new Error("x")]) {
|
||||
assert.ok(!/dingus/i.test(userFacingMessage(e)));
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user