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

Add a mapping from revision to branches while using only one exp show call #3980

Merged
merged 26 commits into from
Jun 5, 2023

Conversation

sroy3
Copy link
Contributor

@sroy3 sroy3 commented May 25, 2023

For #1966

Screen.Recording.2023-05-25.at.2.10.59.PM.mov

Named revision might still change (only one is being returned by dvc), but no more shift of commits between branches.

@sroy3 sroy3 added the product PR that affects product label May 25, 2023
@sroy3 sroy3 self-assigned this May 25, 2023
)
expect(experimentsByCommit.get('branchB')).toBeUndefined()
})

it('should add data from git to commits if git log output is provided', () => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This should be a test to recreate but after a call to update not after collectExperiments. I was still at fixing failing tests.

Copy link
Member

Choose a reason for hiding this comment

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

covered by the integration tests/it('should return the expected rows when given the base fixture'

...out,
branch,
commit,
description: formatCommitMessage(commit.message)
Copy link
Member

Choose a reason for hiding this comment

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

[Q] Can I move this upstream into the collect call?

starred: false
}
]
const getIds = (rows: Commit[]) =>
Copy link
Member

Choose a reason for hiding this comment

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

[F] I always run into/get annoyed by this test. It was previously testing more than it needed to. It is not testing only the functionality that it needs to.


return this.notifyChanged(data)
return this.notifyChanged({ currentBranch, expShow, gitLog, order })
Copy link
Member

Choose a reason for hiding this comment

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

[F] By doing the least amount of processing possible here we can update the test fixture(s) with raw data and make sure that everything still works.

extension/src/experiments/data/index.ts Outdated Show resolved Hide resolved
extension/src/data/index.ts Outdated Show resolved Hide resolved
extension/src/experiments/data/index.ts Show resolved Hide resolved
])
})

it('should handle duplicate commits being returned in the data', () => {
Copy link
Member

Choose a reason for hiding this comment

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

[F] This can no longer happen

@@ -449,20 +454,6 @@ export class ExperimentsModel extends ModelWithPersistence {
return this.currentSorts.findIndex(({ path }) => path === pathToRemove)
}

private getCommits() {
Copy link
Member

Choose a reason for hiding this comment

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

[F] This is no longer required because we're not holding duplicates

@@ -30,6 +30,30 @@ export const experimentsWithCommits: Experiment[] = [
},
params: { 'params.yaml': { dropout: 0.122, epochs: 5 } }
},
{
branch: 'main',
id: 'fe2919b',
Copy link
Member

Choose a reason for hiding this comment

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

[F] There are changes to tests and fixtures because I added two more commits to the base fixture.

@@ -169,13 +168,12 @@ export class Experiments extends BaseRepository<TableData> {
return this.data.managedUpdate()
}

public async setState(data: ExpShowOutput) {
public async setState({ expShow, gitLog, rowOrder }: ExperimentsOutput) {
Copy link
Member

Choose a reason for hiding this comment

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

[I] getNumCommits should come out of WebviewMessages and called in ExperimentsData as well.

Copy link
Member

Choose a reason for hiding this comment

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

I've got an item on the board to follow up and do this but will do it next.

@@ -596,7 +575,7 @@ export class Experiments extends BaseRepository<TableData> {
}

return await pickExperiment(
this.experiments.getUniqueList(),
this.experiments.getCombinedList(),
Copy link
Member

Choose a reason for hiding this comment

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

[F] This name had to change as the old name was misleading (data is no longer duplicated)

dvcLiveOnly: boolean,
commitsOutput: string | undefined
expShow: ExpShowOutput,
gitLog: string,
Copy link
Member

Choose a reason for hiding this comment

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

[F] To me it makes more sense to put the gitLog output before dvcLiveOnly because it is more important for the data.


commits.sort((a, b) => (b.Created || '').localeCompare(a.Created || ''))
Copy link
Member

Choose a reason for hiding this comment

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

[F] Doing this means we get commits sorted in chronological order in the tree.

expShow = expShowFixture,
dvcRoot = dvcDemoPath,
gitLog = gitLogFixture,
rowOrder = rowOrderFixture
Copy link
Member

@mattseddon mattseddon Jun 5, 2023

Choose a reason for hiding this comment

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

[I] Used VS Code's Refactor... Convert parameters to destructured object. The number of optional parameters was out of control. Unfortunately, that increases the diff a bit.

plotsDiff: PlotsOutput | undefined = undefined,
expShow = expShowFixtureWithoutErrors
) => {
export const buildPlots = async ({
Copy link
Member

Choose a reason for hiding this comment

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

[F] Did the same refactoring for this as it also has too many inputs now.

@@ -36,3 +36,4 @@ const MockComponentWithChildren: React.FC<PropsWithChildren> = ({
export const VSCodePanels = MockComponentWithChildren
export const VSCodePanelTab = MockComponentWithChildren
export const VSCodePanelView = MockComponentWithChildren
export const VSCodeTag = MockComponentWithChildren
Copy link
Member

Choose a reason for hiding this comment

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

[F] Adding tags to the rows fixture meant that this was triggered and broke all of the jest tests.

@mattseddon mattseddon marked this pull request as ready for review June 5, 2023 02:16
@mattseddon mattseddon requested a review from julieg18 as a code owner June 5, 2023 02:16
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!

public async getCommitMessages(
cwd: string,
revision: string,
revisions: string
Copy link
Contributor

Choose a reason for hiding this comment

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

Minor: Should the revisions be a number instead of a string then we change the type to string in the getOptions call below?

@mattseddon mattseddon enabled auto-merge (squash) June 5, 2023 21:27
@codeclimate
Copy link

codeclimate bot commented Jun 5, 2023

Code Climate has analyzed commit 9002047 and detected 2 issues on this pull request.

Here's the issue category breakdown:

Category Count
Duplication 2

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

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

View more on Code Climate.

@mattseddon mattseddon merged commit a271e2d into main Jun 5, 2023
@mattseddon mattseddon deleted the map-revisions branch June 5, 2023 22:54
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