Skip to content

Conversation

@tathagat2241
Copy link

@tathagat2241 tathagat2241 commented Oct 29, 2025

Summary

This PR adds new configuration management methods to support API-driven configuration updates

Changes Made

Configuration Model (configuration.model.js)

  • Added updateQueues(queues) - Update queue configurations
  • Added updateJob(type, properties) - Update job properties (interval, group)
  • Added updateHandlerProperties(type, properties) - Update handler settings (enabledByDefault, productCodes, dependencies, thresholds)
  • Added updateConfiguration(data) - Flexible method to update multiple configuration sections at once
  • Made productCodes a required and non-empty field for handlers
  • Added restore(version) - restores the last good version
  • Enhanced register(audit) and unregister(audit) - remove AUDIT_TYPES static list validation.

Configuration Schema (configuration.schema.js)

  • Updated handler schema to require productCodes with minimum 1 item

Configuration Index (index.js)

  • Exported checkConfiguration function for response validation

Testing

  • All tests passing (1133 tests)

Please ensure your pull request adheres to the following guidelines:

  • make sure to link the related issues in this description
  • when merging / squashing, make sure the fixed issue references are visible in the commits, for easy compilation of release notes

Related Issues

https://jira.corp.adobe.com/browse/LLMO-908

Thanks for contributing!

@github-actions
Copy link

This PR will trigger a minor release when merged.

Copy link

@ramboz ramboz left a comment

Choose a reason for hiding this comment

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

Looks overall good to me

Copy link
Contributor

@ravverma ravverma left a comment

Choose a reason for hiding this comment

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

@tathagat2241 minor comments, please address

throw new Error(`Handler "${type}" not found in configuration`);
}

if (properties.productCodes !== undefined) {
Copy link
Contributor

Choose a reason for hiding this comment

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

use hasText

Copy link
Author

Choose a reason for hiding this comment

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

The hasText utility is specifically for strings (isString(str)). This field is a array so hasText would incorrectly return false for valid values

Copy link
Contributor

Choose a reason for hiding this comment

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

isNonEmptyArray can use this

Copy link
Author

Choose a reason for hiding this comment

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

we will have to use both because Without !== undefined: All fields become required and we don't want that. eg: it will fail when only updating jobs.

And without isNonEmpty*(): Empty values pass through (e.g., {handlers: {}} would be accepted)

}
}

if (properties.dependencies !== undefined) {
Copy link
Contributor

Choose a reason for hiding this comment

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

use hasText

Copy link
Author

Choose a reason for hiding this comment

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

The hasText utility is specifically for strings (isString(str)). This field is a array so hasText would incorrectly return false for valid values.

}
}

if (properties.movingAvgThreshold !== undefined && properties.movingAvgThreshold < 1) {
Copy link
Contributor

Choose a reason for hiding this comment

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

use hasText

Copy link
Author

Choose a reason for hiding this comment

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

The hasText utility is specifically for strings (isString(str)). This field is a NUMBER so hasText would incorrectly return false for valid values.

throw new Error('Configuration data cannot be empty');
}

if (data.handlers !== undefined) {
Copy link
Contributor

Choose a reason for hiding this comment

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

use hasText

Copy link
Author

Choose a reason for hiding this comment

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

The hasText utility is specifically for strings (isString(str)). This field is a OBJECT so hasText would incorrectly return false for valid values.

this.setHandlers(mergedHandlers);
}

if (data.jobs !== undefined) {
Copy link
Contributor

Choose a reason for hiding this comment

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

hasText

Copy link
Author

Choose a reason for hiding this comment

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

The hasText utility is specifically for strings (isString(str)). This field is a array so hasText would incorrectly return false for valid values.

this.setJobs(mergedJobs);
}

if (data.queues !== undefined) {
Copy link
Contributor

Choose a reason for hiding this comment

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

use hasText

Copy link
Author

Choose a reason for hiding this comment

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

The hasText utility is specifically for strings (isString(str)). This field is a OBJECT so hasText would incorrectly return false for valid values.

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.

4 participants