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

Cody Ignore: Add an action to override the Cody Ignore policy for testing #1340

Merged
merged 6 commits into from
Apr 24, 2024

Conversation

dominiccooney
Copy link
Contributor

This adds some plumbing for Cody Ignore, and a way to interactively test that locally in IntelliJ without admin access to a Sourcegraph instance.

Part of #1252

Test plan

  • Run agent with Elaborate the agent protocol for Cody Ignore cody#3858
  • Run the plugin with CODY_JETBRAINS_FEATURES=cody.feature.internals-menu=true and open a clone of the sourcegraph/sourcegraph repo
  • On the status bar, Internals, Testing: Cody Ignore
  • Check Override policy for testing
  • Enter URI regex \.go$ . Any repo regex is fine; that setting is currently unused on the extension side. Click OK.
  • Verify that console output includes handling ignore rules changing not yet implemented. This indicates the testing override generated a notification that the rules have changed, through to the stub in the extension.
  • Start a chat
  • In the Enhanced Context Selector, ensure Chat Context is checked. Uncheck any specific repos.
  • Open a Go file, for example cmd/batcheshelper/main.go and highlight some code
  • In chat, ask Cody "what does this do?" There should be no local context and Cody should make something up unrelated to the highlighted code.
  • On the status bar, Internals, Testing: Cody Ignore. Uncheck Override policy for testing. OK. Again verify console output.
  • In chat, hit up and resubmit the same chat message. There should be local context from the open Go file and Cody should comment related to that code.
  • Run the plugin again without CODY_JETBRAINS_FEATURES=cody.feature.internals-menu=true and verify that the Internals menu does not appear on the status bar.

@dominiccooney dominiccooney requested a review from a team April 18, 2024 14:04
Copy link
Contributor

@pkukielka pkukielka left a comment

Choose a reason for hiding this comment

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

LGTM

data class IgnoreForUriParams(val uri: String)

data class IgnoreForUriResponse(
val policy: String // "use" or "ignore"
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not enum?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We tend to just enumerate the string values, but I will look into it in a follow-up. There's no JetBrains side calls to this yet.

@dominiccooney dominiccooney merged commit 0267bb9 into main Apr 24, 2024
6 checks passed
@dominiccooney dominiccooney deleted the dpc/internals-menu branch April 24, 2024 03:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants