Codemod db pass-through calls: messages + runs + approvals + company (C1 part 2/3)

Rewrite ~376 call sites for messages, runs, approvalsMod, and company
domains and delete the corresponding pass-through methods on
AppDatabase / AppDatabaseBase. Structural type references
(ReturnType<HandlerDeps["db"]["getRun"]>) and SweepStaleReviewsDeps-style
mocks are updated to route through the owning sub-module.
This commit is contained in:
ZacharyZhang-NY committed 2026-04-20 13:20:15 -04:00
1 parent 5e9b7acbc6
commit a69fbb053b
86 files changed
+393 -454

No files matched your search

+4 -4
View File
@@ -24,7 +24,7 @@ async function createHarness() {
const db = new AppDatabase(profileDir);
db.init();
const companyId = db.saveCompany({ name: "Orbit Foundry", description: "API test", status: "active" });
const companyId = db.company.saveCompany({ name: "Orbit Foundry", description: "API test", status: "active" });
const workspaceId = db.saveWorkspace({
companyId,
name: "Primary",
@@ -55,7 +55,7 @@ async function createHarness() {
priority: "high",
status: "todo",
});
const run = db.createRun({ companyId, taskId, agentId, workspaceId, connectorId: "openai-codex" });
const run = db.runs.createRun({ companyId, taskId, agentId, workspaceId, connectorId: "openai-codex" });
const token = createAgentToken(agentId, companyId, run.id);
const server = createApiServer(db, () => {}, () => null);
const port = await server.start();
@@ -95,7 +95,7 @@ describe("run event API", () => {
it("returns persisted run events for the active run token", async () => {
const harness = await createHarness();
try {
harness.db.appendRunEvent({
harness.db.runs.appendRunEvent({
companyId: harness.companyId,
runId: harness.runId,
agentId: harness.agentId,
@@ -141,7 +141,7 @@ describe("run event API", () => {
expect(reader).toBeDefined();
setTimeout(() => {
harness.db.appendRunEvent({
harness.db.runs.appendRunEvent({
companyId: harness.companyId,
runId: harness.runId,
agentId: harness.agentId,