Skip to content
This repository was archived by the owner on Aug 1, 2025. It is now read-only.

Commit 3a69a5b

Browse files
mkondratekumpox
andauthored
Fix auto-edit enrolment issue caused by config propagation bug (#8140)
There was a bug in `affectsConfiguration`. We are looking for a key in the section (not the other way). This PR fixes that. It likely fixes some other config propagation / sync issues. In particular, it makes auto-edits available just after the enrolment. ## Test plan Tested manually. Sadly, auto-edit case needs some code tweaks. You can checkout my other branch based on this one that provides the necessary functionalities: [[DO NOT MERGE] Auto-edit enrol testing](https://github.com/sourcegraph/cody/pull/8141#top) <!-- Required. See https://docs-legacy.sourcegraph.com/dev/background-information/testing_principles. --> --------- Co-authored-by: Tom Ross <tom@umpox.com>
1 parent dc5b6d3 commit 3a69a5b

5 files changed

Lines changed: 23 additions & 78 deletions

File tree

agent/recordings/autocomplete_2136217965/recording.har.yaml

Lines changed: 14 additions & 60 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

agent/src/__snapshots__/autocomplete.test.ts.snap

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,6 @@
22

33
exports[`Autocomplete > autocomplete/execute multiline (non-empty result) 1`] = `
44
[
5-
"let swapped: boolean
6-
do {
7-
swapped = false
8-
for (let i = 0; i < arr.length - 1; i++) {
9-
if (arr[i] > arr[i + 1]) {
10-
const temp = arr[i]
11-
arr[i] = arr[i + 1]
12-
arr[i + 1] = temp
13-
swapped = true
14-
}
15-
}
16-
} while (swapped)
17-
return arr",
5+
"return arr;",
186
]
197
`;

agent/src/enterprise-s2.test.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,12 @@ describe('Enterprise - S2 (close main branch)', { timeout: 5000 }, () => {
112112

113113
// The site config `cody.contextFilters` value on sourcegraph.sourcegraph.com instance
114114
// should include `sourcegraph/cody` repo for this test to pass.
115-
it('autocomplete/execute (with Cody Ignore filters)', async () => {
115+
// Note: This test has been skipped as relying on live site config for tests causes problems
116+
// later on when that site config has changed and the tests have not been run for a while.
117+
// This issue is exacerbated by the fact that the changes to site config do not trigger a
118+
// re-run of the tests, so the issue is not caught until the next time the recordings
119+
// are updated.
120+
it.skip('autocomplete/execute (with Cody Ignore filters)', async () => {
116121
// Documents to be used as context sources.
117122
await s2EnterpriseClient.openFile(animalUri)
118123
await s2EnterpriseClient.openFile(squirrelUri)

agent/src/vscode-shim.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ const configuration = new AgentWorkspaceConfiguration(
180180
async (section, value) => {
181181
if (onDidChangeConfiguration) {
182182
await onDidChangeConfiguration.cody_fireAsync({
183-
affectsConfiguration: key => key.includes(section),
183+
affectsConfiguration: prefix => section.includes(prefix),
184184
})
185185
}
186186

vscode/src/autoedits/autoedit-onboarding.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import {
99
telemetryRecorder,
1010
} from '@sourcegraph/cody-shared'
1111
import * as vscode from 'vscode'
12-
import { isRunningInsideAgent } from '../jsonrpc/isRunningInsideAgent'
1312
import { localStorage } from '../services/LocalStorageProvider'
1413
import { isUserEligibleForAutoeditsFeature } from './create-autoedits-provider'
1514

@@ -39,9 +38,8 @@ export class AutoEditBetaOnboarding implements vscode.Disposable {
3938
this.markUserAsAutoEditBetaEnrolled()
4039
this.writeAutoeditNotificationEvent()
4140

42-
const clientsSuffix = isRunningInsideAgent() ? 'Restart your IDE to apply the changes. ' : ''
4341
const selection = await vscode.window.showInformationMessage(
44-
`You have been enrolled to Cody Auto-edit! ${clientsSuffix}Cody will intelligently suggest next edits as you navigate the codebase.`,
42+
'You have been enrolled to Cody Auto-edit! Cody will intelligently suggest next edits as you navigate the codebase.',
4543
switchToAutocompleteText
4644
)
4745

0 commit comments

Comments
 (0)