Skip to content

Prevent Load Override#4

Merged
Kansuler merged 1 commit intomainfrom
prevent-load-override
Oct 4, 2025
Merged

Prevent Load Override#4
Kansuler merged 1 commit intomainfrom
prevent-load-override

Conversation

@Kansuler
Copy link
Copy Markdown
Owner

@Kansuler Kansuler commented Oct 4, 2025

Fixed an issue where calling Load() multiple times would overwrite previously set configuration values. Now the Load function checks if a key already exists in the config maps before setting it, ensuring that once a value is loaded or written, subsequent Load calls won't override it.

This maintains the expected behavior where the first value loaded (whether from environment variables or fallback) takes priority, and prevents accidental overwrites from multiple Load calls on the same key.

Copilot AI review requested due to automatic review settings October 4, 2025 07:25
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Prevents the Load() function from overwriting previously set configuration values by adding existence checks before setting values in the config maps. This ensures that once a value is loaded or written, subsequent Load() calls preserve the original value.

  • Added existence checks in the Load() function for all supported data types
  • Created new test fixture to isolate test cases and prevent interference between subtests
  • Added comprehensive test coverage for the new non-overwrite behavior across all data types

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
configura.go Modified Load() function to check if key exists before setting values, preventing overwrites
configura_test.go Added test isolation and comprehensive test suite for non-overwrite behavior

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Oct 4, 2025

Golang Build & Test status 🚀

Go Test Outcome 🧪success

Coverage Report 📊success

Pusher: @Kansuler, Action: pull_request, Working Directory: ``, Workflow: Go Test Coverage Report On Pull Request

@codacy-production
Copy link
Copy Markdown

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
-3.94% (target: -1.00%) 65.22%
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (4de4051) 440 400 90.91%
Head commit (8706720) 491 (+51) 427 (+27) 86.97% (-3.94%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#4) 69 45 65.22%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

@Kansuler Kansuler merged commit 4106573 into main Oct 4, 2025
3 of 4 checks passed
@Kansuler Kansuler deleted the prevent-load-override branch October 4, 2025 07:30
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.

2 participants