Codemod db pass-through calls to domain modules: tasks + agents (C1 part 1/3)
Rewrite ~525 call sites from `db.<method>()` to `db.<module>.<method>()` for tasks and agents domains (including `getAgent`/`findAgent`/`getTask` which live on the `entityCrud` field). Delete the corresponding pass-through methods on AppDatabaseBase. Structural types that narrowed `db` to a bag of flat methods (CapabilityMatchDb, EscalationDeps, SweepStaleReviewsDeps) are reshaped to match the new namespace. Internal callback references inside database.ts/database-base.ts now invoke the owning module directly (e.g. `this.agents.saveAgent`) rather than the deleted pass-through. The codemod lives at scripts/codemod/remove-appdatabase-passthrough.mjs and filters by owning module + optional explicit method list. It is idempotent and does not re-rewrite already-namespaced calls.
This commit is contained in:
1 parent
411294afa6
commit
5e9b7acbc6
95 files changed
+1123
-793
No files matched your search
@@ -15,7 +15,7 @@ describe("Step 5: Task status + comment wake propagation", () => {
|
||||
const ctoId = createAgent({ name: "CTO", role: "CTO", reportsTo: ceoId });
|
||||
const icId = createAgent({ name: "Dev", role: "Engineer", reportsTo: ctoId });
|
||||
|
||||
const chain = shared.db.getChainOfCommand(icId);
|
||||
const chain = shared.db.agents.getChainOfCommand(icId);
|
||||
expect(chain).toHaveLength(2);
|
||||
expect(chain[0].id).toBe(ctoId); // immediate manager
|
||||
expect(chain[1].id).toBe(ceoId); // top level
|
||||
@@ -25,7 +25,7 @@ describe("Step 5: Task status + comment wake propagation", () => {
|
||||
// Create a potential cycle (shouldn't happen in practice, but guard against it)
|
||||
const agent1 = createAgent({ name: "Agent1" });
|
||||
// agent1 reports to no one (CEO), so chain should be empty
|
||||
const chain = shared.db.getChainOfCommand(agent1);
|
||||
const chain = shared.db.agents.getChainOfCommand(agent1);
|
||||
expect(chain).toHaveLength(0);
|
||||
});
|
||||
|
||||
@@ -33,7 +33,7 @@ describe("Step 5: Task status + comment wake propagation", () => {
|
||||
const ceoId = createAgent({ name: "CEO", role: "CEO" });
|
||||
const ctoId = createAgent({ name: "CTO", role: "CTO", reportsTo: ceoId });
|
||||
|
||||
const parentTaskId = shared.db.saveTask({
|
||||
const parentTaskId = shared.db.tasks.saveTask({
|
||||
companyId: shared.companyId,
|
||||
title: "Build feature X",
|
||||
description: "Top-level task",
|
||||
@@ -43,7 +43,7 @@ describe("Step 5: Task status + comment wake propagation", () => {
|
||||
status: "in_progress",
|
||||
});
|
||||
|
||||
const childTaskId = shared.db.saveTask({
|
||||
const childTaskId = shared.db.tasks.saveTask({
|
||||
companyId: shared.companyId,
|
||||
title: "Implement module A",
|
||||
description: "Subtask",
|
||||
@@ -54,10 +54,10 @@ describe("Step 5: Task status + comment wake propagation", () => {
|
||||
status: "todo",
|
||||
});
|
||||
|
||||
const childTask = shared.db.getTask(childTaskId);
|
||||
const childTask = shared.db.entityCrud.getTask(childTaskId);
|
||||
expect(childTask.parentId).toBe(parentTaskId);
|
||||
|
||||
const parentTask = shared.db.getTask(parentTaskId);
|
||||
const parentTask = shared.db.entityCrud.getTask(parentTaskId);
|
||||
expect(parentTask.assigneeAgentId).toBe(ctoId);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user