Skip to content

fix(maintenance): own SCL trial client lifetime - #420

Merged
masarray merged 1 commit into
mainfrom
maintenance/scl-trial-client-lifetime-20260927
Sep 26, 2026
Merged

masarray merged 1 commit into
mainfrom
maintenance/scl-trial-client-lifetime-20260927

Conversation

@masarray

Copy link
Copy Markdown
Owner

Audit finding M-01: unowned read-only trial association

At the exact main base b897203fad3b9276492bd3f6220e6c86d14c59df, SclSafeTrialRunner.RunAsync created a NativeIec61850Client and captured a diagnostic, then exited its try/catch without disposing that client. The native client implements IAsyncDisposable and owns a network association and gates. This read-only, explicit CLI trial route is separate from the live monitoring path.

Fix

Use an await using declaration in the owning trial scope. The client remains alive through ConnectUsingSclAsync and CaptureDiagnosticSnapshot, then is asynchronously released on success, cancellation or failure. Add a deterministic source-contract test to prevent accidental reintroduction of the unowned client. The test does not claim real-device or network validation.

Invariants / scope

  • Exactly two files changed: Services/SclSafeTrialRunner.cs and tests/ARSAS.Tests/SclSafeTrialRunnerTests.cs.
  • No protocol logic, static DataSet/RCB/GI/report acquisition, production Smart Discovery, engine lock, version, release/tag, SCL payload or test evidence change.
  • Existing exit codes/evidence schema and read-only trial capability remain unchanged.
  • Follow the existing engineering contract; report CI and packaged smoke on the exact head.
  • This PR is one bounded technical repair from the repository maintainability audit tracked by Repository independence, provenance and maintainability hardening #380. Larger architecture changes require a separate reviewed plan and tests.

@masarray
masarray marked this pull request as ready for review September 26, 2026 22:43
@masarray
masarray merged commit 3a2da52 into main Sep 26, 2026
9 checks passed
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