Skip to content

[MOB-16479] Allow path overwrite for Media Edge requests#258

Merged
addb merged 19 commits intoadobe:devfrom
addb:MOB-16479
Sep 2, 2022
Merged

[MOB-16479] Allow path overwrite for Media Edge requests#258
addb merged 19 commits intoadobe:devfrom
addb:MOB-16479

Conversation

@addb
Copy link
Copy Markdown
Contributor

@addb addb commented Aug 2, 2022

Description

Add support to override interact request path. This is primarily being added to support Media edge workflow, but is generic, so that any other extension can make use of it.

Format https:{EdgeDomain}/{Environment}/{EdgeRegionId}/{custom path}
Example https://edge.domain/ee/or2/va/v1/sessionStart

Related Issue

Motivation and Context

How Has This Been Tested?

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have signed the Adobe Open Source CLA.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@addb addb requested review from emdobrin and kevinlind August 2, 2022 22:01
@codecov
Copy link
Copy Markdown

codecov bot commented Aug 2, 2022

Codecov Report

Merging #258 (c65aa48) into dev (15632d5) will decrease coverage by 2.05%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##              dev     #258      +/-   ##
==========================================
- Coverage   94.59%   92.54%   -2.05%     
==========================================
  Files          27       27              
  Lines         998     1032      +34     
==========================================
+ Hits          944      955      +11     
- Misses         54       77      +23     

@kevinlind
Copy link
Copy Markdown
Contributor

Do you know why the coverage drops 2.5% with these changes? The report states that your changes are 100% covered by tests, however coverage is lost on lines this PR doesn't change.

@addb
Copy link
Copy Markdown
Contributor Author

addb commented Aug 4, 2022

Do you know why the coverage drops 2.5% with these changes? The report states that your changes are 100% covered by tests, however coverage is lost on lines this PR doesn't change.

It has to do with the Xcode 13.0.0 update. We have noticed this in other repos as well that the coverage drops when we update to xcode 13.0.0

Copy link
Copy Markdown
Contributor

@emdobrin emdobrin left a comment

Choose a reason for hiding this comment

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

@addb can you also update the description for this PR?

}

/// Extracts all the Edge configuration keys from the Configuration shared state
/// Extracts all the Edge configuration keys needed for this request. Configuration keys are extracted from the Configuration shared state and the given `event` instance.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I recommend not mixing config keys with event keys in the same payload here to keep this function code specialized on a single item at a time. We could instead use a new helper getRequestProperties(event) that extract the request path overwrite and maybe additional request settings in the future.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Additionally getEdgeConfig is used for all the endpoints we integrate with (currently interact and consent), we should allow the path overwrite only in the edge requestContent (interact) requests, and not for consent. Let's also include a test that overwrites are ignored for consent

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should we revert this doc change?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Don't forget to revert this doc change.

addb added 2 commits August 5, 2022 16:18
…t for similar requests in future. Added validation to drop paths with invalid cahracters.
Copy link
Copy Markdown
Contributor

@kevinlind kevinlind left a comment

Choose a reason for hiding this comment

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

Can you check the coverage report and increase your diff coverage back to 100%? You may just need to add some negative tests to isValidPath.

Copy link
Copy Markdown
Contributor

@kevinlind kevinlind left a comment

Choose a reason for hiding this comment

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

One additional small comment, otherwise looks good.

}

/// Extracts all the Edge configuration keys from the Configuration shared state
/// Extracts all the Edge configuration keys needed for this request. Configuration keys are extracted from the Configuration shared state and the given `event` instance.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should we revert this doc change?

import XCTest

/// End-to-end testing for the AEPEdge public APIs
class AEPEdgePathOverwriteTests: FunctionalTestBase {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can you also add a test that it does not include the "request" portion in the request body?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I see the request being sent as event payload.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

hmm.. that should not be the case, we should handle this and not include the client-side "request" portion in the request to Konductor

Copy link
Copy Markdown
Contributor

@kevinlind kevinlind left a comment

Choose a reason for hiding this comment

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

Looks good. One small clean up comment before you merge to revert a doc change after you refactored some code.

}

/// Extracts all the Edge configuration keys from the Configuration shared state
/// Extracts all the Edge configuration keys needed for this request. Configuration keys are extracted from the Configuration shared state and the given `event` instance.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Don't forget to revert this doc change.

@addb addb merged commit ebffb92 into adobe:dev Sep 2, 2022
@addb addb deleted the MOB-16479 branch June 1, 2023 17:30
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.

3 participants