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

Watch for dvc.yaml changes for manually added stages #3365

Merged
merged 9 commits into from
Mar 1, 2023
Merged

Conversation

sroy3
Copy link
Contributor

@sroy3 sroy3 commented Feb 27, 2023

Screen.Recording.2023-02-27.at.5.35.05.PM.mov

@sroy3 sroy3 added the product PR that affects product label Feb 27, 2023
@sroy3 sroy3 self-assigned this Feb 27, 2023
@sroy3 sroy3 marked this pull request as ready for review February 28, 2023 16:47
public async changeHasConfig(update?: boolean) {
const stages = await this.hasStages()
this.hasValidDvcYaml = stages !== undefined
this.hasConfig = !!stages
Copy link
Member

Choose a reason for hiding this comment

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

[Q] Is there any way that this.hasValidDvcYaml isn't !this.hasStages? Is this.hasValidDvcYaml === !this.hasConfig always true? What values of stages mean that we need both variables? Can we refactor to make it more obvious? (my brain is tiny)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

dvc stage list will return '' if no pipelines were found. It will return an error ('./dvc.yaml' validation failed.) if the dvc.yaml file is broken. the listStages command will return the result, but it has a catch clause that will return undefined.

In other words, hasInvalidDvcYaml = hasStages() === undefined and doesNotHaveConfig = hasStages() === ''.

We cannot test accurately for hasConfig if hasValidDvcYaml is true, but I chose to set it to false because it shows the message at the bottom of the table.

Copy link
Contributor

@julieg18 julieg18 left a comment

Choose a reason for hiding this comment

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

Great work!

}

export const AddStage: React.FC<AddStageProps> = ({ hasValidDvcYaml }) => (
<div className={styles.addConfigButton} data-testid="aaa">
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we name this id to be a more clear name? Though it looks like it isn't being used anywhere 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nice catch It was for quick testing (had a lot of trouble testing the shadow DOM button), but I forgot to remove it after.

@codeclimate
Copy link

codeclimate bot commented Mar 1, 2023

Code Climate has analyzed commit 78866e1 and detected 0 issues on this pull request.

The test coverage on the diff in this pull request is 100.0% (85% is the threshold).

This pull request will bring the total coverage in the repository to 96.0% (0.0% change).

View more on Code Climate.

@sroy3 sroy3 enabled auto-merge (squash) March 1, 2023 14:38
@sroy3 sroy3 merged commit ba4482b into main Mar 1, 2023
@sroy3 sroy3 deleted the watch-dvc-stages branch March 1, 2023 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
product PR that affects product
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants