mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-10-25 17:45:53 +01:00
fix: address proposed telemetry review comments
Co-authored-by: Paperclip <noreply@paperclip.ing>
This commit is contained in:
2 files changed
+5
-66
No files matched your search
@@ -1,12 +1,5 @@
|
||||
import { afterEach, describe, expect, it, vi } from "vitest";
|
||||
import { TelemetryClient } from "./client.js";
|
||||
import {
|
||||
trackSkillCreated,
|
||||
trackSkillForked,
|
||||
trackSkillShareLinkCopied,
|
||||
trackSkillTestRun,
|
||||
trackSkillVersionSaved,
|
||||
} from "./events.js";
|
||||
import type { TelemetryConfig, TelemetryState } from "./types.js";
|
||||
|
||||
const TEST_STATE: TelemetryState = {
|
||||
@@ -37,60 +30,6 @@ describe("TelemetryClient runtime event gate", () => {
|
||||
vi.restoreAllMocks();
|
||||
});
|
||||
|
||||
it("swallows proposed first-party events before they touch state or the queue", async () => {
|
||||
vi.stubGlobal("fetch", vi.fn().mockResolvedValue({ ok: true }));
|
||||
const { client, stateFactory } = makeClient();
|
||||
|
||||
client.track(
|
||||
// @ts-expect-error -- proposed-telemetry(PAP-2411): fixture proposal not in generated schema
|
||||
"skill_studio.skill_created",
|
||||
{ sharing_scope: "team" },
|
||||
);
|
||||
|
||||
await client.flush();
|
||||
|
||||
expect(stateFactory).not.toHaveBeenCalled();
|
||||
expect(fetch).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("swallows Skill Studio proposed wrappers before they touch state or the queue", async () => {
|
||||
vi.stubGlobal("fetch", vi.fn().mockResolvedValue({ ok: true }));
|
||||
const { client, stateFactory } = makeClient();
|
||||
|
||||
trackSkillCreated(client, {
|
||||
skillId: "11111111-1111-4111-8111-111111111111",
|
||||
creationSource: "blank",
|
||||
sharingScope: "company",
|
||||
categoryCount: 1,
|
||||
fileCount: 2,
|
||||
});
|
||||
trackSkillVersionSaved(client, {
|
||||
skillId: "11111111-1111-4111-8111-111111111111",
|
||||
revisionNumber: 2,
|
||||
fileType: "skill",
|
||||
});
|
||||
trackSkillTestRun(client, {
|
||||
skillId: "11111111-1111-4111-8111-111111111111",
|
||||
status: "queued",
|
||||
runSource: "run",
|
||||
adHoc: true,
|
||||
templateUsed: false,
|
||||
});
|
||||
trackSkillForked(client, {
|
||||
skillId: "22222222-2222-4222-8222-222222222222",
|
||||
forkFromSkillId: "11111111-1111-4111-8111-111111111111",
|
||||
sourceType: "catalog",
|
||||
sharingScope: "private",
|
||||
reassignAgentCount: 0,
|
||||
});
|
||||
trackSkillShareLinkCopied(client, { sharingScope: "public_link" });
|
||||
|
||||
await client.flush();
|
||||
|
||||
expect(stateFactory).not.toHaveBeenCalled();
|
||||
expect(fetch).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("uses own-property membership so prototype event names are swallowed", async () => {
|
||||
vi.stubGlobal("fetch", vi.fn().mockResolvedValue({ ok: true }));
|
||||
const { client, stateFactory } = makeClient();
|
||||
|
||||
@@ -103,7 +103,7 @@ export function trackSkillCreated(
|
||||
},
|
||||
): void {
|
||||
client.track(
|
||||
// @ts-expect-error -- proposed-telemetry(https://github.com/paperclipai/paperclip/issues/2411): measure successful Skill Studio skill creation funnel
|
||||
// @ts-expect-error -- proposed-telemetry: measure successful Skill Studio skill creation funnel
|
||||
"skill.created",
|
||||
{
|
||||
skill_id: dims.skillId,
|
||||
@@ -124,7 +124,7 @@ export function trackSkillVersionSaved(
|
||||
},
|
||||
): void {
|
||||
client.track(
|
||||
// @ts-expect-error -- proposed-telemetry(https://github.com/paperclipai/paperclip/issues/2411): measure Skill Studio editor save and version creation usage
|
||||
// @ts-expect-error -- proposed-telemetry: measure Skill Studio editor save and version creation usage
|
||||
"skill.version_saved",
|
||||
{
|
||||
skill_id: dims.skillId,
|
||||
@@ -145,7 +145,7 @@ export function trackSkillTestRun(
|
||||
},
|
||||
): void {
|
||||
client.track(
|
||||
// @ts-expect-error -- proposed-telemetry(https://github.com/paperclipai/paperclip/issues/2411): measure Skill Studio validation loop usage
|
||||
// @ts-expect-error -- proposed-telemetry: measure Skill Studio validation loop usage
|
||||
"skill.test_run",
|
||||
{
|
||||
skill_id: dims.skillId,
|
||||
@@ -168,7 +168,7 @@ export function trackSkillForked(
|
||||
},
|
||||
): void {
|
||||
client.track(
|
||||
// @ts-expect-error -- proposed-telemetry(https://github.com/paperclipai/paperclip/issues/2411): measure Skill Studio fork completion and reassignment demand
|
||||
// @ts-expect-error -- proposed-telemetry: measure Skill Studio fork completion and reassignment demand
|
||||
"skill.forked",
|
||||
{
|
||||
skill_id: dims.skillId,
|
||||
@@ -187,7 +187,7 @@ export function trackSkillShareLinkCopied(
|
||||
},
|
||||
): void {
|
||||
client.track(
|
||||
// @ts-expect-error -- proposed-telemetry(https://github.com/paperclipai/paperclip/issues/2411): exercise triage of low-signal share-link copy proposal
|
||||
// @ts-expect-error -- proposed-telemetry: exercise triage of low-signal share-link copy proposal
|
||||
"skill.share_link",
|
||||
{
|
||||
sharing_scope: asEventDimension(dims.sharingScope),
|
||||
|
||||
Reference in new issue
Block a user