@yagni-app/code-staging 0.3.0-staging.1099.1 → 0.3.1-staging.1103.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/crashReport.d.ts +12 -0
- package/dist/crashReport.js +28 -1
- package/dist/extension/crashReport.d.ts +18 -0
- package/dist/extension/crashReport.js +35 -2
- package/package.json +2 -2
package/dist/crashReport.d.ts
CHANGED
|
@@ -29,6 +29,18 @@ export declare const MAX_CRASH_STACK_FRAMES = 40;
|
|
|
29
29
|
export declare const MAX_CRASH_PAYLOAD_BYTES = 16384;
|
|
30
30
|
/** Same truthiness rule as updateChecksDisabled: set and not "" / "0". */
|
|
31
31
|
export declare function crashReportsDisabled(env?: NodeJS.ProcessEnv): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* True when this process is a test run. A crash reporter that phones home
|
|
34
|
+
* from a test suite files FICTIONAL crashes against real production
|
|
35
|
+
* telemetry — see the twin comment in `pi-extension-yagni/src/crashReport.ts`
|
|
36
|
+
* (Sentry YAGNI-BACKEND-2P / -2Q). Kept in sync with that copy.
|
|
37
|
+
*
|
|
38
|
+
* Deliberately broad: a false positive costs one unreported crash on a
|
|
39
|
+
* developer machine, a false negative pollutes production.
|
|
40
|
+
*/
|
|
41
|
+
export declare function runningUnderTest(env?: NodeJS.ProcessEnv): boolean;
|
|
42
|
+
/** Reporting is off when the user disabled it OR this is a test process. */
|
|
43
|
+
export declare function crashReportsSuppressed(env?: NodeJS.ProcessEnv): boolean;
|
|
32
44
|
export interface SanitizeCrashOptions {
|
|
33
45
|
/** Environment whose values get redacted (defaults to process.env). */
|
|
34
46
|
env?: NodeJS.ProcessEnv;
|
package/dist/crashReport.js
CHANGED
|
@@ -33,6 +33,33 @@ export function crashReportsDisabled(env = process.env) {
|
|
|
33
33
|
const value = env[CRASH_REPORT_DISABLE_ENV];
|
|
34
34
|
return value !== undefined && value !== "" && value !== "0";
|
|
35
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* True when this process is a test run. A crash reporter that phones home
|
|
38
|
+
* from a test suite files FICTIONAL crashes against real production
|
|
39
|
+
* telemetry — see the twin comment in `pi-extension-yagni/src/crashReport.ts`
|
|
40
|
+
* (Sentry YAGNI-BACKEND-2P / -2Q). Kept in sync with that copy.
|
|
41
|
+
*
|
|
42
|
+
* Deliberately broad: a false positive costs one unreported crash on a
|
|
43
|
+
* developer machine, a false negative pollutes production.
|
|
44
|
+
*/
|
|
45
|
+
export function runningUnderTest(env = process.env) {
|
|
46
|
+
if (env.NODE_ENV === "test")
|
|
47
|
+
return true;
|
|
48
|
+
// node:test sets this in every spawned test-file process.
|
|
49
|
+
if (env.NODE_TEST_CONTEXT)
|
|
50
|
+
return true;
|
|
51
|
+
if (env.VITEST || env.JEST_WORKER_ID)
|
|
52
|
+
return true;
|
|
53
|
+
// npm/pnpm export the script name being run (`pnpm test`, `pnpm test:file`).
|
|
54
|
+
const script = env.npm_lifecycle_event;
|
|
55
|
+
if (script === "test" || (script !== undefined && script.startsWith("test:")))
|
|
56
|
+
return true;
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
/** Reporting is off when the user disabled it OR this is a test process. */
|
|
60
|
+
export function crashReportsSuppressed(env = process.env) {
|
|
61
|
+
return crashReportsDisabled(env) || runningUnderTest(env);
|
|
62
|
+
}
|
|
36
63
|
// Mirrors scrubSecrets (backend yagniCode/scrubSecrets.ts and
|
|
37
64
|
// pi-extension-yagni pipeline/scrubSecrets.ts) — keep in sync.
|
|
38
65
|
const SECRET_PATTERNS = [
|
|
@@ -147,7 +174,7 @@ export function sanitizeCrashError(err, opts = {}) {
|
|
|
147
174
|
export async function sendCrashReport(input) {
|
|
148
175
|
try {
|
|
149
176
|
const env = input.env ?? process.env;
|
|
150
|
-
if (
|
|
177
|
+
if (crashReportsSuppressed(env))
|
|
151
178
|
return;
|
|
152
179
|
const opts = { env, repoRoot: input.repoRoot };
|
|
153
180
|
const stack = input.stack !== undefined
|
|
@@ -33,6 +33,24 @@ export declare const MAX_CRASH_STACK_FRAMES = 40;
|
|
|
33
33
|
export declare const MAX_CRASH_PAYLOAD_BYTES = 16384;
|
|
34
34
|
/** Same truthiness rule as the CLI's YAGNI_DISABLE_* family. */
|
|
35
35
|
export declare function crashReportsDisabled(env?: NodeJS.ProcessEnv): boolean;
|
|
36
|
+
/**
|
|
37
|
+
* True when this process is a test run.
|
|
38
|
+
*
|
|
39
|
+
* A crash reporter that phones home from a test suite reports FICTIONAL
|
|
40
|
+
* crashes against real production telemetry. That is not theoretical: the
|
|
41
|
+
* `/go` terminal catch builds a live reporter whenever its caller doesn't
|
|
42
|
+
* inject one, so `goCommand.test.ts`'s deliberate `throw new Error("boom")`
|
|
43
|
+
* POSTed to https://yagni.app on every run — 915 events across Sentry
|
|
44
|
+
* YAGNI-BACKEND-2P / -2Q, from a team that had never witnessed a crash.
|
|
45
|
+
*
|
|
46
|
+
* Injecting a stub at each call site fixes one test; this makes the whole
|
|
47
|
+
* class impossible, so a future test that forgets cannot re-open the leak.
|
|
48
|
+
* Detection is deliberately broad — a false positive costs one unreported
|
|
49
|
+
* crash on a developer machine, a false negative pollutes production.
|
|
50
|
+
*/
|
|
51
|
+
export declare function runningUnderTest(env?: NodeJS.ProcessEnv): boolean;
|
|
52
|
+
/** Reporting is off when the user disabled it OR this is a test process. */
|
|
53
|
+
export declare function crashReportsSuppressed(env?: NodeJS.ProcessEnv): boolean;
|
|
36
54
|
export interface SanitizeCrashOptions {
|
|
37
55
|
env?: NodeJS.ProcessEnv;
|
|
38
56
|
repoRoot?: string;
|
|
@@ -40,6 +40,39 @@ export function crashReportsDisabled(env = process.env) {
|
|
|
40
40
|
const value = env[CRASH_REPORT_DISABLE_ENV];
|
|
41
41
|
return value !== undefined && value !== "" && value !== "0";
|
|
42
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* True when this process is a test run.
|
|
45
|
+
*
|
|
46
|
+
* A crash reporter that phones home from a test suite reports FICTIONAL
|
|
47
|
+
* crashes against real production telemetry. That is not theoretical: the
|
|
48
|
+
* `/go` terminal catch builds a live reporter whenever its caller doesn't
|
|
49
|
+
* inject one, so `goCommand.test.ts`'s deliberate `throw new Error("boom")`
|
|
50
|
+
* POSTed to https://yagni.app on every run — 915 events across Sentry
|
|
51
|
+
* YAGNI-BACKEND-2P / -2Q, from a team that had never witnessed a crash.
|
|
52
|
+
*
|
|
53
|
+
* Injecting a stub at each call site fixes one test; this makes the whole
|
|
54
|
+
* class impossible, so a future test that forgets cannot re-open the leak.
|
|
55
|
+
* Detection is deliberately broad — a false positive costs one unreported
|
|
56
|
+
* crash on a developer machine, a false negative pollutes production.
|
|
57
|
+
*/
|
|
58
|
+
export function runningUnderTest(env = process.env) {
|
|
59
|
+
if (env.NODE_ENV === "test")
|
|
60
|
+
return true;
|
|
61
|
+
// node:test sets this in every spawned test-file process.
|
|
62
|
+
if (env.NODE_TEST_CONTEXT)
|
|
63
|
+
return true;
|
|
64
|
+
if (env.VITEST || env.JEST_WORKER_ID)
|
|
65
|
+
return true;
|
|
66
|
+
// npm/pnpm export the script name being run (`pnpm test`, `pnpm test:file`).
|
|
67
|
+
const script = env.npm_lifecycle_event;
|
|
68
|
+
if (script === "test" || (script !== undefined && script.startsWith("test:")))
|
|
69
|
+
return true;
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
/** Reporting is off when the user disabled it OR this is a test process. */
|
|
73
|
+
export function crashReportsSuppressed(env = process.env) {
|
|
74
|
+
return crashReportsDisabled(env) || runningUnderTest(env);
|
|
75
|
+
}
|
|
43
76
|
const HOME_DIR_RE = /(?:\/(?:Users|home)\/|[A-Za-z]:\\Users\\)[^\s/\\]+/g;
|
|
44
77
|
// Spaces deliberately allowed inside the token (real directories contain
|
|
45
78
|
// them); prose after a path may fold into the kept basename — over-redacts
|
|
@@ -122,7 +155,7 @@ export function makeCrashReporter(opts) {
|
|
|
122
155
|
return async (error, context, repoRoot) => {
|
|
123
156
|
try {
|
|
124
157
|
const env = opts.env ?? process.env;
|
|
125
|
-
if (
|
|
158
|
+
if (crashReportsSuppressed(env))
|
|
126
159
|
return;
|
|
127
160
|
const token = opts.getToken();
|
|
128
161
|
const sanitized = sanitizeCrashError(error, { env, repoRoot });
|
|
@@ -191,7 +224,7 @@ const DETACHED_SENDER_SRC = [
|
|
|
191
224
|
export function reportFatalCrash(error, opts, context) {
|
|
192
225
|
try {
|
|
193
226
|
const env = opts.env ?? process.env;
|
|
194
|
-
if (
|
|
227
|
+
if (crashReportsSuppressed(env))
|
|
195
228
|
return;
|
|
196
229
|
const token = opts.getToken();
|
|
197
230
|
if (!token)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yagni-app/code-staging",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1-staging.1103.1",
|
|
4
4
|
"description": "YAGNI Code: a terminal coding agent that already knows your company. One YAGNI login routes the model and grounds the agent in your team's context.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"author": "YAGNI, Inc. <jack@yagni.app> (https://yagni.app)",
|
|
@@ -39,5 +39,5 @@
|
|
|
39
39
|
"smol-toml": "^1.8.0",
|
|
40
40
|
"typebox": "^1.3.11"
|
|
41
41
|
},
|
|
42
|
-
"yagniSourceSha": "
|
|
42
|
+
"yagniSourceSha": "5df84aa9651fc7d6dd30b38bb062e8ee3c71156d"
|
|
43
43
|
}
|