feat: expand graph lifecycle and data platform

This commit is contained in:
xuelong committed 2026-08-24 01:07:29 -07:00
1 parent 00af885b1a
commit 15368f2779
50 files changed
+17461 -1040

No files matched your search

@@ -0,0 +1,41 @@
import assert from "node:assert/strict";
import test from "node:test";
import { SchemaRequestGuard } from "../src/panels/modeling/schemaRequestGuard.ts";
const projectA = {
tenantId: "tenant-a",
projectId: "project-a",
graphName: "graph-a",
};
const projectB = {
tenantId: "tenant-b",
projectId: "project-b",
graphName: "graph-b",
};
test("a response from project A is stale as soon as project B starts loading", () => {
const guard = new SchemaRequestGuard();
const requestA = guard.begin(projectA);
const requestB = guard.begin(projectB);
assert.equal(guard.isCurrent(requestA, projectB), false);
assert.equal(guard.isCurrent(requestB, projectB), true);
});
test("an explicit project-context invalidation rejects an in-flight response", () => {
const guard = new SchemaRequestGuard();
const requestA = guard.begin(projectA);
guard.invalidate();
assert.equal(guard.isCurrent(requestA, projectA), false);
});
test("the captured context also protects against a context change without a new request", () => {
const guard = new SchemaRequestGuard();
const requestA = guard.begin(projectA);
assert.equal(guard.isCurrent(requestA, projectB), false);
});