Repository navigation
display: show GraphQL objects as lazy queries - #289
Merged
Merged
Conversation
Deploying dang with
|
| Latest commit: |
e933883
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://dea8705c.dang-3kk.pages.dev |
| Branch Preview URL: | https://display-raise.dang-3kk.pages.dev |
toString, List.join, interpolation, print and the REPL echo now render a
GraphQL object as the lazy query it is, its GraphQL type and the chain
that produces it, instead of querying its ID:
<Container: container.from(address: …).withEnv(name: …, value: …)>
The angle brackets keep it from reading as Dang source or a printed
string. A mutation's result is <Type: mutation.field(…)>, a list handle
<[Type]: …>, a handle loaded by ID its loader's chain. Nothing is sent,
so showing a mutation's result doesn't re-send it and display can't
fail. Describe renders handles the same way (pkg/dang/chain.go),
replacing its <lazy: …> form.
Argument values are never shown, only their names. Any of them may be a
secret's plaintext and nothing reliable says which: Dagger doesn't
expose its sensitivity marks in introspection, and the standard
introspection query doesn't fetch directives applied to arguments.
Leaving out object arguments too keeps a pipeline that feeds a handle
back into itself from rendering exponentially.
Signed-off-by: Alex Suraci <[email protected]>
The stdlib skill said a GraphQL object displays as its quoted ID; the interop guide's laziness note now says showing a handle doesn't force it, and what it renders as. Signed-off-by: Alex Suraci <[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.
Showing a GraphQL object as text (
toString,List.join, string interpolation,print, the REPL echo) now renders the lazy query it is, its GraphQL type and its pending query chain, with no ID query:This replaces the raise-on-missing-ID approach this PR first took. The branch was rebuilt from
main(9316388), so none of the raise paths,DiagnosticRepror the(string, error)signatures exist anymore.What changed
pkg/dang/chain.gorenderHandlerenders a handle fromQueryBuilder.Steps(). It is shared byRepr/DisplayandDescribe.<Type: mutation.field(…)>. Nothing is sent, so showing it doesn't re-send the mutation.<[Type]: …>. An interface or union handle shows its declared type, since it's no longer resolved.node(id:), sinceload<T>FromIDisn't supported, so it shows as<User: node(id: …)>.@sensitive-based policy was tried and dropped for that reason.…rather than nested chains. This also prevents a pipeline that feeds a handle back into itself (c.withFile(source: c.file(…))) from rendering exponentially.Repr(v) string/Display(v) stringkeep their simple signatures. Rendering needs no context and can't fail.Describeshows handles in the same form:Test.Container! = <Container: container.from(address: …)>. That replaces<lazy: …>. Forcing is unchanged.Tests
tests/display_graphql_test.go(recording client): showing a handle throughprint, interpolation,joinandtoStringsends zero queries. That includes a mutation's result. A handle loaded by ID sends only the field's own query.tests/test_graphql_object_tostring.dang:<User: primaryUser>throughtoString, lists,joinand interpolation;<Node: mutation.touchNode(id: …)>;<User: node(id: …)>for an@expectedTypeID loaded by ID;.idstill gives the ID.pkg/dang/chain_test.go:setSecret, asserting the plaintext never appears;pkg/dang/describe_test.go: expectations moved to the new form.All 14 checks (
**) pass locally.Release note