mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-08-28 05:27:24 +00:00
PR feedback
This commit is contained in:
parent
6b487d6a49
commit
f1de71429f
2 changed files with 4 additions and 27 deletions
|
|
@ -3,16 +3,6 @@ import { ContextProxy } from "../contextProxy"
|
|||
import { logger } from "../../utils/logging"
|
||||
import { GLOBAL_STATE_KEYS, SECRET_KEYS } from "../../shared/globalState"
|
||||
|
||||
// Mock the logger
|
||||
jest.mock("../../utils/logging", () => ({
|
||||
logger: {
|
||||
debug: jest.fn(),
|
||||
info: jest.fn(),
|
||||
warn: jest.fn(),
|
||||
error: jest.fn(),
|
||||
},
|
||||
}))
|
||||
|
||||
// Mock shared/globalState
|
||||
jest.mock("../../shared/globalState", () => ({
|
||||
GLOBAL_STATE_KEYS: ["apiProvider", "apiModelId", "mode"],
|
||||
|
|
@ -121,9 +111,6 @@ describe("ContextProxy", () => {
|
|||
it("should update state directly in original context", async () => {
|
||||
await proxy.updateGlobalState("test-key", "new-value")
|
||||
|
||||
// Should have called logger.debug
|
||||
expect(logger.debug).toHaveBeenCalledWith(expect.stringContaining("updating state for key"))
|
||||
|
||||
// Should have called original context
|
||||
expect(mockGlobalState.update).toHaveBeenCalledWith("test-key", "new-value")
|
||||
|
||||
|
|
@ -148,9 +135,6 @@ describe("ContextProxy", () => {
|
|||
it("should store secret directly in original context", async () => {
|
||||
await proxy.storeSecret("api-key", "new-secret")
|
||||
|
||||
// Should have called logger.debug
|
||||
expect(logger.debug).toHaveBeenCalledWith(expect.stringContaining("storing secret for key"))
|
||||
|
||||
// Should have called original context
|
||||
expect(mockSecrets.store).toHaveBeenCalledWith("api-key", "new-secret")
|
||||
|
||||
|
|
|
|||
|
|
@ -118,7 +118,6 @@ export class ClineProvider implements vscode.WebviewViewProvider {
|
|||
this.mcpHub = undefined
|
||||
this.customModesManager?.dispose()
|
||||
this.outputChannel.appendLine("Disposed all disposables")
|
||||
// Dispose the context proxy to commit any pending changes
|
||||
ClineProvider.activeInstances.delete(this)
|
||||
|
||||
// Unregister from McpServerManager
|
||||
|
|
@ -2081,24 +2080,20 @@ export class ClineProvider implements vscode.WebviewViewProvider {
|
|||
const customModesPromise = this.customModesManager.getCustomModes()
|
||||
|
||||
let idx = 0
|
||||
const secretValuesArray = await Promise.all([
|
||||
...statePromises,
|
||||
...secretPromises,
|
||||
customModesPromise,
|
||||
])
|
||||
const valuePromises = await Promise.all([...statePromises, ...secretPromises, customModesPromise])
|
||||
|
||||
// Populate stateValues and secretValues
|
||||
GLOBAL_STATE_KEYS.forEach((key, _) => {
|
||||
stateValues[key] = secretValuesArray[idx]
|
||||
stateValues[key] = valuePromises[idx]
|
||||
idx = idx + 1
|
||||
})
|
||||
|
||||
SECRET_KEYS.forEach((key, index) => {
|
||||
secretValues[key] = secretValuesArray[idx]
|
||||
secretValues[key] = valuePromises[idx]
|
||||
idx = idx + 1
|
||||
})
|
||||
|
||||
let customModes = secretValuesArray[idx] as ModeConfig[] | undefined
|
||||
let customModes = valuePromises[idx] as ModeConfig[] | undefined
|
||||
|
||||
// Determine apiProvider with the same logic as before
|
||||
let apiProvider: ApiProvider
|
||||
|
|
@ -2219,7 +2214,6 @@ export class ClineProvider implements vscode.WebviewViewProvider {
|
|||
// global
|
||||
|
||||
async updateGlobalState(key: GlobalStateKey, value: any) {
|
||||
this.outputChannel.appendLine(`Updating global state: ${key}`)
|
||||
await this.contextProxy.updateGlobalState(key, value)
|
||||
}
|
||||
|
||||
|
|
@ -2230,7 +2224,6 @@ export class ClineProvider implements vscode.WebviewViewProvider {
|
|||
// secrets
|
||||
|
||||
public async storeSecret(key: SecretKey, value?: string) {
|
||||
this.outputChannel.appendLine(`Storing secret: ${key}`)
|
||||
await this.contextProxy.storeSecret(key, value)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue