|
| 1 | +name: PR169 one-shot SCL comparison patch |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - integrate/ariec61850-dataset-semantic-bindings |
| 7 | + |
| 8 | +permissions: |
| 9 | + contents: write |
| 10 | + |
| 11 | +jobs: |
| 12 | + patch: |
| 13 | + if: github.actor != 'github-actions[bot]' |
| 14 | + runs-on: ubuntu-latest |
| 15 | + steps: |
| 16 | + - uses: actions/checkout@v4 |
| 17 | + with: |
| 18 | + ref: integrate/ariec61850-dataset-semantic-bindings |
| 19 | + fetch-depth: 0 |
| 20 | + |
| 21 | + - name: Replace projected authoritative comparison |
| 22 | + shell: python |
| 23 | + run: | |
| 24 | + from pathlib import Path |
| 25 | +
|
| 26 | + path = Path('MainWindow.xaml.cs') |
| 27 | + text = path.read_text(encoding='utf-8') |
| 28 | + old = ''' var expectedModel = SclLiveSignalModelProjection.Build( |
| 29 | + device.SclWorkspace.IedName, |
| 30 | + device.SclWorkspace.AccessPointName, |
| 31 | + SclWorkspaceSignalMapper.BuildSignals(device.SclWorkspace)); |
| 32 | + var observedModel = SclLiveSignalModelProjection.Build( |
| 33 | + device.Name, |
| 34 | + device.SclWorkspace.AccessPointName, |
| 35 | + liveSignals); |
| 36 | + var comparison = SclLiveModelComparer.Compare(expectedModel, observedModel); |
| 37 | + device.SclComparison = comparison; |
| 38 | +''' |
| 39 | + new = ''' // The engine design model and NativeIec61850Client.LastLiveModel are authoritative. |
| 40 | + // Signal projection remains a legacy/cache fallback only when native discovery is unavailable. |
| 41 | + var expectedModel = device.SclWorkspace.DesignModel; |
| 42 | + var observedModel = device.LiveDiscoveryModel ?? SclLiveSignalModelProjection.Build( |
| 43 | + device.Name, |
| 44 | + device.SclWorkspace.AccessPointName, |
| 45 | + liveSignals); |
| 46 | + var comparison = SclLiveModelComparer.Compare(expectedModel, observedModel); |
| 47 | + device.SclComparison = comparison; |
| 48 | + comparison = device.SclComparison ?? comparison; |
| 49 | +''' |
| 50 | + if old not in text: |
| 51 | + raise SystemExit('Target ApplySclLiveComparison block not found exactly; refusing broad edit.') |
| 52 | + path.write_text(text.replace(old, new, 1), encoding='utf-8') |
| 53 | + |
| 54 | + - name: Commit patch |
| 55 | + shell: bash |
| 56 | + run: | |
| 57 | + git config user.name "github-actions[bot]" |
| 58 | + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" |
| 59 | + git add MainWindow.xaml.cs |
| 60 | + git diff --cached --check |
| 61 | + git commit -m "Use native live model for SCL comparison" |
| 62 | + git push origin HEAD:integrate/ariec61850-dataset-semantic-bindings |
0 commit comments