Skip to content

fix(go): avoid enumerating whole workspaces for compilation - #65

Closed
grouville wants to merge 1 commit into
mainfrom
fix/workspace-discovery-cost
Closed

grouville wants to merge 1 commit into
mainfrom
fix/workspace-discovery-cost

Conversation

@grouville

Copy link
Copy Markdown
Member

The workspace compiler discovery added in #64 lists every checkout filename on each module call. Each returned filename becomes a Dagger cache entry, so a large repository creates a lot of extra engine work.

In dagger/dagger#14664, the Java release check has 614,508 spans, compared with 4,057 on main. Most of the extra spans come from reading those filename lists. Several checks then report that the engine became unresponsive. This confirms the extra work; it does not establish exactly how the Cloud engine stopped.

This changes discovery to return the import and embed patterns from Go metadata and pass them directly to ws.Directory(...). It selects assembly/header files alongside imported packages, excludes dependency tests, and keeps the module's own source. It applies during generation and runtime compilation.

The caching contract stays the same: each affected call receives ws, current compiler inputs are selected again, and compilation can reuse unchanged file contents. No engine change is needed.

Validation: discovery and all template tests pass. On beta.17, the same engine module call drops from 130,168 spans to 1,725 and still returns the correct result. Changing only an external embedded file changes the fixture's result from one to two, both directly and through a sibling client, with no changes to either generated entrypoint. Full Cloud CI is still required to verify that the engine disconnects stop.

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