@akanjs/devkit 3.3.0-rc.70 → 3.3.0-rc.71
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/akanConfig/akanConfig.test.ts +38 -0
- package/akanConfig/dockerImage.ts +25 -4
- package/app/applicationBuildRunner.test.ts +108 -39
- package/app/applicationBuildRunner.ts +45 -40
- package/codeAgent/skills/akan-runtime/SKILL.md +2 -2
- package/integration/devResourceProbe.ts +14 -0
- package/integration/renderAdmissionSoak.ts +6 -0
- package/integration/ssrMemoryProbe.ts +5 -0
- package/mobile/nativeApp.test.ts +6 -0
- package/mobile/nativeApp.ts +8 -3
- package/mobile/serverBundleSecrets.ts +1 -1
- package/package.json +3 -3
- package/transforms/secretEnvDeclaration.test.ts +4 -1
- package/transforms/secretEnvDeclaration.ts +9 -3
- package/transforms/secretEnvFile.ts +1 -1
- package/transforms/secretEnvSource.test.ts +11 -7
- package/transforms/secretEnvSource.ts +44 -13
- package/transforms/serverEnvPlugin.test.ts +116 -0
- package/transforms/serverEnvPlugin.ts +84 -4
- package/transforms/serverEnvProfile.ts +7 -3
- package/transforms/serverEnvSecrets.test.ts +20 -44
|
@@ -32,11 +32,7 @@ interface Built {
|
|
|
32
32
|
text: string;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
const build = async (
|
|
36
|
-
root: string,
|
|
37
|
-
secrets?: "read" | "inline",
|
|
38
|
-
{ mainExtra = "", overSwitch = false } = {},
|
|
39
|
-
): Promise<Built> => {
|
|
35
|
+
const build = async (root: string, secrets?: "read", { mainExtra = "", overSwitch = false } = {}): Promise<Built> => {
|
|
40
36
|
const { appDir, envDir } = await writeSecretEnvFixture(root, { mainExtra });
|
|
41
37
|
if (overSwitch)
|
|
42
38
|
await writeText(path.join(envDir, "env.server.ts"), await Bun.file(path.join(envDir, "env.server.main.ts")).text());
|
|
@@ -110,29 +106,30 @@ describe("createServerEnvPlugin for an image", () => {
|
|
|
110
106
|
});
|
|
111
107
|
});
|
|
112
108
|
|
|
113
|
-
test("the developer's own variable still outranks the one the build reads", async () => {
|
|
109
|
+
test("the developer's own variable still outranks the one the build reads, and stands in for it at boot", async () => {
|
|
114
110
|
const built = await build(await makeTempRoot(), "read");
|
|
115
111
|
const { list, values } = await declare(built);
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
DATABASE_URL: "postgres://own.example.test/app",
|
|
120
|
-
});
|
|
112
|
+
expect(list).toContain(",POSTGRES_URL|DATABASE_URL");
|
|
113
|
+
const own = { DATABASE_URL: "postgres://own.example.test/app" };
|
|
114
|
+
const booted = boot(built.file, { AKAN_ENV_NAMES: list, ...values, ...own });
|
|
121
115
|
expect(booted.env).toMatchObject({ database: { postgres: { url: "postgres://own.example.test/app" } } });
|
|
116
|
+
const { POSTGRES_URL: _url, ...set } = values;
|
|
117
|
+
const instead = boot(built.file, { AKAN_ENV_NAMES: list, ...set, ...own });
|
|
118
|
+
expect({ exitCode: instead.exitCode, warnings: instead.warnings }).toEqual({ exitCode: 0, warnings: [] });
|
|
119
|
+
expect(instead.env).toMatchObject({ database: { postgres: { url: "postgres://own.example.test/app" } } });
|
|
122
120
|
});
|
|
123
121
|
|
|
124
|
-
test("started without its variables, it
|
|
122
|
+
test("started without its variables, it exits non-zero, naming each one and no value", async () => {
|
|
125
123
|
const built = await build(await makeTempRoot(), "read");
|
|
126
124
|
const { list, values } = await declare(built);
|
|
127
125
|
const { MAILER__AUTH__PASS: _pass, DISCORD__TOKENS: _tokens, ...set } = values;
|
|
128
126
|
const booted = boot(built.file, { AKAN_ENV_NAMES: list, ...set });
|
|
129
|
-
expect(booted.exitCode).toBe(0);
|
|
130
|
-
expect(booted.
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
expect((booted.
|
|
135
|
-
expect(booted.env?.discord).not.toHaveProperty("tokens");
|
|
127
|
+
expect(booted.exitCode).not.toBe(0);
|
|
128
|
+
expect(booted.env).toBeNull();
|
|
129
|
+
expect(booted.warnings.join("\n")).toContain(
|
|
130
|
+
"2 secret env values this server reads from its process env are not set, so it does not start: MAILER__AUTH__PASS, DISCORD__TOKENS. Its build left the values out of the image. Set them in the deployment's environment; `akan secret-env <app> --env main` lists every name and writes the values from the env file.",
|
|
131
|
+
);
|
|
132
|
+
expect(holdsSentinel(booted.warnings.join("\n"))).toBe(false);
|
|
136
133
|
});
|
|
137
134
|
|
|
138
135
|
test("after a key is renamed in the env file, a deployment still setting the old variable is told the new name", async () => {
|
|
@@ -146,32 +143,11 @@ describe("createServerEnvPlugin for an image", () => {
|
|
|
146
143
|
});
|
|
147
144
|
const { list } = await declare(renamed);
|
|
148
145
|
const booted = boot(renamed.file, { AKAN_ENV_NAMES: list, ...old.values });
|
|
149
|
-
expect(booted.
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
expect(booted.env?.llm).toEqual({});
|
|
153
|
-
});
|
|
154
|
-
|
|
155
|
-
test("an --inline-secrets build keeps the values as what an unset variable falls back to, and a set one wins", async () => {
|
|
156
|
-
const built = await build(await makeTempRoot(), "inline");
|
|
157
|
-
expect(built.text).toContain(secretEnvSentinels.jwt);
|
|
158
|
-
const { list } = await declare(built);
|
|
159
|
-
const fallback = boot(built.file, { AKAN_ENV_NAMES: list, AKAN_ENV_FALLBACK: "image" });
|
|
160
|
-
expect(fallback.env).toEqual((await evaluated(built)) as { [key: string]: unknown });
|
|
161
|
-
expect(fallback.warnings).toHaveLength(1);
|
|
162
|
-
expect(fallback.warnings[0]).toStartWith(
|
|
163
|
-
"10 secret env values this server declares are not set, so it uses the values built into this image (akan build --inline-secrets): JWT_SECRET, ",
|
|
146
|
+
expect(booted.exitCode).not.toBe(0);
|
|
147
|
+
expect(booted.warnings.join("\n")).toContain(
|
|
148
|
+
"1 secret env value this server reads from its process env is not set, so it does not start: LLM__ACCESS_KEY.",
|
|
164
149
|
);
|
|
165
|
-
|
|
166
|
-
AKAN_ENV_NAMES: list,
|
|
167
|
-
AKAN_ENV_FALLBACK: "image",
|
|
168
|
-
JWT_SECRET: "set-by-the-deployment",
|
|
169
|
-
DISCORD__TOKENS: '["set-by-the-deployment"]',
|
|
170
|
-
});
|
|
171
|
-
expect(overridden.env).toMatchObject({
|
|
172
|
-
security: { jwtSecret: "set-by-the-deployment", sso: { google: { clientSecret: secretEnvSentinels.google } } },
|
|
173
|
-
discord: { tokens: ["set-by-the-deployment"], webhook: secretEnvSentinels.webhook },
|
|
174
|
-
});
|
|
150
|
+
expect(holdsSentinel(booted.warnings.join("\n"))).toBe(false);
|
|
175
151
|
});
|
|
176
152
|
|
|
177
153
|
test("the env file a pipeline copies over the switch is read the same way", async () => {
|