Skip to content

Conversation

@ckshitij
Copy link
Contributor

@ckshitij ckshitij commented Nov 4, 2025

Pull Request

Description:

  • Addess issue-2226
  • Added RemoteConfigurable and RemoteConfiguration interfaces for runtime configuration management.
  • Introduced mock implementations for testing remote configuration behavior.
  • Enhanced remote logger to support dynamic log level updates via remote configuration.
  • Implemented HTTP-based remote configuration fetching and client registration.
  • Added comprehensive tests for remote configuration and logger functionality.

Checklist:

  • I have formatted my code using goimport and golangci-lint.
  • All new code is covered by unit tests.
  • This PR does not decrease the overall code coverage.
  • I have reviewed the code comments and documentation for clarity.

@ckshitij ckshitij force-pushed the issue/2226 branch 2 times, most recently from 443dc6e to 9b79f98 Compare November 4, 2025 19:25
@ckshitij
Copy link
Contributor Author

ckshitij commented Nov 5, 2025

@coolwednesday and @aryanmehrotra kindly review the PR.

Copy link
Member

@Umang01-hash Umang01-hash left a comment

Choose a reason for hiding this comment

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

  • Consider renaming interfaces for better clarity: RemoteConfigurableConfigSubscriber and RemoteConfiguration ConfigProvider

  • All the newly added tests inside remotelogger_test.go have if conditions in the end like:

	if atomic.LoadInt32(&logger.changeCnt) != 0 {
		t.Errorf("expected no ChangeLevel when invalid key present")
	}
	if !foundErrorLog {
		t.Errorf("expected error log message for invalid JSON response, got logs: %v", logger.messages)
	}
	if client.lastConfig["logLevel"] != "DEBUG" {
		t.Errorf("expected logLevel=DEBUG, got %v", client.lastConfig["logLevel"])
	}

We should generally avoid all these if-else conditions inside test methods. Please refactor your tests too.

  • Same if-else conditions inside test lies in file remote_config_test.go. Please refactor it also.

  • It would be nicer if you can also attach a screenshot of the functionality working after your changes so other developers can easily review.


func fetchRemoteConfig(remoteService service.HTTP) (map[string]any, error) {
if newLogLevelStr, err := fetchLogLevelStr(remoteService); err != nil {
return map[string]any{}, err
Copy link
Member

Choose a reason for hiding this comment

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

Error handling in fetchRemoteConfig() should return nil, err instead of empty map on error

@Umang01-hash
Copy link
Member

@ckshitij Thank you for contributing to GoFr. I have left some review comments on your PR. Please address them and we will review it again after all comments are resolved.

@Umang01-hash
Copy link
Member

@ckshitij Are you still working on this PR? If yes, let's resolve the review comments quickly so we can further review your PR.

@ckshitij
Copy link
Contributor Author

@ckshitij Are you still working on this PR? If yes, let's resolve the review comments quickly so we can further review your PR.

@Umang01-hash Yes I’m still working on the same, got busy with something , will try to address the comments by this weekend.

- Added RemoteConfigurable and RemoteConfiguration interfaces for runtime configuration management.
- Introduced mock implementations for testing remote configuration behavior.
- Enhanced remote logger to support dynamic log level updates via remote configuration.
- Implemented HTTP-based remote configuration fetching and client registration.
- Added comprehensive tests for remote configuration and logger functionality.
@ckshitij ckshitij force-pushed the issue/2226 branch 3 times, most recently from 5ff1550 to 27300a9 Compare November 20, 2025 08:13
…ation to Subscriber and Provider for clarity
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