feat: add temporary replaceHandlerEnabledDisabled method for cleanup.#1328
feat: add temporary replaceHandlerEnabledDisabled method for cleanup.#1328tathagat2241 wants to merge 3 commits intomainfrom
Conversation
|
This PR will trigger a minor release when merged. |
|
Hey @tathagat2241 - thanks for putting this up. I understand the need for a replace-vs-merge operation for the cleanup work. A few things came up during review that I'd like to see addressed before merging. Must Fix1. if (!isNonEmptyObject(data)) {
throw new Error('Data cannot be empty');
}2. Null-propagation crash when if (data.enabled != null) { // catches both null and undefinedSame for 3. Silent data loss on non-array values Should Fix4. Tests - please remove the 5. Handler dependency checks are bypassed 6. TypeScript declarations Accountability for RemovalThis is the big one. The PR description and code comments both say "temporary" and "will be removed once the cleanup task is completed." That's great - but there's no mechanism to hold anyone (including future-us) accountable for actually removing it. I'd like to see:
We've all seen "temporary" code that's still around years later. Let's not let this be one of those. A concrete removal ticket with a date makes it easy to track and close the loop. Alternative Worth ConsideringSince this is a one-time cleanup - have you considered just doing it as a script against S3 directly? The config is versioned JSON at If you do need it as an API method, another option is adding a Either way - happy to re-review once the fixes are in. The core logic is sound, it just needs the guardrails. |
solaris007
left a comment
There was a problem hiding this comment.
Requesting changes - see detailed review in the comment above. The must-fix items (null/undefined crash, null-propagation, silent data loss) are real bugs, and the accountability piece (follow-up removal ticket with a date) is important for keeping "temporary" honest.
…ks, unit tests, types, @deprecated, log.warn, SITES-40878
|
@solaris007, I have addressed all of your comments and have created the new commit, Please re-review. Also I have created a ticket to remove this endpoint (SITES-40878) but have not added the date when this will be completed as this is dependent on another task which needs to be completed before we can implement this which is removing Enable Handler check before running the audits "isHandlerEnabled" and that PR is in review. Once it is merged and verified that everything is working as expected then I will implement this in a 2PR fashion with @rpapani. |
TEMPORARY: This method was created to support a temporary API endpoint for cleaning up enabled and disabled lists by removing unnecessary site IDs.
Unlike
updateHandlerPropertieswhich merges arrays, this method completely replaces the specified arrays. This method will be removed once the cleanup task is completed.Changes
replaceHandlerEnabledDisabledmethod to Configuration modelc8 ignorecomments to skip unit test coverage (temporary code)Related
Spacecat-api-service PR: feat: add temporary API to replace enabled/disabled lists spacecat-api-service#1789
Please ensure your pull request adheres to the following guidelines:
Related Issues
https://jira.corp.adobe.com/browse/SITES-40312
Thanks for contributing!