Skip to content

tui: reduce verbosity, per-span toggles, new DAG style - #10468

Merged
vito merged 12 commits into
dagger:mainfrom
vito:tui-shhhhh
Jun 3, 2025
Merged

vito merged 12 commits into
dagger:mainfrom
vito:tui-shhhhh

Conversation

@vito

@vito vito commented May 25, 2025 •

Copy link
Copy Markdown
Contributor
  • Only expand 2 levels by default (TUI: default verbosity that doesn't scare away normal people #10112)
  • Support individually toggling spans instead of (but not replacing) global verbosity model
  • Reduce the amount of lines all over the place by switching to DAG style
  • UI cue to draw the eye towards error logs (bold red bars) and in-flight or failed spans (red/yellow lines)
  • Tuck CLI flags (File, Directory etc.) underneath parsing command line arguments span so they don't pollute toplevel (and add regression golden test, this used to work)
  • Add E hotkey for --no-exit at runtime
  • Finally fix ordering of ID fields to match schema order
  • Use multiline rendering for calls that have excessively long arguments
  • Fix macOS terminal
    • Need to investigate this separately
  • Can we simplify away from verbosity levels?
    • There might be something to this, but didn't figure it out yet
  • Take a swing at Error verbosity #10461

asciicast

@vito
vito requested a review from shykes May 25, 2025 15:44
@vito vito changed the title tui: reduce verbosity, per-span toggling tui: reduce verbosity, per-span toggling, new line style May 26, 2025
@vito
vito force-pushed the tui-shhhhh branch 4 times, most recently from bb687d8 to 5f6228d Compare May 27, 2025 17:10
@crjm

crjm commented May 27, 2025

Copy link
Copy Markdown
Contributor

Looking good! 🎉

@vito vito changed the title tui: reduce verbosity, per-span toggling, new line style tui: reduce verbosity, per-span toggles, DAG style, go-to-error May 28, 2025
@vito
vito force-pushed the tui-shhhhh branch 2 times, most recently from 9f707a1 to db7f274 Compare May 29, 2025 02:11
@vito
vito force-pushed the tui-shhhhh branch 2 times, most recently from 611fb34 to 8ea761f Compare May 30, 2025 21:21
@vito vito changed the title tui: reduce verbosity, per-span toggles, DAG style, go-to-error tui: reduce verbosity, per-span toggles, new DAG style May 30, 2025
@vito
vito marked this pull request as ready for review May 30, 2025 21:34
@vito
vito force-pushed the tui-shhhhh branch 2 times, most recently from 614faa5 to a805d22 Compare May 31, 2025 00:37
vito added 8 commits June 2, 2025 09:20
still doesn't fix going out from the currently zoomed span, which should
go up to the parent, but this is at least much less broken than the
current approach. just hit esc to escape the zoom for now.

Signed-off-by: Alex Suraci <[email protected]>
* switch from indent guides (lines everywhere) to DAG style (lines
  connecting parents to children)
* only expand up to depth 2, to make things less overwhelming
* per-span expand/collapse, for more targeted exploration instead of
  all-or-nothing
* consolidate 'expanded' logic so it's only calculated at tree
  computation time

Signed-off-by: Alex Suraci <[email protected]>

plain: fix missing prefix

this was moved outside of the render fns

Signed-off-by: Alex Suraci <[email protected]>

fixup: use row.Expanded

Signed-off-by: Alex Suraci <[email protected]>
longstanding TODO that significantly improves DX

plus a bit of extra effort to handle contextual args (otherwise they're
nondeterministic)

Signed-off-by: Alex Suraci <[email protected]>
this is making telemetry worse; it doesn't actually block on building
the runtime, only constructing the container, so when that container
eventually fails that failure ends up hidden beneath this successful
span.

it's possible we could keep it by adding a 'sync' here, but I'm not sure
if that will introduce any adverse effects. chatted with the person that
added this and they're OK with just removing it for now.

Signed-off-by: Alex Suraci <[email protected]>
not exactly sure why this is the case, but it's a pre-existing issue,
fixing along the way

Signed-off-by: Alex Suraci <[email protected]>
vito added 4 commits June 3, 2025 13:38
* the 'looking for module' span can take quite a while, so we should
  just show it, otherwise there's zero feedback to the user
* add module refs to detect/load span names, since sometimes multiple of
  these show up, and we need to tell them apart

Signed-off-by: Alex Suraci <[email protected]>
Signed-off-by: Alex Suraci <[email protected]>
now that we call Sync eagerly for better telemetry we should at least
make sure these are loaded as quickly as possible

Signed-off-by: Alex Suraci <[email protected]>
@vito

vito commented Jun 3, 2025

Copy link
Copy Markdown
Contributor Author

Fixed up all the points raised - gonna go ahead and merge to unblock the errors PR! Can address any further feedback there.

@vito
vito merged commit 4c8515c into dagger:main Jun 3, 2025
eunomie added a commit to eunomie/dagger that referenced this pull request Sep 1, 2025
load runtime trace has been removed in dagger#10468 so removed it again,
and remove the corresponding one for type defs

Signed-off-by: Yves Brissaud <[email protected]>
eunomie added a commit to eunomie/dagger that referenced this pull request Sep 1, 2025
load runtime trace has been removed in dagger#10468 so removed it again,
and remove the corresponding one for type defs

Signed-off-by: Yves Brissaud <[email protected]>
eunomie added a commit to eunomie/dagger that referenced this pull request Sep 11, 2025
load runtime trace has been removed in dagger#10468 so removed it again,
and remove the corresponding one for type defs

Signed-off-by: Yves Brissaud <[email protected]>
eunomie added a commit to eunomie/dagger that referenced this pull request Sep 12, 2025
load runtime trace has been removed in dagger#10468 so removed it again,
and remove the corresponding one for type defs

Signed-off-by: Yves Brissaud <[email protected]>
eunomie added a commit to eunomie/dagger that referenced this pull request Sep 12, 2025
load runtime trace has been removed in dagger#10468 so removed it again,
and remove the corresponding one for type defs

Signed-off-by: Yves Brissaud <[email protected]>
eunomie added a commit to eunomie/dagger that referenced this pull request Sep 12, 2025
load runtime trace has been removed in dagger#10468 so removed it again,
and remove the corresponding one for type defs

Signed-off-by: Yves Brissaud <[email protected]>
eunomie added a commit to eunomie/dagger that referenced this pull request Sep 15, 2025
load runtime trace has been removed in dagger#10468 so removed it again,
and remove the corresponding one for type defs

Signed-off-by: Yves Brissaud <[email protected]>
eunomie added a commit to eunomie/dagger that referenced this pull request Sep 17, 2025
load runtime trace has been removed in dagger#10468 so removed it again,
and remove the corresponding one for type defs

Signed-off-by: Yves Brissaud <[email protected]>
eunomie added a commit to eunomie/dagger that referenced this pull request Sep 17, 2025
load runtime trace has been removed in dagger#10468 so removed it again,
and remove the corresponding one for type defs

Signed-off-by: Yves Brissaud <[email protected]>
eunomie added a commit to eunomie/dagger that referenced this pull request Sep 23, 2025
load runtime trace has been removed in dagger#10468 so removed it again,
and remove the corresponding one for type defs

Signed-off-by: Yves Brissaud <[email protected]>
eunomie added a commit to eunomie/dagger that referenced this pull request Sep 26, 2025
load runtime trace has been removed in dagger#10468 so removed it again,
and remove the corresponding one for type defs

Signed-off-by: Yves Brissaud <[email protected]>
eunomie added a commit to eunomie/dagger that referenced this pull request Sep 29, 2025
load runtime trace has been removed in dagger#10468 so removed it again,
and remove the corresponding one for type defs

Signed-off-by: Yves Brissaud <[email protected]>
eunomie added a commit to eunomie/dagger that referenced this pull request Sep 30, 2025
load runtime trace has been removed in dagger#10468 so removed it again,
and remove the corresponding one for type defs

Signed-off-by: Yves Brissaud <[email protected]>
eunomie added a commit to eunomie/dagger that referenced this pull request Sep 30, 2025
load runtime trace has been removed in dagger#10468 so removed it again,
and remove the corresponding one for type defs

Signed-off-by: Yves Brissaud <[email protected]>
eunomie added a commit to eunomie/dagger that referenced this pull request Oct 3, 2025
load runtime trace has been removed in dagger#10468 so removed it again,
and remove the corresponding one for type defs

Signed-off-by: Yves Brissaud <[email protected]>
eunomie added a commit to eunomie/dagger that referenced this pull request Oct 6, 2025
load runtime trace has been removed in dagger#10468 so removed it again,
and remove the corresponding one for type defs

Signed-off-by: Yves Brissaud <[email protected]>
eunomie added a commit to eunomie/dagger that referenced this pull request Oct 7, 2025
load runtime trace has been removed in dagger#10468 so removed it again,
and remove the corresponding one for type defs

Signed-off-by: Yves Brissaud <[email protected]>
eunomie added a commit to eunomie/dagger that referenced this pull request Oct 8, 2025
load runtime trace has been removed in dagger#10468 so removed it again,
and remove the corresponding one for type defs

Signed-off-by: Yves Brissaud <[email protected]>
eunomie added a commit to eunomie/dagger that referenced this pull request Oct 13, 2025
load runtime trace has been removed in dagger#10468 so removed it again,
and remove the corresponding one for type defs

Signed-off-by: Yves Brissaud <[email protected]>
eunomie added a commit to eunomie/dagger that referenced this pull request Oct 14, 2025
load runtime trace has been removed in dagger#10468 so removed it again,
and remove the corresponding one for type defs

Signed-off-by: Yves Brissaud <[email protected]>
eunomie added a commit to eunomie/dagger that referenced this pull request Oct 14, 2025
load runtime trace has been removed in dagger#10468 so removed it again,
and remove the corresponding one for type defs

Signed-off-by: Yves Brissaud <[email protected]>
eunomie added a commit that referenced this pull request Oct 15, 2025
* sdk/go: implement moduleTypeDefs

Go SDK now has a moduleTypeDefs method that is dedicated to return
types exposed by the module.

The `moduleTypeDefs` is similar to `moduleRuntime` but the generated
entrypoint only contains the types and not the invocation code.

Codegen contains a new flag `--typedefs-only` to only generate the
part related to types.

Other than this flag, one change in the codegen is a `register` function
is created to handle the management of the types. `invoke` function
will call `register` when the parent name is empty.
And basically when `--typedefs-only` is set, the invoke function is not
created but the `register` is and is called instead of `invoke`.

Signed-off-by: Yves Brissaud <[email protected]>

* core: allow to define a moduleTypeDefs function

This is an optional new entry point on the module SDK.
It's designed to perform the type definition from the module like
the actual moduleRuntime when an empty string is passed as argument.

If the function doesn't exist, the moduleRuntime is used instead.

But this allows to decouple both of them so we can registry types
of a module without the runnable module itself because to build it
needs the types defined by the module

Signed-off-by: Yves Brissaud <[email protected]>

* core: call moduleTypeDefs to get module types

Use `moduleTypeDefs` instead of `moduleRuntime` if available.
Cache the runtime as expected if `moduleTypeDefs` has been called.

Signed-off-by: Yves Brissaud <[email protected]>

* feat: allow module to self call itself

Signed-off-by: Yves Brissaud <[email protected]>

* feat: allow to define typedefs without container

Signed-off-by: Yves Brissaud <[email protected]>

* feat: load/unload typedefs as JSON

Signed-off-by: Yves Brissaud <[email protected]>

* expose module JSON features on SDK

add tests

Signed-off-by: Yves Brissaud <[email protected]>

* handle type defs for Go SDK

Signed-off-by: Yves Brissaud <[email protected]>

* ref: remove old implementation and rename moduleTypeDefs

Signed-off-by: Yves Brissaud <[email protected]>

* fix socket not found error

If the module runtime is not used for types, sync it so it's
available for the next phases of execution.

Signed-off-by: Yves Brissaud <[email protected]>

* fix: constructor was not unmarshalled

And this caused an issue where constructors for SDK (but also other constructors)
were not callabled.

Also be sure the constructor function name is set to an empty string
using typedef function, like when using the one exposed on the schema.

Signed-off-by: Yves Brissaud <[email protected]>

* chore: rebase codegen and update code to the new architecture

Signed-off-by: Tom Chauveau <[email protected]>

* chore: fix config fetch in generate_typedef that was initializing client connection

Signed-off-by: Tom Chauveau <[email protected]>

* chore: merge moduleConfig and typedefConfig

Signed-off-by: Tom Chauveau <[email protected]>

* fix: allow to dagger init a go module with self types

In case of an empty module during the typedefs phase, generate
the default template so that types from this template are returned
and will be handled by codegen. That way, with a `dagger init --sdk=go`
the types of this "empty" module are available from the start and don't
require a `dagger develop` to be available.

This also adds the introspection schema json file to the typedefs
function of the generator. This allows to generate enough code
so that the module initialisation can correctly load the packages
and types and generates the right types.

Signed-off-by: Yves Brissaud <[email protected]>

* use generated go client code

To get the type defs, we don't need anything else than the core types
as dependencies cannot be part of the function signature.
By using the already generated client code, this speeds up time to
dagger init by 0.5s

Signed-off-by: Yves Brissaud <[email protected]>

* refresh generated files

Signed-off-by: Yves Brissaud <[email protected]>

* add python support

Signed-off-by: Helder Correia <[email protected]>

* lint sdk/python/runtime/main.go

Signed-off-by: Yves Brissaud <[email protected]>

* lint code

Signed-off-by: Yves Brissaud <[email protected]>

* feat: add typescript implementation

Signed-off-by: Tom Chauveau <[email protected]>

* allow to enable/disable self calls per module

In `dagger.json` add the configuration as following:

    {
      "sdk": {
        "source": "go",
        "experimental": {
          "self-calls": true
        }
      }
    }

Signed-off-by: Yves Brissaud <[email protected]>

* extend modulesource api to enable experimental features

Signed-off-by: Yves Brissaud <[email protected]>

* fix python sdk to be backward compatible

Allow python modules to work with or without self calls
experimental feature enabled.

Signed-off-by: Yves Brissaud <[email protected]>

* ignore generated.postcommands on Go typedefs

They are required in order to generate the runnable code, but
not to just get the type signatures.
So this avoid to run multiple times things like go mod tidy.

Signed-off-by: Yves Brissaud <[email protected]>

* feat: add experimental flag to dagger init

    dagger init --sdk=go --experimental=self-cals my-module

Signed-off-by: Yves Brissaud <[email protected]>

* ref: remove json serialization for modules

Signed-off-by: Yves Brissaud <[email protected]>

* add flags to dagger develop

Signed-off-by: Yves Brissaud <[email protected]>

* fix typescript init --with-self-calls

When running

    dagger init --sdk=typescript --with-self-calls my-module

there is no user code. So the template needs to be added.

This was donc in codegen phase, but now this is required for moduleTypeDefs
phase.

Extract the logic to add the init template and call it also inside ModuleTypeDefs
function.

Signed-off-by: Yves Brissaud <[email protected]>

* fix clients

`sdk.Self().SDKImpl.AsRuntime()` failed because
`sdk.Self().SDKImpl` was `nil`.
In case of a client use, this is fine. This addition was made
for modules.
Move the AsRuntime where it's needed only.

Signed-off-by: Yves Brissaud <[email protected]>

* add changie info

Signed-off-by: Yves Brissaud <[email protected]>

* tests: self calls

Test Go, Python and Typescript SDK ability to self call

Signed-off-by: Yves Brissaud <[email protected]>

* fix sdk/dotnet: list of enum

List of enums were not supported.
The new functions on moduleSource (withExperimentalFeatures and withoutExperimentalFeatures)
both take a list of enum values as argument.
This caused the code generator of the .Net SDK to fail.

Signed-off-by: Yves Brissaud <[email protected]>

* fix: remove unnecessary alias for ModuleSourceExperimentalFeature enum

Signed-off-by: Yves Brissaud <[email protected]>

* ref: move creation of dagger connection in getGlobalConfig

Connection is necessary for typedefs, and can be used by others

Signed-off-by: Yves Brissaud <[email protected]>

* fix: small nits from review

Signed-off-by: Yves Brissaud <[email protected]>

* ref: improve visitor for go codegen

Signed-off-by: Yves Brissaud <[email protected]>

* ref: extract SDK interface for typedefs

Signed-off-by: Yves Brissaud <[email protected]>

* ref: rename TypeDefObject functions to TypeDef

Signed-off-by: Yves Brissaud <[email protected]>

* test: enums with self call enabled

Signed-off-by: Yves Brissaud <[email protected]>

* fix: add introspection json so that enum can be handled

Signed-off-by: Yves Brissaud <[email protected]>

* ref(sdk/go): extract typedefs file name in const and pass it to codegen

Signed-off-by: Yves Brissaud <[email protected]>

* fix: reduce verbosity

load runtime trace has been removed in #10468 so removed it again,
and remove the corresponding one for type defs

Signed-off-by: Yves Brissaud <[email protected]>

* chore: make typescript typedef output path settable from inside SDK env variable

Signed-off-by: Tom Chauveau <[email protected]>

* ref: split moduleTypeDefs and self calls

In case `moduleTypeDefs` exists in the SDK, use it to get the module's
types. But if the self calls experimental flags, simply replace the
previous moduleRuntime call, do not use the results as its own dependency.

This allows to remove the previous duplication between TypeDefCode and TypeDef
in go codegen for instance, and to benefit from the moduleTypeDefs work
without the self calls that needs more work to be ready for all cases.

Signed-off-by: Yves Brissaud <[email protected]>

* ref: rename moduleTypeDefs to moduleDefs

Signed-off-by: Yves Brissaud <[email protected]>

* test: update tests using custom sdk

Signed-off-by: Yves Brissaud <[email protected]>

* chore: removing enum tests with self calls

until we are able to fix them

Signed-off-by: Yves Brissaud <[email protected]>

* chore: ensure codegen will be done when generating type defs

Signed-off-by: Yves Brissaud <[email protected]>

* fix: sourcemaps and enums for go and typescript

Bump typescript SDK Dagger version to ensure it's using
    withEnumMember
without to fallback to
    withEnumValue
because the version (0.16) was too old.

Signed-off-by: Yves Brissaud <[email protected]>

* fix: update CoolSdk to support ModuleDefs

CoolSdk is used as a wrapper on top of the Go SDK. As the Go SDK
now implements ModuleDefs, the CoolSdk needs to also do it to properly
wrap the Go SDK.

Signed-off-by: Yves Brissaud <[email protected]>

* fix: use current dag server

Signed-off-by: Yves Brissaud <[email protected]>

* ref: use a container for ModuleDefs implementation

This will allow to control how the WithExec call is made, especially
this will allow to inject the module information during the call.
But this needs to happen from the engine, not from the SDKs.

To inject module data will allow to set the right engine version
at a moment the module is still not yet loaded.

Signed-off-by: Yves Brissaud <[email protected]>

* fix: cool sdk again, due to module interface changes

Signed-off-by: Yves Brissaud <[email protected]>

* test: update sha of repo for ssh tests

shared cool-sdk updated with new moduleDefs function

Signed-off-by: Yves Brissaud <[email protected]>

* fix: python moduleDefs implementation

Always codegen. This is the only way, with the actual implementation,
to have access to the SDK for instance.

The test is wrapping the Python SDK, in a module written in Python.
The code is calling dag.PythonSDK. But this module exists only because it
has been loaded, it's not part of the default core types.
This shouldn't be an issue, except the way the Python SDK works
is moduleDefs is using moduleRuntime container.

The ultimate solution is to cut the link between moduleDefs and moduleRuntime,
to have better performances, but in the meantime this can be a solution.

Signed-off-by: Yves Brissaud <[email protected]>

* chore: rm duplication of code initializing container runtime

Signed-off-by: Yves Brissaud <[email protected]>

* ref: rename moduleDefs to moduleTypes

Signed-off-by: Yves Brissaud <[email protected]>

* ref: use new function to get instrospection schema json

Signed-off-by: Yves Brissaud <[email protected]>

* chore: disable moduleTypes behavior for ts and python SDKs

Currently performances are not good enough and those SDKs require
a bit more work.
In order to unblock the PR and allow to merge it, just remove the moduleTypes
functions for those SDKs so that they are not affected and they will be
added back in dedicated PRs.

The moduleTypes function has been renamed to moduleTypesExp for both SDKs
so it's still exposed and can be calles manually to help fix it,
but the engine is not seeing it anymore.

Signed-off-by: Yves Brissaud <[email protected]>

---------

Signed-off-by: Yves Brissaud <[email protected]>
Signed-off-by: Yves Brissaud <[email protected]>
Signed-off-by: Tom Chauveau <[email protected]>
Signed-off-by: Helder Correia <[email protected]>
Co-authored-by: Tom Chauveau <[email protected]>
Co-authored-by: Helder Correia <[email protected]>
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.

3 participants