Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

Create a shared Cody Ignore dataset#61968

Merged
taras-yemets merged 39 commits into
mainfrom
ty/cody-ignore-shared-dataset
May 9, 2024
Merged

Create a shared Cody Ignore dataset#61968
taras-yemets merged 39 commits into
mainfrom
ty/cody-ignore-shared-dataset

Conversation

@taras-yemets

@taras-yemets taras-yemets commented Apr 17, 2024

Copy link
Copy Markdown
Contributor

To ensure consistency in how Cody context filters are handled across
both the server and clients, this PR:

  • moves existing enterprise Cody context filter test cases to a separate JSON file
  • creates NPM package exporting a JSON file containing the copy of the mentioned test cases
    • dataset file is generated on the prepublishOnly step and is ignored by Git
    • package is excluded from the workspace to ensure the published version of the test dataset is used
  • refactors Cody Web tests to consume test cases from the NPM package.

More context in this thread.

TODO:

  • Release 1.0.0 version after PR is approved

Follow-up work:

  • Add GitHub action commenting on the PR changing the original test dataset suggesting to publish a new package version

Test plan

  • CI

@cla-bot cla-bot Bot added the cla-signed label Apr 17, 2024

@keegancsmith keegancsmith left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Convention in go to put test data in a sub directory called testdata.

From slack DM about motivation for this change:

... publish npm package with fixtures ...

I'd consider removing this step and instead just directly fetching the test fixture from github. It has a very simple API to download a file? You can then fetch the file by the sourcegraph version tag.

@taras-yemets

Copy link
Copy Markdown
Contributor Author

Thank you, @keegancsmith!

... publish npm package with fixtures ...

I'd consider removing this step and instead just directly fetching the test fixture from github. It has a very simple API to download a file? You can then fetch the file by the sourcegraph version tag.

Using this approach, if we conduct tests on this shared dataset in Cody clients' CI, we might encounter situations where the CI fails due to unrelated code changes. I previously suggested this approach, but it was not supported with it.

@keegancsmith

Copy link
Copy Markdown
Member

I'd consider removing this step and instead just directly fetching the test fixture from github. It has a very simple API to download a file? You can then fetch the file by the sourcegraph version tag.

Using this approach, if we conduct tests on this shared dataset in Cody clients' CI, we might encounter situations where the CI fails due to unrelated code changes. I previously suggested this approach, but it was not supported with it.

In that PR you mention you want to use HEAD. I agree that this is not correct, you do not want outside changes to affect your CI. You should use commits or even better sourcegraph version tags. In that case it won't have the issue dominik raises.

The point about NPM and renovate is a good one. However, I would double check that we have automation to publish packages from sourcegraph automatically. I imagine this is quite complicated but I may be mistaken. So the only real reason to use NPM would then be renovate bot picking this up automatically in client repos once you manually publish. This seems reasonable.

My gut tells me that the approach you took is the one with less moving parts. Things like automatic updates don't seem that important to me, since changing things like the ignore file format is a big deal, and will involve manual work in the respective client repos.

So I would just double check again, since the main objection was sound about using an mutable fixture source instead of immutable.

@taras-yemets

Copy link
Copy Markdown
Contributor Author

In that PR you mention you want to use HEAD. I agree that this is not correct, you do not want outside changes to affect your CI. You should use commits or even better sourcegraph version tags.

Both in PR and in Slack I suggested using tags (maybe I should have been more explicit about it). My understanding is that the packaging approach is preferable for the clients team.

I would double check that we have automation to publish packages from sourcegraph automatically. I imagine this is quite complicated

That's my feeling too. At the current stage, we are considering publishing new versions manually.

@taras-yemets

taras-yemets commented May 6, 2024

Copy link
Copy Markdown
Contributor Author

@dominiccooney, @valerybugakov, @philipp-spiess, can you please give some early feedback on the approach (in particular, package structure and its usage)? Would it be convenient to integrate with Cody clients codebases in your opinion?

@valerybugakov valerybugakov self-requested a review May 7, 2024 01:58

@valerybugakov valerybugakov left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The approach looks good to me. Left a couple of questions inline.

Comment thread client/cody-context-filters-test-dataset/dataset.json Outdated
Comment thread client/cody-context-filters-test-dataset/dataset.json Outdated
@taras-yemets taras-yemets marked this pull request as ready for review May 8, 2024 11:25

@dominiccooney dominiccooney left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Thank you!

@valerybugakov valerybugakov left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Beautiful! Thank you 🙌

"directory": "client/cody-context-filters-test-dataset"
},
"scripts": {
"prepublishOnly": "node scripts/generate.js"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

🧠

@taras-yemets taras-yemets enabled auto-merge (squash) May 9, 2024 07:35
@taras-yemets taras-yemets disabled auto-merge May 9, 2024 13:05
@taras-yemets taras-yemets enabled auto-merge (squash) May 9, 2024 13:13
@taras-yemets taras-yemets merged commit 23a2cea into main May 9, 2024
@taras-yemets taras-yemets deleted the ty/cody-ignore-shared-dataset branch May 9, 2024 13:18
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants