Skip to content

Commit 41977f3

Browse files
sentry-junior[bot]Junior
andauthored
feat(seer): Send referrer 'api.cli' on autofix API calls (#965)
Add `referrer: "api.cli"` to the POST body for both `triggerRootCauseAnalysis` and `triggerSolutionPlanning` so the Sentry backend can attribute autofix runs triggered from the CLI. ### Context - getsentry/sentry#115497 adds an optional `referrer` field to `GroupAutofixEndpoint` - getsentry/sentry#115514 registers the `CLI = "api.cli"` enum value on `AutofixReferrer` This PR is the CLI-side counterpart: it sends the `api.cli` referrer string on every autofix POST so downstream analytics and Seer can identify CLI-initiated runs. ### Changes - **`src/lib/api/seer.ts`** — add `referrer: "api.cli"` to the request body in `triggerRootCauseAnalysis` and `triggerSolutionPlanning` - **`test/lib/api-client.seer.test.ts`** — update body assertions to expect the new field Co-authored-by: Junior <junior[bot]@sentry.io>
1 parent 2e8fec5 commit 41977f3

2 files changed

Lines changed: 4 additions & 0 deletions

File tree

src/lib/api/seer.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ export async function triggerRootCauseAnalysis(
6060
params: EXPLORER_MODE_PARAMS,
6161
body: {
6262
step: "root_cause",
63+
referrer: "api.cli",
6364
},
6465
}
6566
);
@@ -125,6 +126,7 @@ export async function triggerSolutionPlanning(
125126
body: {
126127
step: "solution",
127128
run_id: runId,
129+
referrer: "api.cli",
128130
},
129131
}
130132
);

test/lib/api-client.seer.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ describe("triggerRootCauseAnalysis", () => {
7171

7272
expect(capturedBody).toEqual({
7373
step: "root_cause",
74+
referrer: "api.cli",
7475
});
7576
});
7677

@@ -228,6 +229,7 @@ describe("triggerSolutionPlanning", () => {
228229
expect(capturedBody).toEqual({
229230
step: "solution",
230231
run_id: 12_345,
232+
referrer: "api.cli",
231233
});
232234
});
233235
});

0 commit comments

Comments
 (0)