Skip to content

fix: bump to 1.14.0 and fix resource leaks, capture edge cases and masking gaps - #111

Merged
AmisKwok merged 5 commits into
mainfrom
fix/inspector-issues-1.14.0
Sep 30, 2026
Merged

AmisKwok merged 5 commits into
mainfrom
fix/inspector-issues-1.14.0

Conversation

@AmisKwok

@AmisKwok AmisKwok commented Sep 30, 2026 •

Copy link
Copy Markdown
Member

Summary / 摘要

Bumps the plugin to 1.14.0 and fixes a batch of resource-leak and correctness issues across the inspector (memory-leak tracking, WebSocket capture, Dio/HTTP capture, alert throttling, persistence init, route ids, sensitive-data masking). / 将插件升级至 1.14.0,修复检查器内一批资源泄漏与正确性问题(泄漏追踪、WebSocket 抓包、Dio/HTTP 抓包、告警节流、持久化初始化、路由 id、敏感数据脱敏)。

Changes / 变更

  • Memory-leak tracking: evict _trackedRecords by priority leaked > verifying > tracking > released to stop unbounded growth; guard the VM Service socket against concurrent reconnects; add a reentrancy guard to refresh. / 内存泄漏追踪:按 leaked > verifying > tracking > released 优先级级联淘汰封住无界增长;VM Service 连接加并发保护;刷新加重入守卫。
  • Resource leaks: cancelable throttle fallback Timer; de-duplicate WsInspectorService double-close; restore FlutterError.onError to null when originally null. / 资源泄漏:兜底 Timer 可取消;WsInspectorService 重复 close 去重;FlutterError.onError 原为空时正确恢复。
  • Alert throttle key is now source + rule.id so the 1s cooldown is no longer defeated by volatile numbers. / 告警节流 key 改为 source + rule.id,避免含数值消息使 1s 冷却失效。
  • PersistenceService.init serialized via _initFuture to avoid double openDatabase leaking the old handle. / PersistenceService.init 用 _initFuture 串行化,避免重复打开数据库泄漏句柄。
  • Dio capture: statusCode: -1 placeholder on no-response; drain/cancel ResponseBody for stream; truncate bytes to the preview cap. / Dio 抓包:无响应以 statusCode: -1 占位;stream 类型排空并关闭 ResponseBody;bytes 按预览上限截断。
  • Route id collisions fixed via a global auto-increment counter. / 路由 id 改用全局自增计数器,避免同毫秒碰撞。
  • Interceptor response-header rewrite now applied; HTTP client infers scheme beyond 443/8443 and forwards the real connectionInfo. / 拦截规则"修改响应头"现已生效;HTTP client 除 443/8443 外也能识别 TLS 端口并转发真实 connectionInfo。
  • contentLength after gzip now reports the decompressed length. / gzip 解压后 contentLength 报告真实解压长度。
  • environment.isInspectorEnabled honors --dart-define=INSPECTOR_ENABLED=false via String.fromEnvironment. / environment.isInspectorEnabled 用 String.fromEnvironment 正确识别 --dart-define=INSPECTOR_ENABLED=false。
  • Sensitive-data masking hardened: no fail-open, Unicode key unescape, recursive object/array, wider Bearer regex, phone/ID PII patterns. / 敏感数据脱敏加固:不再 fail-open、JSON key Unicode 反转义、对象/数组递归、Bearer 正则拓宽、新增手机/身份证 PII。
  • Perf: FPS frame list uses ListQueue; WS body aggregation throttled to 10Hz; storage stats gained re-entrancy protection. / 性能:FPS 帧列表用 ListQueue;WS body 汇总降频到 10Hz;存储统计加防重入。
  • maxBodyPreviewBytes now counts real bytes instead of UTF-16 chars. / maxBodyPreviewBytes 改为真实字节计数。
  • Docs: CHANGELOG reformatted to EN-primary/ZH-secondary nested bullets; convention codified in AGENTS.md. / 文档:CHANGELOG 改为英文主条目 + 中文子条目双语格式,并在 AGENTS.md 固化约定。

Context / 背景

These fixes address leaks and correctness gaps found during a full code review of the 1.14.0 cycle, so the inspector is safer to keep running in long sessions and on release / real devices. / 这些修复源自 1.14.0 周期内的全量代码审查,解决泄漏与正确性问题,使检查器在长会话及 release/真机下更可靠。

Checklist / 检查项

  • Title follows Conventional Commits / 标题符合约定式提交
  • CI checks pass after merge / 合入后 CI 通过

Test plan

  • flutter analyze clean / flutter analyze 无报错
  • flutter test green / flutter test 全绿
  • Open the inspector in debug, trigger network/WS/log/memory flows and confirm no leaks or hangs / 调试模式打开检查器,触发网络/WS/日志/内存流程,确认无泄漏或卡死

🤖 Generated with Zero Buddy

Reformat the 1.14.0 section as English top-level bullets with Chinese nested sub-bullets (no slash separator), and document the EN-primary/ZH-secondary convention in AGENTS.md so future releases stay consistent.

将 CHANGELOG 1.14.0 段落改为英文主条目 + 中文嵌套子条目(不使用斜杠分隔),并在 AGENTS.md 中固化英中双语格式约定,确保后续发版一致。
WebSocket frame body text now uses InspectorColors.textPrimary instead of default black on the dark card; the Auto-scroll and Request Matching switches use the mint-green accent (InspectorColors.accent) for thumb and track instead of the default purple Material theme. Documented under CHANGELOG 1.14.0.

网络详情页 WebSocket 帧正文改用 textPrimary(不再黑底黑字);自动滚动与 Request Matching 开关改用项目薄荷绿 accent(不再默认紫色)。已记入 1.14.0 变更日志。
The WS auto-scroll and Request Matching switches used the deprecated Switch.activeColor; switched to activeThumbColor (track already uses activeTrackColor) so flutter analyze reports no issues.

WS 自动滚动与 Request Matching 开关改用已废弃的 activeColor,改为 activeThumbColor(track 仍用 activeTrackColor),消除 flutter analyze 的废弃告警。
The example app depends on the plugin via path; after the version bump to 1.14.0, lutter pub get in example/ refreshed the locked plugin version from 1.13.0 to 1.14.0.

示例工程以 path 方式依赖本插件,版本 bump 到 1.14.0 后,example 重新解析依赖把锁文件中的插件版本从 1.13.0 同步为 1.14.0。
@AmisKwok
AmisKwok merged commit a5b051a into main Sep 30, 2026
7 checks passed
@AmisKwok
AmisKwok deleted the fix/inspector-issues-1.14.0 branch September 30, 2026 02:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant