Skip to content

common: preserve case-only state value updates - #3630

Open
user01010111 wants to merge 2 commits into
networkupstools:masterfrom
user01010111:codex/issue-3622-state-values
Open

common: preserve case-only state value updates#3630
user01010111 wants to merge 2 commits into
networkupstools:masterfrom
user01010111:codex/issue-3622-state-values

Conversation

@user01010111

@user01010111 user01010111 commented Sep 7, 2026

Copy link
Copy Markdown

Changing a mutable device.contact from Operations to operations currently
returns unchanged, keeps the old value and suppresses the driver's SETINFO
publication. The server uses the same comparison when storing received updates.
Compare raw values byte-for-byte so the replacement is stored and published.

Variable-name matching and tree ordering remain case-insensitive. Immutable
values still reject replacements, and timestamps and metadata retain their
existing behavior. Drivers producing case-varying values will now publish those
changes; identical repeats remain suppressed. This is separate from the
IMMUTABLE propagation proposal in #2549.

Adds a regression linked to the actual common state library, an existing NIT
dummy sequence check for both case transitions, and a NEWS entry.

Closes: #3622

Validation:

  • The original library regression failed on unmodified upstream 2caa3c875
    for stale case-only values and passed after the fix. It covers flags, immutable
    values, metadata, timestamps, tree/name behavior, lengths and escaping.
  • For the initial fix, GCC 14.2.0 and Clang 19.1.7 Linux builds with project
    warnings and -Werror passed, including real dummy-ups/snmp-ups builds and
    13/13 and 14/14 configured tests respectively. Apple Clang 21.0.0 passed
    9/9 macOS tests; its unrelated
    default-directory warning required a targeted compiler suppression.
  • The initial state regression passed in GNU89 and strict C99 modes, against shared
    libraries under ASan/UBSan with leak detection, and under Valgrind with no
    reported errors or leaked blocks.
  • Local NIT changes from 7 passing checks and one case-transition failure to
    8 passing checks. A separate real dummy-ups/upsd/upsc run observes timed
    publication, server/client capitalization, authenticated simulated SET VAR
    changes, and suppression of identical repeats on macOS and Linux.
  • The test-only null-guard follow-up passes 9/9 macOS tests and 13/13 tests
    in the extracted Linux build. A forced missing-node lookup against the real
    library exits with status 1 and a clear diagnostic before dereferencing.
  • Normal make distcheck-light passes, including the extracted build, tests,
    install/uninstall and cleanup. All five packaged files match the final patch.
    Full spellcheck, source style, shell syntax and diff whitespace checks pass.
    NEWS renders with one unchanged baseline linkman macro warning.

No physical UPS hardware was available for testing. Validation covered common
state-library regressions, compiler and memory checks, existing configured
tests, and real localhost dummy-ups/upsd/upsc integration with timed updates,
observed publication and simulated SET VAR round trips, plus distribution and
documentation checks. Physical UPS models, firmware versions, hardware write
behavior, and hardware combinations were not tested. The MGE mapping establishes
software applicability; no actual MGE write or publication is claimed.

Relevant checklist:

  • Behavior, scope, compatibility and testing described.
  • Maintained test sources registered for build and distribution.
  • Coding style/portability checked; NEWS updated.
  • AI use and model disclosed.
  • Human contributor review and acceptance of responsibility completed.
  • DCO sign-off authorized and included in the commit.

AI assistance: OpenAI Codex with gpt-6-astra (x-high reasoning).
The human contributor remains responsible for reviewing and submitting
the change.

Compare raw state values byte-for-byte so mutable updates such as
device.contact changing from Operations to operations are retained and
published. Preserve case-insensitive variable-name matching, immutable
values, timestamps and metadata.

Add common state-library regression coverage and an existing NIT dummy
sequence check for both case transitions. Document the correction in NEWS.

Closes: networkupstools#3622

AI assistance: OpenAI Codex with gpt-6-astra (x-high reasoning).
The human contributor remains responsible for reviewing and submitting
the change.

Signed-off-by: user01010111 <12504630+user01010111@users.noreply.github.com>
@github-actions

github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown

A ZIP file with standard source tarball and another tarball with pre-built docs for commit f1bdaf5 is temporarily available: NUT-tarballs-PR-3630.zip.

Comment thread tests/statetest.c Fixed
Stop statetest with a clear failure message if the required device.contact
lookup returns NULL, before reading the node name or changing its flags.

AI assistance: OpenAI Codex with gpt-6-astra (x-high reasoning).
The human contributor remains responsible for reviewing and submitting
the change.

Signed-off-by: user01010111 <12504630+user01010111@users.noreply.github.com>
@jimklimov jimklimov added Incorrect or missing readings On some devices driver-reported values are systemically off (e.g. x10, x0.1, const+Value, etc.) C-str Issues and PRs about C/C++ methods, headers and data types dealing with strings and memory blocks AI For good or bad, machine tools are upon us. Humans are still the responsible ones. labels Sep 8, 2026
@jimklimov jimklimov added this to the 2.8.6 milestone Sep 8, 2026
@jimklimov jimklimov added this to NUT QA Sep 8, 2026
@AppVeyorBot

Copy link
Copy Markdown

Build nut 2.8.5.5254-master completed (commit 6619ffa177 by @user01010111)

@AppVeyorBot

Copy link
Copy Markdown

Build nut 2.8.5.5255-master completed (commit f4cda53beb by @user01010111)

@jimklimov jimklimov moved this to In Progress in NUT QA Sep 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI For good or bad, machine tools are upon us. Humans are still the responsible ones. C-str Issues and PRs about C/C++ methods, headers and data types dealing with strings and memory blocks Incorrect or missing readings On some devices driver-reported values are systemically off (e.g. x10, x0.1, const+Value, etc.)

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

Common state store discards case-only changes to opaque string values

4 participants