fix(webui): read usage deployment id from EVOSCIENTIST_USAGE_DEPLOYMENT_ID

Matches the backend split: usage attribution no longer shares
EVOSCIENTIST_DEPLOYMENT_ID with workspace scope partitioning.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
m4
2026-07-30 22:11:31 +08:00
parent fbf88fbf8a
commit c8e8305107
4 changed files with 8 additions and 3 deletions
+5
View File
@@ -22,6 +22,11 @@ EVOSCIENTIST_WORKSPACE_DIR=
# when the backend was started manually (no deploy sidecar); otherwise the # when the backend was started manually (no deploy sidecar); otherwise the
# sidecar value wins. Defaults to a uuid derived from the workspace root. # sidecar value wins. Defaults to a uuid derived from the workspace root.
EVOSCIENTIST_DEPLOYMENT_ID= EVOSCIENTIST_DEPLOYMENT_ID=
# Usage-attribution deployment id, matching the backend's
# EVOSCIENTIST_USAGE_DEPLOYMENT_ID (stored in <data-dir>/deployment-id). This is
# intentionally separate from the scope deployment id above so the usage
# identity cannot repartition workspace scopes.
EVOSCIENTIST_USAGE_DEPLOYMENT_ID=
# Optional for local processes running as the same OS user: both sides share # Optional for local processes running as the same OS user: both sides share
# ~/.config/evoscientist/provider-admin-token automatically. Set this explicitly # ~/.config/evoscientist/provider-admin-token automatically. Set this explicitly
# when the WebUI and backend run on different hosts, users, or containers. # when the WebUI and backend run on different hosts, users, or containers.
+1 -1
View File
@@ -8,7 +8,7 @@ vi.mock("server-only", () => ({}));
const dataDir = fs.mkdtempSync(path.join(os.tmpdir(), "evosci-usage-routes-")); const dataDir = fs.mkdtempSync(path.join(os.tmpdir(), "evosci-usage-routes-"));
process.env.EVOSCIENTIST_DATA_DIR = dataDir; process.env.EVOSCIENTIST_DATA_DIR = dataDir;
process.env.EVOSCIENTIST_USAGE_SINK_TOKEN = "route-test-token"; process.env.EVOSCIENTIST_USAGE_SINK_TOKEN = "route-test-token";
process.env.EVOSCIENTIST_DEPLOYMENT_ID = "11111111-1111-4111-8111-111111111111"; process.env.EVOSCIENTIST_USAGE_DEPLOYMENT_ID = "11111111-1111-4111-8111-111111111111";
process.env.EVOSCIENTIST_WORKSPACE_ID = "ws1_fixture"; process.env.EVOSCIENTIST_WORKSPACE_ID = "ws1_fixture";
const capabilities = await import("./capabilities/route"); const capabilities = await import("./capabilities/route");
+1 -1
View File
@@ -8,7 +8,7 @@ vi.mock("server-only", () => ({}));
const dataDir = fs.mkdtempSync(path.join(os.tmpdir(), "evosci-usage-store-")); const dataDir = fs.mkdtempSync(path.join(os.tmpdir(), "evosci-usage-store-"));
process.env.EVOSCIENTIST_DATA_DIR = dataDir; process.env.EVOSCIENTIST_DATA_DIR = dataDir;
process.env.EVOSCIENTIST_DEPLOYMENT_ID = "11111111-1111-4111-8111-111111111111"; process.env.EVOSCIENTIST_USAGE_DEPLOYMENT_ID = "11111111-1111-4111-8111-111111111111";
process.env.EVOSCIENTIST_WORKSPACE_ID = "ws1_fixture"; process.env.EVOSCIENTIST_WORKSPACE_ID = "ws1_fixture";
const store = await import("./usageStore"); const store = await import("./usageStore");
+1 -1
View File
@@ -574,7 +574,7 @@ export function usageStatus(filters: URLSearchParams): UsageStatusResult {
const db = usageDb(); const db = usageDb();
const statusFilters = new URLSearchParams(); const statusFilters = new URLSearchParams();
for (const [key, environment] of [ for (const [key, environment] of [
["deployment_id", "EVOSCIENTIST_DEPLOYMENT_ID"], ["deployment_id", "EVOSCIENTIST_USAGE_DEPLOYMENT_ID"],
["workspace_id", "EVOSCIENTIST_WORKSPACE_ID"], ["workspace_id", "EVOSCIENTIST_WORKSPACE_ID"],
] as const) { ] as const) {
const value = filters.get(key) ?? process.env[environment]?.trim(); const value = filters.get(key) ?? process.env[environment]?.trim();