Skip to content

display: show GraphQL objects as lazy queries - #289

Merged
vito merged 2 commits into
mainfrom
display-raise
Nov 10, 2026
Merged

vito merged 2 commits into
mainfrom
display-raise

Conversation

@vito

@vito vito commented Nov 10, 2026 •

Copy link
Copy Markdown
Owner

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:

<Container: container.from(address: …).withEnv(name: …, value: …)>

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, DiagnosticRepr or the (string, error) signatures exist anymore.

What changed

  • pkg/dang/chain.go renderHandle renders a handle from QueryBuilder.Steps(). It is shared by Repr/Display and Describe.
    • The angle brackets mean it can never read as Dang source or as a printed string.
    • A mutation's result is <Type: mutation.field(…)>. Nothing is sent, so showing it doesn't re-send the mutation.
    • A list handle is <[Type]: …>. An interface or union handle shows its declared type, since it's no longer resolved.
    • An object loaded by ID shows its loader's chain. This runtime's only loader is node(id:), since load<T>FromID isn't supported, so it shows as <User: node(id: …)>.
  • Argument values are never shown, only their names.
    • Any value could be a secret's plaintext, and nothing reliably says which. Dagger marks sensitive arguments internally but doesn't expose that in introspection, and the standard introspection query doesn't fetch directives applied to arguments. A @sensitive-based policy was tried and dropped for that reason.
    • Object arguments are values too, so they show as … 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) string keep their simple signatures. Rendering needs no context and can't fail.
  • Describe shows 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 through print, interpolation, join and toString sends 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> through toString, lists, join and interpolation;
    • <Node: mutation.touchNode(id: …)>;
    • <User: node(id: …)> for an @expectedType ID loaded by ID;
    • .id still gives the ID.
  • pkg/dang/chain_test.go:
    • a container chain;
    • setSecret, asserting the plaintext never appears;
    • an object argument and a list argument;
    • a mutation;
    • a list handle.
  • pkg/dang/describe_test.go: expectations moved to the new form.

All 14 checks (**) pass locally.

Release note

GraphQL objects now display as the lazy query they are: toString, List.join, string interpolation, print and the REPL show <Container: container.from(address: …)>, the type plus the pending query chain, with argument names but never their values. Nothing is sent to show one, including a mutation's result. Code that relied on toString or interpolation giving the object's ID must select .id.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

Deploying dang with  Cloudflare Pages  Cloudflare Pages

Latest commit: e933883
Status: ✅  Deploy successful!
Preview URL: https://dea8705c.dang-3kk.pages.dev
Branch Preview URL: https://display-raise.dang-3kk.pages.dev

View logs

vito added 2 commits November 10, 2026 03:32
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]>
@vito vito changed the title display: raise when a GraphQL ID can't be had display: show GraphQL objects as lazy queries Nov 10, 2026
@vito
vito merged commit 16eb672 into main Nov 10, 2026
9 checks passed
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