-
Notifications
You must be signed in to change notification settings - Fork 4
[INVALIDATED] fix(discovery): reuse static DataSet workflow after model build #332
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
masarray
wants to merge
1
commit into
docs/vendor-neutral-v1.6.38
from
fix/unify-discovery-static-dataset
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
92 changes: 92 additions & 0 deletions
92
tests/ARSAS.Tests/LiveDiscoveryPostModelWorkflowRegressionTests.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,92 @@ | ||
| namespace ARSAS.Tests; | ||
|
|
||
| public sealed class LiveDiscoveryPostModelWorkflowRegressionTests | ||
| { | ||
| [Fact] | ||
| public void SuccessfulDiscovery_UsesSharedPostModelChooser_InsteadOfOpeningManualCatalogDirectly() | ||
| { | ||
| var source = Read("MainWindow.xaml.cs"); | ||
| var start = source.IndexOf( | ||
| "private async Task<bool> ConnectAndConfigureDeviceAsync", | ||
| StringComparison.Ordinal); | ||
| var end = source.IndexOf( | ||
| "private async Task<bool> ConnectUsingSavedModelAsync", | ||
| start, | ||
| StringComparison.Ordinal); | ||
| Assert.True(start >= 0 && end > start); | ||
| var discovery = source[start..end]; | ||
|
|
||
| Assert.Contains("device.LiveDiscoveryModel", Read("Services/Iec61850MonitorRuntime.cs"), StringComparison.Ordinal); | ||
| Assert.Contains("await OpenIedWorkspaceActionsAsync(device);", discovery, StringComparison.Ordinal); | ||
| Assert.DoesNotContain("OpenSignalSelectionWizardAsync(device, restoredCount)", discovery, StringComparison.Ordinal); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void SharedPostModelChooser_RoutesDataSetSignalsToExactStaticReportOnlyAuthority() | ||
| { | ||
| var actions = Read("MainWindow.SclQuickActions.cs"); | ||
| var sharedAuthority = Read("MainWindow.SharedSclWorkspace.cs"); | ||
| var staticRuntime = Read("Services/NativeIec61850Client.StaticDataSetReporting.cs"); | ||
|
|
||
| var staticStart = actions.IndexOf("if (dialog.UseStaticDataSet)", StringComparison.Ordinal); | ||
| var manualStart = actions.IndexOf("var accepted = await OpenSignalSelectionWizardAsync", staticStart, StringComparison.Ordinal); | ||
| Assert.True(staticStart >= 0 && manualStart > staticStart); | ||
| var staticChoice = actions[staticStart..manualStart]; | ||
|
|
||
| Assert.Contains("ApplyStaticDataSetSelection(device);", staticChoice, StringComparison.Ordinal); | ||
| Assert.Contains("await StartDeviceMonitorAsync(device)", staticChoice, StringComparison.Ordinal); | ||
| Assert.DoesNotContain("UseHybrid", staticChoice, StringComparison.Ordinal); | ||
|
|
||
| Assert.Contains("Iec61850DataSetSignalInventoryService.EnsureMandatorySignals(device)", sharedAuthority, StringComparison.Ordinal); | ||
| Assert.Contains("Iec61850StaticDataSetAuthoritySelection.Build(device)", sharedAuthority, StringComparison.Ordinal); | ||
| Assert.Contains("Iec61850MonitoringModeRegistry.UseStaticDataSetReportOnly(device)", sharedAuthority, StringComparison.Ordinal); | ||
|
|
||
| Assert.Contains("device.SclWorkspace?.DesignModel ?? device.LiveDiscoveryModel", staticRuntime, StringComparison.Ordinal); | ||
| Assert.Contains("AllowDynamicDataSetWrites = false", staticRuntime, StringComparison.Ordinal); | ||
| Assert.Contains("PollingPointKeys = Array.Empty<string>()", staticRuntime, StringComparison.Ordinal); | ||
| Assert.Contains("PollingFallbackSignalCount = 0", staticRuntime, StringComparison.Ordinal); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void SharedPostModelChooser_RoutesSignalCatalogToHybridOnlyAfterManualSelectionIsAccepted() | ||
| { | ||
| var actions = Read("MainWindow.SclQuickActions.cs"); | ||
| var manualStart = actions.IndexOf("var accepted = await OpenSignalSelectionWizardAsync", StringComparison.Ordinal); | ||
| var methodEnd = actions.IndexOf("internal async Task OpenIedWorkspaceActionsFromCardAsync", manualStart, StringComparison.Ordinal); | ||
| Assert.True(manualStart >= 0 && methodEnd > manualStart); | ||
| var manualChoice = actions[manualStart..methodEnd]; | ||
|
|
||
| var acceptedGuard = manualChoice.IndexOf("if (!accepted)", StringComparison.Ordinal); | ||
| var hybridSwitch = manualChoice.IndexOf("Iec61850MonitoringModeRegistry.UseHybrid(device)", StringComparison.Ordinal); | ||
| Assert.True(acceptedGuard >= 0 && hybridSwitch > acceptedGuard); | ||
| Assert.Contains("autoStartAfterSave: false", manualChoice, StringComparison.Ordinal); | ||
| Assert.Contains("await StartDeviceMonitorAsync(device)", manualChoice, StringComparison.Ordinal); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void Chooser_UsesSourceNeutralSignalSourceLabels() | ||
| { | ||
| var xaml = Read("SclSignalSelectionModeWindow.xaml"); | ||
|
|
||
| Assert.Contains("DataSet Signals", xaml, StringComparison.Ordinal); | ||
| Assert.Contains("Static report-only", xaml, StringComparison.Ordinal); | ||
| Assert.Contains("Signal Catalog", xaml, StringComparison.Ordinal); | ||
| } | ||
|
|
||
| private static string Read(string relativePath) | ||
| => File.ReadAllText(FindRepoFile(relativePath)).Replace("\r\n", "\n", StringComparison.Ordinal); | ||
|
|
||
| private static string FindRepoFile(string relativePath) | ||
| { | ||
| DirectoryInfo? directory = new(AppContext.BaseDirectory); | ||
| while (directory != null) | ||
| { | ||
| var candidate = Path.Combine(directory.FullName, relativePath); | ||
| if (File.Exists(candidate)) | ||
| return candidate; | ||
| directory = directory.Parent; | ||
| } | ||
|
|
||
| throw new FileNotFoundException(relativePath); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When two per-device discoveries are already running concurrently, the first completion enters this modal chooser without setting
_signalSelectionWizardOpen; the second completion can therefore pass the same guard inside the first dialog's nested dispatcher loop and open anotherShowDialog. This stacks the second IED's chooser over the first and changesSelectedDevicebehind it, whereas the previous signal-selection path set the global guard before showing its window. Track the actions chooser with the same single-workflow guard, and cover concurrent discovery completions in a UI interaction regression test.AGENTS.md reference: AGENTS.md:L180-L180
Useful? React with 👍 / 👎.