delete Task Logs

A complete read path over a table nothing could write to. task-logger.ts exported
createTaskLog, appendToLog and finalizeLog, and none of the three was called
anywhere in the tree — so `task_logs` could never gain a row, and the screen was
permanently empty for everyone.

The read half was fully wired: mounted router, capability claim, dock icon, two
routes and a page-title rule. That is why it looked alive.

Gone, in the order it was reached:

  Screens/Dashboard/TaskLogs/       the screen
  App.tsx                           /task-logs and /task-logs/:id
  Dashboard/index.tsx               the export
  Layout/Dock.tsx                   the 'Logs' icon, and ScrollText with it
  state/usePageTitle.ts             the title rule
  api/task-logs/task-logs.ts        the router, and its mount in hono.ts
  api/task-logger.ts                101 lines of orphaned writer
  officer_db/src/operations/        the directory
  officer_db/src/schema.ts          the export line
  officer_db/src/types.ts           TaskLogSelect / TaskLogInsert

capabilities/registry.ts loses '/task-logs' from the `tasks` capability's `api`
AND `routes`. The api half is not optional: assertCapabilityTotality check 2
refuses to boot on a capability claiming a prefix nothing mounts, so unmounting
the router while leaving the claim would have stopped the server starting.

db:push now creates 21 tables, down from 43 at the start of the evening.

officer_db/src/operations was one of the two lopsided directories the
schema/queries merge exposed. integrations/ is the remaining one, and it is
legitimate — it spans server and user-data.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-08-13 01:56:07 +00:00
co-authored by Claude Opus 5
parent f9cd0a798a
commit 595dd082a7
14 changed files with 5 additions and 379 deletions
+3 -3
View File
@@ -33,9 +33,9 @@ features listed twice, `db` and `schema` buried at line 270 with three feature b
(`app-store`/`sidecar-installs`, `email`/`email-accounts`, `server`/`server-config`), `operations` had no
query file at all, and `integrations` had no schema file.
Two directories are still lopsided and say so by their contents: `operations/` has only a schema (its
`task_logs` is reached directly from `src/servers/`, bypassing this package), and `integrations/` has only
queries, because it spans `server` and `user-data`.
One directory is still lopsided and says so by its contents: `integrations/` has only queries, because it
spans `server` and `user-data`. (`operations/` was the other, and was deleted on 2026-08-13 along with the
Task Logs feature — see below.)
**`src/schema.ts` is drizzle-kit's view, not the runtime's.** `drizzle.config.ts` points at it, so a
commented line there removes a table from the DATABASE without removing a line of code — every query
-3
View File
@@ -40,6 +40,3 @@ export * from './user-data';
export * from './vault';
export * from './wallet';
// `operations` is deliberately absent: it has a schema and no queries. Its one table, `task_logs`, is
// reached as `schema.taskLogs` from src/servers/api/task-logger.ts, which reaches past this package's
// own boundary. Give it a queries.ts and it earns a line here.
@@ -1,35 +0,0 @@
// Task run logs.
//
// This file held two other tables until 2026-08-13, both dead and both removed:
//
// queue_jobs the background job engine's state, from when it kept it in Postgres. It works
// on files now (src/servers/queue/storage.ts) and had not read this table since.
// terminal_containers a docker id and port per user, from the architecture where every account ran
// inside its own container. That is gone — see data-path.ts on getHomeDir.
//
// Neither had a single reader or writer anywhere in the tree. They were created on every fresh install
// by db:push and then never touched.
//
// What is left is one table with no queries.ts beside it: task_logs is reached as `schema.taskLogs`
// from src/servers/api/task-logger.ts, which reaches past this package's boundary. That is the next
// thing to fix here.
import { pgTable, serial, text, integer, boolean, timestamp, jsonb, index } from 'drizzle-orm/pg-core';
import { users } from '../auth/schema';
export const taskLogs = pgTable('task_logs', {
id: serial('id').primaryKey(),
userId: integer('user_id').notNull().references(() => users.id, { onDelete: 'cascade' }),
taskName: text('task_name').notNull(),
taskDirName: text('task_dir_name').notNull(),
entryName: text('entry_name').notNull(),
entryType: text('entry_type').notNull(),
provider: text('provider').notNull(),
model: text('model').notNull(),
isError: boolean('is_error').notNull().default(false),
messages: jsonb('messages').notNull().default([]),
startedAt: timestamp('started_at', { withTimezone: true }).notNull(),
completedAt: timestamp('completed_at', { withTimezone: true }),
}, (table) => [
index('idx_task_logs_user_started').on(table.userId, table.startedAt),
]);
-1
View File
@@ -27,7 +27,6 @@ export * from './api-keys/schema'; // api_keys
export * from './user-data/schema'; // user_settings, user_state, user_integrations, dock_configs
export * from './dashboards/schema'; // dashboards, screens, dashboard_defaults
export * from './server/schema'; // server_config (SMTP lives here), server_integrations
export * from './operations/schema'; // task_logs
export * from './pipeline-jobs/schema'; // pipeline_jobs
export * from './chat-events/schema'; // chat_session_events
export * from './agent-panels/schema'; // agent_panels
-4
View File
@@ -44,10 +44,6 @@ export type DashboardInsert = typeof Schema.dashboards.$inferInsert;
export type ScreenSelect = typeof Schema.screens.$inferSelect;
export type ScreenInsert = typeof Schema.screens.$inferInsert;
// ── Operations ──
export type TaskLogSelect = typeof Schema.taskLogs.$inferSelect;
export type TaskLogInsert = typeof Schema.taskLogs.$inferInsert;
// ── Email ──