Skip to content

refactor(formatting): avoid second legacy scalar extraction - #417

Merged
masarray merged 1 commit into
mainfrom
maintenance/value-formatter-single-normalization-20260926
Sep 26, 2026
Merged

masarray merged 1 commit into
mainfrom
maintenance/value-formatter-single-normalization-20260926

Conversation

@masarray

@masarray masarray commented Sep 26, 2026 •

Copy link
Copy Markdown
Owner

Scope: one pure formatting subsystem — now based on merged #416 in main

#416 was merged as e7b43508fb3b2bf5fbda7be8ed8425da74bb9766. This PR's tree was reconstructed on that exact merged parent without changing any source blob. The diff against main is exactly two files: Services/Iec61850ValueFormatter.cs and tests/ARSAS.Tests/Iec61850ValueFormatterTests.cs.

Root cause and implementation

FormatReportProcessValue extracts a legacy Structure(...){stVal=...} or numeric metadata-qualified indexed scalar, then delegated to Format, which tried the same structure extraction again. A private FormatNormalizedValue now holds the original switch/Dbpos presentation, so both public entry points extract exactly once. This is display-only, with no protocol, report acquisition, static DataSet, RCB/GI, dynamic write/polling, public API, or persisted model change.

Regression coverage and consumers

Four added test cases cover Boolean and DPC structured report values, numeric indexed BCR-style presentation, and refusal to collapse a nonnumeric indexed structure. Existing generic/report operator vocabulary and timestamp tests remain. Report-driven monitor and FAT preview call FormatReportProcessValue; direct read/polling presentation uses generic Format; model/control TryNormalizeDbpos remains untouched. No performance gain or physical IED operation is claimed.

Integration provenance

No release, tag or production engine lock changes. Tracks #380.

Integration result — verified on actual main

Copy link
Copy Markdown
Owner Author

Focused consumer/impact audit for the two-file formatter refactor (against current #416 base):

  • FormatReportProcessValue is called in Iec61850MonitorRuntime for report-driven display updates and in Services/IoTesting/NativeFatPrintPreviewSnapshot.cs for FAT preview; neither caller changes.
  • Generic Format is used for direct-read value presentation in NativeIec61850Client and polling display in Iec61850MonitorRuntime; generic entry point retains first-pass extraction and its original formatting switch via the new private helper.
  • TryNormalizeDbpos has direct model/control-state consumers in Models/SignalDefinition.cs and NativeIec61850Client.cs; that method and its implementation are untouched.
  • Existing ReportProcessValueSafetyTests, timestamp display tests and report boolean display tests remain in the full test suite; new tests exercise Boolean and DPC structured report values, numeric indexed structures, and nonnumeric index refusal.
  • No protocol decoder, report metadata, raw value, quality or timestamp data path is changed. This is a display-only internal call-graph simplification; no performance gain is claimed without measurement.

The PR remains stacked on #416 and CI is in progress; no merge/signoff claimed.

@masarray
masarray force-pushed the maintenance/combined-ci-validation-413-415-20260926 branch from c37bec2 to f7d1f65 Compare September 26, 2026 09:36
@masarray
masarray force-pushed the maintenance/value-formatter-single-normalization-20260926 branch from 4fefd6b to b85ce12 Compare September 26, 2026 09:38

Copy link
Copy Markdown
Owner Author

Pernyataan pribadi kontributor, diposting melalui ChatGPT berdasarkan izin eksplisit yang diberikan dalam percakapan:

Saya telah membaca dan menyetujui CLA ARSAS untuk kontribusi saya pada PR #416 dan #417. Saya memiliki hak yang diperlukan untuk menyumbangkan kontribusi tersebut, termasuk izin pemberi kerja jika diperlukan. Saya mengizinkan ChatGPT memposting pernyataan ini di kedua PR melalui akun GitHub saya.

@masarray
masarray force-pushed the maintenance/value-formatter-single-normalization-20260926 branch from b85ce12 to c7edc91 Compare September 26, 2026 10:12
@masarray
masarray changed the base branch from maintenance/combined-ci-validation-413-415-20260926 to main September 26, 2026 10:12

Copy link
Copy Markdown
Owner Author

#417 contributor handoff — CLA complete; only DCO sign-off for this new commit remains after final exact-head CI.

This draft now targets the real #416 merged main at e7b43508fb3b2bf5fbda7be8ed8425da74bb9766. Source tree/diff unchanged: two files, four added xUnit cases. Current refactor head: c7edc91d1af814366af579e680acc5d37418923d (currently not signed off).

For the contributor to sign with their own Git identity in their Windows clone:

git fetch origin
git switch --track origin/maintenance/value-formatter-single-normalization-20260926
git rev-parse HEAD
# Continue ONLY if the SHA equals c7edc91d1af814366af579e680acc5d37418923d
git config user.name
git config user.email
git commit --amend --no-edit --signoff
git log -1 --format=%B
git push --force-with-lease origin HEAD:maintenance/value-formatter-single-normalization-20260926

If the local branch already exists, switch to it and fast-forward to the current remote before amending; do not overwrite other local work. The Signed-off-by trailer is the contributor's own certification; ChatGPT has not inserted a substitute sign-off. After the SHA changes, verify one signed-off commit based on the merged main parent and run the 9 exact-head workflows again before merging. No release promotion or physical-device claim.

Signed-off-by: masarray <ari.sulistiono@gmail.com>
@masarray
masarray force-pushed the maintenance/value-formatter-single-normalization-20260926 branch from c7edc91 to ef18bef Compare September 26, 2026 10:30
@masarray
masarray marked this pull request as ready for review September 26, 2026 10:36
@masarray
masarray merged commit 40355bc 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