feat: 实现纯 Kafka 页面刷新重放交接

This commit is contained in:
root
2026-07-11 05:15:35 +02:00
parent 0714304b20
commit 2cb3d3aaa6
34 changed files with 2547 additions and 97 deletions
@@ -20,6 +20,15 @@ const LIVE_KAFKA_CONTRACT = Object.freeze({
HWLAB_KAFKA_HWLAB_EVENT_GROUP_ID: "hwlab-v03-workbench-live-sse"
});
const UNIDESK_OWNED_REFRESH_REPLAY_ENV = Object.freeze([
"HWLAB_WORKBENCH_KAFKA_REFRESH_REPLAY_ENABLED",
"HWLAB_WORKBENCH_KAFKA_REFRESH_REPLAY_GROUP_PREFIX",
"HWLAB_WORKBENCH_KAFKA_REFRESH_REPLAY_TIMEOUT_MS",
"HWLAB_WORKBENCH_KAFKA_REFRESH_REPLAY_SCAN_LIMIT",
"HWLAB_WORKBENCH_KAFKA_REFRESH_REPLAY_MATCHED_EVENT_LIMIT",
"HWLAB_WORKBENCH_KAFKA_REFRESH_REPLAY_LIVE_BUFFER_LIMIT"
]);
const ISOLATED_DEBUG_CONTRACT = Object.freeze({
HWLAB_WORKBENCH_KAFKA_DEBUG_REPLAY_ENABLED: "true",
HWLAB_KAFKA_HWLAB_DEBUG_EVENT_TOPIC: "hwlab.event.debug.v1",
@@ -41,6 +50,9 @@ test("v03 YAML keeps pure Kafka realtime capabilities independently composable",
for (const [name, expected] of Object.entries(LIVE_KAFKA_CONTRACT)) {
assert.equal(cloudApi.env?.[name], expected, `${name} must preserve the pure Kafka live contract`);
}
for (const name of UNIDESK_OWNED_REFRESH_REPLAY_ENV) {
assert.equal(cloudApi.env?.[name], undefined, `${name} is injected from UniDesk config/hwlab-node-lanes.yaml and must not have a second value in HWLAB deploy.yaml`);
}
for (const [name, expected] of Object.entries(ISOLATED_DEBUG_CONTRACT)) {
assert.equal(cloudApi.env?.[name], expected, `${name} must be independently YAML-owned for debug only`);
}
@@ -48,6 +60,7 @@ test("v03 YAML keeps pure Kafka realtime capabilities independently composable",
assert.equal(cloudApi.env?.HWLAB_SESSION_COOKIE_DOMAIN, undefined, "internal and public origins require host-scoped session cookies");
assert.notEqual(cloudApi.env?.HWLAB_KAFKA_AGENTRUN_EVENT_GROUP_ID, "hwlab-v03-agentrun-event-bridge");
assert.equal(cloudWeb.env?.HWLAB_WORKBENCH_LIVE_KAFKA_SSE_ENABLED, "true");
assert.equal(cloudWeb.env?.HWLAB_WORKBENCH_KAFKA_REFRESH_REPLAY_ENABLED, undefined, "UniDesk renderer owns the Web refresh capability value");
assert.equal(cloudWeb.env?.HWLAB_WORKBENCH_PROJECTION_REALTIME_ENABLED, "false");
assert.equal(cloudWeb.env?.HWLAB_WORKBENCH_KAFKA_DEBUG_REPLAY_ENABLED, "true");
});