Skip to content

Consolidate jobs wire types into server jobs/store.ts - #856

Merged
selfcontained merged 1 commit into
mainfrom
agt_2a237f4d45cf/job-debt-collector-9811da51
Jul 30, 2026
Merged

Consolidate jobs wire types into server jobs/store.ts#856
selfcontained merged 1 commit into
mainfrom
agt_2a237f4d45cf/job-debt-collector-9811da51

Conversation

@selfcontained

Copy link
Copy Markdown
Owner

What

Removes the verbatim copy of the jobs API wire types from apps/web/src/hooks/use-jobs.ts. The web hook now imports them type-only from the server across the workspace boundary (net -80 lines):

  • Job = JobWithLatestRun & { nextRun: string | null } (the exact shape JobService.list() returns), JobRun = JobRunRecord, AddJobConfig = AddJobInput; JobRunStatus/JobAgentType/JobNotifyConfig/JobReport are re-exported so all existing web importers are untouched.
  • JobAgentType (server + web) now aliases CliAgentType from shared/agent-types.ts instead of restating the "claude" | "codex" | "opencode" | "cursor" union a third time.
  • AddJobInput moved from jobs/service.ts to jobs/store.ts next to its sibling wire types (service.ts re-exports it, so routes/mcp.ts and other importers are untouched). Importing it from service.ts would have pulled the whole server graph (AgentManager etc.) into the web TS program; store.ts + report.ts keep it small.

Why it's tech debt

The copies had already drifted: web's JobReport declared logs[].timestamp where the server emits logs[].createdAt, marked task summary optional where the server requires it, and AddJobConfig was missing the server's defaultArgs field. No web code read the drifted fields, so this is latent-bug removal, not a behavior change. Same proven pattern as use-templates.ts / lib/agent-types.ts (#849) — type-only imports, so nothing from pg/node reaches the web bundle (verified via finalize:web).

Validation

  • pnpm run check
  • pnpm run test — 2366 server + 516 web + 60 misc ✅
  • pnpm run finalize:web
  • pnpm run test:e2e — 175 passed ✅

Queued next

Backlog top: TemplateRecord/Template + ReleaseJob wire-type pairs, then the triple-implemented git helpers in apps/server/src/shared/.

🤖 Generated with Claude Code

The web client duplicated the jobs API wire types verbatim in
apps/web/src/hooks/use-jobs.ts (JobRunStatus, JobAgentType,
JobNotifyConfig, JobReport, Job, JobRun, AddJobConfig), and the copies
had already drifted: the web JobReport declared logs[].timestamp where
the server emits logs[].createdAt, and marked task summary optional
where the server requires it.

- JobAgentType now aliases CliAgentType from shared/agent-types.ts
  instead of restating the union in both trees.
- AddJobInput moved from jobs/service.ts to jobs/store.ts next to its
  sibling wire types (service.ts re-exports it, so importers are
  untouched); importing it from service.ts would drag the whole server
  graph into the web TS program.
- use-jobs.ts now imports the types type-only across the workspace
  boundary (same pattern as use-templates.ts and lib/agent-types.ts),
  keeping pg/node out of the web bundle.

Type-only change, no runtime behavior difference.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@selfcontained
selfcontained merged commit 1b8efef into main Jul 30, 2026
1 check passed
@selfcontained
selfcontained deleted the agt_2a237f4d45cf/job-debt-collector-9811da51 branch July 30, 2026 09:15
selfcontained added a commit that referenced this pull request Jul 31, 2026
The web Template type in use-templates.ts was a field-for-field copy of
TemplateRecord (apps/server/src/templates/store.ts). Replace the copy
with a type-only import so the wire type has a single source of truth,
following the jobs consolidation in #856. The Template export is kept so
web importers are untouched, and AgentType is already the same shared
type on both sides (via shared/agent-types.ts).

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant