feat: consolidate database management work
Add catalog-owned logical relationships and runtime snapshots, extend the database-management UI and validation coverage, and document the updated operational workflow. Keep active sensitive-generation status in a tooltip and indicator, and update the layout E2E to follow the history action in its new database-scoped location.
This commit is contained in:
@@ -517,6 +517,63 @@ test("creates a session from the active immutable workspace revision", async ()
|
||||
}));
|
||||
});
|
||||
|
||||
test("hands one effective relationship snapshot to both retrieval and Pi", async () => {
|
||||
const effective = JSON.stringify({
|
||||
schemaVersion: 1,
|
||||
workspaceId: "default",
|
||||
relationships: [],
|
||||
});
|
||||
const render = vi.fn(async () => effective);
|
||||
const acquireWorkspaceRuntime = vi.fn((_workspace: string, relationships?: string) => ({
|
||||
path: "/runtime/with-relationships.yaml",
|
||||
workspaceId: "default",
|
||||
workspaceRevision: "e".repeat(40),
|
||||
release: vi.fn(),
|
||||
}));
|
||||
const searchPack = vi.fn(async () => {});
|
||||
const createFor = vi.fn(() => ({ bridge: { onClientEvent: () => {} } }));
|
||||
const app = buildApp(loadConfig({ THT_HARNESS_DIR: "../harness" }), {
|
||||
thtRunner: {
|
||||
sessionNew: async () => ({ id: "effective-map" }),
|
||||
acquireWorkspaceRuntime,
|
||||
searchPack,
|
||||
} as any,
|
||||
effectiveRelationshipSnapshotProvider: { render } as any,
|
||||
readiness: { ensure: async () => ({ ok: true }) } as any,
|
||||
mgr: {
|
||||
get: () => undefined,
|
||||
createFor,
|
||||
configure: async () => {},
|
||||
start: () => {},
|
||||
} as any,
|
||||
getSettings: () => ({ workspace: "default", thinking: "low" }) as any,
|
||||
});
|
||||
|
||||
const response = await app.inject({
|
||||
method: "POST",
|
||||
url: "/sessions",
|
||||
payload: { question: "Which users placed orders?", workspaceId: "default" },
|
||||
});
|
||||
|
||||
expect(response.statusCode).toBe(200);
|
||||
expect(render).toHaveBeenCalledWith("default");
|
||||
expect(acquireWorkspaceRuntime).toHaveBeenCalledWith(
|
||||
expect.stringContaining("/default.yaml"),
|
||||
effective,
|
||||
);
|
||||
expect(createFor).toHaveBeenCalledWith(
|
||||
"effective-map",
|
||||
expect.objectContaining({
|
||||
runtimeConfig: expect.objectContaining({ path: "/runtime/with-relationships.yaml" }),
|
||||
}),
|
||||
);
|
||||
expect(searchPack).toHaveBeenCalledWith(
|
||||
"Which users placed orders?",
|
||||
"effective-map",
|
||||
"/runtime/with-relationships.yaml",
|
||||
);
|
||||
});
|
||||
|
||||
test("rejects an SSH-only workspace before persisting or starting a session", async () => {
|
||||
const sessionNew = vi.fn(async () => ({ id: "must-not-exist" }));
|
||||
const ensure = vi.fn(async () => ({ ok: true }));
|
||||
|
||||
Reference in New Issue
Block a user