Skip to content
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

MWPW-134799: MEP On/Off #1580

Merged
merged 8 commits into from
Dec 7, 2023
Merged

MWPW-134799: MEP On/Off #1580

merged 8 commits into from
Dec 7, 2023

Conversation

3ch023
Copy link
Contributor

@3ch023 3ch023 commented Nov 27, 2023

MEP On/Off

This PR introduces a client-side on/off feature for MEP manifests.
Related Discussion
More details below.

Resolves:

Test URLs:

Details

Promotions.xlsx

Promotions.xlsx - a separate global metadata file, configured in .helix/config.xlsx

image

  • located in root (milo folder)
  • holds connection folder/page-manifest and on/off date times.
  • serves metadata from the 'helix-default' tab
  • has the 'schedule' tab to configure on/off dates
  • The 'helix-default' has a hidden column called 'scheduled'. It is auto-generated from the 'schedule' tab and only visible when you preview promotions.xlsx.
image

Why a separate metadata file?

  • avoid conflicts & risks when GWP is modifying the main metadata file to configure promotions
  • easier overview & troubleshooting for promo issues
  • potential automation data file

Schedule Tab

image
  • no row/column can be deleted -> that would break generation functions in the 'concut' tab
  • datepicker & formatting for date fields
  • time formating for time fields
  • active/inactive controls if the schedule line is applied to metadata. GWP can set a line to inactive if they want to re-enable it later.

Priority

Promotions.xlsx is higher priority than metdata.xlsx
Promotions.xlsx only allows 2 fields to be configured, 'personalization' and 'events'. Its protected, so no other column from global metadata can be overwritten. On the contrary, global metadata should not be able to overwrite the 'personalization' and 'events' data in promotions.xlsx.
Priority is achieved due to order in .helix/config.xlsx

'manifestnames' and 'schedule' meta tags

  • 'manifestnames' contains manifests attached to this particular page (similar to 'personalization' field, but instead of path GWP can use a so-called manifest nickname, from the schedule tab)
  • 'schedule' contains all active promo schedule lines
  • 'schedule' line format: manifest name | start datetime (GMT) | end datetime (GMT) | manifest path
    Sample page
<meta name="manifestnames" content="pre-black-friday-global,black-friday-global,cyber-monday">
<meta name="schedule" content="pre-black-friday-global | 2023-11-01T00:00:00 | 2023-12-15T00:00:00 | https://main--milo--adobecom.hlx.page/promos/2023/black-friday/pre-black-friday/manifest-global.json, black-friday-global | 2023-12-15T00:00:00 | 2023-12-31T00:00:00 | https://main--milo--adobecom.hlx.page/promos/2023/black-friday/black-friday/manifest-global.json">

MEP behavior

  • MEP will read 'schedule' metadata
  • MEP will sort out of 'schedule' promo manifests attached to this page
  • For each manifest it will decide if its enabled (scheduled for current time) or disabled (scheduled outside of current time or the schedule is missing at all)
  • MEP will handle the manifests from 'personalization' and the ones from 'promo' in the same way. The 'personalization' manifests are lower priority - to be discussed.
  • if 'bts' event is found, the start and end datetime are converted to a local browser time, then compared with the current time. If it's on - manifest is enabled, if not - disabled.
  • disabled manifest is NOT preloaded and NOT fetched. This is true for both hlx.page and hlx.live.
  • Preview for promo manifests work the same as for usual personalization.

Preview

'Scheduled - inactive/active' shows if the current browser time is within the manifest's on/off period.
On and Off date time is shown in the local timezone, NOT in GMT.
When there is a manifest overwrite in the URL, MEP will disregard the schedule. This is needed for QA-ing inactive changes.
image

@3ch023 3ch023 requested a review from a team as a code owner November 27, 2023 14:03
Copy link
Contributor

aem-code-sync bot commented Nov 27, 2023

Hello, I'm the AEM Code Sync Bot and I will run some test suites that validate the page speed.
In case there are problems, just click the checkbox below to rerun the respective action.

  • Re-run PSI Checks

Copy link
Contributor

aem-code-sync bot commented Nov 27, 2023

Page Scores Audits Google
/fr/special-offers/special-offers?martech=off PERFORMANCE A11Y SEO BEST PRACTICES SI FCP LCP TBT CLS PSI

