@@ -2127,7 +2127,9 @@ export interface IEventNamePropertyMapping {
21272127 */
21282128 /* __GDPR__
21292129 "unittest.discovery.trigger" : {
2130- "trigger" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "eleanorjboyd" }
2130+ "trigger" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "eleanorjboyd" },
2131+ "filekind" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "eleanorjboyd" },
2132+ "mssincelasttrigger" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "owner": "eleanorjboyd", "isMeasurement": true }
21312133 }
21322134 */
21332135 [ EventName . UNITTEST_DISCOVERY_TRIGGER ] : {
@@ -2142,6 +2144,16 @@ export interface IEventNamePropertyMapping {
21422144 * interpreter : Triggered by interpreter change.
21432145 */
21442146 trigger : 'auto' | 'ui' | 'commandpalette' | 'watching' | 'interpreter' ;
2147+ /**
2148+ * For 'auto' / 'watching' triggers, classifies the file whose change triggered discovery.
2149+ * Used to detect whether discovery is firing on non-test files (see #25866).
2150+ */
2151+ fileKind ?: 'test' | 'conftest' | 'non-test' | 'unknown' ;
2152+ /**
2153+ * Milliseconds since the previous discovery trigger fired (any source).
2154+ * Helps detect chatty re-trigger storms.
2155+ */
2156+ msSinceLastTrigger ?: number ;
21452157 } ;
21462158 /**
21472159 * Telemetry event sent with details about discovering tests
@@ -2165,7 +2177,13 @@ export interface IEventNamePropertyMapping {
21652177 /* __GDPR__
21662178 "unittest.discovery.done" : {
21672179 "tool" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "eleanorjboyd" },
2168- "failed" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "eleanorjboyd" }
2180+ "failed" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "eleanorjboyd" },
2181+ "mode" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "eleanorjboyd" },
2182+ "trigger" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "eleanorjboyd" },
2183+ "failurecategory" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "owner": "eleanorjboyd" },
2184+ "totaldurationms" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "owner": "eleanorjboyd", "isMeasurement": true },
2185+ "testcount" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "owner": "eleanorjboyd", "isMeasurement": true },
2186+ "exitcode" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "owner": "eleanorjboyd", "isMeasurement": true }
21692187 }
21702188 */
21712189 [ EventName . UNITTEST_DISCOVERY_DONE ] : {
@@ -2181,6 +2199,39 @@ export interface IEventNamePropertyMapping {
21812199 * @type {boolean }
21822200 */
21832201 failed : boolean ;
2202+ /**
2203+ * Discovery code path: 'project' = Python Environments API / project-based;
2204+ * 'legacy' = single-workspace adapter fallback.
2205+ */
2206+ mode ?: 'project' | 'legacy' ;
2207+ /**
2208+ * Source that triggered the discovery (mirrors UNITTEST_DISCOVERY_TRIGGER.trigger).
2209+ */
2210+ trigger ?: 'auto' | 'ui' | 'commandpalette' | 'watching' | 'interpreter' ;
2211+ /**
2212+ * Coarse failure category. Only populated when `failed` is true.
2213+ */
2214+ failureCategory ?:
2215+ | 'subprocess-exit-non-zero'
2216+ | 'pipe-error'
2217+ | 'pytest-collect-error'
2218+ | 'plugin-exception'
2219+ | 'timeout'
2220+ | 'env-resolution'
2221+ | 'cancelled'
2222+ | 'unknown' ;
2223+ /**
2224+ * Wall-clock duration of the discovery cycle in milliseconds.
2225+ */
2226+ totalDurationMs ?: number ;
2227+ /**
2228+ * Number of test items discovered (leaf nodes).
2229+ */
2230+ testCount ?: number ;
2231+ /**
2232+ * Subprocess exit code, when known (failed discoveries).
2233+ */
2234+ exitCode ?: number ;
21842235 } ;
21852236 /**
21862237 * Telemetry event sent when cancelling discovering tests
@@ -2222,6 +2273,100 @@ export interface IEventNamePropertyMapping {
22222273 "unittest.run.all_failed" : { "owner": "eleanorjboyd" }
22232274 */
22242275 [ EventName . UNITTEST_RUN_ALL_FAILED ] : never | undefined ;
2276+ /**
2277+ * Telemetry event sent at the end of a test run, capturing duration and pipe health.
2278+ * Companion to UNITTEST_RUN (which is emitted at run start).
2279+ */
2280+ /* __GDPR__
2281+ "unittest.run.done" : {
2282+ "tool" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "eleanorjboyd" },
2283+ "debugging" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "eleanorjboyd" },
2284+ "mode" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "eleanorjboyd" },
2285+ "failed" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "eleanorjboyd" },
2286+ "failurecategory" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "owner": "eleanorjboyd" },
2287+ "pipeclosedearly" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "owner": "eleanorjboyd" },
2288+ "durationms" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "owner": "eleanorjboyd", "isMeasurement": true },
2289+ "requestedcount" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "owner": "eleanorjboyd", "isMeasurement": true },
2290+ "reportedcount" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "owner": "eleanorjboyd", "isMeasurement": true },
2291+ "missingcount" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "owner": "eleanorjboyd", "isMeasurement": true },
2292+ "exitcode" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "owner": "eleanorjboyd", "isMeasurement": true }
2293+ }
2294+ */
2295+ [ EventName . UNITTEST_RUN_DONE ] : {
2296+ tool : TestTool ;
2297+ debugging : boolean ;
2298+ mode : 'project' | 'legacy' ;
2299+ /**
2300+ * `true` if the run ended without reporting all requested results,
2301+ * or if the subprocess crashed / threw.
2302+ */
2303+ failed : boolean ;
2304+ /**
2305+ * Coarse failure category when `failed` is true.
2306+ */
2307+ failureCategory ?:
2308+ | 'pipe-cancelled'
2309+ | 'subprocess-crash'
2310+ | 'no-results'
2311+ | 'env-mismatch'
2312+ | 'cancelled'
2313+ | 'unknown' ;
2314+ /**
2315+ * `true` if the result pipe was disposed before the subprocess fully
2316+ * reported all requested test results (see #25872).
2317+ */
2318+ pipeClosedEarly ?: boolean ;
2319+ /**
2320+ * Wall-clock duration of the run in milliseconds.
2321+ */
2322+ durationMs ?: number ;
2323+ /**
2324+ * Number of test items the user asked to run.
2325+ */
2326+ requestedCount ?: number ;
2327+ /**
2328+ * Number of distinct test results reported back over the pipe.
2329+ */
2330+ reportedCount ?: number ;
2331+ /**
2332+ * requestedCount - reportedCount (signals #25892 "all skipped" pattern).
2333+ */
2334+ missingCount ?: number ;
2335+ /**
2336+ * Subprocess exit code when known.
2337+ */
2338+ exitCode ?: number ;
2339+ } ;
2340+ /**
2341+ * Telemetry event emitted after the test tree is updated with new discovery results.
2342+ * Used to detect full-rebuild-on-every-save pattern (see #25822, #25866).
2343+ */
2344+ /* __GDPR__
2345+ "unittest.tree.update" : {
2346+ "tool" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "eleanorjboyd" },
2347+ "mode" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "eleanorjboyd" },
2348+ "rebuiltfromscratch" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "owner": "eleanorjboyd" },
2349+ "beforecount" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "owner": "eleanorjboyd", "isMeasurement": true },
2350+ "aftercount" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "owner": "eleanorjboyd", "isMeasurement": true }
2351+ }
2352+ */
2353+ [ EventName . UNITTEST_TREE_UPDATE ] : {
2354+ tool : TestTool ;
2355+ mode : 'project' | 'legacy' ;
2356+ /**
2357+ * `true` if the discovery handler cleared and rebuilt all test items rather
2358+ * than performing an incremental update.
2359+ */
2360+ rebuiltFromScratch : boolean ;
2361+ /**
2362+ * Number of root test items in the controller before this update.
2363+ */
2364+ beforeCount : number ;
2365+ /**
2366+ * Number of root test items in the controller after this update.
2367+ */
2368+ afterCount : number ;
2369+ } ;
22252370 /**
22262371 * Telemetry event sent when testing is disabled for a workspace.
22272372 */
0 commit comments