Skip to content

fix: Handle nil raw config on first common writable config update#881

Merged
judehung merged 1 commit intoedgexfoundry:mainfrom
FelixTing:issue-879
Jul 7, 2025
Merged

fix: Handle nil raw config on first common writable config update#881
judehung merged 1 commit intoedgexfoundry:mainfrom
FelixTing:issue-879

Conversation

@FelixTing
Copy link
Member

@FelixTing FelixTing commented Jul 4, 2025

fix: #879

  • Use the current service writable config as the baseline for the initial update
  • Store previousCommonWritable as map to avoid pointer reference syncing with Config Provider

PR Checklist

Please check if your PR fulfills the following requirements:

  • I am not introducing a breaking change (if you are, flag in conventional commit message with BREAKING CHANGE: describing the break)
  • I am not introducing a new dependency (add notes below if you are)
  • I have added unit tests for the new feature or bug fix (if not, why?)
  • I have fully tested (add details below) this the new feature or bug fix (if not, why?)
  • I have opened a PR for the related docs change (if not, why?)

Testing Instructions

  1. Build device-virtual using this version of go-mod-bootstrap
  2. Deploy core services and device-virtual
  3. Use Core Keeper API to update a common writable configuration key. For example:
curl -X PUT http://localhost:59890/api/v3/kvs/key/edgex/v4/core-common-config-bootstrapper/all-services/Writable/Telemetry/Interval \
  -H "Content-Type: application/json" \
  -d '{"value": "20s"}'
  1. The first config update should succeed and output this log:
level=INFO ts=2025-07-04T16:02:11.242333+08:00 app=device-virtual source=config.go:1029 msg="Writable configuration has been updated from the Configuration Provider"
level=INFO ts=2025-07-04T16:02:11.24244+08:00 app=device-virtual source=config.go:1052 msg="Telemetry interval has been updated. Processing new value..."
level=INFO ts=2025-07-04T16:02:11.242467+08:00 app=device-virtual source=manager.go:47 msg="Metrics Manager report interval changed to 20s"

rather than the previous:

level=WARN ts=2025-07-02T09:36:30.330645+08:00 app=device-virtual source=config.go:931 msg="ignoring changed writable key InsecureSecrets overwritten in App or Device common writable"

@FelixTing FelixTing requested a review from judehung July 4, 2025 08:19
@codecov-commenter
Copy link

codecov-commenter commented Jul 4, 2025

Codecov Report

Attention: Patch coverage is 0% with 7 lines in your changes missing coverage. Please review.

Project coverage is 46.08%. Comparing base (797bfb7) to head (88e9152).

Files with missing lines Patch % Lines
bootstrap/config/config.go 0.00% 7 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #881      +/-   ##
==========================================
- Coverage   46.15%   46.08%   -0.07%     
==========================================
  Files          62       62              
  Lines        3664     3669       +5     
==========================================
  Hits         1691     1691              
- Misses       1851     1856       +5     
  Partials      122      122              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Member

@judehung judehung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

- Use the current service writable config as the baseline for the initial update
- Store previousCommonWritable as map to avoid pointer reference syncing with Config Provider

Signed-off-by: FelixTing <felix@iotechsys.com>
Copy link
Member

@judehung judehung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@judehung judehung merged commit 9a296eb into edgexfoundry:main Jul 7, 2025
3 checks passed
@FelixTing FelixTing deleted the issue-879 branch July 7, 2025 06:48
FelixTing added a commit to FelixTing/go-mod-bootstrap that referenced this pull request Oct 14, 2025
…gexfoundry#881)

- Use the current service writable config as the baseline for the initial update
- Store previousCommonWritable as map to avoid pointer reference syncing with Config Provider

Signed-off-by: FelixTing <felix@iotechsys.com>
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.

Writable common config changes require multiple API calls to take effect

3 participants