-
Notifications
You must be signed in to change notification settings - Fork 107
Add diff log to env:pull command #2984
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
base: main
Are you sure you want to change the base?
Add diff log to env:pull command #2984
Conversation
Subscribed to pull request
Generated by CodeMention |
Size Change: +706 B (0%) Total Size: 53.5 MB
|
dbb4bc6
to
cf91e66
Compare
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.
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
35f6856
to
046f6bc
Compare
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.
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
Comments suppressed due to low confidence (1)
packages/eas-cli/src/commands/env/pull.ts:64
- Consider adding error handling around the fs.readFile call to gracefully handle scenarios where the file exists but cannot be read.
const fileContent = await fs.readFile(currentEnvValue, 'base64');
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2984 +/- ##
==========================================
+ Coverage 52.36% 52.60% +0.24%
==========================================
Files 596 596
Lines 23698 23733 +35
Branches 4714 4726 +12
==========================================
+ Hits 12407 12482 +75
+ Misses 11256 11216 -40
Partials 35 35 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
newVariable: EnvironmentVariableWithFileContent | ||
): Promise<boolean> { | ||
if (newVariable.visibility === EnvironmentVariableVisibility.Secret) { | ||
return true; |
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.
Should this be undefined
? Do we know values of secret variables? Maybe we should never compare them (and tell the user we can't)?
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.
Secret variables are a special case: if they are set in the .env var, we keep the current local value (so they are equal), and if it is a new variable, we inform user that they should set it manually (line 185 and 195).
return fileContent === newVariable.valueWithFileContent; | ||
} | ||
|
||
return currentEnvValue === newVariable.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.
Can a variable type change? In which case just checking the value would no longer be sufficient?
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.
If you change a variable type, then values would also necessarly change, yes? if you change a string
variable to a file
, then you need to upload a new value.
|
||
const diffLog = []; | ||
|
||
for (const variableName of allVariableNames) { |
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.
Could we extract this to a testable function and add tests? Shouldn't be too hard.
if (newVariable) { | ||
if (Object.hasOwn(currentEnvLocal, variableName)) { | ||
if (await this.isVariableEqualAsync(currentEnvLocal[variableName], newVariable)) { | ||
diffLog.push(chalk.black(` ${variableName}`)); |
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.
Is black
going to be white in dark mode terminals? Should we just do diffLog.push(\
${variableName}`)`?
046f6bc
to
16bec66
Compare
✅ Thank you for adding the changelog entry! |
Why
ENG-15251: Analyse EnvVar UI feedback from user
Users should be aware of the changes that the command
env:pull
performs: new, changed, and deleted variables should be clearly visible.How
Test Plan
eas env:pull --environment ENVIRONMENT
- all variables should be displayed in normal text, without prefixesVerify for plain text, sensitive, secret, text and file variables.