GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||
GeezerVison is showing github.com — Add `Workspace` API and caching support by vito · Pull Request #11874 · dagger/dagger Conversation
Contributor
Extracting a backwards-compatible portion of #11812 that we can ship first and begin adopting in the repo.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
vito
force-pushed
the
workspace-api
branch
5 times, most recently
from
1c1b128 to
6fa85d7
Compare
vito
marked this pull request as ready for review
shykes
reviewed
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. API nits:
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
vito
force-pushed
the
workspace-api
branch
2 times, most recently
from
edb0128 to
2a9897e
Compare
sipsma
reviewed
Uh oh!
There was an error while loading. Please reload this page. Uh oh!
There was an error while loading. Please reload this page. Uh oh!
There was an error while loading. Please reload this page. Uh oh!
There was an error while loading. Please reload this page. Uh oh!
There was an error while loading. Please reload this page. Uh oh!
There was an error while loading. Please reload this page. Uh oh!
There was an error while loading. Please reload this page. Uh oh!
There was an error while loading. Please reload this page. Uh oh!
There was an error while loading. Please reload this page.
Comment on lines
+43
to
+48
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is another tricky thing where it might be nice to have an LLM write unit test coverage. Seems like everything is mock-able enough already potentially? (not a blocker if big headache)
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removed - saving for #11812 where it's relevant
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
shykes
reviewed
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I just realized we need this for blueprints too... Better to do in this PR, or as a follow-up?
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
vito
force-pushed
the
workspace-api
branch
2 times, most recently
from
9724162 to
b84dfee
Compare
Add a dagql Workspace type that exposes workspace detection, module installation, and module initialization through the GraphQL schema. This moves workspace logic into the engine so CLI commands can use the standard dagql pipeline instead of reimplementing filesystem operations client-side. New resolvers: - workspace(): detect workspace root and config from cwd - workspace.install(): add a module to .dagger/config.toml - workspace.moduleInit(): scaffold a new module and auto-install it Co-Authored-By: Claude Opus 4.6 <[email protected]> Signed-off-by: Alex Suraci <[email protected]> Signed-off-by: Alex Suraci <[email protected]> Follow the naming convention of currentTypeDefs() to make it clear this returns the detected workspace for the current session, not a general workspace constructor. Signed-off-by: Alex Suraci <[email protected]> Signed-off-by: Alex Suraci <[email protected]> Integrate workspace arg passing from the workspace-api branch: - Add IsWorkspace() to FunctionArg to identify Workspace-typed arguments - Make Workspace args always optional in the GraphQL schema, since they are automatically injected by the engine - In CacheConfigForCall, detect Workspace args and inject them via the currentWorkspace query, similar to how contextual args (defaultPath) are handled - Add loadWorkspaceArg() which resolves the workspace through the existing currentWorkspace query - Validate that Workspace cannot be stored as a field on module objects (it must be declared as a function argument) - Add Workspace to the digest fallback list in wrapper.go Signed-off-by: Alex Suraci <[email protected]> Add directory() and file() methods to the Workspace type, providing host-backed filesystem access scoped to the workspace root. - directory(path, include, exclude) returns a Directory snapshot from the host, with the path resolved relative to the workspace root. Delegates to Host.Directory for the actual host filesystem sync. - file(path) returns a single File from the host, resolved relative to the workspace root. Uses the same host directory + file extraction pattern as Host.file. Both methods use CachePerClient caching since they reflect live host filesystem state. Signed-off-by: Alex Suraci <[email protected]> Signed-off-by: Alex Suraci <[email protected]> along the way, unignore modules/evals/ and fix lints Signed-off-by: Alex Suraci <[email protected]> Adds a findUp field to the Workspace type that searches for a file or directory by walking up from a given path within the workspace. The search stops at the workspace root and will not traverse above it. Returns the path relative to the workspace root if found, or null if not found. Signed-off-by: Alex Suraci <[email protected]> Signed-off-by: Alex Suraci <[email protected]> Signed-off-by: Alex Suraci <[email protected]> Signed-off-by: Alex Suraci <[email protected]> Signed-off-by: Alex Suraci <[email protected]> Signed-off-by: Alex Suraci <[email protected]> Signed-off-by: Alex Suraci <[email protected]> Signed-off-by: Alex Suraci <[email protected]> Signed-off-by: Alex Suraci <[email protected]> Signed-off-by: Alex Suraci <[email protected]> Signed-off-by: Alex Suraci <[email protected]> The workspace schema had a local resolveWorkspacePath function that resolved user-provided paths relative to a root directory while preventing directory traversal escapes. This had two problems: 1. It used filepath (OS-dependent) instead of path (POSIX), which would break on Windows clients. The engine always runs on Linux, but workspace roots from Windows clients arrive as forward-slash paths with drive prefixes (e.g. 'C:/Users/foo') since the client normalizes backslashes before sending. Linux's filepath.IsAbs doesn't recognize 'C:/...' as absolute, and filepath.Clean won't handle drive letters correctly. 2. It was a useful general-purpose utility buried in the workspace schema package with no unit tests. Moved the logic to pathutil.SandboxedRelativePath which: - Normalizes backslashes to forward slashes for Windows client paths - Strips drive letters (via pathutil.GetDrive) or leading '/' so absolute user paths are treated as relative to the root - Uses normalizePath (already in pathutil) for consistent handling - Verifies the resolved path doesn't escape root via '..' Also switched workspace.go from filepath to path (POSIX) throughout, since all path operations run on the Linux engine against forward-slash-normalized paths. Added 12 unit tests covering relative paths, dot, absolute paths, dotdot escape attempts, Windows backslashes, drive letters, and Windows roots with drive prefixes. Signed-off-by: Alex Suraci <[email protected]> not needed for this initial first pass Signed-off-by: Alex Suraci <[email protected]> Signed-off-by: Alex Suraci <[email protected]> Signed-off-by: Alex Suraci <[email protected]> Seems like this broke stuff after all. This reverts commit 57fea54. Signed-off-by: Alex Suraci <[email protected]> Signed-off-by: Alex Suraci <[email protected]>
sipsma
approved these changes
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. LGTM once tests are passing (which is expected after the revert just pushed)
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactionsSigned-off-by: Alex Suraci <[email protected]> Uh oh!
There was an error while loading. Please reload this page.
This was referenced
Closed
This was referenced
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ReviewersUh oh!
There was an error while loading. Please reload this page. AssigneesNo one assignedLabels
None yet
ProjectsMilestoneNo milestoneDevelopmentSuccessfully merging this pull request may close these issues. Uh oh!
There was an error while loading. Please reload this page. 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. | ||||||||||||||||||
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |