Skip to content

feat(client): export redacted support snapshots - #645

Merged
SunSi12138 merged 31 commits into
devfrom
feat/575-client-support-snapshot
Sep 10, 2026
Merged

SunSi12138 merged 31 commits into
devfrom
feat/575-client-support-snapshot

Conversation

@SunSi12138

@SunSi12138 SunSi12138 commented Sep 9, 2026 •

Copy link
Copy Markdown
Owner

Fixes #575

Summary

  • add an on-demand, bounded Client/connection support snapshot API in SharpLink.Client
  • export schema-versioned redacted JSON with endpoint/connection truncation totals and a hard UTF-8 size cap
  • use NativeAOT-safe System.Text.Json source generation for both pretty and compact export; no reflection-based JSON serialization or runtime enum converter generation
  • reuse existing readiness, policy generations, connection/session owners, pending-request counts, stream counts, send-queue byte counters, and negotiated session state instead of introducing RPC-path history
  • expose safe endpoint ordinals/transport categories and coarse failure classifications; never export raw endpoint addresses/attributes, metadata, payloads, exception messages/data, environment variables, command lines, credentials, private material, or callback targets
  • keep capture weakly consistent and on-demand: capture owned state into bounded DTOs before JSON serialization, without holding connection/global locks across export
  • document the support-snapshot workflow in doc/troubleshooting.md

Acceptance coverage

  • empty/not-connected and ready connection snapshots
  • static multi-endpoint totals/truncation and convergence while another endpoint is connecting
  • fixed draining connection capture
  • pending usage near configured capacity using the existing pending owner
  • negotiated protocol/resource fields and safe compression/runtime configuration summary
  • real fixed dial, TLS, and handshake failures plus auth/protocol safe-classification coverage
  • endpoint/auth/metadata/URI-credential sentinel redaction in final JSON
  • dynamic endpoint replacement raced with repeated capture
  • Stop raced with repeated snapshot/JSON capture and post-stop repeated capture
  • deterministic schema version, pretty/compact export, and hard JSON byte limit

Validation

Final head: 017cc8da5ddca63416016803aa939d2e17dbe7c4

  • PR Fast: success
    • Release build
    • generated-assembly dependency guard
    • 1,669 Unit Tests
    • 264 Generator Tests
    • 60 Load Test Tests
    • deterministic managed-allocation gate
  • PR Quick: success
    • Debug + Release build
    • 1,669 Unit Tests
    • Generator + Load Test Tests
    • 451 Integration Tests
    • NativeAOT transport/topology smoke
    • pack + NuGet package contract/smoke
    • demo, load, and chaos smoke
  • CodeQL: success
  • Extension fault containment: success
  • Pending and codec validation: success
  • format, project-reference boundary, and maintainability gates: success

The first PR Fast attempt on the final head hit one unrelated existing timed-unary emission test timeout; the same-head PR Quick Unit run and the PR Fast rerun both passed all 1,669 tests.

@SunSi12138
SunSi12138 marked this pull request as ready for review September 9, 2026 18:54

@SunSi12138 SunSi12138 left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

整体方向和 redaction/有界 JSON 设计是合理的,exact-head CI 也已通过。当前有两个 cluster diagnostics 语义缺口值得在合并前处理:cluster 拓扑只从 ready connection 反推,导致 connecting/retiring/资源统计丢失;以及 last connection failure 目前没有接入 static/dynamic cluster 的真实失败路径。两点都直接影响 #575 的核心排障价值,见 inline。

@SunSi12138
SunSi12138 merged commit 9cfa364 into dev Sep 10, 2026
10 checks passed
@SunSi12138
SunSi12138 deleted the feat/575-client-support-snapshot branch September 10, 2026 06:30

Copy link
Copy Markdown
Owner Author

Final re-review: both substantive cluster-diagnostics findings are resolved on exact head 6c71d799f88399d1a3457bc7ecfccf039ffc0f44.

  • Cluster topology is now captured from the static/dynamic runtime owners under their existing gates, so connecting, retiring/draining connections, real transport category, totals, and aggregate pending/active/stream/send-queue resources are retained without adding RPC hot-path history/state.
  • Last connection failure is now published from real resolver and static/dynamic connection-establishment failure paths. Raw endpoint ids are not retained in the publication; static endpoint indices / dynamic per-state generations are mapped to snapshot-local endpoint-XXXX ordinals at capture time.
  • Added review regressions cover static convergence/transport, dynamic retiring resources, real static/dynamic dial failures, and resolver failure/redaction.
  • The reviewed branch is behind_by=0 against dev@fde86f91c327f2de1234cd70efbf9ea7b675c9e0. Exact-head PR Fast #1470, PR Quick #2755, CodeQL #3787, Extension fault containment chore(deps): bump github/codeql-action from 4.37.4 to 4.37.6 #97, and Pending and codec validation [generator][DX] Hide generated Proxy/Stub implementation types from IntelliSense #161 are all successful.

No new correctness/redaction/boundedness blocker was found. #645 has been squash-merged into dev as 9cfa3640af77b356b98f4110d99ad5ca3929b229. The earlier timed-unary CI recurrence remains tracked separately in #387 and is not attributed to this PR.

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