-
Notifications
You must be signed in to change notification settings - Fork 2
support for deploying to services/ui_api release APIs #45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cursor Bugbot has reviewed your changes and found 4 potential issues.
| var uri = this._uploadKey(keyPrefix, revisionKey); | ||
|
|
||
| if (useHydra) { | ||
| if (useReleaseEndpoint) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hardcoded app name in activation endpoint breaks services
High Severity
The _activateRevision function hardcodes 'journeys' in the URI template instead of using the configurable appName. While activate receives appName as a parameter, it never passes it to _activateRevision. According to the README documentation, the endpoint format is PUT /<app_name>/<version>/activate, so this will fail for any app other than journeys.
Additional Locations (1)
|
|
||
| if (response.statusCode == 404) { | ||
| return []; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
404 check occurs after body processing causes error
High Severity
In _listRevisions, the code processes response.body (calling .filter() on it) before checking if response.statusCode is 404. When the API returns 404, response.body is likely undefined or not an array, causing .filter() to throw an error before the 404 handler returns an empty array.
| activeRevision: function (keyPrefix, useHydra) { | ||
| return this._listRevisions(keyPrefix, useHydra).then(function (revisions) { | ||
| activeRevision: function (keyPrefix, appName, useReleaseEndpoint, isSummaryEndpoint) { | ||
| return this._listRevisions(keyPrefix, appName, useReleaseEndpoint, isSummaryEndpoint).then(function (revisions) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
activeRevision accesses wrong property returning undefined
High Severity
The activeRevision function accesses revisions[i].version to return the active revision key, but _listRevisions returns objects with a revision property (not version). This causes activeRevision to always return undefined even when an active revision exists.
| }, | ||
|
|
||
| uploadHydraRelease: function (keyPrefix, revisionKey, value) { | ||
| updateReleaseToServices: function (keyPrefix, revisionKey, appName, value) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Request body uses wrong field name for services API
High Severity
The updateReleaseToServices function sends id as the field name in the request body, but the README documentation (added in this same PR) specifies that the services API expects a field named version. The POST request to the services endpoint will fail or be ignored because the revision key is sent under the wrong field name.


This PR integrates with services/ui_api release endpoints since hydra release endpoints are deprecated.
For some historical context, the previous version of this library was referenced as a specific non-main git commit (seen in https://github.com/customerio/ui/pull/11790/changes). I believe this was just neglected cleanup after a major project and will be moving forward with merging this into the main branch.
Note
Medium Risk
Changes core deploy/activate/revision-listing request shapes and response parsing across multiple modes; misconfiguration or endpoint differences could lead to failed deploys or activating the wrong revision.
Overview
Adds a new deployment mode (
useServices) and app scoping (appName, defaultjourneys) so uploads, activation, and revision listing can target either the legacy REST API, Hydra’s summary endpoint, or Services’ per-app release endpoints.Refactors
lib/rest-clientto select requesturi, map differing response fields (idvsversion), and handle 404-as-empty for revision listing; updates method names/signatures accordingly and documents the Customer.io-specific endpoints inREADME.md.Written by Cursor Bugbot for commit 89d6745. This will update automatically on new commits. Configure here.