fix e2e tests by not calling platform on local mode
This commit is contained in:
parent
81a4a5152d
commit
7c1f543891
8 changed files with 41 additions and 33 deletions
|
|
@ -7,7 +7,7 @@ import {
|
|||
import { IDE } from "../..";
|
||||
import { ControlPlaneClient } from "../../control-plane/client";
|
||||
|
||||
export function clientRenderHelper(
|
||||
export async function clientRenderHelper(
|
||||
unrolledAssistant: string,
|
||||
ide: IDE,
|
||||
controlPlaneClient: ControlPlaneClient,
|
||||
|
|
@ -31,5 +31,10 @@ export function clientRenderHelper(
|
|||
resolveFQSNs: controlPlaneClient.resolveFQSNs.bind(controlPlaneClient),
|
||||
};
|
||||
|
||||
return clientRender(unrolledAssistant, ideSecretStore, platformClient);
|
||||
const userId = await controlPlaneClient.userId;
|
||||
return await clientRender(
|
||||
unrolledAssistant,
|
||||
ideSecretStore,
|
||||
userId ? platformClient : undefined,
|
||||
);
|
||||
}
|
||||
|
|
|
|||
8
core/package-lock.json
generated
8
core/package-lock.json
generated
|
|
@ -13,7 +13,7 @@
|
|||
"@aws-sdk/client-sagemaker-runtime": "^3.621.0",
|
||||
"@aws-sdk/credential-providers": "^3.620.1",
|
||||
"@continuedev/config-types": "^1.0.13",
|
||||
"@continuedev/config-yaml": "^1.0.15",
|
||||
"@continuedev/config-yaml": "^1.0.16",
|
||||
"@continuedev/fetch": "^1.0.4",
|
||||
"@continuedev/llm-info": "^1.0.2",
|
||||
"@continuedev/openai-adapters": "^1.0.10",
|
||||
|
|
@ -3038,9 +3038,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@continuedev/config-yaml": {
|
||||
"version": "1.0.15",
|
||||
"resolved": "https://registry.npmjs.org/@continuedev/config-yaml/-/config-yaml-1.0.15.tgz",
|
||||
"integrity": "sha512-00c1pz+FqAVEWLo8t71OJzm1KBAAJCXqIjd917Vy8lr7xO0Eoj42lo2GFlVRnqQ0hQvhFQ0s9onHhRag/phHZA==",
|
||||
"version": "1.0.16",
|
||||
"resolved": "https://registry.npmjs.org/@continuedev/config-yaml/-/config-yaml-1.0.16.tgz",
|
||||
"integrity": "sha512-r3dzTvL8aQ5RrzM+FX6fF+U12/crU4wpPXgDcDloSsxiOQfu3k/shLCbNzFPW57XhLUQAmUJYSZsJbIvYrNPNA==",
|
||||
"dependencies": {
|
||||
"@continuedev/config-types": "^1.0.14",
|
||||
"yaml": "^2.6.1",
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@
|
|||
"@aws-sdk/client-sagemaker-runtime": "^3.621.0",
|
||||
"@aws-sdk/credential-providers": "^3.620.1",
|
||||
"@continuedev/config-types": "^1.0.13",
|
||||
"@continuedev/config-yaml": "^1.0.15",
|
||||
"@continuedev/config-yaml": "^1.0.16",
|
||||
"@continuedev/fetch": "^1.0.4",
|
||||
"@continuedev/llm-info": "^1.0.2",
|
||||
"@continuedev/openai-adapters": "^1.0.10",
|
||||
|
|
|
|||
2
extensions/vscode/package-lock.json
generated
2
extensions/vscode/package-lock.json
generated
|
|
@ -106,7 +106,7 @@
|
|||
"@aws-sdk/client-sagemaker-runtime": "^3.621.0",
|
||||
"@aws-sdk/credential-providers": "^3.620.1",
|
||||
"@continuedev/config-types": "^1.0.13",
|
||||
"@continuedev/config-yaml": "^1.0.15",
|
||||
"@continuedev/config-yaml": "^1.0.16",
|
||||
"@continuedev/fetch": "^1.0.4",
|
||||
"@continuedev/llm-info": "^1.0.2",
|
||||
"@continuedev/openai-adapters": "^1.0.10",
|
||||
|
|
|
|||
2
gui/package-lock.json
generated
2
gui/package-lock.json
generated
|
|
@ -108,7 +108,7 @@
|
|||
"@aws-sdk/client-sagemaker-runtime": "^3.621.0",
|
||||
"@aws-sdk/credential-providers": "^3.620.1",
|
||||
"@continuedev/config-types": "^1.0.13",
|
||||
"@continuedev/config-yaml": "^1.0.15",
|
||||
"@continuedev/config-yaml": "^1.0.16",
|
||||
"@continuedev/fetch": "^1.0.4",
|
||||
"@continuedev/llm-info": "^1.0.2",
|
||||
"@continuedev/openai-adapters": "^1.0.10",
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ function FilenameLink({ rif }: FilenameLinkProps) {
|
|||
);
|
||||
relPathOrBasename = relativePathOrBasename;
|
||||
} catch (e) {
|
||||
return getUriPathBasename(rif.filepath);
|
||||
return <span>{getUriPathBasename(rif.filepath)}</span>;
|
||||
}
|
||||
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@continuedev/config-yaml",
|
||||
"version": "1.0.15",
|
||||
"version": "1.0.16",
|
||||
"description": "",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ import {
|
|||
export async function clientRender(
|
||||
unrolledConfigContent: string,
|
||||
secretStore: SecretStore,
|
||||
platformClient: PlatformClient,
|
||||
platformClient?: PlatformClient,
|
||||
): Promise<ConfigYaml> {
|
||||
// 1. First we need to get a list of all the FQSNs that are required to render the config
|
||||
const secrets = getTemplateVariables(unrolledConfigContent);
|
||||
|
|
@ -34,31 +34,34 @@ export async function clientRender(
|
|||
}
|
||||
}
|
||||
|
||||
// 3. For any secrets not found, we send the FQSNs to the Continue Platform at the `/ide/sync-secrets` endpoint. This endpoint replies for each of the FQSNs with the following information (`SecretResult`): `foundAt`: tells which secret store it was found in (this is “user”, “org”, “package” or null if not found anywhere). If it’s found in an org or a package, it tells us the `secretLocation`, which is either just an org slug, or is a full org/package slug. If it’s found in “user” secrets, we send back the `value`. Full definition of `SecretResult` at [2]. The method of resolving an FQSN to a `SecretResult` is detailed at [3]
|
||||
const secretResults = await platformClient.resolveFQSNs(unresolvedFQSNs);
|
||||
// Don't use platform client in local mode
|
||||
if (platformClient) {
|
||||
// 3. For any secrets not found, we send the FQSNs to the Continue Platform at the `/ide/sync-secrets` endpoint. This endpoint replies for each of the FQSNs with the following information (`SecretResult`): `foundAt`: tells which secret store it was found in (this is “user”, “org”, “package” or null if not found anywhere). If it’s found in an org or a package, it tells us the `secretLocation`, which is either just an org slug, or is a full org/package slug. If it’s found in “user” secrets, we send back the `value`. Full definition of `SecretResult` at [2]. The method of resolving an FQSN to a `SecretResult` is detailed at [3]
|
||||
const secretResults = await platformClient.resolveFQSNs(unresolvedFQSNs);
|
||||
|
||||
// 4. (back to the client) Any “user” secrets that were returned back are added to the local secret store so we don’t have to request them again
|
||||
for (const secretResult of secretResults) {
|
||||
if (!secretResult) {
|
||||
continue;
|
||||
}
|
||||
// 4. (back to the client) Any “user” secrets that were returned back are added to the local secret store so we don’t have to request them again
|
||||
for (const secretResult of secretResults) {
|
||||
if (!secretResult) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!secretResult.found) {
|
||||
// When a secret isn't found anywhere, we keep it templated as just the secret name
|
||||
// in case it can be found in the on-prem proxy's env
|
||||
secretsTemplateData["secrets." + encodeFQSN(secretResult.fqsn)] =
|
||||
`\${{ secrets.${secretResult.fqsn.secretName} }}`;
|
||||
continue;
|
||||
}
|
||||
|
||||
if ("value" in secretResult) {
|
||||
secretStore.set(secretResult.fqsn.secretName, secretResult.value);
|
||||
}
|
||||
|
||||
if (!secretResult.found) {
|
||||
// When a secret isn't found anywhere, we keep it templated as just the secret name
|
||||
// in case it can be found in the on-prem proxy's env
|
||||
secretsTemplateData["secrets." + encodeFQSN(secretResult.fqsn)] =
|
||||
`\${{ secrets.${secretResult.fqsn.secretName} }}`;
|
||||
continue;
|
||||
"value" in secretResult
|
||||
? secretResult.value
|
||||
: `\${{ secrets.${encodeSecretLocation(secretResult.secretLocation)} }}`;
|
||||
}
|
||||
|
||||
if ("value" in secretResult) {
|
||||
secretStore.set(secretResult.fqsn.secretName, secretResult.value);
|
||||
}
|
||||
|
||||
secretsTemplateData["secrets." + encodeFQSN(secretResult.fqsn)] =
|
||||
"value" in secretResult
|
||||
? secretResult.value
|
||||
: `\${{ secrets.${encodeSecretLocation(secretResult.secretLocation)} }}`;
|
||||
}
|
||||
|
||||
// 5. User secrets are rendered in place of the template variable. Others remain templated, but replaced with the specific location where they are to be found (`${{ secrets.<secretLocation> }}` instead of `${{ secrets.<FQSN> }}`)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue