Skip to content

Commit

Permalink
More implementations and reworking
Browse files Browse the repository at this point in the history
  • Loading branch information
cretz committed Jan 11, 2024
1 parent 4e34c90 commit c4b1ff6
Show file tree
Hide file tree
Showing 23 changed files with 2,167 additions and 968 deletions.
42 changes: 33 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
(under development)

To regen command code:

```
go run ./temporalcli/internal/cmd/gen-commands
```

Known incompatibilities:

NOTE: All of these incompatibilities are intentional and almost all decisions can be reverted if decided.
Expand All @@ -14,16 +20,27 @@ NOTE: All of these incompatibilities are intentional and almost all decisions ca
* `--tls-ca-path` cannot be a URL
* Not explicitly setting TLS SNI name from host of URL
* JSON output for things like workflow start use more JSON-like field names
* Workflow history JSON not dumped as part of `workflow execute` when JSON set
* Workflow history JSON not dumped by default as part of `workflow execute` when JSON set
* Concept of `--fields long` is gone, now whether some more verbose fields are emitted is controlled more specifically
* To get accurate workflow result, workflow follows runs for `workflow execute`
* To get accurate workflow result, workflow follows continue as new for `workflow execute`
* Removed the `-f` alias for `--follow` on `workflow show`
* `server start-dev` will reuse the root logger which means:
* Default is text (or "pretty") instead JSON
* No way to set level to "fatal" only
* All panic and fatal logs are just error logs
* Goes to stderr instead of stdout
* `server start-dev --db-filename` no longer auto-creates directory path of 0777 dirs if not present
* `workflow execute` when using `--event-details` (equivalent of `--fields long`) now shows full proto JSON attributes
instead of wrapped partial table
* `workflow start` and `workflow execute` no longer succeeds by default if the workflow exists already, but
`--allow-existing` exists
* The text version of `workflow describe` does not have all the things the JSON version does (and in the past there was
only JSON)
* `workflow list` in JSON now does one object at a time instead of before where it was 100 objects at a time
* `workflow list` in text now does a page at a time before realigning table (sans headers) instead of 100 at a time
* `workflow list` in text no longer includes `--fields long`
* Removed `--context-timeout` since it is confusing when you might want to customize it (can re-add timeout concepts if
needed)

Known improvements:

Expand All @@ -35,10 +52,13 @@ Known improvements:
* Solid test framework
* Added `--input-encoding` to support more payload types (e.g. can support proto JSON and even proto binary)
* Library available for docs team to write doc generator with
* Only log or data content written, so disabling log means all data could be consumed with JSON tooling
* JSON output is reasonable for tool use
* Properly gives failing status code if workflow fails on "execute" but JSON output is set
* `--color` is available to disable any coloring
* Dev server reuses logger meaning it is on stderr by default
* `workflow execute` now streams the event table instead of waiting
* Use shorthand JSON payloads by default on (non-history) JSON output which makes payloads much more readable
* `workflow describe` now doesn't force users to see JSON, there is a non-JSON text form

Notes about approach taken:

Expand All @@ -47,6 +67,7 @@ Notes about approach taken:
* Did not spend (much) time trying to completely change behavior or commands
* Compatibility intentionally retained in most reasonable ways
* File-level copyright notices retained on places with DataDog
* Expecting better formatting to come later

Contribution rules:

Expand All @@ -55,16 +76,19 @@ Contribution rules:
* Avoid package sprawl and complication
* Try to only use logger and printer for output
* Command testing (does not apply to unit tests that are not testing commands)
* Use the command harness (create a new one for each different option if needed)
* Name command tests as `Test<CamelCaseCommand>_<Qualifier>`, e.g. a simple "temporal server start dev" test may be
named `TestServerStartDev_Simple`. Can test multiple subcommands at once and `CamelCaseCommand` can just be the
parent, e.g. a simple test of different "temporal env" commands may be named `TestEnv_Simple`.
* Use the command harness (create a new one for each different option if needed) if server not needed, or add new test
to `SharedServerSuite` if server needed
* Name command tests as `Test<CamelCaseCommand>[_<CamelCaseSubCommand>]_<Qualifier>`, e.g. a simple
"temporal server start dev" test may be named `TestServer_StartDev_Simple`. Can test multiple subcommands at once
and `CamelCaseCommand` can just be the parent, e.g. a simple test of different "temporal env" commands may be named
`TestEnv_Simple`. Often the `Qualifier` is just `Simple`.

TODO:

* Version via goreleaser
* "card" output?
* Env variables
* Workflow show max-field-length?
* Workflow start delay: https://github.com/temporalio/cli/pull/402
* Enhance task queue describe: https://github.com/temporalio/cli/pull/399
* Enhance task queue describe: https://github.com/temporalio/cli/pull/399
* Consider having a common dev-server suite for sharing a common dev server across several tests
* Show result in `workflow describe` the same way it's shown in `workflow execute`
13 changes: 0 additions & 13 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ require (
github.com/olekukonko/tablewriter v0.0.5
github.com/spf13/cobra v1.8.0
github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.17.0
github.com/stretchr/testify v1.8.4
github.com/temporalio/ui-server/v2 v2.21.3
go.temporal.io/api v1.26.2-0.20231129165614-630d88440548
Expand Down Expand Up @@ -40,7 +39,6 @@ require (
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect
github.com/facebookgo/clock v0.0.0-20150410010913-600d898af40a // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/go-logr/logr v1.2.4 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-sql-driver/mysql v1.5.0 // indirect
Expand All @@ -59,7 +57,6 @@ require (
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.18.1 // indirect
github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/iancoleman/strcase v0.3.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect
Expand All @@ -72,16 +69,13 @@ require (
github.com/labstack/echo/v4 v4.9.1 // indirect
github.com/labstack/gommon v0.4.0 // indirect
github.com/lib/pq v1.10.9 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-runewidth v0.0.14 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/olivere/elastic/v7 v7.0.32 // indirect
github.com/opentracing/opentracing-go v1.2.0 // indirect
github.com/pborman/uuid v1.2.1 // indirect
github.com/pelletier/go-toml/v2 v2.1.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/prometheus/client_golang v1.16.0 // indirect
Expand All @@ -93,14 +87,8 @@ require (
github.com/rivo/uniseg v0.4.4 // indirect
github.com/robfig/cron v1.2.0 // indirect
github.com/robfig/cron/v3 v3.0.1 // indirect
github.com/sagikazarmark/locafero v0.3.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/sourcegraph/conc v0.3.0 // indirect
github.com/spf13/afero v1.10.0 // indirect
github.com/spf13/cast v1.5.1 // indirect
github.com/stretchr/objx v0.5.0 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
github.com/temporalio/ringpop-go v0.0.0-20230606200434-b5c079f412d3 // indirect
github.com/temporalio/sqlparser v0.0.0-20231115171017-f4060bcfa6cb // indirect
github.com/temporalio/tchannel-go v1.22.1-0.20231116015023-bd4fb7678499 // indirect
Expand Down Expand Up @@ -145,7 +133,6 @@ require (
google.golang.org/genproto/googleapis/api v0.0.0-20231127180814-3a041ad873d4 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20231127180814-3a041ad873d4 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/square/go-jose.v2 v2.6.0 // indirect
gopkg.in/validator.v2 v2.0.1 // indirect
lukechampine.com/uint128 v1.3.0 // indirect
Expand Down
Loading

0 comments on commit c4b1ff6

Please sign in to comment.