Repository navigation
Conversation
Proposal for demand-driven workspace module loading via a per-module WorkspaceModule.typeDefs introspection: dagger call/functions reads module names (currentWorkspace.moduleList, no load) then fetches only the targeted module's typedefs, instead of serving every module via load-all currentTypeDefs. currentTypeDefs stays untouched (kept for MCP and bare listing). Includes the main-baseline call-flow reference doc. Signed-off-by: Yves Brissaud <[email protected]>
Replace the one-shot ensureModulesLoaded with per-request, per-module
loading. Each request loads only the pending workspace modules it
demands and unselected modules stay pending, loading when a later
request demands them. The dagql schema is rebuilt from the served set
per request, so the session schema grows monotonically: narrowing is
deferral, not exclusion, and is therefore safe for open multi-request
sessions, generalizing the previous SingleQuery-only peek to every
client.
The demand is read from the request:
- Root fields naming a pending module load just that module (the
existing entrypoint fallback is preserved); full-schema fields
(__schema, env, currentTypeDefs, ...) and anything unrecognized
load everything.
- An operation named "DaggerModuleScope_<module>" -- set by a targeted
`dagger call`/`functions <module>` introspection, which otherwise
names no module -- loads that module plus the workspace entrypoint.
PeekRootFieldsAndOperation exposes the operation name (recovered from
the document when the request envelope omits it) and a small codec
encodes/decodes the scope. The operation name is otherwise ignored,
so the same query works against engines that do not peek it.
Extra (-m) modules are explicitly requested, so they keep loading
eagerly on the first request with sticky errors. Ambient module failures
become per-module: a broken module only fails the requests that demand
it, and stays pending so later demands report its load error. Served
identities and names are tracked so cross-batch loads stay deduplicated
and demand filters keep recognizing already-loaded modules. Cancellation
and deadline errors are never recorded as module failures, so an
interrupted load stays retryable by later demands in the session.
Signed-off-by: Yves Brissaud <[email protected]>
The entire currentWorkspace selector API returns core types, so
currentWorkspace { generators|checks|services(include: [...]) } validates
against the core schema with no modules loaded -- only the resolver's
result needs them. Add a Query.Server.EnsureWorkspaceModules hook
(implemented by the engine, precedent: CurrentWorkspace) and call it at
the top of the checks/generators/services resolvers with their native
include argument.
So `dagger generate|check|up <module>` loads only the named module with
no CLI or API change -- the include is already the command's functional
argument -- and an unrelated broken or stale module can no longer block
the operation.
Signed-off-by: Yves Brissaud <[email protected]>
Per-module typedefs introspection that loads only the named workspace module on demand (EnsureWorkspaceModules), leaving siblings pending, then builds its typedefs through typeDefsFromServedDeps extracted from Query.currentTypeDefs. Lets dagger call/functions narrow loading to the targeted module instead of the load-all currentTypeDefs. Signed-off-by: Yves Brissaud <[email protected]>
dagger call/functions resolve the leading positional token to an installed workspace module via currentWorkspace.moduleList, and when it matches fetch only that module's typedefs through currentWorkspace.moduleList.typeDefs instead of the load-all currentTypeDefs. Unmatched tokens (entrypoint-proxied functions, bare listings) fall back to currentTypeDefs. typedefs.graphql now shares a TypeDefParts fragment across both operations. Signed-off-by: Yves Brissaud <[email protected]>
Add a generators-broken workspace fixture -- a healthy module exposing a generator, a check, and a service, alongside a module with intentionally invalid source -- and lock in that `dagger generate`, `check`, `up`, `call`, and `functions` targeting the healthy module never load the broken one, while full listings still load every module and surface it. The generate test runs with -y, exercising the multi-request path where later requests must keep recognizing the already-loaded module. A second fixture (call-narrowing) covers the demand shapes single-word module names cannot: a module declared as "goodMod" is targeted through its kebab-case command name (`dagger call good-mod ...`), and with a workspace entrypoint configured, calling one of its root-proxied functions loads the entrypoint module alone. In both cases the broken sibling module stays unloaded. Signed-off-by: Yves Brissaud <[email protected]>
eunomie
force-pushed
the
per-module-typedefs
branch
from
June 24, 2026 13:57
5c6003e to
ba13666
Compare
Signed-off-by: Yves Brissaud <[email protected]>
This was referenced Jun 25, 2026
eunomie
added a commit
to eunomie/dagger
that referenced
this pull request
Jul 2, 2026
Design for extending the demand-driven workspace module loading (merged for generate/check/up in dagger#13548) to dagger api call and api functions. The introspection these commands build their command tree from (currentTypeDefs) names no module, so the target must cross the wire: the chosen design carries the CLI's leading command token in a new ClientMetadata workspace_module_scope hint, resolved engine-side with the same kebab/entrypoint rules as the merged demand filters and consumed one-shot by the first request whose only full-schema demand is currentTypeDefs. No GraphQL API change, no SDK regeneration, no version gating; old engines ignore the unknown metadata key and old CLIs simply do not send it. Includes the investigation behind the choice: the merged foundation, why call/functions are the hard case, a post-mortem of the prior attempts (dagger#13380, dagger#13406, dagger#13539, dagger#13543), and the alternatives ranked. Signed-off-by: Yves Brissaud <[email protected]>
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. |
eunomie
added a commit
to eunomie/dagger
that referenced
this pull request
Jul 16, 2026
Design for extending the demand-driven workspace module loading (merged for generate/check/up in dagger#13548) to dagger api call and api functions. The introspection these commands build their command tree from (currentTypeDefs) names no module, so the target must cross the wire: the chosen design carries the CLI's leading command token in a new ClientMetadata workspace_module_scope hint, resolved engine-side with the same kebab/entrypoint rules as the merged demand filters and consumed one-shot by the first request whose only full-schema demand is currentTypeDefs. No GraphQL API change, no SDK regeneration, no version gating; old engines ignore the unknown metadata key and old CLIs simply do not send it. Includes the investigation behind the choice: the merged foundation, why call/functions are the hard case, a post-mortem of the prior attempts (dagger#13380, dagger#13406, dagger#13539, dagger#13543), and the alternatives ranked. Signed-off-by: Yves Brissaud <[email protected]>
eunomie
added a commit
to eunomie/dagger
that referenced
this pull request
Jul 16, 2026
Design for extending the demand-driven workspace module loading (merged for generate/check/up in dagger#13548) to dagger api call and api functions. The introspection these commands build their command tree from (currentTypeDefs) names no module, so the target must cross the wire: the chosen design carries the CLI's leading command token in a new ClientMetadata workspace_module_scope hint, resolved engine-side with the same kebab/entrypoint rules as the merged demand filters and consumed one-shot by the first request whose only full-schema demand is currentTypeDefs. No GraphQL API change, no SDK regeneration, no version gating; old engines ignore the unknown metadata key and old CLIs simply do not send it. Includes the investigation behind the choice: the merged foundation, why call/functions are the hard case, a post-mortem of the prior attempts (dagger#13380, dagger#13406, dagger#13539, dagger#13543), and the alternatives ranked. Signed-off-by: Yves Brissaud <[email protected]>
eunomie
added a commit
to eunomie/dagger
that referenced
this pull request
Jul 16, 2026
Design for extending the demand-driven workspace module loading (merged for generate/check/up in dagger#13548) to dagger api call and api functions. The introspection these commands build their command tree from (currentTypeDefs) names no module, so the target must cross the wire: the chosen design carries the CLI's leading command token in a new ClientMetadata workspace_module_scope hint, resolved engine-side with the same kebab/entrypoint rules as the merged demand filters and consumed one-shot by the first request whose only full-schema demand is currentTypeDefs. No GraphQL API change, no SDK regeneration, no version gating; old engines ignore the unknown metadata key and old CLIs simply do not send it. Includes the investigation behind the choice: the merged foundation, why call/functions are the hard case, a post-mortem of the prior attempts (dagger#13380, dagger#13406, dagger#13539, dagger#13543), and the alternatives ranked. Signed-off-by: Yves Brissaud <[email protected]>
eunomie
added a commit
to eunomie/dagger
that referenced
this pull request
Jul 16, 2026
Document, in hack/designs/done, how dagger api call and api functions narrow workspace module loading to their target: the CLI forwards its leading command-line word as the workspace_module_scope client metadata hint and the engine resolves it, completing the demand-driven loading that generate/check/up already had. Covers the behavior table, the one-shot-per-session rule, nested-client plumbing, why the target rides connection metadata rather than a new API surface, and the prior attempts (dagger#13380, dagger#13406, dagger#13539, dagger#13543). Signed-off-by: Yves Brissaud <[email protected]>
eunomie
added a commit
to eunomie/dagger
that referenced
this pull request
Jul 16, 2026
Document, in hack/designs/done, how dagger api call and api functions narrow workspace module loading to their target: the CLI forwards its leading command-line word as the workspace_module_scope client metadata hint and the engine resolves it, completing the demand-driven loading that generate/check/up already had. Covers the behavior table, the one-shot-per-session rule, nested-client plumbing, why the target rides connection metadata rather than a new API surface, and the prior attempts (dagger#13380, dagger#13406, dagger#13539, dagger#13543). Signed-off-by: Yves Brissaud <[email protected]>
Contributor
|
This PR was closed because it has been stalled for 7 days with no activity. |
tiborvass
pushed a commit
to eunomie/dagger
that referenced
this pull request
Jul 20, 2026
Document, in hack/designs/done, how dagger api call and api functions narrow workspace module loading to their target: the CLI forwards its leading command-line word as the workspace_module_scope client metadata hint and the engine resolves it, completing the demand-driven loading that generate/check/up already had. Covers the behavior table, the one-shot-per-session rule, nested-client plumbing, why the target rides connection metadata rather than a new API surface, and the prior attempts (dagger#13380, dagger#13406, dagger#13539, dagger#13543). Signed-off-by: Yves Brissaud <[email protected]>
tiborvass
pushed a commit
to eunomie/dagger
that referenced
this pull request
Jul 21, 2026
Document, in hack/designs/done, how dagger api call and api functions narrow workspace module loading to their target: the CLI forwards its leading command-line word as the workspace_module_scope client metadata hint and the engine resolves it, completing the demand-driven loading that generate/check/up already had. Covers the behavior table, the one-shot-per-session rule, nested-client plumbing, why the target rides connection metadata rather than a new API surface, and the prior attempts (dagger#13380, dagger#13406, dagger#13539, dagger#13543). Signed-off-by: Yves Brissaud <[email protected]>
tiborvass
pushed a commit
to eunomie/dagger
that referenced
this pull request
Jul 21, 2026
Document, in hack/designs/done, how dagger api call and api functions narrow workspace module loading to their target: the CLI forwards its leading command-line word as the workspace_module_scope client metadata hint and the engine resolves it, completing the demand-driven loading that generate/check/up already had. Covers the behavior table, the one-shot-per-session rule, nested-client plumbing, why the target rides connection metadata rather than a new API surface, and the prior attempts (dagger#13380, dagger#13406, dagger#13539, dagger#13543). Signed-off-by: Yves Brissaud <[email protected]>
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.
Problem
dagger call|functions <module>builds its command tree fromcurrentTypeDefs(returnAllTypes: true), which serves every workspace module. Running one module pays for all its siblings, and a single broken or stale sibling blocks operating on any module — including the one you randagger generateto fix.Solution
Discover module names without loading anything, then fetch only the targeted module's typedefs:
WorkspaceModule.typeDefs(returnAllTypes, hideCore)(new engine field): loads only the named workspace module on demand viaEnsureWorkspaceModules, then builds its typedefs through the closure logic shared withcurrentTypeDefs. Siblings stay pending, so a broken one can't block the call.dagger call|functionsresolve the leading token to an installed module (currentWorkspace.moduleList, kebab-mapped to the config name) and request only that module's typedefs viamoduleList(module:).typeDefs. An unmatched token falls back to the workspace entrypoint module; bare / no-token falls back to load-allcurrentTypeDefs.currentTypeDefsitself is unchanged — still used by the in-engine MCP/LLM tool builder and by baredagger functions.Flow
sequenceDiagram autonumber actor U as User participant CLI as dagger CLI participant ENG as Engine U->>CLI: dagger call backend test CLI->>ENG: connect session Note over ENG: no modules loaded yet CLI->>ENG: currentWorkspace.moduleList (names, no load) ENG-->>CLI: backend, frontend, docs (+ entrypoint flag) Note over CLI: backend is an installed module CLI->>ENG: moduleList(module: backend).typeDefs Note over ENG: load backend only — siblings stay pending ENG-->>CLI: Query + backend typedefs CLI->>ENG: execution backend.test ENG-->>CLI: resultTests
TestGenerators/TestWorkspace*Narrows(generate / check / up / call): a broken sibling no longer blocks a scopeddagger call; kebab-case and entrypoint targets are covered; baredagger functionsstill loads everything (and surfaces the broken module).Design notes:
hack/designs/per-module-typedefs.md.Builds on the additive demand-loading foundation from #13406 (included here). Supersedes #13539, which carried the target in an encoded operation name; here it enters the query as a normal argument.