Skip to content

Conversation

@djanhjo
Copy link

@djanhjo djanhjo commented Jan 30, 2026

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, default journeys) 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-client to select request uri, map differing response fields (id vs version), and handle 404-as-empty for revision listing; updates method names/signatures accordingly and documents the Customer.io-specific endpoints in README.md.

Written by Cursor Bugbot for commit 89d6745. This will update automatically on new commits. Configure here.

@djanhjo djanhjo merged commit 7e7947d into hydra_support Jan 30, 2026
3 checks passed
@djanhjo djanhjo deleted the services_support branch January 30, 2026 15:14
Copy link

@cursor cursor bot left a 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) {
Copy link

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)

Fix in Cursor Fix in Web


if (response.statusCode == 404) {
return [];
}
Copy link

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.

Fix in Cursor Fix in Web

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) {
Copy link

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.

Fix in Cursor Fix in Web

},

uploadHydraRelease: function (keyPrefix, revisionKey, value) {
updateReleaseToServices: function (keyPrefix, revisionKey, appName, value) {
Copy link

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.

Fix in Cursor Fix in Web

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