Skip to content

Alias web Template type to server TemplateRecord - #860

Merged
selfcontained merged 1 commit into
mainfrom
tech-debt/templates-wire-type
Jul 31, 2026
Merged

Alias web Template type to server TemplateRecord#860
selfcontained merged 1 commit into
mainfrom
tech-debt/templates-wire-type

Conversation

@selfcontained

Copy link
Copy Markdown
Owner

What

Replaces the web Template type in apps/web/src/hooks/use-templates.ts — a field-for-field copy of the server's TemplateRecord (apps/server/src/templates/store.ts) — with a type-only import and alias (export type Template = TemplateRecord). Net -14 lines, zero behavior change, zero importer changes (the Template export name is preserved).

Why it's tech debt

This was one of the mirrored server↔web wire-type pairs identified in the 2026-07-21 audit; drifted copies of these have already produced real bugs (see #844). The jobs pair was consolidated in #856 using the same type-only-import pattern; this is the templates pair. use-templates.ts already imports values from ../../../server/src/templates/arg-parser, and agentType on both sides is the same shared type from shared/agent-types.ts (#849), so the alias is exact.

templates/store.ts is a leaf-ish module (node builtins, pg types, db/settings, arg-parser) — web's tsc resolves its imports via apps/server/node_modules, and esbuild erases type-only imports so nothing reaches the bundle (verified by finalize:web).

Validation

  • pnpm run check green
  • pnpm run finalize:web green (production build)
  • pnpm run test:e2e green (175 passed, 12 skipped)

Queued next

Release wire-type pair (ReleaseProgress/ReleaseJob in release-runtime.ts vs use-release-stream.ts) — last of the wire-type trio.

🤖 Generated with Claude Code

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>
@selfcontained
selfcontained merged commit 80fd154 into main Jul 31, 2026
1 check passed
@selfcontained
selfcontained deleted the tech-debt/templates-wire-type branch July 31, 2026 09:09
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