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

fix: remove unintentionally spammy loadEnvironment warnings #2466

Merged
merged 8 commits into from
Jun 11, 2020

Conversation

zetlen
Copy link
Contributor

@zetlen zetlen commented Jun 7, 2020

Description

Simplify the breaking change warnings in loadEnvironment, and add a fail-safe to make sure they don't log forever.

Changes:

  • Remove defaultChanged and exampleChanged warning types, because they're not useful and I was wrong to create them. When a default changes, you either don't care or you've overridden it. When an example changes, you really never care.
  • Remove the old warnings about changes from many releases ago.

Additions:

  • Add a required "dateAdded" and an optional "warnForDays" property to change entries. They will now only log for an interval of "warnForDays", up to 180 days.
  • Add a test for envVarDefinitions themselves, to ensure they're compliant.

Related Issue

Fixes PWA-502
Fixes underlying problem from #2308

Acceptance

Verification Stakeholders

@brendanfalkowski @revanth0212

Specification

Verification Steps

  1. Check out the branch.
  2. Run a build. Observe that the CHECKOUT_BRAINTREE_TOKEN is gone.
  3. Examine the new tests. Break them experimentally if you want to see what's going on. Or, add new change entries and see what happens.

Screenshots / Screen Captures (if appropriate)

Checklist

  • I have added tests to cover my changes, if necessary.
  • I have updated the documentation accordingly, if necessary.

@PWAStudioBot
Copy link
Contributor

PWAStudioBot commented Jun 7, 2020

Messages
📖

Access a deployed version of this PR here. Make sure to wait for the "pwa-pull-request-deploy" job to complete.

📖 DangerCI Failures related to missing labels/description/linked issues/etc will persist until the next push or next nightly build run (assuming they are fixed).
📖

Associated JIRA tickets: PWA-502.

Generated by 🚫 dangerJS against 5197f77

@devops-pwa-codebuild
Copy link
Collaborator

devops-pwa-codebuild commented Jun 7, 2020

Performance Test Results

The following fails have been reported by WebpageTest. These numbers indicates a possible performance issue with the PR which requires further manual testing to validate.

https://pr-2466.pwa-venia.com : LH Performance Expected 0.85 Actual 0.54, LH Best Practices Expected 1 Actual 0.92
https://pr-2466.pwa-venia.com/venia-tops.html : LH Performance Expected 0.75 Actual 0.36, LH Best Practices Expected 1 Actual 0.92
https://pr-2466.pwa-venia.com/valeria-two-layer-tank.html : LH Performance Expected 0.8 Actual 0.49, LH Accessibility Expected 0.9 Actual 0.89, LH Best Practices Expected 1 Actual 0.92

@revanth0212 revanth0212 changed the base branch from revanth/buildpack_braintree_token_check to develop June 8, 2020 16:07
@m2-community-project m2-community-project bot moved this from Ready for Review to Review in Progress in Pull Request Progress Jun 8, 2020
const buildpackVersion = require('../../package.json').version;

class CompatEnvAdapter {
static isExpired({ dateChanged, warnForDays }) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Quick question JZ. Why did you make this a static method instead of a function outside the class? Not that it would make any difference, just to pick your brain.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's a good question though. Two reasons:

  1. It's a pure function that relies on no instance variables, BUT it's only used by this class
  2. I needed to use it in tests

"reason": "The new environment variables DEV_SERVER_HOST and STAGING_SERVER_HOST now provide the host override functionality for the Docker setup."
}
]
"changes": []
Copy link
Contributor

Choose a reason for hiding this comment

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

Now that we have the EnvAdapter class looking at the expiry date and frequency, how about a sample change for that? Maybe even the brain tree token in question, maybe remind it every 30 days.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's actually not a frequency measure! It's a time duration during which it would warn every time you run the command.

What if we used the unit test to demonstrate that instead of adding a change here that we don't need?

revanth0212
revanth0212 previously approved these changes Jun 8, 2020
Copy link
Contributor

@revanth0212 revanth0212 left a comment

Choose a reason for hiding this comment

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

Awesome JZ. Love the changes. Can we add docs for the newly added keys in changes?

this.UNSET = Symbol('FLAG_FOR_UNSET');
this._actual = actual;
this._stored = new Map();
afterEach(() => this._unmock());
Copy link
Contributor

Choose a reason for hiding this comment

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

Had no idea we can do this, invoking jest helpers inside custom code.

@m2-community-project m2-community-project bot moved this from Review in Progress to Reviewer Approved in Pull Request Progress Jun 10, 2020
@zetlen zetlen added the version: Minor This changeset includes functionality added in a backwards compatible manner. label Jun 11, 2020
@dpatil-magento dpatil-magento merged commit 609c27d into develop Jun 11, 2020
@dpatil-magento dpatil-magento deleted the zetlen/remove-env-warning-spam branch June 11, 2020 18:17
@m2-community-project m2-community-project bot moved this from Reviewer Approved to Done in Pull Request Progress Jun 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg:pwa-buildpack version: Minor This changeset includes functionality added in a backwards compatible manner.
Development

Successfully merging this pull request may close these issues.

None yet

7 participants