Convert gitgram/ and aitimemachine/ from embedded git repos (which showed as opaque submodule gitlinks on GitHub) into fully-tracked first-party content. AITM now merges its 7 vendored repos as first-party engines: - memory: beads (Go task DAG) + context7 (docs SDK), unified into saved_contexts - git: vendored C git (bundled binary) + gitnexus (in-process code intelligence) - agentic: a2a (@a2a-js/sdk) + pal (AITM-managed Python subprocess) Includes the full session's product build: Gitgram web/mobile/backend features, AITM website/CLI/MCP, the unified memory layer, engine build tooling (scripts/build-engines.sh, Dockerfile, CI), docs (README, ENGINES.md, ARCHITECTURE.md), and extensive test suites. Build artifacts, node_modules, external/, and gemini-cli are gitignored. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
100 lines
2.9 KiB
TypeScript
100 lines
2.9 KiB
TypeScript
import { beforeAll, beforeEach, describe, expect, it } from "vitest";
|
|
import request from "supertest";
|
|
import type { Express } from "express";
|
|
import {
|
|
createTestApp,
|
|
mockProjects,
|
|
seedTestData,
|
|
TEST_API_KEY,
|
|
} from "../setup.js";
|
|
|
|
let app: Express;
|
|
|
|
beforeAll(async () => {
|
|
app = await createTestApp();
|
|
});
|
|
|
|
beforeEach(() => {
|
|
seedTestData();
|
|
});
|
|
|
|
describe("Data Deletion Requests", () => {
|
|
it("queues a project delete request", async () => {
|
|
const res = await request(app)
|
|
.post("/v1/data/delete-request")
|
|
.set("X-API-Key", TEST_API_KEY)
|
|
.send({
|
|
scope: "project",
|
|
projectId: "proj_test_001",
|
|
reason: "cleanup",
|
|
});
|
|
|
|
expect(res.status).toBe(202);
|
|
expect(res.body.success).toBe(true);
|
|
expect(res.body.request.id).toMatch(/^delreq_/);
|
|
expect(res.body.request.status).toBe("pending");
|
|
});
|
|
|
|
it("supports dry-run processing without completing the job", async () => {
|
|
const queued = await request(app)
|
|
.post("/v1/data/delete-request")
|
|
.set("X-API-Key", TEST_API_KEY)
|
|
.send({
|
|
scope: "project",
|
|
projectId: "proj_test_001",
|
|
});
|
|
|
|
const requestId = queued.body.request.id as string;
|
|
|
|
const processed = await request(app)
|
|
.post(`/v1/data/delete-request/${requestId}/process`)
|
|
.set("X-API-Key", TEST_API_KEY)
|
|
.send({ dryRun: true });
|
|
|
|
expect(processed.status).toBe(200);
|
|
expect(processed.body.success).toBe(true);
|
|
expect(processed.body.result.dryRun).toBe(true);
|
|
expect(processed.body.result.summary.scope).toBe("project");
|
|
|
|
const job = await request(app)
|
|
.get(`/v1/data/delete-request/${requestId}`)
|
|
.set("X-API-Key", TEST_API_KEY);
|
|
|
|
expect(job.status).toBe(200);
|
|
expect(job.body.request.status).toBe("pending");
|
|
expect(job.body.request.result.state).toBe("dry_run_preview");
|
|
});
|
|
|
|
it("processes request and marks it completed", async () => {
|
|
const queued = await request(app)
|
|
.post("/v1/data/delete-request")
|
|
.set("X-API-Key", TEST_API_KEY)
|
|
.send({
|
|
scope: "project",
|
|
projectId: "proj_test_001",
|
|
});
|
|
|
|
const requestId = queued.body.request.id as string;
|
|
|
|
const processed = await request(app)
|
|
.post(`/v1/data/delete-request/${requestId}/process`)
|
|
.set("X-API-Key", TEST_API_KEY)
|
|
.send({ dryRun: false });
|
|
|
|
expect(processed.status).toBe(200);
|
|
expect(processed.body.success).toBe(true);
|
|
expect(processed.body.result.alreadyCompleted).toBe(false);
|
|
expect(processed.body.result.summary.scope).toBe("project");
|
|
|
|
const job = await request(app)
|
|
.get(`/v1/data/delete-request/${requestId}`)
|
|
.set("X-API-Key", TEST_API_KEY);
|
|
|
|
expect(job.status).toBe(200);
|
|
expect(job.body.request.status).toBe("completed");
|
|
expect(job.body.request.progress).toBe(100);
|
|
|
|
expect(mockProjects.find((p) => p.id === "proj_test_001")).toBeUndefined();
|
|
});
|
|
});
|