Consolidate jobs wire types into server jobs/store.ts - #856
Merged
Conversation
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
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 shapeJobService.list()returns),JobRun=JobRunRecord,AddJobConfig=AddJobInput;JobRunStatus/JobAgentType/JobNotifyConfig/JobReportare re-exported so all existing web importers are untouched.JobAgentType(server + web) now aliasesCliAgentTypefromshared/agent-types.tsinstead of restating the"claude" | "codex" | "opencode" | "cursor"union a third time.AddJobInputmoved fromjobs/service.tstojobs/store.tsnext to its sibling wire types (service.tsre-exports it, soroutes/mcp.tsand other importers are untouched). Importing it fromservice.tswould have pulled the whole server graph (AgentManager etc.) into the web TS program;store.ts+report.tskeep it small.Why it's tech debt
The copies had already drifted: web's
JobReportdeclaredlogs[].timestampwhere the server emitslogs[].createdAt, marked tasksummaryoptional where the server requires it, andAddJobConfigwas missing the server'sdefaultArgsfield. No web code read the drifted fields, so this is latent-bug removal, not a behavior change. Same proven pattern asuse-templates.ts/lib/agent-types.ts(#849) — type-only imports, so nothing frompg/node reaches the web bundle (verified viafinalize: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