mirror of
https://github.com/bitbaum/loki.git
synced 2026-12-04 22:08:18 +01:00
* chore: add a formatter, matching the style this repo already writes singleQuote=false was chosen by counting this repo's own imports, not by fleet decree. The fleet is genuinely split and the two repos that already had a .prettierrc disagreed with each other, so there was no standard to restore. Quote style does not cross repo boundaries; having a gate does. Markdown is ignored for now — prettier rewraps prose, which would bury the real diff. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * style: format with prettier (1062 files) Mechanical. No behaviour change. This SHA is listed in .git-blame-ignore-revs so `git blame` skips it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * chore: teach git blame to skip the reformat Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * fix(lint): reattach two guards the reformat detached Both effects were one-liners, so a trailing eslint-disable-line covered the setState call: useEffect(() => { setSelected(new Set()); }, [q.length]); // eslint-disable-line ... prettier expanded the block. The comment stayed on the closing line while the call moved above it, so the guard protected nothing and the rule its author had deliberately silenced failed the build. This is the second shape of the same defect — hirnli had the eslint-disable-NEXT-line variant. Both come from the same fact: an eslint directive binds to a line number, so reformatting can silently unbind it, which makes 'mechanical, no behaviour change' false for any bulk reformat. * chore(desktop): bump the runner version the reformat requires desktop-release-drift enforces that anything built into Fleet Runner which differs from the last released tag must carry a version ahead of that tag — main read 0.8.15 and fleet-runner-v0.8.15 already shipped. A whole-repo reformat changes bytes under desktop/, so the gate fires. The alternative was adding desktop/ to .prettierignore, which would buy a quiet PR by carving a permanent hole in the formatter's coverage — the precise shape of silent drift this test was written to catch. Bumping is what the rule asks for and costs one patch release whose only content is whitespace. * chore: merge main and re-format A whole-repo reformat conflicts with any concurrent commit, and a conflicting PR runs no checks at all while reporting nothing. Conflicts resolved to main, which is correct because this branch changes formatting and nothing else. * chore: leave desktop/ out of this reformat desktop-release-drift is right to refuse this. Everything under desktop/ is built into Fleet Runner, so changing it means shipping: bump the version AND add a FLEET_RUNNER_RELEASES entry, whose stated audience is 'person who installed Fleet Runner and wants to know what changed'. For a whitespace-only build the honest answer is 'nothing', so that release should not exist — and I should not write release notes claiming otherwise. I had bumped to 0.8.16 to get the gate green. That was the wrong direction: publishing a build to three OS runners to keep a formatting PR quiet. Reverted. desktop/ is excluded in .prettierignore with the reasoning recorded there, to be formatted alongside the next real runner change, where the bump and the notes are true anyway. --------- Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
141 lines
4.8 KiB
TypeScript
141 lines
4.8 KiB
TypeScript
/**
|
|
* Live check of the form-assist pipeline against the real model.
|
|
*
|
|
* Proves the two things that were broken: filling a form from prose, and then
|
|
* CHANGING what is already there with a follow-up instruction.
|
|
*
|
|
* Run: npx tsx scripts/verify-ai-forms.ts
|
|
*/
|
|
|
|
import { runFormAssist } from "@fleet/ai-forms";
|
|
import { GOAL_FORM, SUBSCRIPTION_FORM } from "../src/config/ai-forms";
|
|
import { callGroqText } from "../src/lib/groq";
|
|
|
|
const complete = ({
|
|
system,
|
|
prompt,
|
|
maxTokens,
|
|
temperature,
|
|
}: {
|
|
system: string;
|
|
prompt: string;
|
|
maxTokens: number;
|
|
temperature: number;
|
|
}) => callGroqText(prompt, { systemPrompt: system, maxTokens, temperature, timeoutMs: 30_000 });
|
|
|
|
let failures = 0;
|
|
|
|
function check(label: string, ok: boolean, detail: string) {
|
|
console.log(`${ok ? " ✓" : " ✗"} ${label} — ${detail}`);
|
|
if (!ok) failures++;
|
|
}
|
|
|
|
async function main() {
|
|
console.log("\n1. Fill an empty Goal from prose");
|
|
const filled = await runFormAssist({
|
|
target: GOAL_FORM,
|
|
request: {
|
|
intent: "fill",
|
|
instruction:
|
|
"I want to ship the self-hosted payments layer for OrangeCat by the end of March 2026, so creators get paid without an intermediary.",
|
|
values: {},
|
|
},
|
|
complete,
|
|
});
|
|
if (!filled.ok) {
|
|
console.error(" ✗ fill failed:", filled.error);
|
|
process.exit(1);
|
|
}
|
|
console.log(" message:", filled.message);
|
|
console.log(" values :", JSON.stringify(filled.values));
|
|
check("title filled", String(filled.values.title ?? "").length > 3, String(filled.values.title));
|
|
check(
|
|
"targetDate is an ISO calendar date in 2026-03",
|
|
/^2026-03-\d{2}$/.test(String(filled.values.targetDate ?? "")),
|
|
String(filled.values.targetDate),
|
|
);
|
|
check(
|
|
"excluded field never written",
|
|
filled.values.parentGoalId === undefined || filled.values.parentGoalId === "",
|
|
String(filled.values.parentGoalId),
|
|
);
|
|
|
|
console.log("\n2. Follow up: change what is already there");
|
|
// Seeded rather than reusing step 1's output: the model sometimes writes an
|
|
// already-terse description, and "shorter" then legitimately changes nothing.
|
|
const seeded = {
|
|
title: "Ship self-hosted payments layer",
|
|
description:
|
|
"We are going to build and roll out a completely self-hosted payments layer for OrangeCat so that creators on the platform are able to receive money directly from their supporters without any intermediary sitting in the middle taking a cut or gatekeeping access.",
|
|
targetDate: "2026-03-31",
|
|
};
|
|
const longDescription = seeded.description;
|
|
const refined = await runFormAssist({
|
|
target: GOAL_FORM,
|
|
request: {
|
|
intent: "refine",
|
|
// Field-scoped on purpose: a bare "shorter" legitimately touches every
|
|
// text field, so it cannot test that refinement stays where it is aimed.
|
|
instruction: "make the description shorter, leave the title alone",
|
|
values: seeded,
|
|
history: [
|
|
{ role: "user", text: "ship the payments layer by end of March 2026" },
|
|
{ role: "assistant", text: filled.message },
|
|
],
|
|
},
|
|
complete,
|
|
});
|
|
if (!refined.ok) {
|
|
console.error(" ✗ refine failed:", refined.error);
|
|
process.exit(1);
|
|
}
|
|
console.log(" message:", refined.message);
|
|
console.log(" description:", JSON.stringify(refined.values.description));
|
|
check(
|
|
"description actually changed (this is what used to silently no-op)",
|
|
refined.values.description !== seeded.description,
|
|
`${longDescription.length} chars -> ${String(refined.values.description ?? "").length}`,
|
|
);
|
|
check(
|
|
"untouched field kept its value",
|
|
refined.values.title === seeded.title,
|
|
String(refined.values.title),
|
|
);
|
|
check("changed list is honest", refined.changed.length > 0, refined.changed.join(", "));
|
|
|
|
console.log("\n3. A two-word instruction on a select + overridable defaults");
|
|
const sub = await runFormAssist({
|
|
target: SUBSCRIPTION_FORM,
|
|
request: {
|
|
intent: "fill",
|
|
instruction: "GitHub Copilot, nineteen dollars a month, paid on the Visa ending 1234",
|
|
values: { currency: "CHF", frequency: "monthly" },
|
|
},
|
|
complete,
|
|
});
|
|
if (!sub.ok) {
|
|
console.error(" ✗ subscription fill failed:", sub.error);
|
|
process.exit(1);
|
|
}
|
|
console.log(" values :", JSON.stringify(sub.values));
|
|
check("amount parsed as a number", sub.values.amount === 19, String(sub.values.amount));
|
|
check(
|
|
"overridable default replaced by stated currency",
|
|
sub.values.currency === "USD",
|
|
String(sub.values.currency),
|
|
);
|
|
check(
|
|
"frequency stayed a legal option value",
|
|
["monthly", "annual", "quarterly", "weekly", "one-time"].includes(String(sub.values.frequency)),
|
|
String(sub.values.frequency),
|
|
);
|
|
|
|
console.log(`\n${failures === 0 ? "ALL CHECKS PASSED" : `${failures} CHECK(S) FAILED`}\n`);
|
|
process.exit(failures === 0 ? 0 : 1);
|
|
}
|
|
|
|
main().catch((error) => {
|
|
console.error(error);
|
|
process.exit(1);
|
|
});
|