Skip to content

wip: prototype moduleTypes persistence#12915

Draft
shykes wants to merge 1 commit intomainfrom
codegen-moduletypes
Draft

wip: prototype moduleTypes persistence#12915
shykes wants to merge 1 commit intomainfrom
codegen-moduletypes

Conversation

@shykes
Copy link
Copy Markdown
Contributor

@shykes shykes commented Apr 6, 2026

Problem

Every time you run dagger functions, the engine calls the SDK's moduleTypes hook, which runs live codegen inside a container just to figure out what functions and types your module exposes. This is slow and unnecessary — the answer only changes when your source code changes.

Solution

Move typedef discovery out of runtime. During dagger generate, persist the module's type definitions as a checked-in artifact (dagger.moduletypes.json). At load time, read that file instead of running SDK codegen. Keep the live codegen path as a fallback for bootstrap and stale artifacts.

Design

This PR is a first step + handoff draft:

  1. Simplify ModuleTypes() — reuse baseWithCodegen() instead of duplicating ~45 lines of container setup. Same behavior, less code.
  2. Add regression tests for three behaviors we must preserve:
    • Fresh source edits are visible immediately in dagger functions
    • Compile errors in function bodies don't break function listing
    • User init() doesn't run during typedef loading
  3. Two design docs describe the full plan:
    • save-load-object-state.md — a generic engine primitive for saving/loading stable object state as portable JSON
    • codegen-moduletypes.md — using that primitive to persist module typedefs, so dagger functions becomes a file read instead of a codegen run

@shykes shykes requested a review from eunomie April 6, 2026 23:32
@github-actions
Copy link
Copy Markdown
Contributor

This PR is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 7 days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant