feat(feedback): gate onboarding survey on first processing, add prompt lifecycle events (#615)

Defers the onboarding usage survey to the instance's first successful processing (the worker writes a one-time onboarding.firstProcessedAt marker and the overlay gates on it), so it reaches engaged users instead of first-landing visitors.

Replaces the two questions telemetry already answers (modality preference from tool_used, install method from instance_started) with what it can't infer: prior tool, self-host motivation, and discovery source.

Adds feedback_prompt_shown and feedback_prompt_dismissed on all five feedback surfaces (usage survey, per-job prompt, admin install card, global nav dialog, search-miss) so skip and completion rates are measurable, not just submissions. New survey strings translated into all 20 non-English locales.
This commit is contained in:
SnapOtter
2026-07-21 16:31:30 +00:00
committed by GitHub
parent b20bca3c3c
commit 129e42b95c
41 changed files with 950 additions and 209 deletions
+26
View File
@@ -5,6 +5,7 @@ import { db, schema } from "../../../apps/api/src/db/index.js";
import {
getSettingNumber,
getSettingString,
setSettingIfAbsent,
upsertSetting,
} from "../../../apps/api/src/lib/settings-helpers.js";
@@ -117,3 +118,28 @@ describe("getSettingString", () => {
expect(result).toBe("");
});
});
describe("setSettingIfAbsent", () => {
it("writes the value when the key is absent", async () => {
const key = uniqueKey();
keysToClean.push(key);
await setSettingIfAbsent(key, "first");
const rows = await db.select().from(schema.settings).where(eq(schema.settings.key, key));
expect(rows).toHaveLength(1);
expect(rows[0].value).toBe("first");
});
it("keeps the first value and ignores later writes (first-write-wins)", async () => {
const key = uniqueKey();
keysToClean.push(key);
await setSettingIfAbsent(key, "first");
await setSettingIfAbsent(key, "second");
const rows = await db.select().from(schema.settings).where(eq(schema.settings.key, key));
expect(rows).toHaveLength(1);
expect(rows[0].value).toBe("first");
});
});