fix: coalesce pinch updates and stop live zoom write-back
All checks were successful
CI / Windows build (push) Successful in 9m55s

Surface Aug6 diag showed sDrop=0 but ~220 same-ms dual ZOOM frames and √2 cur ping-pong from reading currentZoom back into pinch state. Flush once per microtask and embed gitSha in diagnostic meta.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-06 03:44:10 +08:00
parent 4f6fb69dee
commit 85af037b7d
5 changed files with 150 additions and 40 deletions

View File

@@ -1,5 +1,6 @@
// Build a zip diagnostic pack the user can hand back for remote debugging.
import 'dart:async';
import 'dart:convert';
import 'dart:io';
@@ -13,6 +14,18 @@ import 'badnote_log.dart';
import 'frame_sampler.dart';
import 'pen_event_ring.dart';
/// Injected at build/export time so Surface packages can be matched to git.
/// Override via `--dart-define=BADNOTE_GIT_SHA=...` in CI.
const String kBadNoteGitSha = String.fromEnvironment(
'BADNOTE_GIT_SHA',
defaultValue: 'dev',
);
const String kBadNoteBuildTime = String.fromEnvironment(
'BADNOTE_BUILD_TIME',
defaultValue: '',
);
class DiagnosticExportResult {
DiagnosticExportResult({required this.zipPath, required this.bytes});
@@ -34,6 +47,8 @@ class DiagnosticExport {
final meta = <String, Object?>{
'exportedAt': DateTime.now().toIso8601String(),
'sessionId': log.sessionId,
'gitSha': kBadNoteGitSha,
'buildTime': kBadNoteBuildTime.isEmpty ? null : kBadNoteBuildTime,
'platform': Platform.operatingSystem,
'osVersion': Platform.operatingSystemVersion,
'localHostname': Platform.localHostname,
@@ -48,7 +63,8 @@ class DiagnosticExport {
'zoom': InputDiagnostics.instance.summary(),
'frames': FrameSampler.instance.summary(),
'instructions':
'Reproduce the issue for ~3 minutes with diagnostics on, then share this zip.',
'Reproduce the issue for ~3 minutes with diagnostics on, then share this zip. '
'Confirm meta.gitSha matches the CI commit you installed.',
};
final archive = Archive();