@3ch023 3ch023 added run-nala Run Nala Test Automation against PR needs-verification PR requires E2E testing by a reviewer labels Nov 27, 2023
let event = null;
const scheduled = manifestPath.match(REGEX_PROMO);
if (scheduled) {
event = events.find((e) => e.name === scheduled[1]);
Copy link
Contributor

Choose a reason for hiding this comment

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

what is 1? could we use a talkative constant (PROMO_NAME_GRP?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

constant is now gone completely because of a changed approach

for (const manifest of cleanedManifests) {
results.push(await runPersonalization(manifest, config));
const noOverride = !config.mep?.override;
Copy link
Contributor

Choose a reason for hiding this comment

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

wouldn't it be clearer to have an override flag, and then !override test?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed


const REGEX_PROMO = /\/promos\/(\w+)\//;
Copy link
Contributor

Choose a reason for hiding this comment

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

is \w+ enough for first level folder? characters like '-' or '_' are allowed, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

very good point, this regex certainly needs more thinking.
let me research a bit more and fix it up

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed regex at all

disabled = true;
} else {
const currentDate = new Date();
if (event.start && event.end
Copy link
Contributor

Choose a reason for hiding this comment

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

don't we want to manage "evergreen" promotion that are endless?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

for now, i don't recall such use-case.
can you give more details?
how will it work?

Copy link
Contributor

@npeltier npeltier Nov 28, 2023

Choose a reason for hiding this comment

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

never mind, just checked, and those use cases are not meant to leverage mep anyway.

Copy link
Contributor

Choose a reason for hiding this comment

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

don't we want to manage "evergreen" promotion that are endless?

Evergreen sounds like regular content then, no? Should not be tied to promotion anymore in that case.

Copy link
Contributor

aem-code-sync bot commented Nov 30, 2023

Page Scores Audits Google
/fr/special-offers/special-offers?martech=off PERFORMANCE A11Y SEO BEST PRACTICES SI FCP LCP TBT CLS PSI

Copy link
Contributor

aem-code-sync bot commented Nov 30, 2023

Page Scores Audits Google
/fr/special-offers/special-offers?martech=off PERFORMANCE A11Y SEO BEST PRACTICES SI FCP LCP TBT CLS PSI

Copy link
Contributor

aem-code-sync bot commented Nov 30, 2023

Page Scores Audits Google
/fr/special-offers/special-offers?martech=off PERFORMANCE A11Y SEO BEST PRACTICES SI FCP LCP TBT CLS PSI
/products/special-offers?martech=off Lighthouse returned error: ERRORED_DOCUMENT_REQUEST. Lighthouse was unable to reliably load the page you requested. Make sure you are testing the correct URL and that the server is properly responding to all requests. (Status code: 404) PSI

Copy link
Contributor

aem-code-sync bot commented Nov 30, 2023

Copy link
Contributor

aem-code-sync bot commented Nov 30, 2023

Page Scores Audits Google
/products/special-offers?martech=off PERFORMANCE A11Y SEO BEST PRACTICES SI FCP LCP TBT CLS PSI

Copy link
Contributor

aem-code-sync bot commented Nov 30, 2023

Page Scores Audits Google
/products/special-offers?martech=off PERFORMANCE A11Y SEO BEST PRACTICES SI FCP LCP TBT CLS PSI

Copy link
Contributor

aem-code-sync bot commented Dec 1, 2023

Page Scores Audits Google
/products/special-offers?martech=off PERFORMANCE A11Y SEO BEST PRACTICES SI FCP LCP TBT CLS PSI

@3ch023 3ch023 changed the base branch from main to mwpw-138750-analytics2 December 1, 2023 13:39
@3ch023
Copy link
Contributor Author

3ch023 commented Dec 1, 2023

for now rebased on mwpw-138750-analytics2 as agreed with @vivgoodrich,
once pull/1531 is merged, this PR will be rebased to the main and ready to merge.

Base automatically changed from mwpw-138750-analytics2 to main December 4, 2023 20:30
Copy link

codecov bot commented Dec 5, 2023

Codecov Report

Attention: 12 lines in your changes are missing coverage. Please review.

Comparison is base (951817c) 95.65% compared to head (60260f4) 95.05%.

Files Patch % Lines
.../features/personalization/add-preview-to-config.js 22.22% 7 Missing ⚠️
libs/features/personalization/preview.js 0.00% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1580      +/-   ##
==========================================
- Coverage   95.65%   95.05%   -0.60%     
==========================================
  Files         150      153       +3     
  Lines       38783    39170     +387     
==========================================
+ Hits        37097    37234     +137     
- Misses       1686     1936     +250     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@elevendozen
Copy link

@3ch023 et al... as of today i finally have all my "tests" up and running in the new system, and so far it is a huge step forward! I have various promos (marquee, segment, medium promo, sticky, etc) for various campaigns (bf, bts, ste). I've updated the master "promotions" spreadsheet manifest with a matrix we can use for our yearly cycle... so yes... it all feels right, so far...
Small request: can we move "promotions" manifest from /www/ and into /www/promos/, that way all promo stuff is together under the promos directory? What is the impact?

@3ch023
Copy link
Contributor Author

3ch023 commented Dec 6, 2023

can we move "promotions" manifest from /www/ and into /www/promos/

sure, moved it in both CC and Milo

@3ch023 3ch023 added verified PR has been E2E tested by a reviewer and removed do not merge PR should not be merged yet needs-verification PR requires E2E testing by a reviewer labels Dec 6, 2023
Copy link
Contributor

@npeltier npeltier left a comment

Choose a reason for hiding this comment

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

lgtm

As discussed offline, i would have preferred i think to leave promotion semantic out of mep completely. metadata name manifestpaths goes in that route. Ideally we could have mep having the feature to override bits of the site at schedule moments, and commerce users using that feature for promotion purpose.
I keep in mind though promotion is our main driver, and making things generic is not always the best route at the beginning. Let's see what usage gives us

@3ch023 3ch023 merged commit fb696a6 into main Dec 7, 2023
7 of 11 checks passed
@3ch023 3ch023 deleted the onoff branch December 7, 2023 15:21
yesil pushed a commit to yesil/milo that referenced this pull request Dec 14, 2023
* MWPW-134799: add on/off to MEP
VKniaz pushed a commit to VKniaz/milo that referenced this pull request Dec 15, 2023
* MWPW-134799: add on/off to MEP
vgoodric pushed a commit to vgoodric/bootcamp-milo that referenced this pull request Feb 1, 2024
* MWPW-134799: add on/off to MEP
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
run-nala Run Nala Test Automation against PR verified PR has been E2E tested by a reviewer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants