Add release headers service, runtime-aware API header handling, and i18n updates for release configuration

- Implement `releaseHeaders.js` to manage release-related HTTP headers.
- Update requests to include runtime-based release headers.
- Extend i18n phrases across multiple locales for release runtime and configuration labels.
- Enhance unit tests for header building and API availability error handling.
This commit is contained in:
Jeppe Bundgaard
2026-05-20 17:52:54 +02:00
parent 130cc2fc10
commit ea8db593c5
43 changed files with 3191 additions and 171 deletions
+25 -6
View File
@@ -3,6 +3,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import {
__resetReleaseTimelineForTests,
__setReleaseTimelineTransportForTests,
buildCurrentReleaseHeaders,
buildReleaseTimelineContext,
configureReleaseRuntime,
flushReleaseTimelineEvents,
@@ -54,15 +55,33 @@ describe("release timeline runtime", () => {
bundle_id: 31,
},
urls: {
frontend_base_url: "https://lb.truckwash.io/canary/frontend/",
api_base_url: "https://lb.truckwash.io/canary/api/",
frontend_base_url: "https://api-v2.truckwash.io/canary/frontend/",
api_base_url: "https://api-v2.truckwash.io/canary/api/",
},
});
expect(releaseRuntimeState.frontendBaseUrl).toBe("https://lb.truckwash.io/canary/frontend");
expect(releaseRuntimeState.apiBaseUrl).toBe("https://lb.truckwash.io/canary/api");
expect(getReleaseRuntimeApiBaseUrl()).toBe("https://lb.truckwash.io/canary/api");
expect(resolveReleaseApiUrl("/orders")).toBe("https://lb.truckwash.io/canary/api/orders");
expect(releaseRuntimeState.frontendBaseUrl).toBe("https://api-v2.truckwash.io/canary/frontend");
expect(releaseRuntimeState.apiBaseUrl).toBe("https://api-v2.truckwash.io/canary/api");
expect(getReleaseRuntimeApiBaseUrl()).toBe("https://api-v2.truckwash.io/canary/api");
expect(resolveReleaseApiUrl("/orders")).toBe("https://api-v2.truckwash.io/canary/api/orders");
});
it("builds release headers from the active runtime state", () => {
configureReleaseRuntime({
trace_id: "trace-headers",
channel: { slug: "internal", name: "Intern" },
versions: {
frontend: { version_label: "frontend-internal", commit_sha: "130cc2fc106a" },
api: { version_label: "api-internal" },
bundle_id: 42,
},
});
expect(buildCurrentReleaseHeaders()).toMatchObject({
"X-Release-Trace": "trace-headers",
"X-Release-Channel": "internal",
"X-Frontend-Version": "130cc2fc106a",
});
});
it("redacts sensitive payload keys recursively", () => {