From 106d9839813e7e77872fcc502104dfc1bc2ca1e3 Mon Sep 17 00:00:00 2001 From: Feiyang Xie Date: Tue, 27 Oct 2026 12:34:40 -0700 Subject: [PATCH 01/13] feat: add Workflow and Schedule time-skipping CLI commands --- go.mod | 4 +- go.sum | 118 ++++++-- internal/temporalcli/commands.gen.go | 256 ++++++++++++++++++ internal/temporalcli/commands.schedule.go | 211 ++++++++++++++- .../commands.schedule_internal_test.go | 85 ++++++ .../commands.workflow_time_skipping.go | 138 ++++++++++ ...ds.workflow_time_skipping_internal_test.go | 50 ++++ .../temporalcli/commands.workflow_view.go | 5 + internal/temporalcli/commands.yaml | 175 ++++++++++++ 9 files changed, 1011 insertions(+), 31 deletions(-) create mode 100644 internal/temporalcli/commands.schedule_internal_test.go create mode 100644 internal/temporalcli/commands.workflow_time_skipping.go create mode 100644 internal/temporalcli/commands.workflow_time_skipping_internal_test.go diff --git a/go.mod b/go.mod index 0fba24bd3..e6936f0a1 100644 --- a/go.mod +++ b/go.mod @@ -18,9 +18,9 @@ require ( github.com/temporalio/cli/cliext v0.0.0 github.com/temporalio/ui-server/v2 v2.56.4 go.temporal.io/api v1.64.1-0.20261030195137-01272cbd37c9 - go.temporal.io/sdk v1.49.0 + go.temporal.io/sdk v1.49.1-0.20261021203027-733b3b459a02 go.temporal.io/sdk/contrib/envconfig v1.1.0 - go.temporal.io/server v1.33.0-166.3 + go.temporal.io/server v1.29.0-135.0.0.20261027191414-bf81a4c20009 golang.org/x/exp v0.0.0-20260611194520-c48552f49976 golang.org/x/mod v0.41.0 golang.org/x/term v0.47.0 diff --git a/go.sum b/go.sum index 97ffb93a4..f5d4d8eac 100644 --- a/go.sum +++ b/go.sum @@ -29,6 +29,8 @@ filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4 filippo.io/edwards25519 v1.2.0 h1:crnVqOiS4jqYleHd9vaKZ+HKtHfllngJIiOpNpoJsjo= filippo.io/edwards25519 v1.2.0/go.mod h1:xzAOLCNug/yB62zG1bQ8uziwrIqIuxhctzJT18Q77mc= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/BurntSushi/toml v1.4.0 h1:kuoIxZQy2WRRk1pttg9asf+WVv6tWQuBNVmK8+nqPr0= +github.com/BurntSushi/toml v1.4.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= github.com/BurntSushi/toml v1.6.0 h1:dRaEfpa2VI55EwlIW72hMRHdWouJeRF7TPYhI+AUQjk= github.com/BurntSushi/toml v1.6.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= @@ -160,6 +162,8 @@ github.com/facebookgo/clock v0.0.0-20150410010913-600d898af40a h1:yDWHCSQ40h88yi github.com/facebookgo/clock v0.0.0-20150410010913-600d898af40a/go.mod h1:7Ga40egUymuWXxAe151lTNnCv97MddSOVsjpPPkityA= github.com/fatih/color v1.19.0 h1:Zp3PiM21/9Ld6FzSKyL5c/BULoe/ONr9KlbYVOfG8+w= github.com/fatih/color v1.19.0/go.mod h1:zNk67I0ZUT1bEGsSGyCZYZNrHuTkJJB+r6Q9VuMi0LE= +github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= +github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/felixge/httpsnoop v1.1.0 h1:3YtUj32ZZkqZtt3sZZsClsymw/QDuVfpNhoA31zeORc= github.com/felixge/httpsnoop v1.1.0/go.mod h1:Zqxgdd+1Rkcz8euOqdr7lqgCRJztwr5hp9vDSi5UZCE= github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k= @@ -172,6 +176,8 @@ github.com/fxamacker/cbor/v2 v2.9.1/go.mod h1:vM4b+DJCtHn+zz7h3FFp/hDAI9WNWCsZj2 github.com/go-faker/faker/v4 v4.7.0 h1:VboC02cXHl/NuQh5lM2W8b87yp4iFXIu59x4w0RZi4E= github.com/go-faker/faker/v4 v4.7.0/go.mod h1:u1dIRP5neLB6kTzgyVjdBOV5R1uP7BdxkcWk7tiKQXk= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= +github.com/go-jose/go-jose/v4 v4.1.4 h1:moDMcTHmvE6Groj34emNPLs/qtYXRVcd6S7NHbHz3kA= +github.com/go-jose/go-jose/v4 v4.1.4/go.mod h1:x4oUasVrzR7071A4TnHLGSPpNOm2a21K9Kf04k1rs08= github.com/go-jose/go-jose/v4 v4.1.6 h1:sNRkftxFJxwsILiQukqp5z83QBSmntVwmgRY7AqBDO4= github.com/go-jose/go-jose/v4 v4.1.6/go.mod h1:x4oUasVrzR7071A4TnHLGSPpNOm2a21K9Kf04k1rs08= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= @@ -181,30 +187,56 @@ github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-openapi/jsonpointer v1.0.0 h1:kR9tHqY0CtZaOPVFm622dPVNhrvYpwr4uCxgL3h1H8s= github.com/go-openapi/jsonpointer v1.0.0/go.mod h1:Z3rw7dWu1p9IgitXCFamSlA5lmDiklEB6vkaxcNZW5Y= +github.com/go-openapi/jsonreference v0.21.5 h1:6uCGVXU/aNF13AQNggxfysJ+5ZcU4nEAe+pJyVWRdiE= +github.com/go-openapi/jsonreference v0.21.5/go.mod h1:u25Bw85sX4E2jzFodh1FOKMTZLcfifd1Q+iKKOUxExw= github.com/go-openapi/jsonreference v1.0.0 h1:jlmTr6torcd1YgDQvSfNmRtKzYDO4FGBkrAdlAVWnpY= github.com/go-openapi/jsonreference v1.0.0/go.mod h1:jtwdyGbJk0Xhe5Y+rwtglQP6Sb1WZST4rT32LWB+sv0= +github.com/go-openapi/swag v0.27.1 h1:VotvOLWW8q/EAxB0YdsBBGC8XYyeL1YwBj2ungAGPNg= +github.com/go-openapi/swag v0.27.1/go.mod h1:GTkJPwHfhJp6MWr4/rCh64HVI3Ofu+tcsbfjfHmTxpE= github.com/go-openapi/swag v0.28.0 h1:xkgbOSKj6DZziNpyqRRAOt3GJGtgjgsd2RoyT30VWuw= github.com/go-openapi/swag v0.28.0/go.mod h1:4qYnT3Cqr1p1VknOdPo70evN4rgQnAg6jwApHyxSGIg= +github.com/go-openapi/swag/cmdutils v0.27.1 h1:I7sYqaWVl5mq0NEmNQkAmFDyNin9ufvMX/p2zwtQaOE= +github.com/go-openapi/swag/cmdutils v0.27.1/go.mod h1:Sm1MVFMkF6guJJ+pQqHnQA3N0j9qALV3NxzDSv6bETM= github.com/go-openapi/swag/cmdutils v0.28.0 h1:7TOeNtkYru1SG8Y34tDh9WBbLsMqGnptuxWiHREPZ4Q= github.com/go-openapi/swag/cmdutils v0.28.0/go.mod h1:Sm1MVFMkF6guJJ+pQqHnQA3N0j9qALV3NxzDSv6bETM= +github.com/go-openapi/swag/conv v0.27.1 h1:8wi9ZG+olmY1wXphl93EWniPtbSPkXM/feH7FgjsvrU= +github.com/go-openapi/swag/conv v0.27.1/go.mod h1:QbqMivkpKhC3g1B1GGGOJ6ANewI3S62dbzYu3Duowqs= github.com/go-openapi/swag/conv v0.28.0 h1:GtqqbyFe7vR5Y7ehxG9W6/OvrSFdf1OLeTGp40TqxH8= github.com/go-openapi/swag/conv v0.28.0/go.mod h1:mbUE+mzctnhxi864m0Q07SpN8OowD9JhxmxuYvZZD/k= +github.com/go-openapi/swag/fileutils v0.27.1 h1:QQqBSoi5mW4XpU85nS0mLcA+zAE6vLzrb0QkmLKf9oM= +github.com/go-openapi/swag/fileutils v0.27.1/go.mod h1:VvJFZLTZS0AI854gEQz5tk7dBESdLjiNUMSZ/th2ry8= github.com/go-openapi/swag/fileutils v0.28.0 h1:Z04XWQD7R8Eq+7GnOrjovBxPPmZzsS4gt2H2GPGIViU= github.com/go-openapi/swag/fileutils v0.28.0/go.mod h1:VvJFZLTZS0AI854gEQz5tk7dBESdLjiNUMSZ/th2ry8= +github.com/go-openapi/swag/jsonutils v0.27.1 h1:SVgK3i4USzCU5mibOOS/l4ea2h9UQXy7J7RNLTjuXjU= +github.com/go-openapi/swag/jsonutils v0.27.1/go.mod h1:tdlEpZqdcQ17uj6J4YdK9vd8It5qWMwjWXOs0tjpRlk= github.com/go-openapi/swag/jsonutils v0.28.0 h1:YIch6FwO7RXzeAnbO8Tu7dWBZeUEH+4nA0HXltVTnv4= github.com/go-openapi/swag/jsonutils v0.28.0/go.mod h1:CYM3WlTUcagR2ZoHdz54di/cbBqt82tuxuXgAjxw+mg= +github.com/go-openapi/swag/loading v0.27.1 h1:/DxUgDXKbBX4bcn7r9uEXfJyzN5XpiJmZplzQTjrRCY= +github.com/go-openapi/swag/loading v0.27.1/go.mod h1:jvGh3iA2+zyUUycB5fgJWzeHnhrpvGnJJM0RVE9ZShE= github.com/go-openapi/swag/loading v0.28.0 h1:td8QZdZC9MIYGGSnSPKShKiK22I2tU5UQvuUhIBPRLU= github.com/go-openapi/swag/loading v0.28.0/go.mod h1:rXB0QiQX5mMveXEA7ouM4KiiM9jVJe4K6BVbwhD1M4k= +github.com/go-openapi/swag/mangling v0.27.1 h1:yC9D0HyUE8gbP+BfmGx9+AA89ikwZTMjESK3OnnoaqA= +github.com/go-openapi/swag/mangling v0.27.1/go.mod h1:jtBE2+V+3pILxOR7Vgce+Cwp6A2PgZbvVqfNntbVs0w= github.com/go-openapi/swag/mangling v0.28.0 h1:pH8eyeNO9SLYsTMWJrurnNfKmDa28XrlA+HePVD53VM= github.com/go-openapi/swag/mangling v0.28.0/go.mod h1:jtBE2+V+3pILxOR7Vgce+Cwp6A2PgZbvVqfNntbVs0w= +github.com/go-openapi/swag/netutils v0.27.1 h1:mICMFoS82F5TZ4Zy3cqmcQk+BFeCp3Uyq3Np7GI0/qU= +github.com/go-openapi/swag/netutils v0.27.1/go.mod h1:J+WYyFMLtvtCGqa6jLv+YNUmIKI3ZRQRrvfNDMoQoEQ= github.com/go-openapi/swag/netutils v0.28.0 h1:YXN6TALEi2pzts8/8GNm6T61HTAZsieukGZidap989k= github.com/go-openapi/swag/netutils v0.28.0/go.mod h1:J+WYyFMLtvtCGqa6jLv+YNUmIKI3ZRQRrvfNDMoQoEQ= +github.com/go-openapi/swag/pools v0.27.1 h1:9LeadcMyb2GJCbXX5hVQDbZ2Lq9TL4dCs/nx1j5DO0E= +github.com/go-openapi/swag/pools v0.27.1/go.mod h1:kVQefhSK5RWuRe7BXsL8htgBPAMpN7HDGpGEknqugeE= github.com/go-openapi/swag/pools v0.28.0 h1:HPMZWSAfce3rdVTFcjFiCIBtDg9h4x2QlRrHipwhxeU= github.com/go-openapi/swag/pools v0.28.0/go.mod h1:kVQefhSK5RWuRe7BXsL8htgBPAMpN7HDGpGEknqugeE= +github.com/go-openapi/swag/stringutils v0.27.1 h1:ZXePZ0r2p1qSjo8tD3Un4vFj8+FqlCkczxDrJIhYUp8= +github.com/go-openapi/swag/stringutils v0.27.1/go.mod h1:lzRN95CxXmA03XcDWHLOb6nOMcxCqR5rGY0lOgsfRoM= github.com/go-openapi/swag/stringutils v0.28.0 h1:ixsc9iYgDPubHL/8nSkbnryEHpD2VRlBMLKpQyPXcDU= github.com/go-openapi/swag/stringutils v0.28.0/go.mod h1:lzRN95CxXmA03XcDWHLOb6nOMcxCqR5rGY0lOgsfRoM= +github.com/go-openapi/swag/typeutils v0.27.1 h1:KSTdFlfnse4r6dP9IrEnwMldjE+zs71UeEB3//PtVXc= +github.com/go-openapi/swag/typeutils v0.27.1/go.mod h1:Srm0xFNRZ1Y+vCxJclo5qzx8aj+1pAKda/YfFPrG0dQ= github.com/go-openapi/swag/typeutils v0.28.0 h1:nRBKSBXjDgf01VDPB3fWeD9nQuhCOVeIYAkUx2tbkyY= github.com/go-openapi/swag/typeutils v0.28.0/go.mod h1:Srm0xFNRZ1Y+vCxJclo5qzx8aj+1pAKda/YfFPrG0dQ= +github.com/go-openapi/swag/yamlutils v0.27.1 h1:ftxv6xvXb1E3zohUc+okZ9nSqNb9StQX/FXnKZ98sQA= +github.com/go-openapi/swag/yamlutils v0.27.1/go.mod h1:bnxFIB1qewGRiZHypXGZ3fNgf13/0HfRgnS/iZBDrOo= github.com/go-openapi/swag/yamlutils v0.28.0 h1:TV3JXH6DS46KUroDtMLAYHGkdWf5VDq3wVWFirmzROY= github.com/go-openapi/swag/yamlutils v0.28.0/go.mod h1:x0q/yndZHEgk9Rx3DyDqzFUmHy55KTvIZldvF2dTJXs= github.com/go-sql-driver/mysql v1.8.1/go.mod h1:wEBSXgmK//2ZFJyE+qWnIsVGmvmEKlqwuVSjsCm7DZg= @@ -225,6 +257,8 @@ github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6 github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v1.0.0 h1:Oy607GVXHs7RtbggtPBnr2RmDArIsAefDwvrdWvRhGs= github.com/golang/snappy v1.0.0/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/gomarkdown/markdown v0.0.0-20260411013819-759bbc3e3207 h1:p7t34F7K4OCRQblcDhNJnP46Uaarz3z2cLcvOZYxWn8= +github.com/gomarkdown/markdown v0.0.0-20260411013819-759bbc3e3207/go.mod h1:JDGcbDT52eL4fju3sZ4TeHGsQwhG9nbDV21aMyhwPoA= github.com/gomarkdown/markdown v0.0.0-20260724235538-61af6e1e6971 h1:Qoqh9ZuBuqoeWZSyTfv+n1lezKuAyMFMQzOewVvFFTo= github.com/gomarkdown/markdown v0.0.0-20260724235538-61af6e1e6971/go.mod h1:JDGcbDT52eL4fju3sZ4TeHGsQwhG9nbDV21aMyhwPoA= github.com/google/gnostic-models v0.7.1 h1:SisTfuFKJSKM5CPZkffwi6coztzzeYUhc3v4yxLWH8c= @@ -254,6 +288,8 @@ github.com/gorilla/securecookie v1.1.2 h1:YCIWL56dvtr73r6715mJs5ZvhtnY73hBvEF8kX github.com/gorilla/securecookie v1.1.2/go.mod h1:NfCASbcHqRSY+3a8tlWJwsQap2VX5pwzwo4h3eOamfo= github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.3 h1:B+8ClL/kCQkRiU82d9xajRPKYMrB7E0MbtzWVi1K4ns= github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.3/go.mod h1:NbCUVmiS4foBGBHOYlCT25+YmGpJ32dZPi75pGEUpj4= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.29.0 h1:5VipnvEpbqr2gA2VbM+nYVbkIF28c5ZQfqCBQ5g2xfk= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.29.0/go.mod h1:Hyl3n6Twe1hvtd9XUXDec4pTvgMSEixRuQKPTMH2bNs= github.com/grpc-ecosystem/grpc-gateway/v2 v2.30.0 h1:/Tnpcb2E0Pz/tN9s3bfEY2Q8ePCEX9iuS+cneUwncnw= github.com/grpc-ecosystem/grpc-gateway/v2 v2.30.0/go.mod h1:zOBXOsUaBSjKgmH4OGzV1esUpR3oUSCPYVd2cUBjKYY= github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed h1:5upAirOpQc1Q53c0bnx2ufif5kANL7bfZWcc6VJWJd8= @@ -287,6 +323,8 @@ github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHm github.com/jung-kurt/gofpdf v1.0.3-0.20190309125859-24315acbbda5/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/klauspost/compress v1.18.7 h1:aUyZsS4kH3QTKurYhAOwAHxllVPnOthb3vPfnF1Ehjw= +github.com/klauspost/compress v1.18.7/go.mod h1:cwPg85FWrGar70rWktvGQj8/hthj3wpl0PGDogxkrSQ= github.com/klauspost/compress v1.20.4 h1:dD0v/bvxtjCBqQu6sx1TNWkalEY5lNTIe+HY9w8TeNI= github.com/klauspost/compress v1.20.4/go.mod h1:LUdAzn7YLVvxLpc7y3V1m40wESHTgc1422pwwBSKYuI= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= @@ -300,6 +338,8 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= +github.com/labstack/echo/v4 v4.15.4 h1:DL45vVYa+BWE+XuW+zZNd9H0YEdZ80UAWJGcTVW4EVs= +github.com/labstack/echo/v4 v4.15.4/go.mod h1:CuMetKIRwsuO/qlAgMq+KTAalwGoB/h4tC+yPdrTj1g= github.com/labstack/echo/v4 v4.16.4 h1:sQ9yq/FgkY7zWZKaRIvNJAQ1ybWVJrm+z37SWI8keRY= github.com/labstack/echo/v4 v4.16.4/go.mod h1:V/EQaTVHYJH92QhbQe7kFQ4mjgcjxLQQUQtAN87zZdw= github.com/labstack/gommon v0.5.0 h1:6VSQ2NOzsnEJ5W6+84E0RbcaDDmgB6NIAzWCczTEe6c= @@ -315,9 +355,9 @@ github.com/mattn/go-colorable v0.1.15 h1:+u9SLTRGnXv73cEsnsmoZBom+dMU88B2M0aDcWy github.com/mattn/go-colorable v0.1.15/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8= github.com/mattn/go-isatty v0.0.23 h1:cYwCQTQf3HB6xUC+BtyCLZNr7IzbOmoZbmssVNzSyiQ= github.com/mattn/go-isatty v0.0.23/go.mod h1:nMCL3Zebbrt45jsMDgnfIwz6ydEQApk5oEI3HqDio6A= -github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/mattn/go-runewidth v0.0.23 h1:7ykA0T0jkPpzSvMS5i9uoNn2Xy3R383f9HDx3RybWcw= github.com/mattn/go-runewidth v0.0.23/go.mod h1:XBkDxAl56ILZc9knddidhrOlY5R/pDhgLpndooCuJAs= +github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/mattn/go-sqlite3 v1.14.22 h1:2gZY6PC6kBnID23Tichd1K+Z0oS6nE/XwU+Vz/5o4kU= github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= @@ -375,9 +415,9 @@ github.com/robfig/cron v1.2.0 h1:ZjScXvvxeQ63Dbyxy76Fj3AT3Ut0aKsyd2/tl3DTMuQ= github.com/robfig/cron v1.2.0/go.mod h1:JGuDeoQd7Z6yL4zQhZ3OPEVHB7fL6Ka6skscFHfmt2k= github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs= github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro= -github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= +github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/samuel/go-thrift v0.0.0-20190219015601-e8b6b52668fe/go.mod h1:Vrkh1pnjV9Bl8c3P9zH0/D4NlOHWP5d4/hF4YTULaec= github.com/shopspring/decimal v1.4.0 h1:bxl37RwXBklmTi0C79JfXCEBD1cqqHt0bbgBAGFp81k= @@ -392,29 +432,33 @@ github.com/spf13/cast v1.10.0 h1:h2x0u2shc1QuLHfxi+cTJvs30+ZAHOGRic8uyGTDWxY= github.com/spf13/cast v1.10.0/go.mod h1:jNfB8QC9IA6ZuY2ZjDp0KtFO2LZZlg4S/7bzP6qqeHo= github.com/spf13/cobra v1.10.2 h1:DMTTonx5m65Ic0GOoRY2c16WCbHxOOw6xxezuLaBpcU= github.com/spf13/cobra v1.10.2/go.mod h1:7C1pvHqHw5A4vrJfjNwvOdzYu0Gml16OCs2GRiTUUS4= -github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk= github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spiffe/go-spiffe/v2 v2.7.0 h1:uXe1MflJoHw58wAUvxVlcM7WpKtijWG7I1UidcGh6g4= github.com/spiffe/go-spiffe/v2 v2.7.0/go.mod h1:47Q0Q9/AqGha8QLHp+kxpH4Wca7X7EnOtlIJy3mxZ3U= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.5.3 h1:jmXUvGomnU1o3W/V5h2VEradbpJDwGrzugQQvL0POH4= github.com/stretchr/objx v0.5.3/go.mod h1:rDQraq+vQZU7Fde9LOZLr8Tax6zZvy4kuNKF+QYS+U0= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= -github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= +github.com/temporalio/ringpop-go v0.1.1 h1:2V4wwgWrA+99cyvrhkFs8hvj2DaqQmJ68sG28gic6f0= +github.com/temporalio/ringpop-go v0.1.1/go.mod h1:RE+CHmY+kOZQk47AQaVzwrGmxpflnLgTd6EOK0853j4= github.com/temporalio/ringpop-go v0.1.3 h1:DbjgzTIpXrTJ5qCvQh7r+q4OM23Asy1CNHeRz5bD5Y0= github.com/temporalio/ringpop-go v0.1.3/go.mod h1:RE+CHmY+kOZQk47AQaVzwrGmxpflnLgTd6EOK0853j4= github.com/temporalio/sqlparser v0.1.0 h1:jHbQyN3bfVLWGYPC/tLHpdjJxuL1YKOd1sf5OQPRM7o= github.com/temporalio/sqlparser v0.1.0/go.mod h1:143qKdh3G45IgV9p+gbAwp3ikRDI8mxsijFiXDfuxsw= -github.com/temporalio/tchannel-go v1.22.1-0.20220818200552-1be8d8cffa5b/go.mod h1:c+V9Z/ZgkzAdyGvHrvC5AsXgN+M9Qwey04cBdKYzV7U= github.com/temporalio/tchannel-go v1.22.1 h1:H1hsQvAk0ExXgzGI3Qll6M0WjAlu2ysL2FtvZ/jdkU4= +github.com/temporalio/tchannel-go v1.22.1-0.20220818200552-1be8d8cffa5b/go.mod h1:c+V9Z/ZgkzAdyGvHrvC5AsXgN+M9Qwey04cBdKYzV7U= github.com/temporalio/tchannel-go v1.22.1/go.mod h1:ezRQRwu9KQXy8Wuuv1aaFFxoCNz5CeNbVOOkh3xctbY= +github.com/temporalio/ui-server/v2 v2.54.1 h1:V45S+OatX/PbOz5TAtd+T94hm4tfGHc1j5dZAHo+Ouw= +github.com/temporalio/ui-server/v2 v2.54.1/go.mod h1:KmNitkJBhWV2rRQ8k2Q1Jpc4C9SDNOYM9uPW852pz4Y= github.com/temporalio/ui-server/v2 v2.56.4 h1:8CClJYPjZBEMbQm9Ztjb++4GsBO2GJ1o70BxV2PW6ZQ= github.com/temporalio/ui-server/v2 v2.56.4/go.mod h1:pOXxPlKkQm3U32u38cwHzpXvf0CbRxlpQtwGL6+XFtM= github.com/tidwall/btree v1.8.1 h1:27ehoXvm5AG/g+1VxLS1SD3vRhp/H7LuEfwNvddEdmA= @@ -449,8 +493,12 @@ go.opentelemetry.io/collector/pdata v1.56.0 h1:W+QAfN2Iz8SNss1T5JNzRWFnw+7oP1vXB go.opentelemetry.io/collector/pdata v1.56.0/go.mod h1:usR9utboXufbD1rp1oJy+3smQXXpZ+CsI3WN7QsiOs0= go.opentelemetry.io/contrib/detectors/gcp v1.44.0 h1:NmLfL734pJhM0JKaYd2Y28+nY9dPRWYAAbxhRCrKXPw= go.opentelemetry.io/contrib/detectors/gcp v1.44.0/go.mod h1:tNAsgd8avTGke1+MndXlU5Cru4PQ9Ai/cCNWQv/ZJ/s= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.68.0 h1:0Qx7VGBacMm9ZENQ7TnNObTYI4ShC+lHI16seduaxZo= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.68.0/go.mod h1:Sje3i3MjSPKTSPvVWCaL8ugBzJwik3u4smCjUeuupqg= go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.70.0 h1:oECp5f+hN7nkwjU/8BxQ/q23bGPb8FIrD839owX222E= go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.70.0/go.mod h1:DqEFwLumhzMBDQv9PcWbyoDxHI/4lAk6CM4nJBH39sc= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.68.0 h1:CqXxU8VOmDefoh0+ztfGaymYbhdB/tT3zs79QaZTNGY= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.68.0/go.mod h1:BuhAPThV8PBHBvg8ZzZ/Ok3idOdhWIodywz2xEcRbJo= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.70.0 h1:LMuyCAyfalSjDyjdC65nK6N0zoTT63+E/u95X0JovZI= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.70.0/go.mod h1:085m8qbm4hgc8rZWGDEa4vmyyo2c3nPxUslYUKUIU04= go.opentelemetry.io/otel v1.45.0 h1:pdrWmLHofpubmArBv1LgFSv1Z0Ie/ppdZzu+kUN5EeU= @@ -479,22 +527,32 @@ go.opentelemetry.io/otel/trace v1.45.0 h1:l/mP6Uv7oNO7/TblbhpbgMidxhq1uO/rPsikOy go.opentelemetry.io/otel/trace v1.45.0/go.mod h1:qoJJA2xNMnxRrdISU/kLtfUH2wNeQbiv+jhs/CxI8bc= go.opentelemetry.io/proto/otlp v1.11.0 h1:5rrYs0Ykyj50sdU/JU0x8etU+LubXWb+gED6TbEdMIk= go.opentelemetry.io/proto/otlp v1.11.0/go.mod h1:SmVizdCOAm3XBtG1g1NnOdhW6jtddT72hLMhv8VwA8E= +go.temporal.io/api v1.63.8-0.20261016215345-3926793dec12 h1:Ellxop5uzsvgK0CZEg/aOvXHBZLl4LbgBeuVzjSLiqc= +go.temporal.io/api v1.63.8-0.20261016215345-3926793dec12/go.mod h1:acM0I9WPuYg8W3Pd9jOZvEgi7mRUttUQ4+e7fowKVnM= go.temporal.io/api v1.64.1-0.20261030195137-01272cbd37c9 h1:ZJb+HC/3UhzBBnvzKhGOVNf6WSDpNPBDn94vhEBfZVo= go.temporal.io/api v1.64.1-0.20261030195137-01272cbd37c9/go.mod h1:acM0I9WPuYg8W3Pd9jOZvEgi7mRUttUQ4+e7fowKVnM= +go.temporal.io/auto-scaled-workers v0.0.0-20261013231030-67ffdef6330d h1:cKo/dGcLpFAZXKxIAR2sg9hI+h8/8Z0tNHxXA7LCRVI= +go.temporal.io/auto-scaled-workers v0.0.0-20261013231030-67ffdef6330d/go.mod h1:DpnPBMkwtk/08wMxwR3u3mIOshsgK/V7KKLh1QzNdjw= go.temporal.io/auto-scaled-workers v0.0.0-20261030203857-75274b664c29 h1:wr2yPeTpZAvovJ1tQviQFfcZQRuqvdhU1T+6yvZ23S0= go.temporal.io/auto-scaled-workers v0.0.0-20261030203857-75274b664c29/go.mod h1:Wcxj1DAGbC/tQwcfX8VjGhVKM9+/idGDQIvYx/gf13Y= go.temporal.io/sdk v1.49.0 h1:CtGI0BUe/SCo3eoqTwuWWtXKueii9GBVus7KrKKH1Vo= go.temporal.io/sdk v1.49.0/go.mod h1:xP0FulN5JJSfisESUP60LlWsrKz2tLSStGjVdk8r5cc= +go.temporal.io/sdk v1.49.1-0.20261021203027-733b3b459a02 h1:D0ypFFAz7SNeOQTD72WkdPK8O4XgaB03uMmyTHtVsB8= +go.temporal.io/sdk v1.49.1-0.20261021203027-733b3b459a02/go.mod h1:OsF05yeW+3KDYpBEn8BQmj78RXX3qWo/SPJr3s5PLK4= +go.temporal.io/sdk/contrib/envconfig v1.0.2 h1:MGHfsuPUtsf7X9M6WYn3zYJj/mWsuYHnA1uuiL0KEuE= +go.temporal.io/sdk/contrib/envconfig v1.0.2/go.mod h1:MuMiH7hksps2uXnmKuAWaP9P6WbkSDy62kl64t1VJVg= go.temporal.io/sdk/contrib/envconfig v1.1.0 h1:9HGsyrZytjdcZeWJwQlczqYulMhmHS2PRcarcFRjMRE= go.temporal.io/sdk/contrib/envconfig v1.1.0/go.mod h1:th96Zl21YH2mHEe3uZ5Dw0KwZFSF4I2oSwTcUxGA19Y= +go.temporal.io/server v1.29.0-135.0.0.20261027191414-bf81a4c20009 h1:gFi39tM7NtedBMryDl6loxvKKpi7eESvZfGaWH46Qcc= +go.temporal.io/server v1.29.0-135.0.0.20261027191414-bf81a4c20009/go.mod h1:qqkCsy2vnbqJILCAlQQpoXxjywHmnZ3rKWEPyqEqcis= go.temporal.io/server v1.33.0-166.3 h1:y3tLzHag7F6Pv5EieBUJk2+RlTkUhKT1TaC7k5k2HcQ= go.temporal.io/server v1.33.0-166.3/go.mod h1:SP/bukdhfHYhAlaz7oghgdNZvJtEaBmPjzvSbvkS2jk= go.temporal.io/testx v0.0.0-20261029001555-ddcb0739798d h1:SK9slpVz38T0H1ldMpsh/GFWrVTZw7gWC3i2An0rviI= go.temporal.io/testx v0.0.0-20261029001555-ddcb0739798d/go.mod h1:nL3IFIKnioDnUxNaqKLyzR2tZUK6THrXsaQuVjNYVX8= -go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= -go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= +go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= +go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/dig v1.19.0 h1:BACLhebsYdpQ7IROQ1AGPjrXcP5dF80U3gKoFzbaq/4= go.uber.org/dig v1.19.0/go.mod h1:Us0rSJiThwCv2GteUN0Q7OKvU7n5J4dxZ9JKUXozFdE= go.uber.org/fx v1.24.0 h1:wE8mruvpg2kiiL1Vqd0CC+tr0/24XIB10Iwp2lLWzkg= @@ -503,10 +561,10 @@ go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= go.uber.org/mock v0.6.0 h1:hyF9dfmbgIX5EfOdasqLsWD6xqpNZlXblLB/Dbnwv3Y= go.uber.org/mock v0.6.0/go.mod h1:KiVJ4BqZJaMj4svdfmHM0AUx4NJYO8ZNpPnZn1Z+BBU= -go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= -go.uber.org/multierr v1.7.0/go.mod h1:7EAYxJLBy9rStEaz58O2t4Uvip6FSURkq8/ppBp95ak= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= +go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= +go.uber.org/multierr v1.7.0/go.mod h1:7EAYxJLBy9rStEaz58O2t4Uvip6FSURkq8/ppBp95ak= go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA= go.uber.org/zap v1.14.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= go.uber.org/zap v1.27.1 h1:08RqriUEv8+ArZRYSTXy1LeBScaMpVSTBhCeaZYfMYc= @@ -522,6 +580,8 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= +golang.org/x/crypto v0.56.0 h1:GUh5Ii4J5jtcseSMiRqr1jXCNHoxjeV9Fmekc2oLy6Y= +golang.org/x/crypto v0.56.0/go.mod h1:OMW5y6CY9l38uPLmxU6l6pwcXp1obtLo3e6gT7gQR2I= golang.org/x/crypto v0.58.0 h1:COkYLr4k7nDI4r6QtMML2AfzeIswWHAJthLS6K/M/54= golang.org/x/crypto v0.58.0/go.mod h1:Xh+kl5A+M0gMiWDytH2Hhr5Z7WbNCpv/eB/EFgfSk+w= golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -540,11 +600,11 @@ golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKG golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.41.0 h1:qJmnOUb4YB+FsEuM3HcWucdZASCPGhsX6uljO6pog0c= +golang.org/x/mod v0.41.0/go.mod h1:Ek9pY8RKWXwsWvd3rQiHYtMqkjSUV+s1Rj7j4H5Ur6o= golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.41.0 h1:qJmnOUb4YB+FsEuM3HcWucdZASCPGhsX6uljO6pog0c= -golang.org/x/mod v0.41.0/go.mod h1:Ek9pY8RKWXwsWvd3rQiHYtMqkjSUV+s1Rj7j4H5Ur6o= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -553,9 +613,11 @@ golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwY golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= +golang.org/x/net v0.58.0 h1:ynWG7rqYi4ccpTEuPZ2QGWHktVEM9DMCj9yzDE0Q7To= +golang.org/x/net v0.58.0/go.mod h1:YwCddHnFlT7eLQqVprV19OnhLGtc5xOKgE0RyqgfWAU= +golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.62.0 h1:18ELalfM5+XNRwzM2nYqXsZQ9ByS1uhj2O/U7+5jqRY= golang.org/x/net v0.62.0/go.mod h1:WgDCOTH8iwtB66T4/GfI94AHo/hhdb7Hah9NDseQfiI= golang.org/x/oauth2 v0.36.0 h1:peZ/1z27fi9hUOFCAZaHyrpWG5lwe0RJEEEeH0ThlIs= @@ -566,6 +628,8 @@ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek= +golang.org/x/sync v0.22.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0= golang.org/x/sync v0.24.0 h1:iqiDrGoDgyuvAKrhLQthUEzU/R378N78gXbBjxed7oA= golang.org/x/sync v0.24.0/go.mod h1:sUUOizhqBxiL6pEWpqNLUiaJn1ShEbZ6BBqskPbjZm0= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -581,27 +645,33 @@ golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs= +golang.org/x/sys v0.47.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= golang.org/x/sys v0.49.0 h1:XbzkgYJHdqh/8m2Uu0W/dQv8nktxx4BFHp1M0gROTXA= golang.org/x/sys v0.49.0/go.mod h1:hNLxWAXmnKAxqDtdwIYC4bM9oQPEecfsnNMuSxOs3og= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= -golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U= +golang.org/x/term v0.45.0 h1:NwWyBmoJCbfTHpxrWoZ9C6/VxOf7ic219I8xZZFdrf0= +golang.org/x/term v0.45.0/go.mod h1:9aqxs0blBcrm/n0L9QW0aRVD+ktan8ssZromtqJC43w= golang.org/x/term v0.47.0 h1:cpyOwQkr2Nzxe2p6KnrTG7Ei2wtzjsuSjhpXXepZ/BM= golang.org/x/term v0.47.0/go.mod h1:efAfAuG6RKABvg1ArGebRkvX6LXul14SM67o2e4mUCY= +golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= +golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.41.0 h1:vz/seA0lnX87Othu2f/0L24RcgrXD9/YFTSuGjj3rH8= +golang.org/x/text v0.41.0/go.mod h1:jvf1O8ajNzZqhSrQBPbutR/EB83Cc0CFrezNQIwbb5M= golang.org/x/text v0.43.0 h1:1QivrlhwAsnMOcqgOdl9my7s9OyZl8O5/UGUTJVXoWc= golang.org/x/text v0.43.0/go.mod h1:hbSIYA/amXcRXTFSZqh8tWHEoqRvvbKPJ2uz/KU+a+s= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/time v0.15.0 h1:bbrp8t3bGUeFOx08pvsMYRTCVSMk89u4tKbNOZbp88U= golang.org/x/time v0.15.0/go.mod h1:Y4YMaQmXwGQZoFaVFk4YpCt4FLQMYKZe9oeV/f4MSno= golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -615,19 +685,21 @@ golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.1.8/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= +golang.org/x/tools v0.1.8/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU= +golang.org/x/tools v0.49.0 h1:3NI7VXzL9+1WZD52Dx2ttoPwD5DWrFGpl9mFZDlmisI= +golang.org/x/tools v0.49.0/go.mod h1:SJNXV9DBKT0UbdttsQjbfJlAE/q+y36++zo3uL3N0Oo= golang.org/x/tools v0.51.0 h1:k4Xc/1Om9jwkBJBo4NVLMSARBoWtK10mx+W5BnXCeAI= golang.org/x/tools v0.51.0/go.mod h1:9eEncMayCV6zRMGhR5eZEC2iBx98qWcF1HZ9Z7wJOoA= +golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gonum.org/v1/gonum v0.0.0-20180816165407-929014505bf4/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo= -gonum.org/v1/gonum v0.8.2/go.mod h1:oe/vMfY3deqTw+1EZJhuvEW2iwGF1bW9wwu7XCu0+v0= gonum.org/v1/gonum v0.17.0 h1:VbpOemQlsSMrYmn7T2OUvQ4dqxQXU+ouZFQsZOx50z4= gonum.org/v1/gonum v0.17.0/go.mod h1:El3tOrEuMpv2UdMrbNlKEh9vd86bmQ6vqIcDwxEOc1E= +gonum.org/v1/gonum v0.8.2/go.mod h1:oe/vMfY3deqTw+1EZJhuvEW2iwGF1bW9wwu7XCu0+v0= gonum.org/v1/netlib v0.0.0-20190313105609-8cb42192e0e0/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw= gonum.org/v1/plot v0.0.0-20190515093506-e2840ee46a6b/go.mod h1:Wt8AAjI+ypCyYX3nZBvf6cAIx93T+c/OS2HFAYskSZc= google.golang.org/api v0.276.0 h1:nVArUtfLEihtW+b0DdcqRGK1xoEm2+ltAihyztq7MKY= diff --git a/internal/temporalcli/commands.gen.go b/internal/temporalcli/commands.gen.go index 7e314c50b..219431d68 100644 --- a/internal/temporalcli/commands.gen.go +++ b/internal/temporalcli/commands.gen.go @@ -72,6 +72,30 @@ func (v *ScheduleConfigurationOptions) BuildFlags(f *pflag.FlagSet) { f.StringVar(&v.TimeZone, "time-zone", "", "Interpret calendar specs with the `TZ` time zone. For a list of time zones, see: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones.") } +type WorkflowTimeSkippingOptionsOptions struct { + DisablePropagation bool + MaxSkipPerSession int + FlagSet *pflag.FlagSet +} + +func (v *WorkflowTimeSkippingOptionsOptions) BuildFlags(f *pflag.FlagSet) { + v.FlagSet = f + f.BoolVar(&v.DisablePropagation, "disable-propagation", false, "Defaults to false. Omit this flag or set it to false to propagate the time-skipping enabled state to child Workflows started by this Workflow. Set it to true, or specify it without a value, to disable propagation. Fast-forward targets are never propagated. Virtual time is propagated regardless of this flag.") + f.IntVar(&v.MaxSkipPerSession, "max-skip-per-session", 0, "Limit the number of time skips in this session. Omit to use the server default.") +} + +type ScheduleTimeSkippingOptionsOptions struct { + DisablePropagation bool + MaxSkipPerSession int + FlagSet *pflag.FlagSet +} + +func (v *ScheduleTimeSkippingOptionsOptions) BuildFlags(f *pflag.FlagSet) { + v.FlagSet = f + f.BoolVar(&v.DisablePropagation, "disable-propagation", false, "Do not propagate time skipping to Workflows started by this Schedule.") + f.IntVar(&v.MaxSkipPerSession, "max-skip-per-session", 0, "Override the server default maximum skips per session.") +} + type ScheduleCreateOnlyOptions struct { ScheduleSearchAttribute []string ScheduleMemo []string @@ -2588,6 +2612,7 @@ func NewTemporalScheduleCommand(cctx *CommandContext, parent *TemporalCommand) * s.Command.AddCommand(&NewTemporalScheduleDescribeCommand(cctx, &s).Command) s.Command.AddCommand(&NewTemporalScheduleListCommand(cctx, &s).Command) s.Command.AddCommand(&NewTemporalScheduleListMatchingTimesCommand(cctx, &s).Command) + s.Command.AddCommand(&NewTemporalScheduleTimeSkippingCommand(cctx, &s).Command) s.Command.AddCommand(&NewTemporalScheduleToggleCommand(cctx, &s).Command) s.Command.AddCommand(&NewTemporalScheduleTriggerCommand(cctx, &s).Command) s.Command.AddCommand(&NewTemporalScheduleUpdateCommand(cctx, &s).Command) @@ -2789,6 +2814,123 @@ func NewTemporalScheduleListMatchingTimesCommand(cctx *CommandContext, parent *T return &s } +type TemporalScheduleTimeSkippingCommand struct { + Parent *TemporalScheduleCommand + Command cobra.Command +} + +func NewTemporalScheduleTimeSkippingCommand(cctx *CommandContext, parent *TemporalScheduleCommand) *TemporalScheduleTimeSkippingCommand { + var s TemporalScheduleTimeSkippingCommand + s.Parent = parent + s.Command.Use = "time-skipping" + s.Command.Short = "Manage Schedule time skipping (Experimental)" + if hasHighlighting { + s.Command.Long = "Enable or disable Schedule time skipping. For example:\n\n\x1b[1mtemporal schedule time-skipping enable \\\n --namespace YourNamespace \\\n --schedule-id YourScheduleId \\\n --fast-forward-duration 5h\x1b[0m\n\nUse enable to set a fast-forward target for the Schedule." + } else { + s.Command.Long = "Enable or disable Schedule time skipping. For example:\n\n```\ntemporal schedule time-skipping enable \\\n --namespace YourNamespace \\\n --schedule-id YourScheduleId \\\n --fast-forward-duration 5h\n```\n\nUse enable to set a fast-forward target for the Schedule." + } + s.Command.Args = cobra.NoArgs + s.Command.AddCommand(&NewTemporalScheduleTimeSkippingDisableCommand(cctx, &s).Command) + s.Command.AddCommand(&NewTemporalScheduleTimeSkippingEnableCommand(cctx, &s).Command) + s.Command.AddCommand(&NewTemporalScheduleTimeSkippingPollCommand(cctx, &s).Command) + return &s +} + +type TemporalScheduleTimeSkippingDisableCommand struct { + Parent *TemporalScheduleTimeSkippingCommand + Command cobra.Command + ScheduleIdOptions +} + +func NewTemporalScheduleTimeSkippingDisableCommand(cctx *CommandContext, parent *TemporalScheduleTimeSkippingCommand) *TemporalScheduleTimeSkippingDisableCommand { + var s TemporalScheduleTimeSkippingDisableCommand + s.Parent = parent + s.Command.DisableFlagsInUseLine = true + s.Command.Use = "disable [flags]" + s.Command.Short = "Disable Schedule time skipping (Experimental)" + if hasHighlighting { + s.Command.Long = "Disable time skipping for a Schedule:\n\n\x1b[1mtemporal schedule time-skipping disable \\\n --namespace YourNamespace \\\n --schedule-id YourScheduleId\x1b[0m\n\nThe Schedule remains available after time skipping is disabled." + } else { + s.Command.Long = "Disable time skipping for a Schedule:\n\n```\ntemporal schedule time-skipping disable \\\n --namespace YourNamespace \\\n --schedule-id YourScheduleId\n```\n\nThe Schedule remains available after time skipping is disabled." + } + s.Command.Args = cobra.NoArgs + s.ScheduleIdOptions.BuildFlags(s.Command.Flags()) + s.Command.Run = func(c *cobra.Command, args []string) { + if err := s.run(cctx, args); err != nil { + cctx.Options.Fail(err) + } + } + return &s +} + +type TemporalScheduleTimeSkippingEnableCommand struct { + Parent *TemporalScheduleTimeSkippingCommand + Command cobra.Command + ScheduleIdOptions + ScheduleTimeSkippingOptionsOptions + FastForwardDuration cliext.FlagDuration + FastForwardId string +} + +func NewTemporalScheduleTimeSkippingEnableCommand(cctx *CommandContext, parent *TemporalScheduleTimeSkippingCommand) *TemporalScheduleTimeSkippingEnableCommand { + var s TemporalScheduleTimeSkippingEnableCommand + s.Parent = parent + s.Command.DisableFlagsInUseLine = true + s.Command.Use = "enable [flags]" + s.Command.Short = "Enable Schedule time skipping (Experimental)" + if hasHighlighting { + s.Command.Long = "Enable time skipping for a Schedule and set a fast-forward target:\n\n\x1b[1mtemporal schedule time-skipping enable \\\n --namespace YourNamespace \\\n --schedule-id YourScheduleId \\\n --fast-forward-duration 5h\x1b[0m\n\nThe fast-forward target is relative to the current virtual time." + } else { + s.Command.Long = "Enable time skipping for a Schedule and set a fast-forward target:\n\n```\ntemporal schedule time-skipping enable \\\n --namespace YourNamespace \\\n --schedule-id YourScheduleId \\\n --fast-forward-duration 5h\n```\n\nThe fast-forward target is relative to the current virtual time." + } + s.Command.Args = cobra.NoArgs + s.FastForwardDuration = 0 + s.Command.Flags().Var(&s.FastForwardDuration, "fast-forward-duration", "Set a fast-forward target this far ahead of the current virtual time. Must be greater than zero. Required.") + _ = cobra.MarkFlagRequired(s.Command.Flags(), "fast-forward-duration") + s.Command.Flags().StringVar(&s.FastForwardId, "fast-forward-id", "", "Identify this fast-forward in Schedule status. Generated if omitted. Not an idempotency key.") + s.ScheduleIdOptions.BuildFlags(s.Command.Flags()) + s.ScheduleTimeSkippingOptionsOptions.BuildFlags(s.Command.Flags()) + s.Command.Run = func(c *cobra.Command, args []string) { + if err := s.run(cctx, args); err != nil { + cctx.Options.Fail(err) + } + } + return &s +} + +type TemporalScheduleTimeSkippingPollCommand struct { + Parent *TemporalScheduleTimeSkippingCommand + Command cobra.Command + ScheduleIdOptions + FastForwardId string + Timeout cliext.FlagDuration +} + +func NewTemporalScheduleTimeSkippingPollCommand(cctx *CommandContext, parent *TemporalScheduleTimeSkippingCommand) *TemporalScheduleTimeSkippingPollCommand { + var s TemporalScheduleTimeSkippingPollCommand + s.Parent = parent + s.Command.DisableFlagsInUseLine = true + s.Command.Use = "poll [flags]" + s.Command.Short = "Poll a Schedule fast-forward (Experimental)" + if hasHighlighting { + s.Command.Long = "Poll Schedule status for the result of a specific fast-forward:\n\n\x1b[1mtemporal schedule time-skipping poll \\\n --namespace YourNamespace \\\n --schedule-id YourScheduleId \\\n --fast-forward-id YourFastForwardId \\\n --timeout 5m\x1b[0m\n\nA poll timeout means the fast-forward may still be running; poll again to check its status." + } else { + s.Command.Long = "Poll Schedule status for the result of a specific fast-forward:\n\n```\ntemporal schedule time-skipping poll \\\n --namespace YourNamespace \\\n --schedule-id YourScheduleId \\\n --fast-forward-id YourFastForwardId \\\n --timeout 5m\n```\n\nA poll timeout means the fast-forward may still be running; poll again to check its status." + } + s.Command.Args = cobra.NoArgs + s.Command.Flags().StringVar(&s.FastForwardId, "fast-forward-id", "", "ID of the fast-forward to poll. Required.") + _ = cobra.MarkFlagRequired(s.Command.Flags(), "fast-forward-id") + s.Timeout = 0 + s.Command.Flags().Var(&s.Timeout, "timeout", "Maximum time to wait. Omit to wait until completion or interruption.") + s.ScheduleIdOptions.BuildFlags(s.Command.Flags()) + s.Command.Run = func(c *cobra.Command, args []string) { + if err := s.run(cctx, args); err != nil { + cctx.Options.Fail(err) + } + } + return &s +} + type TemporalScheduleToggleCommand struct { Parent *TemporalScheduleCommand Command cobra.Command @@ -4746,6 +4888,7 @@ func NewTemporalWorkflowCommand(cctx *CommandContext, parent *TemporalCommand) * s.Command.AddCommand(&NewTemporalWorkflowStartCommand(cctx, &s).Command) s.Command.AddCommand(&NewTemporalWorkflowStartUpdateWithStartCommand(cctx, &s).Command) s.Command.AddCommand(&NewTemporalWorkflowTerminateCommand(cctx, &s).Command) + s.Command.AddCommand(&NewTemporalWorkflowTimeSkippingCommand(cctx, &s).Command) s.Command.AddCommand(&NewTemporalWorkflowTraceCommand(cctx, &s).Command) s.Command.AddCommand(&NewTemporalWorkflowUnpauseCommand(cctx, &s).Command) s.Command.AddCommand(&NewTemporalWorkflowUpdateCommand(cctx, &s).Command) @@ -5480,6 +5623,119 @@ func NewTemporalWorkflowTerminateCommand(cctx *CommandContext, parent *TemporalW return &s } +type TemporalWorkflowTimeSkippingCommand struct { + Parent *TemporalWorkflowCommand + Command cobra.Command +} + +func NewTemporalWorkflowTimeSkippingCommand(cctx *CommandContext, parent *TemporalWorkflowCommand) *TemporalWorkflowTimeSkippingCommand { + var s TemporalWorkflowTimeSkippingCommand + s.Parent = parent + s.Command.Use = "time-skipping" + s.Command.Short = "Manage Workflow time skipping (Experimental)" + if hasHighlighting { + s.Command.Long = "Enable or disable time skipping for a Workflow Execution. For example:\n\n\x1b[1mtemporal workflow time-skipping enable \\\n --namespace YourNamespace \\\n --workflow-id YourWorkflowId\x1b[0m\n\nUse poll to check the result of a fast-forward." + } else { + s.Command.Long = "Enable or disable time skipping for a Workflow Execution. For example:\n\n```\ntemporal workflow time-skipping enable \\\n --namespace YourNamespace \\\n --workflow-id YourWorkflowId\n```\n\nUse poll to check the result of a fast-forward." + } + s.Command.Args = cobra.NoArgs + s.Command.AddCommand(&NewTemporalWorkflowTimeSkippingDisableCommand(cctx, &s).Command) + s.Command.AddCommand(&NewTemporalWorkflowTimeSkippingEnableCommand(cctx, &s).Command) + s.Command.AddCommand(&NewTemporalWorkflowTimeSkippingPollCommand(cctx, &s).Command) + return &s +} + +type TemporalWorkflowTimeSkippingDisableCommand struct { + Parent *TemporalWorkflowTimeSkippingCommand + Command cobra.Command + WorkflowReferenceOptions +} + +func NewTemporalWorkflowTimeSkippingDisableCommand(cctx *CommandContext, parent *TemporalWorkflowTimeSkippingCommand) *TemporalWorkflowTimeSkippingDisableCommand { + var s TemporalWorkflowTimeSkippingDisableCommand + s.Parent = parent + s.Command.DisableFlagsInUseLine = true + s.Command.Use = "disable [flags]" + s.Command.Short = "Disable Workflow time skipping (Experimental)" + if hasHighlighting { + s.Command.Long = "Disable time skipping for a Workflow Execution:\n\n\x1b[1mtemporal workflow time-skipping disable \\\n --namespace YourNamespace \\\n --workflow-id YourWorkflowId\x1b[0m\n\nThe Workflow Execution remains available after time skipping is disabled." + } else { + s.Command.Long = "Disable time skipping for a Workflow Execution:\n\n```\ntemporal workflow time-skipping disable \\\n --namespace YourNamespace \\\n --workflow-id YourWorkflowId\n```\n\nThe Workflow Execution remains available after time skipping is disabled." + } + s.Command.Args = cobra.NoArgs + s.WorkflowReferenceOptions.BuildFlags(s.Command.Flags()) + s.Command.Run = func(c *cobra.Command, args []string) { + if err := s.run(cctx, args); err != nil { + cctx.Options.Fail(err) + } + } + return &s +} + +type TemporalWorkflowTimeSkippingEnableCommand struct { + Parent *TemporalWorkflowTimeSkippingCommand + Command cobra.Command + WorkflowReferenceOptions + WorkflowTimeSkippingOptionsOptions + FastForwardDuration cliext.FlagDuration + FastForwardId string +} + +func NewTemporalWorkflowTimeSkippingEnableCommand(cctx *CommandContext, parent *TemporalWorkflowTimeSkippingCommand) *TemporalWorkflowTimeSkippingEnableCommand { + var s TemporalWorkflowTimeSkippingEnableCommand + s.Parent = parent + s.Command.DisableFlagsInUseLine = true + s.Command.Use = "enable [flags]" + s.Command.Short = "Enable Workflow time skipping (Experimental)" + if hasHighlighting { + s.Command.Long = "Enable time skipping for a Workflow Execution, optionally with a fast-forward target:\n\n\x1b[1mtemporal workflow time-skipping enable \\\n --namespace YourNamespace \\\n --workflow-id YourWorkflowId \\\n --fast-forward-duration 5h\x1b[0m\n\nEach call replaces the time-skipping configuration and starts a new skip session." + } else { + s.Command.Long = "Enable time skipping for a Workflow Execution, optionally with a fast-forward target:\n\n```\ntemporal workflow time-skipping enable \\\n --namespace YourNamespace \\\n --workflow-id YourWorkflowId \\\n --fast-forward-duration 5h\n```\n\nEach call replaces the time-skipping configuration and starts a new skip session." + } + s.Command.Args = cobra.NoArgs + s.FastForwardDuration = 0 + s.Command.Flags().Var(&s.FastForwardDuration, "fast-forward-duration", "Set a fast-forward target this far ahead of the current virtual time.") + s.Command.Flags().StringVar(&s.FastForwardId, "fast-forward-id", "", "Identify this fast-forward in Workflow status and when polling for completion. Generated if omitted. Not an idempotency key. Requires --fast-forward-duration.") + s.WorkflowReferenceOptions.BuildFlags(s.Command.Flags()) + s.WorkflowTimeSkippingOptionsOptions.BuildFlags(s.Command.Flags()) + s.Command.Run = func(c *cobra.Command, args []string) { + if err := s.run(cctx, args); err != nil { + cctx.Options.Fail(err) + } + } + return &s +} + +type TemporalWorkflowTimeSkippingPollCommand struct { + Parent *TemporalWorkflowTimeSkippingCommand + Command cobra.Command + WorkflowReferenceOptions + FastForwardId string +} + +func NewTemporalWorkflowTimeSkippingPollCommand(cctx *CommandContext, parent *TemporalWorkflowTimeSkippingCommand) *TemporalWorkflowTimeSkippingPollCommand { + var s TemporalWorkflowTimeSkippingPollCommand + s.Parent = parent + s.Command.DisableFlagsInUseLine = true + s.Command.Use = "poll [flags]" + s.Command.Short = "Poll a Workflow fast-forward (Experimental)" + if hasHighlighting { + s.Command.Long = "Poll for the result of a specific Workflow fast-forward:\n\n\x1b[1mtemporal workflow time-skipping poll \\\n --namespace YourNamespace \\\n --workflow-id YourWorkflowId \\\n --fast-forward-id YourFastForwardId\x1b[0m\n\nA server-side poll timeout means the caller may poll again." + } else { + s.Command.Long = "Poll for the result of a specific Workflow fast-forward:\n\n```\ntemporal workflow time-skipping poll \\\n --namespace YourNamespace \\\n --workflow-id YourWorkflowId \\\n --fast-forward-id YourFastForwardId\n```\n\nA server-side poll timeout means the caller may poll again." + } + s.Command.Args = cobra.NoArgs + s.Command.Flags().StringVar(&s.FastForwardId, "fast-forward-id", "", "ID of the fast-forward to poll. Required.") + _ = cobra.MarkFlagRequired(s.Command.Flags(), "fast-forward-id") + s.WorkflowReferenceOptions.BuildFlags(s.Command.Flags()) + s.Command.Run = func(c *cobra.Command, args []string) { + if err := s.run(cctx, args); err != nil { + cctx.Options.Fail(err) + } + } + return &s +} + type TemporalWorkflowTraceCommand struct { Parent *TemporalWorkflowCommand Command cobra.Command diff --git a/internal/temporalcli/commands.schedule.go b/internal/temporalcli/commands.schedule.go index 3a18271bd..b560fb8f5 100644 --- a/internal/temporalcli/commands.schedule.go +++ b/internal/temporalcli/commands.schedule.go @@ -1,13 +1,16 @@ package temporalcli import ( + "context" "errors" "fmt" + "math" "regexp" "strconv" "strings" "time" + "github.com/google/uuid" "github.com/temporalio/cli/cliext" "github.com/temporalio/cli/internal/printer" "google.golang.org/protobuf/encoding/protojson" @@ -43,10 +46,11 @@ type printableSchedule struct { // Info NextRunTime time.Time LastRunTime time.Time - RunningWorkflows []string // describe only - CreatedAt time.Time `cli:",cardOmitEmpty"` // describe only - LastUpdateAt time.Time `cli:",cardOmitEmpty"` // describe only - ActionCounts *actionCounts `cli:",cardOmitEmpty"` // describe only + RunningWorkflows []string // describe only + CreatedAt time.Time `cli:",cardOmitEmpty"` // describe only + LastUpdateAt time.Time `cli:",cardOmitEmpty"` // describe only + ActionCounts *actionCounts `cli:",cardOmitEmpty"` // describe only + TimeSkipping *printableScheduleTimeSkipping `cli:",cardOmitEmpty"` // describe only // SearchAttributes, Memo SearchAttributes *commonpb.SearchAttributes `cli:",cardOmitEmpty"` Memo *commonpb.Memo `cli:",cardOmitEmpty"` @@ -58,6 +62,22 @@ type actionCounts struct { SkippedOverlap int } +type printableScheduleTimeSkipping struct { + EffectiveEnabled bool + DisablePropagation bool + MaxSessionSkipCount int32 + CurrentSessionSkipCount int32 + CurrentTime time.Time `cli:",cardOmitEmpty"` + FastForward *printableScheduleFastForward `cli:",cardOmitEmpty"` +} + +type printableScheduleFastForward struct { + Id string + Duration string + TargetTime time.Time `cli:",cardOmitEmpty"` + HasCompleted bool +} + // Neither protojson nor fmt print structs containing time.Durations nicely, so do it manually // using a struct of strings. type printableInterval struct { @@ -104,7 +124,34 @@ func describeResultToPrintable(id string, desc *client.ScheduleDescription) *pri MissedCatchupWindow: desc.Info.NumActionsMissedCatchupWindow, SkippedOverlap: desc.Info.NumActionsSkippedOverlap, } + out.TimeSkipping = timeSkippingToPrintable(desc.Info.TimeSkippingInfo) + return out +} + +func timeSkippingToPrintable(info *commonpb.TimeSkippingInfo) *printableScheduleTimeSkipping { + if info == nil { + return nil + } + out := &printableScheduleTimeSkipping{ + EffectiveEnabled: info.GetEffectiveConfig().GetEnabled(), + DisablePropagation: info.GetEffectiveConfig().GetDisablePropagation(), + MaxSessionSkipCount: info.GetEffectiveConfig().GetMaxSessionSkipCount(), + CurrentSessionSkipCount: info.GetCurrentSessionSkipCount(), + } + if currentTime := info.GetCurrentTime(); currentTime != nil { + out.CurrentTime = currentTime.AsTime() + } + if ff := info.GetFastForwardInfo(); ff != nil { + out.FastForward = &printableScheduleFastForward{ + Id: ff.GetFastForwardId(), + Duration: formatDuration(ff.GetFastForwardDuration().AsDuration()), + HasCompleted: ff.GetHasCompleted(), + } + if targetTime := ff.GetTargetTime(); targetTime != nil { + out.FastForward.TargetTime = targetTime.AsTime() + } + } return out } @@ -297,7 +344,6 @@ func (c *TemporalScheduleCreateCommand) run(cctx *CommandContext, args []string) // TriggerImmediately not supported // ScheduleBackfill not supported } - if err = c.toScheduleSpec(&opts.Spec); err != nil { return err } else if opts.Action, err = toScheduleAction(&c.SharedWorkflowStartOptions, &c.PayloadInputOptions); err != nil { @@ -424,6 +470,7 @@ func (c *TemporalScheduleListCommand) run(cctx *CommandContext, args []string) e "CreatedAt", "LastUpdateAt", "ActionCounts", + "TimeSkipping", }, Table: &printer.TableOptions{}, } @@ -531,7 +578,6 @@ func (c *TemporalScheduleUpdateCommand) run(cctx *CommandContext, args []string) Paused: c.Paused, }, } - if newSchedule.Policy.Overlap, err = enumspb.ScheduleOverlapPolicyFromString(c.OverlapPolicy.Value); err != nil { return err } @@ -558,6 +604,159 @@ func (c *TemporalScheduleUpdateCommand) run(cctx *CommandContext, args []string) }) } +func scheduleTimeSkippingConfig(fastForward time.Duration, fastForwardID string, disablePropagation bool, maxSkips int) (*client.TimeSkippingConfig, error) { + if fastForward <= 0 { + return nil, errors.New("--fast-forward-duration must be greater than zero") + } + if maxSkips < 0 || maxSkips > math.MaxInt32 { + return nil, fmt.Errorf("--max-skip-per-session must be between 0 and %d", math.MaxInt32) + } + if fastForwardID == "" { + fastForwardID = uuid.NewString() + } + config := &client.TimeSkippingConfig{ + Enabled: true, + DisablePropagation: disablePropagation, + MaxSessionSkipCount: int32(maxSkips), + FastForwardConfig: &client.FastForwardConfig{ + ID: fastForwardID, + Duration: fastForward, + }, + } + return config, nil +} + +func patchScheduleTimeSkipping(cctx *CommandContext, parent *TemporalScheduleCommand, scheduleID string, config *client.TimeSkippingConfig) error { + cl, err := dialClient(cctx, &parent.ClientOptions) + if err != nil { + return err + } + defer cl.Close() + err = cl.ScheduleClient().GetHandle(cctx, scheduleID).SetTimeSkippingConfig(cctx, client.ScheduleSetTimeSkippingConfigOptions{Config: config}) + if err != nil { + return err + } + printScheduleTimeSkippingResult(cctx, "updated", parent.Namespace, scheduleID, config) + return nil +} + +func (c *TemporalScheduleTimeSkippingDisableCommand) run(cctx *CommandContext, args []string) error { + return patchScheduleTimeSkipping(cctx, c.Parent.Parent, c.ScheduleId, &client.TimeSkippingConfig{Enabled: false}) +} + +func (c *TemporalScheduleTimeSkippingEnableCommand) run(cctx *CommandContext, args []string) error { + if c.Command.Flags().Changed("max-skip-per-session") && c.MaxSkipPerSession <= 0 { + return errors.New("--max-skip-per-session must be greater than zero") + } + config, err := scheduleTimeSkippingConfig(c.FastForwardDuration.Duration(), c.FastForwardId, c.DisablePropagation, c.MaxSkipPerSession) + if err != nil { + return err + } + return patchScheduleTimeSkipping(cctx, c.Parent.Parent, c.ScheduleId, config) +} + +const scheduleTimeSkippingPollInterval = 100 * time.Millisecond + +func scheduleTimeSkippingPollStatus(info *commonpb.TimeSkippingInfo, fastForwardID string) (string, string) { + ff := info.GetFastForwardInfo() + if ff == nil || ff.GetFastForwardId() == "" { + return "failed", "fast-forward was removed or was not found in Schedule status" + } + if ff.GetFastForwardId() != fastForwardID { + return "failed", fmt.Sprintf("fast-forward was replaced by %q", ff.GetFastForwardId()) + } + if ff.GetHasCompleted() { + return "completed", "" + } + if !info.GetEffectiveConfig().GetEnabled() { + return "failed", "time skipping was disabled before fast-forward completed" + } + return "pending", "" +} + +func (c *TemporalScheduleTimeSkippingPollCommand) run(cctx *CommandContext, args []string) error { + if c.Command.Flags().Changed("timeout") && c.Timeout.Duration() <= 0 { + return errors.New("--timeout must be greater than zero") + } + ctx := context.Context(cctx) + if c.Timeout.Duration() > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, c.Timeout.Duration()) + defer cancel() + } + cl, err := dialClient(cctx, &c.Parent.Parent.ClientOptions) + if err != nil { + return err + } + defer cl.Close() + handle := cl.ScheduleClient().GetHandle(ctx, c.ScheduleId) + ticker := time.NewTicker(scheduleTimeSkippingPollInterval) + defer ticker.Stop() + for { + desc, err := handle.Describe(ctx) + if err != nil { + if errors.Is(ctx.Err(), context.DeadlineExceeded) { + cctx.Printer.Println("poll timed out") + return nil + } + return err + } + status, reason := scheduleTimeSkippingPollStatus(desc.Info.TimeSkippingInfo, c.FastForwardId) + if status != "pending" { + if reason == "" { + cctx.Printer.Println(status) + } else { + cctx.Printer.Printlnf("%s: %s", status, reason) + } + return nil + } + select { + case <-ctx.Done(): + if errors.Is(ctx.Err(), context.DeadlineExceeded) { + cctx.Printer.Println("poll timed out") + return nil + } + return ctx.Err() + case <-ticker.C: + } + } +} + +func printScheduleTimeSkippingResult( + cctx *CommandContext, + action string, + namespace string, + scheduleID string, + config *client.TimeSkippingConfig, +) { + if config == nil || cctx.JSONOutput { + return + } + cctx.Printer.Printlnf("Schedule %s: %s", action, scheduleID) + if config.Enabled { + cctx.Printer.Println("Time skipping: enabled") + } else { + cctx.Printer.Println("Time skipping: disabled") + } + if config.MaxSessionSkipCount > 0 { + cctx.Printer.Printlnf("Maximum skips per session: %d", config.MaxSessionSkipCount) + } + if ff := config.FastForwardConfig; ff != nil { + cctx.Printer.Printlnf("Fast-forward duration: %s", formatDuration(ff.Duration)) + cctx.Printer.Printlnf("Fast-forward ID: %s", ff.ID) + cctx.Printer.Println("Poll fast-forward:") + cctx.Printer.Printlnf(" temporal schedule time-skipping poll --namespace %s --schedule-id %s --fast-forward-id %s", namespace, scheduleID, ff.ID) + } + cctx.Printer.Println() + cctx.Printer.Println("Check status:") + cctx.Printer.Printlnf(" temporal schedule describe --namespace %s --schedule-id %s", namespace, scheduleID) + if config.Enabled { + cctx.Printer.Println() + cctx.Printer.Println("Disable time skipping:") + cctx.Printer.Printlnf(" temporal schedule time-skipping disable --namespace %s --schedule-id %s", namespace, scheduleID) + } +} + func formatCalendarSpec(spec client.ScheduleCalendarSpec) *schedpb.CalendarSpec { processField := func(ranges []client.ScheduleRange) string { var out []string diff --git a/internal/temporalcli/commands.schedule_internal_test.go b/internal/temporalcli/commands.schedule_internal_test.go new file mode 100644 index 000000000..9a090048d --- /dev/null +++ b/internal/temporalcli/commands.schedule_internal_test.go @@ -0,0 +1,85 @@ +package temporalcli + +import ( + "testing" + "time" + + "github.com/stretchr/testify/require" + commonpb "go.temporal.io/api/common/v1" + "google.golang.org/protobuf/types/known/durationpb" + "google.golang.org/protobuf/types/known/timestamppb" +) + +func TestScheduleTimeSkippingConfig(t *testing.T) { + config, err := scheduleTimeSkippingConfig(5*time.Hour, "", true, 17) + require.NoError(t, err) + + require.True(t, config.Enabled) + require.True(t, config.DisablePropagation) + require.Equal(t, int32(17), config.MaxSessionSkipCount) + require.NotEmpty(t, config.FastForwardConfig.ID) + require.Equal(t, 5*time.Hour, config.FastForwardConfig.Duration) + + config, err = scheduleTimeSkippingConfig(5*time.Hour, "YourFastForwardId", false, 0) + require.NoError(t, err) + require.Equal(t, "YourFastForwardId", config.FastForwardConfig.ID) +} + +func TestTimeSkippingToPrintable(t *testing.T) { + targetTime := time.Date(2026, time.September, 27, 12, 0, 0, 0, time.UTC) + config := &commonpb.TimeSkippingConfig{ + Enabled: true, + DisablePropagation: true, + MaxSessionSkipCount: 200, + FastForwardConfig: &commonpb.FastForwardConfig{ + Id: "ff-id", + Duration: durationpb.New(5 * time.Hour), + }, + } + info := &commonpb.TimeSkippingInfo{ + CurrentTime: timestamppb.New(targetTime.Add(-time.Hour)), + EffectiveConfig: config, + CurrentSessionSkipCount: 4, + FastForwardInfo: &commonpb.TimeSkippingFastForwardInfo{ + FastForwardDuration: durationpb.New(5 * time.Hour), + FastForwardId: "ff-id", + TargetTime: timestamppb.New(targetTime), + HasCompleted: true, + }, + } + + printable := timeSkippingToPrintable(info) + require.True(t, printable.EffectiveEnabled) + require.True(t, printable.DisablePropagation) + require.Equal(t, int32(200), printable.MaxSessionSkipCount) + require.Equal(t, int32(4), printable.CurrentSessionSkipCount) + require.Equal(t, "ff-id", printable.FastForward.Id) + require.Equal(t, "5h 0m 0s", printable.FastForward.Duration) + require.Equal(t, targetTime, printable.FastForward.TargetTime) + require.True(t, printable.FastForward.HasCompleted) + + config.DisablePropagation = false + require.False(t, timeSkippingToPrintable(info).DisablePropagation) +} + +func TestScheduleTimeSkippingPollStatus(t *testing.T) { + const id = "YourFastForwardId" + for _, tc := range []struct { + name string + info *commonpb.TimeSkippingInfo + status string + reason string + }{ + {name: "removed", status: "failed", reason: "fast-forward was removed or was not found in Schedule status"}, + {name: "replaced", info: &commonpb.TimeSkippingInfo{FastForwardInfo: &commonpb.TimeSkippingFastForwardInfo{FastForwardId: "other"}}, status: "failed", reason: `fast-forward was replaced by "other"`}, + {name: "completed", info: &commonpb.TimeSkippingInfo{FastForwardInfo: &commonpb.TimeSkippingFastForwardInfo{FastForwardId: id, HasCompleted: true}}, status: "completed"}, + {name: "disabled", info: &commonpb.TimeSkippingInfo{FastForwardInfo: &commonpb.TimeSkippingFastForwardInfo{FastForwardId: id}}, status: "failed", reason: "time skipping was disabled before fast-forward completed"}, + {name: "pending", info: &commonpb.TimeSkippingInfo{EffectiveConfig: &commonpb.TimeSkippingConfig{Enabled: true}, FastForwardInfo: &commonpb.TimeSkippingFastForwardInfo{FastForwardId: id}}, status: "pending"}, + } { + t.Run(tc.name, func(t *testing.T) { + status, reason := scheduleTimeSkippingPollStatus(tc.info, id) + require.Equal(t, tc.status, status) + require.Equal(t, tc.reason, reason) + }) + } +} diff --git a/internal/temporalcli/commands.workflow_time_skipping.go b/internal/temporalcli/commands.workflow_time_skipping.go new file mode 100644 index 000000000..12646ddbd --- /dev/null +++ b/internal/temporalcli/commands.workflow_time_skipping.go @@ -0,0 +1,138 @@ +package temporalcli + +import ( + "errors" + "fmt" + "math" + "time" + + "github.com/google/uuid" + commonpb "go.temporal.io/api/common/v1" + enumspb "go.temporal.io/api/enums/v1" + workflowservice "go.temporal.io/api/workflowservice/v1" + "go.temporal.io/sdk/client" +) + +func workflowTimeSkippingConfig(duration time.Duration, hasDuration bool, fastForwardID string, disablePropagation bool, maxSkips int) (*client.TimeSkippingConfig, error) { + if hasDuration && duration <= 0 { + return nil, errors.New("--fast-forward-duration must be greater than zero") + } + if !hasDuration && fastForwardID != "" { + return nil, errors.New("--fast-forward-id requires --fast-forward-duration") + } + if maxSkips < 0 || maxSkips > math.MaxInt32 { + return nil, fmt.Errorf("--max-skip-per-session must be between 0 and %d", math.MaxInt32) + } + config := &client.TimeSkippingConfig{ + Enabled: true, + DisablePropagation: disablePropagation, + MaxSessionSkipCount: int32(maxSkips), + } + if hasDuration { + if fastForwardID == "" { + fastForwardID = uuid.NewString() + } + config.FastForwardConfig = &client.FastForwardConfig{ID: fastForwardID, Duration: duration} + } + return config, nil +} + +func (c *TemporalWorkflowTimeSkippingEnableCommand) run(cctx *CommandContext, args []string) error { + if c.Command.Flags().Changed("max-skip-per-session") && c.MaxSkipPerSession <= 0 { + return errors.New("--max-skip-per-session must be greater than zero") + } + config, err := workflowTimeSkippingConfig(c.FastForwardDuration.Duration(), c.Command.Flags().Changed("fast-forward-duration"), c.FastForwardId, c.DisablePropagation, c.MaxSkipPerSession) + if err != nil { + return err + } + return patchWorkflowTimeSkipping(cctx, c.Parent.Parent, c.WorkflowId, c.RunId, config) +} + +func (c *TemporalWorkflowTimeSkippingDisableCommand) run(cctx *CommandContext, args []string) error { + return patchWorkflowTimeSkipping(cctx, c.Parent.Parent, c.WorkflowId, c.RunId, &client.TimeSkippingConfig{Enabled: false}) +} + +func patchWorkflowTimeSkipping(cctx *CommandContext, parent *TemporalWorkflowCommand, workflowID, runID string, config *client.TimeSkippingConfig) error { + cl, err := dialClient(cctx, &parent.ClientOptions) + if err != nil { + return err + } + defer cl.Close() + _, err = cl.UpdateWorkflowExecutionOptions(cctx, client.UpdateWorkflowExecutionOptionsRequest{ + WorkflowId: workflowID, + RunId: runID, + WorkflowExecutionOptionsChanges: client.WorkflowExecutionOptionsChanges{ + TimeSkippingConfig: &client.TimeSkippingConfigChange{Value: config}, + }, + }) + if err != nil { + return err + } + if cctx.JSONOutput { + return nil + } + cctx.Printer.Printlnf("Workflow time skipping updated: %s", workflowID) + if config.Enabled { + cctx.Printer.Println("Time skipping: enabled") + } else { + cctx.Printer.Println("Time skipping: disabled") + } + cctx.Printer.Println("Check status:") + cmd := fmt.Sprintf(" temporal workflow describe --namespace %s --workflow-id %s", parent.Namespace, workflowID) + if runID != "" { + cmd += " --run-id " + runID + } + cctx.Printer.Println(cmd) + if ff := config.FastForwardConfig; ff != nil { + cctx.Printer.Printlnf("Fast-forward ID: %s", ff.ID) + cctx.Printer.Println("Poll fast-forward:") + cmd := fmt.Sprintf(" temporal workflow time-skipping poll --namespace %s --workflow-id %s", parent.Namespace, workflowID) + if runID != "" { + cmd += " --run-id " + runID + } + cctx.Printer.Println(cmd + " --fast-forward-id " + ff.ID) + } + return nil +} + +func workflowTimeSkippingPollResult(resp *workflowservice.PollWorkflowExecutionTimeSkippingResponse) (string, string, error) { + switch resp.GetFastForwardPollingResult() { + case enumspb.FAST_FORWARD_POLLING_RESULT_FAST_FORWARD_COMPLETED: + return "completed", "", nil + case enumspb.FAST_FORWARD_POLLING_RESULT_POLL_TIMEOUT: + return "poll timed out", "", nil + case enumspb.FAST_FORWARD_POLLING_RESULT_FAST_FORWARD_FAILED: + return "failed", resp.GetFailedReason(), nil + default: + return "", "", fmt.Errorf("unknown fast-forward polling result %v", resp.GetFastForwardPollingResult()) + } +} + +func (c *TemporalWorkflowTimeSkippingPollCommand) run(cctx *CommandContext, args []string) error { + cl, err := dialClient(cctx, &c.Parent.Parent.ClientOptions) + if err != nil { + return err + } + defer cl.Close() + resp, err := cl.WorkflowService().PollWorkflowExecutionTimeSkipping(cctx, &workflowservice.PollWorkflowExecutionTimeSkippingRequest{ + Namespace: c.Parent.Parent.Namespace, + WorkflowExecution: &commonpb.WorkflowExecution{ + WorkflowId: c.WorkflowId, + RunId: c.RunId, + }, + FastForwardId: c.FastForwardId, + }) + if err != nil { + return err + } + status, reason, err := workflowTimeSkippingPollResult(resp) + if err != nil { + return err + } + if reason == "" { + cctx.Printer.Println(status) + } else { + cctx.Printer.Printlnf("%s: %s", status, reason) + } + return nil +} diff --git a/internal/temporalcli/commands.workflow_time_skipping_internal_test.go b/internal/temporalcli/commands.workflow_time_skipping_internal_test.go new file mode 100644 index 000000000..56eeb0783 --- /dev/null +++ b/internal/temporalcli/commands.workflow_time_skipping_internal_test.go @@ -0,0 +1,50 @@ +package temporalcli + +import ( + "testing" + "time" + + "github.com/stretchr/testify/require" + enumspb "go.temporal.io/api/enums/v1" + workflowservice "go.temporal.io/api/workflowservice/v1" +) + +func TestWorkflowTimeSkippingConfig(t *testing.T) { + config, err := workflowTimeSkippingConfig(0, false, "", false, 0) + require.NoError(t, err) + require.True(t, config.Enabled) + require.Nil(t, config.FastForwardConfig) + require.False(t, config.DisablePropagation) + + config, err = workflowTimeSkippingConfig(5*time.Hour, true, "YourFastForwardId", true, 17) + require.NoError(t, err) + require.True(t, config.DisablePropagation) + require.Equal(t, int32(17), config.MaxSessionSkipCount) + require.Equal(t, "YourFastForwardId", config.FastForwardConfig.ID) + require.Equal(t, 5*time.Hour, config.FastForwardConfig.Duration) + + _, err = workflowTimeSkippingConfig(0, false, "YourFastForwardId", false, 0) + require.EqualError(t, err, "--fast-forward-id requires --fast-forward-duration") + _, err = workflowTimeSkippingConfig(0, true, "", false, 0) + require.EqualError(t, err, "--fast-forward-duration must be greater than zero") +} + +func TestWorkflowTimeSkippingPollResult(t *testing.T) { + for _, tc := range []struct { + result enumspb.FastForwardPollingResult + reason string + status string + }{ + {enumspb.FAST_FORWARD_POLLING_RESULT_FAST_FORWARD_COMPLETED, "", "completed"}, + {enumspb.FAST_FORWARD_POLLING_RESULT_POLL_TIMEOUT, "", "poll timed out"}, + {enumspb.FAST_FORWARD_POLLING_RESULT_FAST_FORWARD_FAILED, "time skipping disabled", "failed"}, + } { + status, reason, err := workflowTimeSkippingPollResult(&workflowservice.PollWorkflowExecutionTimeSkippingResponse{ + FastForwardPollingResult: tc.result, + FailedReason: tc.reason, + }) + require.NoError(t, err) + require.Equal(t, tc.status, status) + require.Equal(t, tc.reason, reason) + } +} diff --git a/internal/temporalcli/commands.workflow_view.go b/internal/temporalcli/commands.workflow_view.go index fdd3747d9..0695a2882 100644 --- a/internal/temporalcli/commands.workflow_view.go +++ b/internal/temporalcli/commands.workflow_view.go @@ -141,6 +141,11 @@ func (c *TemporalWorkflowDescribeCommand) run(cctx *CommandContext, args []strin RootWorkflowId: info.GetRootExecution().GetWorkflowId(), RootRunId: info.GetRootExecution().GetRunId(), }, printer.StructuredOptions{}) + if tsi := resp.GetWorkflowExtendedInfo().GetTimeSkippingInfo(); tsi != nil { + cctx.Printer.Println() + cctx.Printer.Println(color.MagentaString("Time Skipping:")) + _ = cctx.Printer.PrintStructured(timeSkippingToPrintable(tsi), printer.StructuredOptions{}) + } if priority := info.GetPriority(); priority != nil && (priority.GetPriorityKey() != 0 || priority.GetFairnessKey() != "" || priority.GetFairnessWeight() != 0) { diff --git a/internal/temporalcli/commands.yaml b/internal/temporalcli/commands.yaml index c177f4ee7..2b325b614 100644 --- a/internal/temporalcli/commands.yaml +++ b/internal/temporalcli/commands.yaml @@ -3740,6 +3740,85 @@ commands: - schedule-id - overlap-policy + - name: temporal schedule time-skipping + summary: Manage Schedule time skipping (Experimental) + description: | + Enable or disable Schedule time skipping. For example: + + ``` + temporal schedule time-skipping enable \ + --namespace YourNamespace \ + --schedule-id YourScheduleId \ + --fast-forward-duration 5h + ``` + + Use enable to set a fast-forward target for the Schedule. + + - name: temporal schedule time-skipping disable + summary: Disable Schedule time skipping (Experimental) + description: | + Disable time skipping for a Schedule: + + ``` + temporal schedule time-skipping disable \ + --namespace YourNamespace \ + --schedule-id YourScheduleId + ``` + + The Schedule remains available after time skipping is disabled. + option-sets: + - schedule-id + + - name: temporal schedule time-skipping enable + summary: Enable Schedule time skipping (Experimental) + description: | + Enable time skipping for a Schedule and set a fast-forward target: + + ``` + temporal schedule time-skipping enable \ + --namespace YourNamespace \ + --schedule-id YourScheduleId \ + --fast-forward-duration 5h + ``` + + The fast-forward target is relative to the current virtual time. + option-sets: + - schedule-id + - schedule-time-skipping-options + options: + - name: fast-forward-duration + type: duration + required: true + description: Set a fast-forward target this far ahead of the current virtual time. Must be greater than zero. + - name: fast-forward-id + type: string + description: Identify this fast-forward in Schedule status. Generated if omitted. Not an idempotency key. + + - name: temporal schedule time-skipping poll + summary: Poll a Schedule fast-forward (Experimental) + description: | + Poll Schedule status for the result of a specific fast-forward: + + ``` + temporal schedule time-skipping poll \ + --namespace YourNamespace \ + --schedule-id YourScheduleId \ + --fast-forward-id YourFastForwardId \ + --timeout 5m + ``` + + A poll timeout means the fast-forward may still be running; poll again to check its status. + option-sets: + - schedule-id + options: + - name: fast-forward-id + type: string + required: true + description: ID of the fast-forward to poll. + - name: timeout + type: duration + description: Maximum time to wait. Omit to wait until completion or interruption. + - name: temporal schedule update summary: Update Schedule details description: | @@ -4953,6 +5032,79 @@ commands: type: bool description: Print properties without changing their format. + - name: temporal workflow time-skipping + summary: Manage Workflow time skipping (Experimental) + description: | + Enable or disable time skipping for a Workflow Execution. For example: + + ``` + temporal workflow time-skipping enable \ + --namespace YourNamespace \ + --workflow-id YourWorkflowId + ``` + + Use poll to check the result of a fast-forward. + + - name: temporal workflow time-skipping enable + summary: Enable Workflow time skipping (Experimental) + description: | + Enable time skipping for a Workflow Execution, optionally with a fast-forward target: + + ``` + temporal workflow time-skipping enable \ + --namespace YourNamespace \ + --workflow-id YourWorkflowId \ + --fast-forward-duration 5h + ``` + + Each call replaces the time-skipping configuration and starts a new skip session. + option-sets: + - workflow-reference + - workflow-time-skipping-options + options: + - name: fast-forward-duration + type: duration + description: Set a fast-forward target this far ahead of the current virtual time. + - name: fast-forward-id + type: string + description: Identify this fast-forward in Workflow status and when polling for completion. Generated if omitted. Not an idempotency key. Requires --fast-forward-duration. + + - name: temporal workflow time-skipping disable + summary: Disable Workflow time skipping (Experimental) + description: | + Disable time skipping for a Workflow Execution: + + ``` + temporal workflow time-skipping disable \ + --namespace YourNamespace \ + --workflow-id YourWorkflowId + ``` + + The Workflow Execution remains available after time skipping is disabled. + option-sets: + - workflow-reference + + - name: temporal workflow time-skipping poll + summary: Poll a Workflow fast-forward (Experimental) + description: | + Poll for the result of a specific Workflow fast-forward: + + ``` + temporal workflow time-skipping poll \ + --namespace YourNamespace \ + --workflow-id YourWorkflowId \ + --fast-forward-id YourFastForwardId + ``` + + A server-side poll timeout means the caller may poll again. + option-sets: + - workflow-reference + options: + - name: fast-forward-id + type: string + required: true + description: ID of the fast-forward to poll. + - name: temporal workflow execute summary: Start new Workflow Execution description: | @@ -5869,6 +6021,29 @@ option-sets: For a list of time zones, see: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones. + - name: workflow-time-skipping-options + options: + - name: disable-propagation + type: bool + description: | + Defaults to false. Omit this flag or set it to false to propagate the + time-skipping enabled state to child Workflows started by this Workflow. + Set it to true, or specify it without a value, to disable propagation. + Fast-forward targets are never propagated. Virtual time is propagated + regardless of this flag. + - name: max-skip-per-session + type: int + description: Limit the number of time skips in this session. Omit to use the server default. + + - name: schedule-time-skipping-options + options: + - name: disable-propagation + type: bool + description: Do not propagate time skipping to Workflows started by this Schedule. + - name: max-skip-per-session + type: int + description: Override the server default maximum skips per session. + - name: schedule-create-only options: - name: schedule-search-attribute From 43c3fb0b23a3ed31213451b41dc0c1ac7fd0adb9 Mon Sep 17 00:00:00 2001 From: Feiyang Xie Date: Tue, 27 Oct 2026 12:35:05 -0700 Subject: [PATCH 02/13] feat: add opt-in time skipping to dev server --- internal/devserver/server.go | 57 +++++++-- internal/devserver/server_test.go | 68 ++++++++++ internal/temporalcli/commands.gen.go | 4 + .../temporalcli/commands.schedule_test.go | 121 ++++++++++++++++++ internal/temporalcli/commands.server.go | 41 +++++- .../commands.server_internal_test.go | 29 +++++ .../temporalcli/commands.workflow_test.go | 65 ++++++++++ internal/temporalcli/commands.yaml | 11 ++ internal/temporalcli/commands_test.go | 1 + 9 files changed, 384 insertions(+), 13 deletions(-) create mode 100644 internal/devserver/server_test.go create mode 100644 internal/temporalcli/commands.server_internal_test.go diff --git a/internal/devserver/server.go b/internal/devserver/server.go index 5da778138..9cef983c3 100644 --- a/internal/devserver/server.go +++ b/internal/devserver/server.go @@ -85,6 +85,7 @@ type StartOptions struct { SqlitePragmas map[string]string FrontendHTTPPort int EnableGlobalNamespace bool + EnableTimeSkipping bool DynamicConfigValues map[string]any SearchAttributes map[string]enums.IndexedValueType LogConfig func([]byte) @@ -238,7 +239,27 @@ func (s *StartOptions) buildServerOptions() ([]temporal.ServerOption, *slog.Leve temporal.WithClaimMapper(func(*config.Config) authorization.ClaimMapper { return claimMapper }), } - dynConf := make(dynamicconfig.StaticClient, len(s.DynamicConfigValues)+1) + dynConf := devServerDynamicConfig(s.DynamicConfigValues, s.EnableTimeSkipping) + opts = append(opts, temporal.WithDynamicConfigClient(dynConf)) + + // gRPC interceptors if set + if len(s.GRPCInterceptors) > 0 { + opts = append(opts, temporal.WithChainedFrontendGrpcInterceptors(s.GRPCInterceptors...)) + } + + return opts, logLevel, nil +} + +var timeSkippingDynamicConfigDefaults = map[dynamicconfig.Key]any{ + dynamicconfig.WorkflowTimeSkippingEnabled.Key(): true, + dynamicconfig.CHASMSchedulerTimeSkippingEnabled.Key(): true, + dynamicconfig.EnableCHASMSchedulerCreation.Key(): true, + dynamicconfig.CHASMSchedulerCreationRolloutPercent.Key(): 100, + dynamicconfig.EnableCHASMSchedulerRouting.Key(): true, +} + +func devServerDynamicConfig(values map[string]any, enableTimeSkipping bool) dynamicconfig.StaticClient { + dynConf := make(dynamicconfig.StaticClient, len(values)+len(timeSkippingDynamicConfigDefaults)+5) // Setting host level mutable state cache size to 8k. dynConf[dynamicconfig.HistoryCacheHostLevelMaxSize.Key()] = 8096 // Up default visibility RPS @@ -250,18 +271,34 @@ func (s *StartOptions) buildServerOptions() ([]temporal.ServerOption, *slog.Leve // Enable SANO; this can be removed when SANO is on by default. dynConf[nexusoperation.Enabled.Key()] = true - // Dynamic config if set - for k, v := range s.DynamicConfigValues { - dynConf[dynamicconfig.MakeKey(k)] = v + if enableTimeSkipping { + // Enable Workflow and CHASM Schedule time skipping in every namespace. + for key, value := range timeSkippingDynamicConfigDefaults { + dynConf[key] = value + } } - opts = append(opts, temporal.WithDynamicConfigClient(dynConf)) - // gRPC interceptors if set - if len(s.GRPCInterceptors) > 0 { - opts = append(opts, temporal.WithChainedFrontendGrpcInterceptors(s.GRPCInterceptors...)) + // Explicit config overrides defaults. A namespace-specific YAML value also + // needs the global default as a fallback for other namespaces. + for name, value := range values { + key := dynamicconfig.MakeKey(name) + if fallback, ok := timeSkippingDynamicConfigDefaults[key]; ok && enableTimeSkipping { + if constrained, ok := value.([]dynamicconfig.ConstrainedValue); ok { + hasGlobal := false + for _, entry := range constrained { + if entry.Constraints == (dynamicconfig.Constraints{}) { + hasGlobal = true + break + } + } + if !hasGlobal { + value = append(append([]dynamicconfig.ConstrainedValue(nil), constrained...), dynamicconfig.ConstrainedValue{Value: fallback}) + } + } + } + dynConf[key] = value } - - return opts, logLevel, nil + return dynConf } func (s *StartOptions) buildServerConfig() (*config.Config, error) { diff --git a/internal/devserver/server_test.go b/internal/devserver/server_test.go new file mode 100644 index 000000000..0bacd1e76 --- /dev/null +++ b/internal/devserver/server_test.go @@ -0,0 +1,68 @@ +package devserver + +import ( + "testing" + + "github.com/stretchr/testify/require" + "go.temporal.io/server/common/dynamicconfig" + "go.temporal.io/server/common/log" +) + +func TestTimeSkippingDynamicConfigDefaults(t *testing.T) { + config := dynamicconfig.NewCollection(devServerDynamicConfig(nil, true), log.NewNoopLogger()) + for _, namespace := range []string{"default", "timeskipping-test"} { + require.True(t, dynamicconfig.WorkflowTimeSkippingEnabled.Get(config)(namespace)) + require.True(t, dynamicconfig.CHASMSchedulerTimeSkippingEnabled.Get(config)(namespace)) + require.True(t, dynamicconfig.EnableCHASMSchedulerCreation.Get(config)(namespace)) + require.Equal(t, 100, dynamicconfig.CHASMSchedulerCreationRolloutPercent.Get(config)(namespace)) + require.True(t, dynamicconfig.EnableCHASMSchedulerRouting.Get(config)(namespace)) + } +} + +func TestTimeSkippingDynamicConfigDefaultOff(t *testing.T) { + values := devServerDynamicConfig(nil, false) + for key := range timeSkippingDynamicConfigDefaults { + _, present := values[key] + require.False(t, present, "unexpected override for %s", key) + } + config := dynamicconfig.NewCollection(values, log.NewNoopLogger()) + for _, namespace := range []string{"default", "timeskipping-test"} { + require.False(t, dynamicconfig.WorkflowTimeSkippingEnabled.Get(config)(namespace)) + require.False(t, dynamicconfig.CHASMSchedulerTimeSkippingEnabled.Get(config)(namespace)) + require.False(t, dynamicconfig.EnableCHASMSchedulerCreation.Get(config)(namespace)) + require.Equal(t, 0, dynamicconfig.CHASMSchedulerCreationRolloutPercent.Get(config)(namespace)) + } +} + +func TestTimeSkippingDynamicConfigNamespaceOverride(t *testing.T) { + values := map[string]any{ + dynamicconfig.WorkflowTimeSkippingEnabled.Key().String(): []dynamicconfig.ConstrainedValue{{ + Value: false, + Constraints: dynamicconfig.Constraints{Namespace: "timeskipping-test"}, + }}, + dynamicconfig.CHASMSchedulerTimeSkippingEnabled.Key().String(): []dynamicconfig.ConstrainedValue{{ + Value: false, + Constraints: dynamicconfig.Constraints{Namespace: "timeskipping-test"}, + }}, + } + config := dynamicconfig.NewCollection(devServerDynamicConfig(values, true), log.NewNoopLogger()) + for _, enabled := range []func(string) bool{ + dynamicconfig.WorkflowTimeSkippingEnabled.Get(config), + dynamicconfig.CHASMSchedulerTimeSkippingEnabled.Get(config), + } { + require.False(t, enabled("timeskipping-test")) + require.True(t, enabled("another-namespace")) + } +} + +func TestTimeSkippingDynamicConfigGlobalOverride(t *testing.T) { + key := dynamicconfig.WorkflowTimeSkippingEnabled.Key().String() + config := dynamicconfig.NewCollection(devServerDynamicConfig(map[string]any{key: false}, true), log.NewNoopLogger()) + require.False(t, dynamicconfig.WorkflowTimeSkippingEnabled.Get(config)("default")) + + yamlValues := map[string]any{ + key: []dynamicconfig.ConstrainedValue{{Value: false}}, + } + config = dynamicconfig.NewCollection(devServerDynamicConfig(yamlValues, true), log.NewNoopLogger()) + require.False(t, dynamicconfig.WorkflowTimeSkippingEnabled.Get(config)("another-namespace")) +} diff --git a/internal/temporalcli/commands.gen.go b/internal/temporalcli/commands.gen.go index 219431d68..41497857d 100644 --- a/internal/temporalcli/commands.gen.go +++ b/internal/temporalcli/commands.gen.go @@ -3061,6 +3061,7 @@ type TemporalServerStartDevCommand struct { MetricsPort int UiPort int Headless bool + EnableTimeSkipping bool Ip string UiIp string UiPublicPath string @@ -3069,6 +3070,7 @@ type TemporalServerStartDevCommand struct { UiDisableNewsFetch bool SqlitePragma []string DynamicConfigValue []string + DynamicConfigFile string LogConfig bool SearchAttribute []string } @@ -3092,6 +3094,7 @@ func NewTemporalServerStartDevCommand(cctx *CommandContext, parent *TemporalServ s.Command.Flags().IntVar(&s.MetricsPort, "metrics-port", 0, "Port for the '/metrics' HTTP endpoint. Defaults to a random free port.") s.Command.Flags().IntVar(&s.UiPort, "ui-port", 0, "Port for the Web UI. Defaults to '--port' value + 1000.") s.Command.Flags().BoolVar(&s.Headless, "headless", false, "Disable the Web UI.") + s.Command.Flags().BoolVar(&s.EnableTimeSkipping, "enable-time-skipping", false, "Enable Workflow and CHASM Schedule time skipping in all Namespaces for this dev server run. Also enable CHASM Schedule creation and routing. Explicit dynamic config values take precedence.") s.Command.Flags().StringVar(&s.Ip, "ip", "localhost", "IP address bound to the front-end Service.") s.Command.Flags().StringVar(&s.UiIp, "ui-ip", "", "IP address bound to the Web UI. Defaults to same as '--ip' value.") s.Command.Flags().StringVar(&s.UiPublicPath, "ui-public-path", "", "The public base path for the Web UI. Defaults to `/`.") @@ -3100,6 +3103,7 @@ func NewTemporalServerStartDevCommand(cctx *CommandContext, parent *TemporalServ s.Command.Flags().BoolVar(&s.UiDisableNewsFetch, "ui-disable-news-fetch", false, "Disable the Web UI newsfeed. When set, the UI will not request the newsfeed and the button to open the newsfeed panel is hidden.") s.Command.Flags().StringArrayVar(&s.SqlitePragma, "sqlite-pragma", nil, "SQLite pragma statements in \"PRAGMA=VALUE\" format.") s.Command.Flags().StringArrayVar(&s.DynamicConfigValue, "dynamic-config-value", nil, "Dynamic configuration value using `KEY=VALUE` pairs. Keys must be identifiers, and values must be JSON values. For example: `YourKey=\"YourString\"` Can be passed multiple times.") + s.Command.Flags().StringVar(&s.DynamicConfigFile, "dynamic-config-file", "", "Path to a dynamic configuration YAML file. Values passed with `--dynamic-config-value` take precedence over values from this file.") s.Command.Flags().BoolVar(&s.LogConfig, "log-config", false, "Print the server config to stderr.") s.Command.Flags().StringArrayVar(&s.SearchAttribute, "search-attribute", nil, "Search attributes to register using `KEY=VALUE` pairs. Keys must be identifiers, and values must be the search attribute type, which is one of the following: Text, Keyword, Int, Double, Bool, Datetime, KeywordList.") s.Command.Run = func(c *cobra.Command, args []string) { diff --git a/internal/temporalcli/commands.schedule_test.go b/internal/temporalcli/commands.schedule_test.go index d3bf978d9..9e849caba 100644 --- a/internal/temporalcli/commands.schedule_test.go +++ b/internal/temporalcli/commands.schedule_test.go @@ -59,6 +59,65 @@ func (s *SharedServerSuite) TestSchedule_Create() { s.NoError(res.Err) } +func (s *SharedServerSuite) TestSchedule_TimeSkippingEnable() { + schedID, _, res := s.createSchedule("--interval", "10d", "--paused") + s.NoError(res.Err) + res = s.Execute( + "schedule", "time-skipping", "enable", + "--address", s.Address(), + "--schedule-id", schedID, + "--fast-forward-duration", "5h", + "--fast-forward-id", "YourFastForwardId", + "--disable-propagation", + "--max-skip-per-session", "17", + ) + s.NoError(res.Err) + s.Contains(res.Stdout.String(), "Time skipping: enabled") + s.Contains(res.Stdout.String(), "Fast-forward duration: 5h 0m 0s") + s.Contains(res.Stdout.String(), "Fast-forward ID: YourFastForwardId") + s.Contains(res.Stdout.String(), "Maximum skips per session: 17") + res = s.Execute( + "schedule", "describe", + "--address", s.Address(), + "--schedule-id", schedID, + ) + s.NoError(res.Err) + s.Contains(res.Stdout.String(), `"DisablePropagation":true`) + + res = s.Execute( + "schedule", "time-skipping", "poll", + "--address", s.Address(), + "--schedule-id", schedID, + "--fast-forward-id", "YourFastForwardId", + "--timeout", "200ms", + ) + s.NoError(res.Err) + s.Contains(res.Stdout.String(), "poll timed out") +} + +func (s *SharedServerSuite) TestSchedule_TimeSkippingPollCompleted() { + schedID, _, res := s.createSchedule("--interval", "10d") + s.NoError(res.Err) + res = s.Execute( + "schedule", "time-skipping", "enable", + "--address", s.Address(), + "--schedule-id", schedID, + "--fast-forward-duration", "5h", + "--fast-forward-id", "PollCompletedId", + ) + s.NoError(res.Err) + + res = s.Execute( + "schedule", "time-skipping", "poll", + "--address", s.Address(), + "--schedule-id", schedID, + "--fast-forward-id", "PollCompletedId", + "--timeout", "10s", + ) + s.NoError(res.Err) + s.Contains(res.Stdout.String(), "completed") +} + func (s *SharedServerSuite) TestSchedule_Delete() { schedId, _, res := s.createSchedule("--interval", "10d") s.NoError(res.Err) @@ -511,6 +570,68 @@ func (s *SharedServerSuite) TestSchedule_Update() { }, 10*time.Second, 100*time.Millisecond) } +func (s *SharedServerSuite) TestSchedule_TimeSkippingDisable() { + schedID, _, res := s.createSchedule("--interval", "10d", "--paused") + s.NoError(res.Err) + + res = s.Execute( + "schedule", "time-skipping", "enable", + "--address", s.Address(), + "--schedule-id", schedID, + "--fast-forward-duration", "6h", + ) + s.NoError(res.Err) + s.Contains(res.Stdout.String(), "Time skipping: enabled") + s.Contains(res.Stdout.String(), "Fast-forward ID:") + + res = s.Execute( + "schedule", "describe", + "--address", s.Address(), + "--schedule-id", schedID, + ) + s.NoError(res.Err) + s.Contains(res.Stdout.String(), "TimeSkipping") + s.Contains(res.Stdout.String(), `"EffectiveEnabled":true`) + s.Contains(res.Stdout.String(), `"FastForward":`) + + res = s.Execute( + "schedule", "time-skipping", "disable", + "--address", s.Address(), + "--schedule-id", schedID, + ) + s.NoError(res.Err) + s.Contains(res.Stdout.String(), "Time skipping: disabled") + + res = s.Execute( + "schedule", "describe", + "--address", s.Address(), + "--schedule-id", schedID, + "--output", "json", + ) + s.NoError(res.Err) + var description struct { + Schedule struct { + Action struct { + StartWorkflow struct { + WorkflowType struct { + Name string `json:"name"` + } `json:"workflowType"` + } `json:"startWorkflow"` + } `json:"action"` + } `json:"schedule"` + Info struct { + TimeSkippingInfo struct { + EffectiveConfig struct { + Enabled bool `json:"enabled"` + } `json:"effectiveConfig"` + } `json:"timeSkippingInfo"` + } `json:"info"` + } + s.NoError(json.Unmarshal(res.Stdout.Bytes(), &description)) + s.Equal("DevWorkflow", description.Schedule.Action.StartWorkflow.WorkflowType.Name) + s.False(description.Info.TimeSkippingInfo.EffectiveConfig.Enabled) +} + func (s *SharedServerSuite) TestSchedule_Memo_Update() { schedId, schedWfId, res := s.createSchedule("--memo", "bar=1") s.NoError(res.Err) diff --git a/internal/temporalcli/commands.server.go b/internal/temporalcli/commands.server.go index ad335d6cf..50221ed72 100644 --- a/internal/temporalcli/commands.server.go +++ b/internal/temporalcli/commands.server.go @@ -3,10 +3,12 @@ package temporalcli import ( "encoding/json" "fmt" + "os" "strings" "github.com/google/uuid" "go.temporal.io/api/enums/v1" + "go.temporal.io/server/common/dynamicconfig" "github.com/temporalio/cli/internal/devserver" ) @@ -49,6 +51,7 @@ func (t *TemporalServerStartDevCommand) run(cctx *CommandContext, args []string) MasterClusterName: "active", CurrentClusterName: "active", InitialFailoverVersion: 1, + EnableTimeSkipping: t.EnableTimeSkipping, } // Set the log level value of the server to the overall log level given to the // CLI. But if it is "never" we have to do a special value, and if it was @@ -98,9 +101,24 @@ func (t *TemporalServerStartDevCommand) run(cctx *CommandContext, args []string) var err error if opts.SqlitePragmas, err = stringKeysValues(t.SqlitePragma); err != nil { return fmt.Errorf("invalid pragma: %w", err) - } else if opts.DynamicConfigValues, err = stringKeysJSONValues(t.DynamicConfigValue, true); err != nil { + } + flagDynamicConfigValues, err := stringKeysJSONValues(t.DynamicConfigValue, true) + if err != nil { return fmt.Errorf("invalid dynamic config values: %w", err) } + if t.DynamicConfigFile != "" { + opts.DynamicConfigValues, err = loadDynamicConfigFile(t.DynamicConfigFile) + if err != nil { + return err + } + } + if opts.DynamicConfigValues == nil { + opts.DynamicConfigValues = make(map[string]any) + } + // Explicit command-line values take precedence over values from the file. + for key, value := range flagDynamicConfigValues { + opts.DynamicConfigValues[dynamicconfig.MakeKey(key).String()] = value + } // We have to convert all dynamic config values that JSON number to int if we // can because server dynamic config expecting int won't work with the default // float JSON unmarshal uses @@ -119,11 +137,12 @@ func (t *TemporalServerStartDevCommand) run(cctx *CommandContext, args []string) // Apply set of default dynamic config values if not already present for k, v := range defaultDynamicConfigValues { - if _, ok := opts.DynamicConfigValues[k]; !ok { + key := dynamicconfig.MakeKey(k).String() + if _, ok := opts.DynamicConfigValues[key]; !ok { if opts.DynamicConfigValues == nil { opts.DynamicConfigValues = map[string]any{} } - opts.DynamicConfigValues[k] = v + opts.DynamicConfigValues[key] = v } } @@ -183,6 +202,22 @@ func (t *TemporalServerStartDevCommand) run(cctx *CommandContext, args []string) return nil } +func loadDynamicConfigFile(filename string) (map[string]any, error) { + contents, err := os.ReadFile(filename) + if err != nil { + return nil, fmt.Errorf("read dynamic config file: %w", err) + } + loader := dynamicconfig.LoadYamlFile(contents) + if err := loader.Err(); err != nil { + return nil, fmt.Errorf("parse dynamic config file: %w", err) + } + values := make(map[string]any, len(loader.Map)) + for key, constrainedValues := range loader.Map { + values[key.String()] = constrainedValues + } + return values, nil +} + func toFriendlyIp(host string) string { if host == "127.0.0.1" || host == "::1" { return "localhost" diff --git a/internal/temporalcli/commands.server_internal_test.go b/internal/temporalcli/commands.server_internal_test.go new file mode 100644 index 000000000..3942bfc84 --- /dev/null +++ b/internal/temporalcli/commands.server_internal_test.go @@ -0,0 +1,29 @@ +package temporalcli + +import ( + "os" + "path/filepath" + "testing" + + "github.com/stretchr/testify/require" + "go.temporal.io/server/common/dynamicconfig" +) + +func TestLoadDynamicConfigFile(t *testing.T) { + filename := filepath.Join(t.TempDir(), "dynamicconfig.yaml") + require.NoError(t, os.WriteFile(filename, []byte(` +history.enableCHASMSchedulerCreation: + - value: true + constraints: + namespace: fx-test +`), 0o600)) + + values, err := loadDynamicConfigFile(filename) + require.NoError(t, err) + + constrainedValues, ok := values["history.enablechasmschedulercreation"].([]dynamicconfig.ConstrainedValue) + require.True(t, ok) + require.Len(t, constrainedValues, 1) + require.Equal(t, true, constrainedValues[0].Value) + require.Equal(t, "fx-test", constrainedValues[0].Constraints.Namespace) +} diff --git a/internal/temporalcli/commands.workflow_test.go b/internal/temporalcli/commands.workflow_test.go index d1d728853..a451776b4 100644 --- a/internal/temporalcli/commands.workflow_test.go +++ b/internal/temporalcli/commands.workflow_test.go @@ -57,6 +57,71 @@ func (s *SharedServerSuite) TestWorkflow_Signal_SingleWorkflowSuccess() { s.Equal(map[string]any{"foo": "bar"}, actual) } +func (s *SharedServerSuite) TestWorkflow_TimeSkippingEnablePollDisable() { + s.Worker().OnDevWorkflow(func(ctx workflow.Context, a any) (any, error) { + if err := workflow.Sleep(ctx, 10*time.Hour); err != nil { + return nil, err + } + return nil, nil + }) + run, err := s.Client.ExecuteWorkflow( + s.Context, + client.StartWorkflowOptions{TaskQueue: s.Worker().Options.TaskQueue}, + DevWorkflow, + "ignored", + ) + s.NoError(err) + + res := s.Execute( + "workflow", "time-skipping", "enable", + "--address", s.Address(), + "--workflow-id", run.GetID(), + "--run-id", run.GetRunID(), + "--fast-forward-duration", "5h", + "--fast-forward-id", "WorkflowPollId", + "--disable-propagation", + "--max-skip-per-session", "17", + ) + s.NoError(res.Err) + s.Contains(res.Stdout.String(), "Fast-forward ID: WorkflowPollId") + statusCommand := fmt.Sprintf("temporal workflow describe --namespace %s --workflow-id %s --run-id %s", s.Namespace(), run.GetID(), run.GetRunID()) + pollCommand := fmt.Sprintf("temporal workflow time-skipping poll --namespace %s --workflow-id %s --run-id %s --fast-forward-id WorkflowPollId", s.Namespace(), run.GetID(), run.GetRunID()) + s.Contains(res.Stdout.String(), statusCommand) + s.Contains(res.Stdout.String(), pollCommand) + s.Less(strings.Index(res.Stdout.String(), "Check status:"), strings.Index(res.Stdout.String(), "Fast-forward ID:")) + + res = s.Execute( + "workflow", "time-skipping", "poll", + "--address", s.Address(), + "--workflow-id", run.GetID(), + "--run-id", run.GetRunID(), + "--fast-forward-id", "WorkflowPollId", + ) + s.NoError(res.Err) + s.Contains(res.Stdout.String(), "completed") + + res = s.Execute( + "workflow", "describe", + "--address", s.Address(), + "--workflow-id", run.GetID(), + ) + s.NoError(res.Err) + s.Contains(res.Stdout.String(), "Time Skipping:") + s.ContainsOnSameLine(res.Stdout.String(), "DisablePropagation", "true") + + res = s.Execute( + "workflow", "time-skipping", "disable", + "--address", s.Address(), + "--workflow-id", run.GetID(), + "--run-id", run.GetRunID(), + ) + s.NoError(res.Err) + s.Contains(res.Stdout.String(), "Time skipping: disabled") + s.Contains(res.Stdout.String(), statusCommand) + s.NotContains(res.Stdout.String(), "Poll fast-forward:") + s.NoError(s.Client.CancelWorkflow(s.Context, run.GetID(), run.GetRunID())) +} + func (s *SharedServerSuite) TestWorkflow_Signal_MultipleInputsWithComplexMetadata() { // Start a random workflow run, err := s.Client.ExecuteWorkflow( diff --git a/internal/temporalcli/commands.yaml b/internal/temporalcli/commands.yaml index 2b325b614..8f2601b6b 100644 --- a/internal/temporalcli/commands.yaml +++ b/internal/temporalcli/commands.yaml @@ -3987,6 +3987,12 @@ commands: - name: headless type: bool description: Disable the Web UI. + - name: enable-time-skipping + type: bool + description: | + Enable Workflow and CHASM Schedule time skipping in all Namespaces for + this dev server run. Also enable CHASM Schedule creation and routing. + Explicit dynamic config values take precedence. - name: ip type: string description: IP address bound to the front-end Service. @@ -4022,6 +4028,11 @@ commands: Keys must be identifiers, and values must be JSON values. For example: `YourKey="YourString"` Can be passed multiple times. + - name: dynamic-config-file + type: string + description: | + Path to a dynamic configuration YAML file. Values passed with + `--dynamic-config-value` take precedence over values from this file. - name: log-config type: bool description: Print the server config to stderr. diff --git a/internal/temporalcli/commands_test.go b/internal/temporalcli/commands_test.go index f66885df0..125e6330b 100644 --- a/internal/temporalcli/commands_test.go +++ b/internal/temporalcli/commands_test.go @@ -234,6 +234,7 @@ func (s *SharedServerSuite) SetupSuite() { StartOptions: devserver.StartOptions{ // Enable for operator cluster commands EnableGlobalNamespace: true, + EnableTimeSkipping: true, DynamicConfigValues: map[string]any{ "frontend.enableUpdateWorkflowExecutionAsyncAccepted": true, // Allow a high rate of change to namespaces, particularly From fc478b32ef5bd7946cae443a8a13f9d250dac706 Mon Sep 17 00:00:00 2001 From: Feiyang Xie Date: Tue, 27 Oct 2026 15:35:39 -0700 Subject: [PATCH 03/13] more testing and bug fix --- internal/devserver/server.go | 59 +--- internal/devserver/server_test.go | 130 ++++++--- internal/devserver/time_skipping_config.go | 63 ++++ internal/temporalcli/commands.gen.go | 80 +++-- internal/temporalcli/commands.schedule.go | 97 ++----- .../commands.schedule_internal_test.go | 85 ------ .../temporalcli/commands.schedule_test.go | 273 +++++++++++++++++- internal/temporalcli/commands.server.go | 40 +-- .../commands.server_internal_test.go | 29 -- .../commands.time_skipping_test.go | 84 ++++++ .../temporalcli/commands.workflow_test.go | 88 ++++++ .../commands.workflow_time_skipping.go | 38 +-- ...ds.workflow_time_skipping_internal_test.go | 35 +-- internal/temporalcli/commands.yaml | 156 +++++----- internal/temporalcli/commands_test.go | 14 +- internal/temporalcli/timeskipping.go | 80 +++++ internal/temporalcli/timeskipping_test.go | 183 ++++++++++++ 17 files changed, 1039 insertions(+), 495 deletions(-) create mode 100644 internal/devserver/time_skipping_config.go delete mode 100644 internal/temporalcli/commands.schedule_internal_test.go delete mode 100644 internal/temporalcli/commands.server_internal_test.go create mode 100644 internal/temporalcli/commands.time_skipping_test.go create mode 100644 internal/temporalcli/timeskipping.go create mode 100644 internal/temporalcli/timeskipping_test.go diff --git a/internal/devserver/server.go b/internal/devserver/server.go index 9cef983c3..01d812820 100644 --- a/internal/devserver/server.go +++ b/internal/devserver/server.go @@ -239,27 +239,7 @@ func (s *StartOptions) buildServerOptions() ([]temporal.ServerOption, *slog.Leve temporal.WithClaimMapper(func(*config.Config) authorization.ClaimMapper { return claimMapper }), } - dynConf := devServerDynamicConfig(s.DynamicConfigValues, s.EnableTimeSkipping) - opts = append(opts, temporal.WithDynamicConfigClient(dynConf)) - - // gRPC interceptors if set - if len(s.GRPCInterceptors) > 0 { - opts = append(opts, temporal.WithChainedFrontendGrpcInterceptors(s.GRPCInterceptors...)) - } - - return opts, logLevel, nil -} - -var timeSkippingDynamicConfigDefaults = map[dynamicconfig.Key]any{ - dynamicconfig.WorkflowTimeSkippingEnabled.Key(): true, - dynamicconfig.CHASMSchedulerTimeSkippingEnabled.Key(): true, - dynamicconfig.EnableCHASMSchedulerCreation.Key(): true, - dynamicconfig.CHASMSchedulerCreationRolloutPercent.Key(): 100, - dynamicconfig.EnableCHASMSchedulerRouting.Key(): true, -} - -func devServerDynamicConfig(values map[string]any, enableTimeSkipping bool) dynamicconfig.StaticClient { - dynConf := make(dynamicconfig.StaticClient, len(values)+len(timeSkippingDynamicConfigDefaults)+5) + dynConf := make(dynamicconfig.StaticClient, len(s.DynamicConfigValues)+1) // Setting host level mutable state cache size to 8k. dynConf[dynamicconfig.HistoryCacheHostLevelMaxSize.Key()] = 8096 // Up default visibility RPS @@ -271,34 +251,21 @@ func devServerDynamicConfig(values map[string]any, enableTimeSkipping bool) dyna // Enable SANO; this can be removed when SANO is on by default. dynConf[nexusoperation.Enabled.Key()] = true - if enableTimeSkipping { - // Enable Workflow and CHASM Schedule time skipping in every namespace. - for key, value := range timeSkippingDynamicConfigDefaults { - dynConf[key] = value - } + // Dynamic config if set + for k, v := range s.DynamicConfigValues { + dynConf[dynamicconfig.MakeKey(k)] = v + } + if s.EnableTimeSkipping { + applyTimeSkippingDynamicConfig(dynConf) } + opts = append(opts, temporal.WithDynamicConfigClient(dynConf)) - // Explicit config overrides defaults. A namespace-specific YAML value also - // needs the global default as a fallback for other namespaces. - for name, value := range values { - key := dynamicconfig.MakeKey(name) - if fallback, ok := timeSkippingDynamicConfigDefaults[key]; ok && enableTimeSkipping { - if constrained, ok := value.([]dynamicconfig.ConstrainedValue); ok { - hasGlobal := false - for _, entry := range constrained { - if entry.Constraints == (dynamicconfig.Constraints{}) { - hasGlobal = true - break - } - } - if !hasGlobal { - value = append(append([]dynamicconfig.ConstrainedValue(nil), constrained...), dynamicconfig.ConstrainedValue{Value: fallback}) - } - } - } - dynConf[key] = value + // gRPC interceptors if set + if len(s.GRPCInterceptors) > 0 { + opts = append(opts, temporal.WithChainedFrontendGrpcInterceptors(s.GRPCInterceptors...)) } - return dynConf + + return opts, logLevel, nil } func (s *StartOptions) buildServerConfig() (*config.Config, error) { diff --git a/internal/devserver/server_test.go b/internal/devserver/server_test.go index 0bacd1e76..36fff743f 100644 --- a/internal/devserver/server_test.go +++ b/internal/devserver/server_test.go @@ -8,61 +8,95 @@ import ( "go.temporal.io/server/common/log" ) -func TestTimeSkippingDynamicConfigDefaults(t *testing.T) { - config := dynamicconfig.NewCollection(devServerDynamicConfig(nil, true), log.NewNoopLogger()) - for _, namespace := range []string{"default", "timeskipping-test"} { - require.True(t, dynamicconfig.WorkflowTimeSkippingEnabled.Get(config)(namespace)) - require.True(t, dynamicconfig.CHASMSchedulerTimeSkippingEnabled.Get(config)(namespace)) - require.True(t, dynamicconfig.EnableCHASMSchedulerCreation.Get(config)(namespace)) - require.Equal(t, 100, dynamicconfig.CHASMSchedulerCreationRolloutPercent.Get(config)(namespace)) - require.True(t, dynamicconfig.EnableCHASMSchedulerRouting.Get(config)(namespace)) +func timeSkippingConfigForTest(values map[string]any, enabled bool) dynamicconfig.StaticClient { + config := make(dynamicconfig.StaticClient) + for key, value := range values { + config[dynamicconfig.MakeKey(key)] = value } -} - -func TestTimeSkippingDynamicConfigDefaultOff(t *testing.T) { - values := devServerDynamicConfig(nil, false) - for key := range timeSkippingDynamicConfigDefaults { - _, present := values[key] - require.False(t, present, "unexpected override for %s", key) - } - config := dynamicconfig.NewCollection(values, log.NewNoopLogger()) - for _, namespace := range []string{"default", "timeskipping-test"} { - require.False(t, dynamicconfig.WorkflowTimeSkippingEnabled.Get(config)(namespace)) - require.False(t, dynamicconfig.CHASMSchedulerTimeSkippingEnabled.Get(config)(namespace)) - require.False(t, dynamicconfig.EnableCHASMSchedulerCreation.Get(config)(namespace)) - require.Equal(t, 0, dynamicconfig.CHASMSchedulerCreationRolloutPercent.Get(config)(namespace)) + if enabled { + applyTimeSkippingDynamicConfig(config) } + return config } -func TestTimeSkippingDynamicConfigNamespaceOverride(t *testing.T) { - values := map[string]any{ - dynamicconfig.WorkflowTimeSkippingEnabled.Key().String(): []dynamicconfig.ConstrainedValue{{ - Value: false, - Constraints: dynamicconfig.Constraints{Namespace: "timeskipping-test"}, - }}, - dynamicconfig.CHASMSchedulerTimeSkippingEnabled.Key().String(): []dynamicconfig.ConstrainedValue{{ - Value: false, - Constraints: dynamicconfig.Constraints{Namespace: "timeskipping-test"}, - }}, +func TestDevServerTimeSkippingDynamicConfigPrecedence(t *testing.T) { + disabled := map[dynamicconfig.Key]any{ + dynamicconfig.WorkflowTimeSkippingEnabled.Key(): false, + dynamicconfig.CHASMSchedulerTimeSkippingEnabled.Key(): false, + dynamicconfig.EnableCHASMSchedulerCreation.Key(): false, + dynamicconfig.CHASMSchedulerCreationRolloutPercent.Key(): 0, + dynamicconfig.EnableCHASMSchedulerRouting.Key(): false, } - config := dynamicconfig.NewCollection(devServerDynamicConfig(values, true), log.NewNoopLogger()) - for _, enabled := range []func(string) bool{ - dynamicconfig.WorkflowTimeSkippingEnabled.Get(config), - dynamicconfig.CHASMSchedulerTimeSkippingEnabled.Get(config), - } { - require.False(t, enabled("timeskipping-test")) - require.True(t, enabled("another-namespace")) + type wantConfig struct { + workflow, schedule, creation, routing bool + rollout, maxSkip int } -} + serverDefaults := wantConfig{routing: true, maxSkip: 200} + allEnabled := wantConfig{workflow: true, schedule: true, creation: true, routing: true, rollout: 100, maxSkip: 200} + allDisabled := wantConfig{maxSkip: 200} + granularDisabled := wantConfig{maxSkip: 50} -func TestTimeSkippingDynamicConfigGlobalOverride(t *testing.T) { - key := dynamicconfig.WorkflowTimeSkippingEnabled.Key().String() - config := dynamicconfig.NewCollection(devServerDynamicConfig(map[string]any{key: false}, true), log.NewNoopLogger()) - require.False(t, dynamicconfig.WorkflowTimeSkippingEnabled.Get(config)("default")) + granular := make(map[string]any, len(disabled)+1) + globalScalar := make(map[string]any, len(disabled)) + globalYAML := make(map[string]any, len(disabled)) + for key, value := range disabled { + granular[key.String()] = []dynamicconfig.ConstrainedValue{{ + Value: value, Constraints: dynamicconfig.Constraints{Namespace: "timeskipping-test"}, + }} + globalScalar[key.String()] = value + globalYAML[key.String()] = []dynamicconfig.ConstrainedValue{{Value: value}} + } + granular[dynamicconfig.TimeSkippingMaxSkipPerSession.Key().String()] = []dynamicconfig.ConstrainedValue{{ + Value: 50, Constraints: dynamicconfig.Constraints{Namespace: "timeskipping-test"}, + }} - yamlValues := map[string]any{ - key: []dynamicconfig.ConstrainedValue{{Value: false}}, + for _, tc := range []struct { + name string + enabled bool + explicit map[string]any + wantTest wantConfig + wantElse wantConfig + shape string + }{ + {name: "flag off", wantTest: serverDefaults, wantElse: serverDefaults, shape: "absent"}, + {name: "no explicit config", enabled: true, wantTest: allEnabled, wantElse: allEnabled, shape: "defaults"}, + {name: "namespace explicit config", enabled: true, explicit: granular, wantTest: granularDisabled, wantElse: allEnabled, shape: "granular"}, + {name: "global explicit scalar config", enabled: true, explicit: globalScalar, wantTest: allDisabled, wantElse: allDisabled, shape: "global"}, + {name: "global explicit YAML config", enabled: true, explicit: globalYAML, wantTest: allDisabled, wantElse: allDisabled, shape: "global"}, + } { + t.Run(tc.name, func(t *testing.T) { + raw := timeSkippingConfigForTest(tc.explicit, tc.enabled) + for key, fallback := range timeSkippingDynamicConfigDefaults { + switch tc.shape { + case "absent": + _, present := raw[key] + require.False(t, present, "unexpected override for %s", key) + case "defaults": + require.Equal(t, fallback, raw[key], "key %s", key) + case "granular": + require.Len(t, tc.explicit[key.String()].([]dynamicconfig.ConstrainedValue), 1, "input for %s was mutated", key) + require.Equal(t, []dynamicconfig.ConstrainedValue{ + {Value: disabled[key], Constraints: dynamicconfig.Constraints{Namespace: "timeskipping-test"}}, + {Value: fallback}, + }, raw[key], "key %s", key) + case "global": + require.Equal(t, tc.explicit[key.String()], raw[key], "key %s was replaced or appended to", key) + } + } + config := dynamicconfig.NewCollection(raw, log.NewNoopLogger()) + for namespace, want := range map[string]wantConfig{ + "timeskipping-test": tc.wantTest, + "another-namespace": tc.wantElse, + } { + t.Run(namespace, func(t *testing.T) { + require.Equal(t, want.workflow, dynamicconfig.WorkflowTimeSkippingEnabled.Get(config)(namespace)) + require.Equal(t, want.schedule, dynamicconfig.CHASMSchedulerTimeSkippingEnabled.Get(config)(namespace)) + require.Equal(t, want.creation, dynamicconfig.EnableCHASMSchedulerCreation.Get(config)(namespace)) + require.Equal(t, want.rollout, dynamicconfig.CHASMSchedulerCreationRolloutPercent.Get(config)(namespace)) + require.Equal(t, want.routing, dynamicconfig.EnableCHASMSchedulerRouting.Get(config)(namespace)) + require.Equal(t, want.maxSkip, dynamicconfig.TimeSkippingMaxSkipPerSession.Get(config)(namespace)) + }) + } + }) } - config = dynamicconfig.NewCollection(devServerDynamicConfig(yamlValues, true), log.NewNoopLogger()) - require.False(t, dynamicconfig.WorkflowTimeSkippingEnabled.Get(config)("another-namespace")) } diff --git a/internal/devserver/time_skipping_config.go b/internal/devserver/time_skipping_config.go new file mode 100644 index 000000000..1310d0242 --- /dev/null +++ b/internal/devserver/time_skipping_config.go @@ -0,0 +1,63 @@ +// The MIT License +// +// Copyright (c) 2022 Temporal Technologies Inc. All rights reserved. +// +// Copyright (c) 2020 Uber Technologies, Inc. +// +// Copyright (c) 2021 Datadog, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package devserver + +import "go.temporal.io/server/common/dynamicconfig" + +var timeSkippingDynamicConfigDefaults = map[dynamicconfig.Key]any{ + dynamicconfig.WorkflowTimeSkippingEnabled.Key(): true, + dynamicconfig.CHASMSchedulerTimeSkippingEnabled.Key(): true, + dynamicconfig.EnableCHASMSchedulerCreation.Key(): true, + dynamicconfig.CHASMSchedulerCreationRolloutPercent.Key(): 100, + dynamicconfig.EnableCHASMSchedulerRouting.Key(): true, +} + +func applyTimeSkippingDynamicConfig(dynConf dynamicconfig.StaticClient) { + for key, fallback := range timeSkippingDynamicConfigDefaults { + value, exists := dynConf[key] + if !exists { + dynConf[key] = fallback + continue + } + // Explicit global values win. Constrained values need the default as a + // fallback for namespaces they do not match. + constrained, ok := value.([]dynamicconfig.ConstrainedValue) + if !ok { + continue + } + hasGlobal := false + for _, entry := range constrained { + if entry.Constraints == (dynamicconfig.Constraints{}) { + hasGlobal = true + break + } + } + if !hasGlobal { + dynConf[key] = append(append([]dynamicconfig.ConstrainedValue(nil), constrained...), dynamicconfig.ConstrainedValue{Value: fallback}) + } + } +} diff --git a/internal/temporalcli/commands.gen.go b/internal/temporalcli/commands.gen.go index 41497857d..f3f4844f3 100644 --- a/internal/temporalcli/commands.gen.go +++ b/internal/temporalcli/commands.gen.go @@ -38,6 +38,16 @@ func (v *ScheduleIdOptions) BuildFlags(f *pflag.FlagSet) { _ = cobra.MarkFlagRequired(f, "schedule-id") } +type MaxSkipPerSessionOptions struct { + MaxSkipPerSession int + FlagSet *pflag.FlagSet +} + +func (v *MaxSkipPerSessionOptions) BuildFlags(f *pflag.FlagSet) { + v.FlagSet = f + f.IntVar(&v.MaxSkipPerSession, "max-skip-per-session", 0, "Limit the number of time skips in a single time-skipping session. A session starts when time skipping is enabled and ends when it is automatically disabled. Updating the time-skipping configuration resets the session. Omit to use the server default, which is 200 and can be configured through the `system.timeSkippingMaxSkipPerSession` dynamic config. Usually leave this unset unless a previous test reached the limit and time skipping turned off automatically; then set a higher value. If specified, must be between 1 and 10000. Use `temporal schedule describe` or `temporal workflow describe` to check `MaxSessionSkipCount`, `CurrentSessionSkipCount`, and `EffectiveEnabled` in the time-skipping status.") +} + type ScheduleConfigurationOptions struct { Calendar []string CatchupWindow cliext.FlagDuration @@ -72,30 +82,6 @@ func (v *ScheduleConfigurationOptions) BuildFlags(f *pflag.FlagSet) { f.StringVar(&v.TimeZone, "time-zone", "", "Interpret calendar specs with the `TZ` time zone. For a list of time zones, see: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones.") } -type WorkflowTimeSkippingOptionsOptions struct { - DisablePropagation bool - MaxSkipPerSession int - FlagSet *pflag.FlagSet -} - -func (v *WorkflowTimeSkippingOptionsOptions) BuildFlags(f *pflag.FlagSet) { - v.FlagSet = f - f.BoolVar(&v.DisablePropagation, "disable-propagation", false, "Defaults to false. Omit this flag or set it to false to propagate the time-skipping enabled state to child Workflows started by this Workflow. Set it to true, or specify it without a value, to disable propagation. Fast-forward targets are never propagated. Virtual time is propagated regardless of this flag.") - f.IntVar(&v.MaxSkipPerSession, "max-skip-per-session", 0, "Limit the number of time skips in this session. Omit to use the server default.") -} - -type ScheduleTimeSkippingOptionsOptions struct { - DisablePropagation bool - MaxSkipPerSession int - FlagSet *pflag.FlagSet -} - -func (v *ScheduleTimeSkippingOptionsOptions) BuildFlags(f *pflag.FlagSet) { - v.FlagSet = f - f.BoolVar(&v.DisablePropagation, "disable-propagation", false, "Do not propagate time skipping to Workflows started by this Schedule.") - f.IntVar(&v.MaxSkipPerSession, "max-skip-per-session", 0, "Override the server default maximum skips per session.") -} - type ScheduleCreateOnlyOptions struct { ScheduleSearchAttribute []string ScheduleMemo []string @@ -2825,9 +2811,9 @@ func NewTemporalScheduleTimeSkippingCommand(cctx *CommandContext, parent *Tempor s.Command.Use = "time-skipping" s.Command.Short = "Manage Schedule time skipping (Experimental)" if hasHighlighting { - s.Command.Long = "Enable or disable Schedule time skipping. For example:\n\n\x1b[1mtemporal schedule time-skipping enable \\\n --namespace YourNamespace \\\n --schedule-id YourScheduleId \\\n --fast-forward-duration 5h\x1b[0m\n\nUse enable to set a fast-forward target for the Schedule." + s.Command.Long = "Schedule time-skipping commands:\n\n- \x1b[1mtemporal schedule time-skipping enable\x1b[0m: Enable time skipping with a\n fast-forward duration.\n- \x1b[1mtemporal schedule time-skipping disable\x1b[0m: Disable time skipping.\n- \x1b[1mtemporal schedule time-skipping poll\x1b[0m: Poll a fast-forward result.\n\n\x1b[1mtemporal schedule describe\x1b[0m shows the new \x1b[1mTimeSkippingInfo\x1b[0m field,\nincluding the effective configuration and fast-forward status." } else { - s.Command.Long = "Enable or disable Schedule time skipping. For example:\n\n```\ntemporal schedule time-skipping enable \\\n --namespace YourNamespace \\\n --schedule-id YourScheduleId \\\n --fast-forward-duration 5h\n```\n\nUse enable to set a fast-forward target for the Schedule." + s.Command.Long = "Schedule time-skipping commands:\n\n- `temporal schedule time-skipping enable`: Enable time skipping with a\n fast-forward duration.\n- `temporal schedule time-skipping disable`: Disable time skipping.\n- `temporal schedule time-skipping poll`: Poll a fast-forward result.\n\n`temporal schedule describe` shows the new `TimeSkippingInfo` field,\nincluding the effective configuration and fast-forward status." } s.Command.Args = cobra.NoArgs s.Command.AddCommand(&NewTemporalScheduleTimeSkippingDisableCommand(cctx, &s).Command) @@ -2849,9 +2835,9 @@ func NewTemporalScheduleTimeSkippingDisableCommand(cctx *CommandContext, parent s.Command.Use = "disable [flags]" s.Command.Short = "Disable Schedule time skipping (Experimental)" if hasHighlighting { - s.Command.Long = "Disable time skipping for a Schedule:\n\n\x1b[1mtemporal schedule time-skipping disable \\\n --namespace YourNamespace \\\n --schedule-id YourScheduleId\x1b[0m\n\nThe Schedule remains available after time skipping is disabled." + s.Command.Long = "Disable time skipping for a Schedule:\n\n\x1b[1mtemporal schedule time-skipping disable \\\n --namespace YourNamespace \\\n --schedule-id YourScheduleId\x1b[0m\n\nNo other time-skipping flags are needed." } else { - s.Command.Long = "Disable time skipping for a Schedule:\n\n```\ntemporal schedule time-skipping disable \\\n --namespace YourNamespace \\\n --schedule-id YourScheduleId\n```\n\nThe Schedule remains available after time skipping is disabled." + s.Command.Long = "Disable time skipping for a Schedule:\n\n```\ntemporal schedule time-skipping disable \\\n --namespace YourNamespace \\\n --schedule-id YourScheduleId\n```\n\nNo other time-skipping flags are needed." } s.Command.Args = cobra.NoArgs s.ScheduleIdOptions.BuildFlags(s.Command.Flags()) @@ -2867,9 +2853,10 @@ type TemporalScheduleTimeSkippingEnableCommand struct { Parent *TemporalScheduleTimeSkippingCommand Command cobra.Command ScheduleIdOptions - ScheduleTimeSkippingOptionsOptions + MaxSkipPerSessionOptions FastForwardDuration cliext.FlagDuration FastForwardId string + DisablePropagation bool } func NewTemporalScheduleTimeSkippingEnableCommand(cctx *CommandContext, parent *TemporalScheduleTimeSkippingCommand) *TemporalScheduleTimeSkippingEnableCommand { @@ -2879,17 +2866,18 @@ func NewTemporalScheduleTimeSkippingEnableCommand(cctx *CommandContext, parent * s.Command.Use = "enable [flags]" s.Command.Short = "Enable Schedule time skipping (Experimental)" if hasHighlighting { - s.Command.Long = "Enable time skipping for a Schedule and set a fast-forward target:\n\n\x1b[1mtemporal schedule time-skipping enable \\\n --namespace YourNamespace \\\n --schedule-id YourScheduleId \\\n --fast-forward-duration 5h\x1b[0m\n\nThe fast-forward target is relative to the current virtual time." + s.Command.Long = "Enable time skipping for a Schedule:\n\n\x1b[1mtemporal schedule time-skipping enable \\\n --namespace YourNamespace \\\n --schedule-id YourScheduleId \\\n --fast-forward-duration 5h\x1b[0m\n\nEach enable call sets the complete time-skipping configuration. Specify\nevery optional setting you want to override; omitted settings use their\ndefaults.\nCheck the effective values, including defaults, with:\n\n\x1b[1mtemporal schedule describe \\\n --namespace YourNamespace \\\n --schedule-id YourScheduleId\x1b[0m" } else { - s.Command.Long = "Enable time skipping for a Schedule and set a fast-forward target:\n\n```\ntemporal schedule time-skipping enable \\\n --namespace YourNamespace \\\n --schedule-id YourScheduleId \\\n --fast-forward-duration 5h\n```\n\nThe fast-forward target is relative to the current virtual time." + s.Command.Long = "Enable time skipping for a Schedule:\n\n```\ntemporal schedule time-skipping enable \\\n --namespace YourNamespace \\\n --schedule-id YourScheduleId \\\n --fast-forward-duration 5h\n```\n\nEach enable call sets the complete time-skipping configuration. Specify\nevery optional setting you want to override; omitted settings use their\ndefaults.\nCheck the effective values, including defaults, with:\n\n```\ntemporal schedule describe \\\n --namespace YourNamespace \\\n --schedule-id YourScheduleId\n```" } s.Command.Args = cobra.NoArgs s.FastForwardDuration = 0 - s.Command.Flags().Var(&s.FastForwardDuration, "fast-forward-duration", "Set a fast-forward target this far ahead of the current virtual time. Must be greater than zero. Required.") + s.Command.Flags().Var(&s.FastForwardDuration, "fast-forward-duration", "Fast-forward the Schedule's virtual time by this duration. Must be greater than zero. Required.") _ = cobra.MarkFlagRequired(s.Command.Flags(), "fast-forward-duration") s.Command.Flags().StringVar(&s.FastForwardId, "fast-forward-id", "", "Identify this fast-forward in Schedule status. Generated if omitted. Not an idempotency key.") + s.Command.Flags().BoolVar(&s.DisablePropagation, "disable-propagation", false, "Defaults to false. Omit this flag or set it to false to propagate the time-skipping enabled state to Workflows started by this Schedule. Set it to true, or specify it without a value, to disable propagation. Fast-forward targets are never propagated. Virtual time is propagated regardless of this flag.") s.ScheduleIdOptions.BuildFlags(s.Command.Flags()) - s.ScheduleTimeSkippingOptionsOptions.BuildFlags(s.Command.Flags()) + s.MaxSkipPerSessionOptions.BuildFlags(s.Command.Flags()) s.Command.Run = func(c *cobra.Command, args []string) { if err := s.run(cctx, args); err != nil { cctx.Options.Fail(err) @@ -3070,7 +3058,6 @@ type TemporalServerStartDevCommand struct { UiDisableNewsFetch bool SqlitePragma []string DynamicConfigValue []string - DynamicConfigFile string LogConfig bool SearchAttribute []string } @@ -3103,7 +3090,6 @@ func NewTemporalServerStartDevCommand(cctx *CommandContext, parent *TemporalServ s.Command.Flags().BoolVar(&s.UiDisableNewsFetch, "ui-disable-news-fetch", false, "Disable the Web UI newsfeed. When set, the UI will not request the newsfeed and the button to open the newsfeed panel is hidden.") s.Command.Flags().StringArrayVar(&s.SqlitePragma, "sqlite-pragma", nil, "SQLite pragma statements in \"PRAGMA=VALUE\" format.") s.Command.Flags().StringArrayVar(&s.DynamicConfigValue, "dynamic-config-value", nil, "Dynamic configuration value using `KEY=VALUE` pairs. Keys must be identifiers, and values must be JSON values. For example: `YourKey=\"YourString\"` Can be passed multiple times.") - s.Command.Flags().StringVar(&s.DynamicConfigFile, "dynamic-config-file", "", "Path to a dynamic configuration YAML file. Values passed with `--dynamic-config-value` take precedence over values from this file.") s.Command.Flags().BoolVar(&s.LogConfig, "log-config", false, "Print the server config to stderr.") s.Command.Flags().StringArrayVar(&s.SearchAttribute, "search-attribute", nil, "Search attributes to register using `KEY=VALUE` pairs. Keys must be identifiers, and values must be the search attribute type, which is one of the following: Text, Keyword, Int, Double, Bool, Datetime, KeywordList.") s.Command.Run = func(c *cobra.Command, args []string) { @@ -5638,9 +5624,9 @@ func NewTemporalWorkflowTimeSkippingCommand(cctx *CommandContext, parent *Tempor s.Command.Use = "time-skipping" s.Command.Short = "Manage Workflow time skipping (Experimental)" if hasHighlighting { - s.Command.Long = "Enable or disable time skipping for a Workflow Execution. For example:\n\n\x1b[1mtemporal workflow time-skipping enable \\\n --namespace YourNamespace \\\n --workflow-id YourWorkflowId\x1b[0m\n\nUse poll to check the result of a fast-forward." + s.Command.Long = "Workflow time-skipping commands:\n\n- \x1b[1mtemporal workflow time-skipping enable\x1b[0m: Enable time skipping with an\n optional fast-forward duration.\n- \x1b[1mtemporal workflow time-skipping disable\x1b[0m: Disable time skipping.\n- \x1b[1mtemporal workflow time-skipping poll\x1b[0m: Poll a fast-forward result.\n\n\x1b[1mtemporal workflow describe\x1b[0m shows the \x1b[1mTime Skipping\x1b[0m section, including\nthe effective configuration and fast-forward status." } else { - s.Command.Long = "Enable or disable time skipping for a Workflow Execution. For example:\n\n```\ntemporal workflow time-skipping enable \\\n --namespace YourNamespace \\\n --workflow-id YourWorkflowId\n```\n\nUse poll to check the result of a fast-forward." + s.Command.Long = "Workflow time-skipping commands:\n\n- `temporal workflow time-skipping enable`: Enable time skipping with an\n optional fast-forward duration.\n- `temporal workflow time-skipping disable`: Disable time skipping.\n- `temporal workflow time-skipping poll`: Poll a fast-forward result.\n\n`temporal workflow describe` shows the `Time Skipping` section, including\nthe effective configuration and fast-forward status." } s.Command.Args = cobra.NoArgs s.Command.AddCommand(&NewTemporalWorkflowTimeSkippingDisableCommand(cctx, &s).Command) @@ -5662,9 +5648,9 @@ func NewTemporalWorkflowTimeSkippingDisableCommand(cctx *CommandContext, parent s.Command.Use = "disable [flags]" s.Command.Short = "Disable Workflow time skipping (Experimental)" if hasHighlighting { - s.Command.Long = "Disable time skipping for a Workflow Execution:\n\n\x1b[1mtemporal workflow time-skipping disable \\\n --namespace YourNamespace \\\n --workflow-id YourWorkflowId\x1b[0m\n\nThe Workflow Execution remains available after time skipping is disabled." + s.Command.Long = "Disable time skipping for a Workflow Execution:\n\n\x1b[1mtemporal workflow time-skipping disable \\\n --namespace YourNamespace \\\n --workflow-id YourWorkflowId\x1b[0m\n\nNo other time-skipping flags are needed." } else { - s.Command.Long = "Disable time skipping for a Workflow Execution:\n\n```\ntemporal workflow time-skipping disable \\\n --namespace YourNamespace \\\n --workflow-id YourWorkflowId\n```\n\nThe Workflow Execution remains available after time skipping is disabled." + s.Command.Long = "Disable time skipping for a Workflow Execution:\n\n```\ntemporal workflow time-skipping disable \\\n --namespace YourNamespace \\\n --workflow-id YourWorkflowId\n```\n\nNo other time-skipping flags are needed." } s.Command.Args = cobra.NoArgs s.WorkflowReferenceOptions.BuildFlags(s.Command.Flags()) @@ -5680,9 +5666,10 @@ type TemporalWorkflowTimeSkippingEnableCommand struct { Parent *TemporalWorkflowTimeSkippingCommand Command cobra.Command WorkflowReferenceOptions - WorkflowTimeSkippingOptionsOptions + MaxSkipPerSessionOptions FastForwardDuration cliext.FlagDuration FastForwardId string + DisablePropagation bool } func NewTemporalWorkflowTimeSkippingEnableCommand(cctx *CommandContext, parent *TemporalWorkflowTimeSkippingCommand) *TemporalWorkflowTimeSkippingEnableCommand { @@ -5692,16 +5679,17 @@ func NewTemporalWorkflowTimeSkippingEnableCommand(cctx *CommandContext, parent * s.Command.Use = "enable [flags]" s.Command.Short = "Enable Workflow time skipping (Experimental)" if hasHighlighting { - s.Command.Long = "Enable time skipping for a Workflow Execution, optionally with a fast-forward target:\n\n\x1b[1mtemporal workflow time-skipping enable \\\n --namespace YourNamespace \\\n --workflow-id YourWorkflowId \\\n --fast-forward-duration 5h\x1b[0m\n\nEach call replaces the time-skipping configuration and starts a new skip session." + s.Command.Long = "Enable time skipping for a Workflow Execution:\n\n\x1b[1mtemporal workflow time-skipping enable \\\n --namespace YourNamespace \\\n --workflow-id YourWorkflowId \\\n --fast-forward-duration 5h\x1b[0m\n\n--fast-forward-duration is optional. Each enable call replaces the complete\ntime-skipping configuration and starts a new skip session. Specify every\noptional setting you want to override; omitted settings use their defaults.\nCheck the effective values, including defaults, with:\n\n\x1b[1mtemporal workflow describe \\\n --namespace YourNamespace \\\n --workflow-id YourWorkflowId\x1b[0m" } else { - s.Command.Long = "Enable time skipping for a Workflow Execution, optionally with a fast-forward target:\n\n```\ntemporal workflow time-skipping enable \\\n --namespace YourNamespace \\\n --workflow-id YourWorkflowId \\\n --fast-forward-duration 5h\n```\n\nEach call replaces the time-skipping configuration and starts a new skip session." + s.Command.Long = "Enable time skipping for a Workflow Execution:\n\n```\ntemporal workflow time-skipping enable \\\n --namespace YourNamespace \\\n --workflow-id YourWorkflowId \\\n --fast-forward-duration 5h\n```\n\n--fast-forward-duration is optional. Each enable call replaces the complete\ntime-skipping configuration and starts a new skip session. Specify every\noptional setting you want to override; omitted settings use their defaults.\nCheck the effective values, including defaults, with:\n\n```\ntemporal workflow describe \\\n --namespace YourNamespace \\\n --workflow-id YourWorkflowId\n```" } s.Command.Args = cobra.NoArgs s.FastForwardDuration = 0 - s.Command.Flags().Var(&s.FastForwardDuration, "fast-forward-duration", "Set a fast-forward target this far ahead of the current virtual time.") + s.Command.Flags().Var(&s.FastForwardDuration, "fast-forward-duration", "Fast-forward the Workflow Execution's virtual time by this duration. Must be greater than zero.") s.Command.Flags().StringVar(&s.FastForwardId, "fast-forward-id", "", "Identify this fast-forward in Workflow status and when polling for completion. Generated if omitted. Not an idempotency key. Requires --fast-forward-duration.") + s.Command.Flags().BoolVar(&s.DisablePropagation, "disable-propagation", false, "Defaults to false. Omit this flag or set it to false to propagate the time-skipping enabled state to child Workflows started by this Workflow. Set it to true, or specify it without a value, to disable propagation. Fast-forward targets are never propagated. Virtual time is propagated regardless of this flag.") s.WorkflowReferenceOptions.BuildFlags(s.Command.Flags()) - s.WorkflowTimeSkippingOptionsOptions.BuildFlags(s.Command.Flags()) + s.MaxSkipPerSessionOptions.BuildFlags(s.Command.Flags()) s.Command.Run = func(c *cobra.Command, args []string) { if err := s.run(cctx, args); err != nil { cctx.Options.Fail(err) @@ -5724,9 +5712,9 @@ func NewTemporalWorkflowTimeSkippingPollCommand(cctx *CommandContext, parent *Te s.Command.Use = "poll [flags]" s.Command.Short = "Poll a Workflow fast-forward (Experimental)" if hasHighlighting { - s.Command.Long = "Poll for the result of a specific Workflow fast-forward:\n\n\x1b[1mtemporal workflow time-skipping poll \\\n --namespace YourNamespace \\\n --workflow-id YourWorkflowId \\\n --fast-forward-id YourFastForwardId\x1b[0m\n\nA server-side poll timeout means the caller may poll again." + s.Command.Long = "Poll for the result of a specific Workflow fast-forward:\n\n\x1b[1mtemporal workflow time-skipping poll \\\n --namespace YourNamespace \\\n --workflow-id YourWorkflowId \\\n --fast-forward-id YourFastForwardId\x1b[0m\n\nReports \x1b[1mcompleted\x1b[0m, \x1b[1mpoll timed out\x1b[0m, or \x1b[1mfailed\x1b[0m with a reason.\nA server-side poll timeout means the caller may poll again." } else { - s.Command.Long = "Poll for the result of a specific Workflow fast-forward:\n\n```\ntemporal workflow time-skipping poll \\\n --namespace YourNamespace \\\n --workflow-id YourWorkflowId \\\n --fast-forward-id YourFastForwardId\n```\n\nA server-side poll timeout means the caller may poll again." + s.Command.Long = "Poll for the result of a specific Workflow fast-forward:\n\n```\ntemporal workflow time-skipping poll \\\n --namespace YourNamespace \\\n --workflow-id YourWorkflowId \\\n --fast-forward-id YourFastForwardId\n```\n\nReports `completed`, `poll timed out`, or `failed` with a reason.\nA server-side poll timeout means the caller may poll again." } s.Command.Args = cobra.NoArgs s.Command.Flags().StringVar(&s.FastForwardId, "fast-forward-id", "", "ID of the fast-forward to poll. Required.") diff --git a/internal/temporalcli/commands.schedule.go b/internal/temporalcli/commands.schedule.go index b560fb8f5..f3a0399c1 100644 --- a/internal/temporalcli/commands.schedule.go +++ b/internal/temporalcli/commands.schedule.go @@ -4,13 +4,11 @@ import ( "context" "errors" "fmt" - "math" "regexp" "strconv" "strings" "time" - "github.com/google/uuid" "github.com/temporalio/cli/cliext" "github.com/temporalio/cli/internal/printer" "google.golang.org/protobuf/encoding/protojson" @@ -46,11 +44,11 @@ type printableSchedule struct { // Info NextRunTime time.Time LastRunTime time.Time - RunningWorkflows []string // describe only - CreatedAt time.Time `cli:",cardOmitEmpty"` // describe only - LastUpdateAt time.Time `cli:",cardOmitEmpty"` // describe only - ActionCounts *actionCounts `cli:",cardOmitEmpty"` // describe only - TimeSkipping *printableScheduleTimeSkipping `cli:",cardOmitEmpty"` // describe only + RunningWorkflows []string // describe only + CreatedAt time.Time `cli:",cardOmitEmpty"` // describe only + LastUpdateAt time.Time `cli:",cardOmitEmpty"` // describe only + ActionCounts *actionCounts `cli:",cardOmitEmpty"` // describe only + TimeSkippingInfo *printableTimeSkippingInfo `cli:",cardOmitEmpty"` // describe only // SearchAttributes, Memo SearchAttributes *commonpb.SearchAttributes `cli:",cardOmitEmpty"` Memo *commonpb.Memo `cli:",cardOmitEmpty"` @@ -62,22 +60,6 @@ type actionCounts struct { SkippedOverlap int } -type printableScheduleTimeSkipping struct { - EffectiveEnabled bool - DisablePropagation bool - MaxSessionSkipCount int32 - CurrentSessionSkipCount int32 - CurrentTime time.Time `cli:",cardOmitEmpty"` - FastForward *printableScheduleFastForward `cli:",cardOmitEmpty"` -} - -type printableScheduleFastForward struct { - Id string - Duration string - TargetTime time.Time `cli:",cardOmitEmpty"` - HasCompleted bool -} - // Neither protojson nor fmt print structs containing time.Durations nicely, so do it manually // using a struct of strings. type printableInterval struct { @@ -124,34 +106,7 @@ func describeResultToPrintable(id string, desc *client.ScheduleDescription) *pri MissedCatchupWindow: desc.Info.NumActionsMissedCatchupWindow, SkippedOverlap: desc.Info.NumActionsSkippedOverlap, } - out.TimeSkipping = timeSkippingToPrintable(desc.Info.TimeSkippingInfo) - return out -} - -func timeSkippingToPrintable(info *commonpb.TimeSkippingInfo) *printableScheduleTimeSkipping { - if info == nil { - return nil - } - - out := &printableScheduleTimeSkipping{ - EffectiveEnabled: info.GetEffectiveConfig().GetEnabled(), - DisablePropagation: info.GetEffectiveConfig().GetDisablePropagation(), - MaxSessionSkipCount: info.GetEffectiveConfig().GetMaxSessionSkipCount(), - CurrentSessionSkipCount: info.GetCurrentSessionSkipCount(), - } - if currentTime := info.GetCurrentTime(); currentTime != nil { - out.CurrentTime = currentTime.AsTime() - } - if ff := info.GetFastForwardInfo(); ff != nil { - out.FastForward = &printableScheduleFastForward{ - Id: ff.GetFastForwardId(), - Duration: formatDuration(ff.GetFastForwardDuration().AsDuration()), - HasCompleted: ff.GetHasCompleted(), - } - if targetTime := ff.GetTargetTime(); targetTime != nil { - out.FastForward.TargetTime = targetTime.AsTime() - } - } + out.TimeSkippingInfo = timeSkippingToPrintable(desc.Info.TimeSkippingInfo) return out } @@ -344,6 +299,7 @@ func (c *TemporalScheduleCreateCommand) run(cctx *CommandContext, args []string) // TriggerImmediately not supported // ScheduleBackfill not supported } + if err = c.toScheduleSpec(&opts.Spec); err != nil { return err } else if opts.Action, err = toScheduleAction(&c.SharedWorkflowStartOptions, &c.PayloadInputOptions); err != nil { @@ -470,7 +426,7 @@ func (c *TemporalScheduleListCommand) run(cctx *CommandContext, args []string) e "CreatedAt", "LastUpdateAt", "ActionCounts", - "TimeSkipping", + "TimeSkippingInfo", }, Table: &printer.TableOptions{}, } @@ -578,6 +534,7 @@ func (c *TemporalScheduleUpdateCommand) run(cctx *CommandContext, args []string) Paused: c.Paused, }, } + if newSchedule.Policy.Overlap, err = enumspb.ScheduleOverlapPolicyFromString(c.OverlapPolicy.Value); err != nil { return err } @@ -604,29 +561,10 @@ func (c *TemporalScheduleUpdateCommand) run(cctx *CommandContext, args []string) }) } -func scheduleTimeSkippingConfig(fastForward time.Duration, fastForwardID string, disablePropagation bool, maxSkips int) (*client.TimeSkippingConfig, error) { - if fastForward <= 0 { - return nil, errors.New("--fast-forward-duration must be greater than zero") - } - if maxSkips < 0 || maxSkips > math.MaxInt32 { - return nil, fmt.Errorf("--max-skip-per-session must be between 0 and %d", math.MaxInt32) - } - if fastForwardID == "" { - fastForwardID = uuid.NewString() - } - config := &client.TimeSkippingConfig{ - Enabled: true, - DisablePropagation: disablePropagation, - MaxSessionSkipCount: int32(maxSkips), - FastForwardConfig: &client.FastForwardConfig{ - ID: fastForwardID, - Duration: fastForward, - }, - } - return config, nil -} - func patchScheduleTimeSkipping(cctx *CommandContext, parent *TemporalScheduleCommand, scheduleID string, config *client.TimeSkippingConfig) error { + if config == nil { + return errors.New("time-skipping configuration is required") + } cl, err := dialClient(cctx, &parent.ClientOptions) if err != nil { return err @@ -648,14 +586,15 @@ func (c *TemporalScheduleTimeSkippingEnableCommand) run(cctx *CommandContext, ar if c.Command.Flags().Changed("max-skip-per-session") && c.MaxSkipPerSession <= 0 { return errors.New("--max-skip-per-session must be greater than zero") } - config, err := scheduleTimeSkippingConfig(c.FastForwardDuration.Duration(), c.FastForwardId, c.DisablePropagation, c.MaxSkipPerSession) + config, err := timeSkippingConfig(c.FastForwardDuration.Duration(), true, c.FastForwardId, c.DisablePropagation, c.MaxSkipPerSession) if err != nil { return err } return patchScheduleTimeSkipping(cctx, c.Parent.Parent, c.ScheduleId, config) } -const scheduleTimeSkippingPollInterval = 100 * time.Millisecond +// TODO: need to change to SDK polling. +const scheduleTimeSkippingPollInterval = 500 * time.Millisecond func scheduleTimeSkippingPollStatus(info *commonpb.TimeSkippingInfo, fastForwardID string) (string, string) { ff := info.GetFastForwardInfo() @@ -748,7 +687,11 @@ func printScheduleTimeSkippingResult( cctx.Printer.Printlnf(" temporal schedule time-skipping poll --namespace %s --schedule-id %s --fast-forward-id %s", namespace, scheduleID, ff.ID) } cctx.Printer.Println() - cctx.Printer.Println("Check status:") + if config.Enabled { + cctx.Printer.Println("Check status:") + } else { + cctx.Printer.Println("Check status of time skipping:") + } cctx.Printer.Printlnf(" temporal schedule describe --namespace %s --schedule-id %s", namespace, scheduleID) if config.Enabled { cctx.Printer.Println() diff --git a/internal/temporalcli/commands.schedule_internal_test.go b/internal/temporalcli/commands.schedule_internal_test.go deleted file mode 100644 index 9a090048d..000000000 --- a/internal/temporalcli/commands.schedule_internal_test.go +++ /dev/null @@ -1,85 +0,0 @@ -package temporalcli - -import ( - "testing" - "time" - - "github.com/stretchr/testify/require" - commonpb "go.temporal.io/api/common/v1" - "google.golang.org/protobuf/types/known/durationpb" - "google.golang.org/protobuf/types/known/timestamppb" -) - -func TestScheduleTimeSkippingConfig(t *testing.T) { - config, err := scheduleTimeSkippingConfig(5*time.Hour, "", true, 17) - require.NoError(t, err) - - require.True(t, config.Enabled) - require.True(t, config.DisablePropagation) - require.Equal(t, int32(17), config.MaxSessionSkipCount) - require.NotEmpty(t, config.FastForwardConfig.ID) - require.Equal(t, 5*time.Hour, config.FastForwardConfig.Duration) - - config, err = scheduleTimeSkippingConfig(5*time.Hour, "YourFastForwardId", false, 0) - require.NoError(t, err) - require.Equal(t, "YourFastForwardId", config.FastForwardConfig.ID) -} - -func TestTimeSkippingToPrintable(t *testing.T) { - targetTime := time.Date(2026, time.September, 27, 12, 0, 0, 0, time.UTC) - config := &commonpb.TimeSkippingConfig{ - Enabled: true, - DisablePropagation: true, - MaxSessionSkipCount: 200, - FastForwardConfig: &commonpb.FastForwardConfig{ - Id: "ff-id", - Duration: durationpb.New(5 * time.Hour), - }, - } - info := &commonpb.TimeSkippingInfo{ - CurrentTime: timestamppb.New(targetTime.Add(-time.Hour)), - EffectiveConfig: config, - CurrentSessionSkipCount: 4, - FastForwardInfo: &commonpb.TimeSkippingFastForwardInfo{ - FastForwardDuration: durationpb.New(5 * time.Hour), - FastForwardId: "ff-id", - TargetTime: timestamppb.New(targetTime), - HasCompleted: true, - }, - } - - printable := timeSkippingToPrintable(info) - require.True(t, printable.EffectiveEnabled) - require.True(t, printable.DisablePropagation) - require.Equal(t, int32(200), printable.MaxSessionSkipCount) - require.Equal(t, int32(4), printable.CurrentSessionSkipCount) - require.Equal(t, "ff-id", printable.FastForward.Id) - require.Equal(t, "5h 0m 0s", printable.FastForward.Duration) - require.Equal(t, targetTime, printable.FastForward.TargetTime) - require.True(t, printable.FastForward.HasCompleted) - - config.DisablePropagation = false - require.False(t, timeSkippingToPrintable(info).DisablePropagation) -} - -func TestScheduleTimeSkippingPollStatus(t *testing.T) { - const id = "YourFastForwardId" - for _, tc := range []struct { - name string - info *commonpb.TimeSkippingInfo - status string - reason string - }{ - {name: "removed", status: "failed", reason: "fast-forward was removed or was not found in Schedule status"}, - {name: "replaced", info: &commonpb.TimeSkippingInfo{FastForwardInfo: &commonpb.TimeSkippingFastForwardInfo{FastForwardId: "other"}}, status: "failed", reason: `fast-forward was replaced by "other"`}, - {name: "completed", info: &commonpb.TimeSkippingInfo{FastForwardInfo: &commonpb.TimeSkippingFastForwardInfo{FastForwardId: id, HasCompleted: true}}, status: "completed"}, - {name: "disabled", info: &commonpb.TimeSkippingInfo{FastForwardInfo: &commonpb.TimeSkippingFastForwardInfo{FastForwardId: id}}, status: "failed", reason: "time skipping was disabled before fast-forward completed"}, - {name: "pending", info: &commonpb.TimeSkippingInfo{EffectiveConfig: &commonpb.TimeSkippingConfig{Enabled: true}, FastForwardInfo: &commonpb.TimeSkippingFastForwardInfo{FastForwardId: id}}, status: "pending"}, - } { - t.Run(tc.name, func(t *testing.T) { - status, reason := scheduleTimeSkippingPollStatus(tc.info, id) - require.Equal(t, tc.status, status) - require.Equal(t, tc.reason, reason) - }) - } -} diff --git a/internal/temporalcli/commands.schedule_test.go b/internal/temporalcli/commands.schedule_test.go index 9e849caba..31e32cfcf 100644 --- a/internal/temporalcli/commands.schedule_test.go +++ b/internal/temporalcli/commands.schedule_test.go @@ -10,13 +10,19 @@ import ( "math/rand" "regexp" "strings" + "testing" "time" + "github.com/google/uuid" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" "github.com/temporalio/cli/internal/temporalcli" "go.temporal.io/api/enums/v1" "go.temporal.io/api/operatorservice/v1" + "go.temporal.io/api/workflowservice/v1" + "go.temporal.io/sdk/client" "go.temporal.io/sdk/workflow" + "google.golang.org/protobuf/encoding/protojson" ) func (s *SharedServerSuite) createSchedule(args ...string) (schedId, schedWfId string, res *CommandResult) { @@ -60,6 +66,7 @@ func (s *SharedServerSuite) TestSchedule_Create() { } func (s *SharedServerSuite) TestSchedule_TimeSkippingEnable() { + s.useTimeSkippingServer() schedID, _, res := s.createSchedule("--interval", "10d", "--paused") s.NoError(res.Err) res = s.Execute( @@ -83,19 +90,91 @@ func (s *SharedServerSuite) TestSchedule_TimeSkippingEnable() { ) s.NoError(res.Err) s.Contains(res.Stdout.String(), `"DisablePropagation":true`) +} + +func (s *SharedServerSuite) TestSchedule_TimeSkippingEnableRequiresDuration() { + s.useTimeSkippingServer() + schedID, _, res := s.createSchedule("--interval", "10d", "--paused") + require.NoError(s.T(), res.Err) + + res = s.Execute( + "schedule", "time-skipping", "enable", + "--address", s.Address(), + "--schedule-id", schedID, + ) + s.EqualError(res.Err, `required flag(s) "fast-forward-duration" not set`) + s.Contains(res.Stderr.String(), `Error: required flag(s) "fast-forward-duration" not set`) + s.NotContains(res.Stdout.String(), "Schedule updated:") +} + +func (s *SharedServerSuite) TestSchedule_TimeSkippingEnableGeneratesFastForwardID() { + s.useTimeSkippingServer() + schedID, _, res := s.createSchedule("--interval", "10d", "--paused") + require.NoError(s.T(), res.Err) + + res = s.Execute( + "schedule", "time-skipping", "enable", + "--address", s.Address(), + "--schedule-id", schedID, + "--fast-forward-duration", "5h", + ) + require.NoError(s.T(), res.Err) + match := regexp.MustCompile(`(?m)^Fast-forward ID: (\S+)$`).FindStringSubmatch(res.Stdout.String()) + require.Len(s.T(), match, 2) + fastForwardID := match[1] + _, err := uuid.Parse(fastForwardID) + require.NoError(s.T(), err) + s.Contains(res.Stdout.String(), "temporal schedule time-skipping poll --namespace default --schedule-id "+schedID+" --fast-forward-id "+fastForwardID) + res = s.Execute( + "schedule", "describe", + "--address", s.Address(), + "--schedule-id", schedID, + ) + require.NoError(s.T(), res.Err) + s.Contains(res.Stdout.String(), `"Id":"`+fastForwardID+`"`) + + // The generated ID is usable in the suggested poll command. res = s.Execute( "schedule", "time-skipping", "poll", "--address", s.Address(), "--schedule-id", schedID, - "--fast-forward-id", "YourFastForwardId", + "--fast-forward-id", fastForwardID, "--timeout", "200ms", ) s.NoError(res.Err) - s.Contains(res.Stdout.String(), "poll timed out") + s.Equal("poll timed out", strings.TrimSpace(res.Stdout.String())) } -func (s *SharedServerSuite) TestSchedule_TimeSkippingPollCompleted() { +func (s *SharedServerSuite) TestSchedule_TimeSkippingPollTimeout() { + s.useTimeSkippingServer() + schedID, _, res := s.createSchedule("--interval", "10d", "--paused") + s.NoError(res.Err) + res = s.Execute( + "schedule", "time-skipping", "enable", + "--address", s.Address(), + "--schedule-id", schedID, + "--fast-forward-duration", "5h", + "--fast-forward-id", "YourFastForwardId", + ) + s.NoError(res.Err) + + // A timeout leaves the fast-forward available to poll again. + for range 2 { + res = s.Execute( + "schedule", "time-skipping", "poll", + "--address", s.Address(), + "--schedule-id", schedID, + "--fast-forward-id", "YourFastForwardId", + "--timeout", "200ms", + ) + s.NoError(res.Err) + s.Equal("poll timed out", strings.TrimSpace(res.Stdout.String())) + } +} + +func (s *SharedServerSuite) TestSchedule_TimeSkippingMinimalLifecycle() { + s.useTimeSkippingServer() schedID, _, res := s.createSchedule("--interval", "10d") s.NoError(res.Err) res = s.Execute( @@ -103,19 +182,126 @@ func (s *SharedServerSuite) TestSchedule_TimeSkippingPollCompleted() { "--address", s.Address(), "--schedule-id", schedID, "--fast-forward-duration", "5h", - "--fast-forward-id", "PollCompletedId", ) s.NoError(res.Err) + s.Contains(res.Stdout.String(), "Time skipping: enabled") + match := regexp.MustCompile(`(?m)^Fast-forward ID: (\S+)$`).FindStringSubmatch(res.Stdout.String()) + s.Len(match, 2) + fastForwardID := match[1] + _, err := uuid.Parse(fastForwardID) + s.NoError(err) res = s.Execute( "schedule", "time-skipping", "poll", "--address", s.Address(), "--schedule-id", schedID, - "--fast-forward-id", "PollCompletedId", + "--fast-forward-id", fastForwardID, "--timeout", "10s", ) s.NoError(res.Err) - s.Contains(res.Stdout.String(), "completed") + s.Equal("completed", strings.TrimSpace(res.Stdout.String())) + + res = s.Execute("schedule", "describe", "--address", s.Address(), "--schedule-id", schedID) + s.NoError(res.Err) + s.Contains(res.Stdout.String(), "TimeSkippingInfo") + s.Contains(res.Stdout.String(), `"Id":"`+fastForwardID+`"`) + s.Contains(res.Stdout.String(), `"HasCompleted":true`) + s.Contains(res.Stdout.String(), `"DisablePropagation":false`) + + for _, output := range []string{"json", "jsonl"} { + res = s.Execute("schedule", "describe", "--address", s.Address(), "--schedule-id", schedID, "--output", output) + s.NoError(res.Err) + var description workflowservice.DescribeScheduleResponse + s.NoError(protojson.Unmarshal(res.Stdout.Bytes(), &description)) + s.Equal("DevWorkflow", description.GetSchedule().GetAction().GetStartWorkflow().GetWorkflowType().GetName()) + info := description.GetInfo().GetTimeSkippingInfo() + s.NotNil(info) + s.Equal(fastForwardID, info.GetFastForwardInfo().GetFastForwardId()) + s.True(info.GetFastForwardInfo().GetHasCompleted()) + s.False(info.GetEffectiveConfig().GetDisablePropagation()) + if output == "jsonl" { + s.Len(strings.Split(strings.TrimSpace(res.Stdout.String()), "\n"), 1) + } + } + + res = s.Execute("schedule", "time-skipping", "disable", "--address", s.Address(), "--schedule-id", schedID) + s.NoError(res.Err) + s.Contains(res.Stdout.String(), "Time skipping: disabled") + res = s.Execute("schedule", "describe", "--address", s.Address(), "--schedule-id", schedID) + s.NoError(res.Err) + s.Contains(res.Stdout.String(), `"EffectiveEnabled":false`) +} + +func (s *SharedServerSuite) TestSchedule_TimeSkippingPollFailed() { + s.useTimeSkippingServer() + for _, change := range []string{"not enabled", "disabled", "replaced"} { + s.T().Run(change, func(t *testing.T) { + schedID, _, res := s.createSchedule("--interval", "10d", "--paused") + require.NoError(t, res.Err) + if change != "not enabled" { + res = s.Execute( + "schedule", "time-skipping", "enable", + "--address", s.Address(), + "--schedule-id", schedID, + "--fast-forward-duration", "5h", + "--fast-forward-id", "OriginalFastForwardId", + ) + require.NoError(t, res.Err) + } + switch change { + case "disabled": + res = s.Execute( + "schedule", "time-skipping", "disable", + "--address", s.Address(), + "--schedule-id", schedID, + ) + require.NoError(t, res.Err) + case "replaced": + res = s.Execute( + "schedule", "time-skipping", "enable", + "--address", s.Address(), + "--schedule-id", schedID, + "--fast-forward-duration", "5h", + "--fast-forward-id", "ReplacementFastForwardId", + ) + require.NoError(t, res.Err) + } + res = s.Execute( + "schedule", "time-skipping", "poll", + "--address", s.Address(), + "--schedule-id", schedID, + "--fast-forward-id", "OriginalFastForwardId", + "--timeout", "5s", + ) + require.NoError(t, res.Err) + require.Regexp(t, `^failed: \S`, strings.TrimSpace(res.Stdout.String())) + }) + } +} + +func (s *SharedServerSuite) TestSchedule_TimeSkippingPollCanceled() { + s.useTimeSkippingServer() + schedID, _, res := s.createSchedule("--interval", "10d", "--paused") + s.NoError(res.Err) + res = s.Execute( + "schedule", "time-skipping", "enable", + "--address", s.Address(), + "--schedule-id", schedID, + "--fast-forward-duration", "5h", + "--fast-forward-id", "YourFastForwardId", + ) + s.NoError(res.Err) + + ctx, cancel := context.WithCancel(s.Context) + cancel() + res = s.ExecuteWithContext(ctx, + "schedule", "time-skipping", "poll", + "--address", s.Address(), + "--schedule-id", schedID, + "--fast-forward-id", "YourFastForwardId", + ) + s.ErrorContains(res.Err, "canceled") + s.Empty(res.Stdout.String()) } func (s *SharedServerSuite) TestSchedule_Delete() { @@ -571,6 +757,7 @@ func (s *SharedServerSuite) TestSchedule_Update() { } func (s *SharedServerSuite) TestSchedule_TimeSkippingDisable() { + s.useTimeSkippingServer() schedID, _, res := s.createSchedule("--interval", "10d", "--paused") s.NoError(res.Err) @@ -590,9 +777,9 @@ func (s *SharedServerSuite) TestSchedule_TimeSkippingDisable() { "--schedule-id", schedID, ) s.NoError(res.Err) - s.Contains(res.Stdout.String(), "TimeSkipping") + s.Contains(res.Stdout.String(), "TimeSkippingInfo") s.Contains(res.Stdout.String(), `"EffectiveEnabled":true`) - s.Contains(res.Stdout.String(), `"FastForward":`) + s.Contains(res.Stdout.String(), `"FastForwardInfo":`) res = s.Execute( "schedule", "time-skipping", "disable", @@ -727,3 +914,73 @@ func (s *SharedServerSuite) TestSchedule_ListMatchingTimes_NotFound() { ) s.Error(res.Err) } + +func (s *SharedServerSuite) TestSchedule_TimeSkippingPropagatesWithSkipOverlap() { + s.useTimeSkippingServer() + + // The first action is at the next future UTC hour; the fast-forward target + // falls between its third and fourth actions. + firstAction := time.Now().UTC().Truncate(time.Hour).Add(2 * time.Hour) + scheduleID, _, res := s.createSchedule( + "--interval", "1h", + "--start-time", firstAction.Add(-time.Second).Format(time.RFC3339Nano), + "--overlap-policy", "Skip", + ) + s.NoError(res.Err) + + duration := time.Until(firstAction.Add(2*time.Hour + time.Minute)) + res = s.Execute( + "schedule", "time-skipping", "enable", + "--address", s.Address(), + "--schedule-id", scheduleID, + "--fast-forward-duration", duration.String(), + "--fast-forward-id", "ThreeActionsWithPropagation", + "--disable-propagation=false", + ) + s.NoError(res.Err) + + res = s.Execute( + "schedule", "time-skipping", "poll", + "--address", s.Address(), + "--schedule-id", scheduleID, + "--fast-forward-id", "ThreeActionsWithPropagation", + "--timeout", "30s", + ) + s.NoError(res.Err) + s.Contains(res.Stdout.String(), "completed") + + var description *client.ScheduleDescription + s.EventuallyWithT(func(t *assert.CollectT) { + var err error + description, err = s.Client.ScheduleClient().GetHandle(s.Context, scheduleID).Describe(s.Context) + assert.NoError(t, err) + if err != nil { + return + } + assert.Equal(t, 3, description.Info.NumActions) + assert.Len(t, description.Info.RecentActions, 3) + assert.Equal(t, 0, description.Info.NumActionsSkippedOverlap) + }, 10*time.Second, 100*time.Millisecond) + s.NotNil(description.Schedule.Policy) + s.Equal(enums.SCHEDULE_OVERLAP_POLICY_SKIP, description.Schedule.Policy.Overlap) + s.NotNil(description.Info.TimeSkippingInfo) + s.False(description.Info.TimeSkippingInfo.GetEffectiveConfig().GetDisablePropagation()) + + workflowIDs := make(map[string]struct{}, 3) + for i, action := range description.Info.RecentActions { + scheduledTime := firstAction.Add(time.Duration(i) * time.Hour) + s.WithinDuration(scheduledTime, action.ScheduleTime, time.Second) + s.NotNil(action.StartWorkflowResult) + workflowID := action.StartWorkflowResult.WorkflowID + _, seen := workflowIDs[workflowID] + s.False(seen, "schedule action reused Workflow ID %q", workflowID) + workflowIDs[workflowID] = struct{}{} + runID := action.StartWorkflowResult.FirstExecutionRunID + workflowDescription, err := s.Client.DescribeWorkflowExecution(s.Context, workflowID, runID) + s.NoError(err) + s.NotNil(workflowDescription.GetWorkflowExecutionInfo().GetStartTime()) + s.WithinDuration(scheduledTime, workflowDescription.GetWorkflowExecutionInfo().GetStartTime().AsTime(), 5*time.Second) + s.NotNil(workflowDescription.GetWorkflowExtendedInfo().GetTimeSkippingInfo()) + s.True(workflowDescription.GetWorkflowExtendedInfo().GetTimeSkippingInfo().GetEffectiveConfig().GetEnabled()) + } +} diff --git a/internal/temporalcli/commands.server.go b/internal/temporalcli/commands.server.go index 50221ed72..2fc5a98f1 100644 --- a/internal/temporalcli/commands.server.go +++ b/internal/temporalcli/commands.server.go @@ -3,12 +3,10 @@ package temporalcli import ( "encoding/json" "fmt" - "os" "strings" "github.com/google/uuid" "go.temporal.io/api/enums/v1" - "go.temporal.io/server/common/dynamicconfig" "github.com/temporalio/cli/internal/devserver" ) @@ -101,24 +99,9 @@ func (t *TemporalServerStartDevCommand) run(cctx *CommandContext, args []string) var err error if opts.SqlitePragmas, err = stringKeysValues(t.SqlitePragma); err != nil { return fmt.Errorf("invalid pragma: %w", err) - } - flagDynamicConfigValues, err := stringKeysJSONValues(t.DynamicConfigValue, true) - if err != nil { + } else if opts.DynamicConfigValues, err = stringKeysJSONValues(t.DynamicConfigValue, true); err != nil { return fmt.Errorf("invalid dynamic config values: %w", err) } - if t.DynamicConfigFile != "" { - opts.DynamicConfigValues, err = loadDynamicConfigFile(t.DynamicConfigFile) - if err != nil { - return err - } - } - if opts.DynamicConfigValues == nil { - opts.DynamicConfigValues = make(map[string]any) - } - // Explicit command-line values take precedence over values from the file. - for key, value := range flagDynamicConfigValues { - opts.DynamicConfigValues[dynamicconfig.MakeKey(key).String()] = value - } // We have to convert all dynamic config values that JSON number to int if we // can because server dynamic config expecting int won't work with the default // float JSON unmarshal uses @@ -137,12 +120,11 @@ func (t *TemporalServerStartDevCommand) run(cctx *CommandContext, args []string) // Apply set of default dynamic config values if not already present for k, v := range defaultDynamicConfigValues { - key := dynamicconfig.MakeKey(k).String() - if _, ok := opts.DynamicConfigValues[key]; !ok { + if _, ok := opts.DynamicConfigValues[k]; !ok { if opts.DynamicConfigValues == nil { opts.DynamicConfigValues = map[string]any{} } - opts.DynamicConfigValues[key] = v + opts.DynamicConfigValues[k] = v } } @@ -202,22 +184,6 @@ func (t *TemporalServerStartDevCommand) run(cctx *CommandContext, args []string) return nil } -func loadDynamicConfigFile(filename string) (map[string]any, error) { - contents, err := os.ReadFile(filename) - if err != nil { - return nil, fmt.Errorf("read dynamic config file: %w", err) - } - loader := dynamicconfig.LoadYamlFile(contents) - if err := loader.Err(); err != nil { - return nil, fmt.Errorf("parse dynamic config file: %w", err) - } - values := make(map[string]any, len(loader.Map)) - for key, constrainedValues := range loader.Map { - values[key.String()] = constrainedValues - } - return values, nil -} - func toFriendlyIp(host string) string { if host == "127.0.0.1" || host == "::1" { return "localhost" diff --git a/internal/temporalcli/commands.server_internal_test.go b/internal/temporalcli/commands.server_internal_test.go deleted file mode 100644 index 3942bfc84..000000000 --- a/internal/temporalcli/commands.server_internal_test.go +++ /dev/null @@ -1,29 +0,0 @@ -package temporalcli - -import ( - "os" - "path/filepath" - "testing" - - "github.com/stretchr/testify/require" - "go.temporal.io/server/common/dynamicconfig" -) - -func TestLoadDynamicConfigFile(t *testing.T) { - filename := filepath.Join(t.TempDir(), "dynamicconfig.yaml") - require.NoError(t, os.WriteFile(filename, []byte(` -history.enableCHASMSchedulerCreation: - - value: true - constraints: - namespace: fx-test -`), 0o600)) - - values, err := loadDynamicConfigFile(filename) - require.NoError(t, err) - - constrainedValues, ok := values["history.enablechasmschedulercreation"].([]dynamicconfig.ConstrainedValue) - require.True(t, ok) - require.Len(t, constrainedValues, 1) - require.Equal(t, true, constrainedValues[0].Value) - require.Equal(t, "fx-test", constrainedValues[0].Constraints.Namespace) -} diff --git a/internal/temporalcli/commands.time_skipping_test.go b/internal/temporalcli/commands.time_skipping_test.go new file mode 100644 index 000000000..5be529577 --- /dev/null +++ b/internal/temporalcli/commands.time_skipping_test.go @@ -0,0 +1,84 @@ +package temporalcli_test + +import ( + "context" + "testing" + + "github.com/stretchr/testify/require" + "github.com/temporalio/cli/internal/temporalcli" +) + +// Validate user input through the public CLI without contacting a server. +func TestTimeSkippingInvalidFlags(t *testing.T) { + execute := func(t *testing.T, args ...string) *CommandResult { + t.Helper() + res := &CommandResult{} + options := temporalcli.CommandOptions{ + IOStreams: temporalcli.IOStreams{Stdout: &res.Stdout, Stderr: &res.Stderr}, + Fail: func(err error) { res.Err = err }, + } + options.DeprecatedEnvConfig.DisableEnvConfig = true + options.DeprecatedEnvConfig.EnvConfigName = "default" + cctx, cancel, err := temporalcli.NewCommandContext(context.Background(), options) + require.NoError(t, err) + defer cancel() + cmd := temporalcli.NewTemporalCommand(cctx) + cmd.Command.SetArgs(args) + cmd.Command.SetOut(&res.Stdout) + cmd.Command.SetErr(&res.Stderr) + if err := cmd.Command.ExecuteContext(cctx); err != nil { + res.Err = err + } + return res + } + for _, noun := range []string{"workflow", "schedule"} { + t.Run(noun, func(t *testing.T) { + idFlag := "--" + noun + "-id" + for _, verb := range []string{"enable", "disable", "poll"} { + t.Run(verb+" missing execution ID", func(t *testing.T) { + args := []string{noun, "time-skipping", verb} + if verb == "enable" { + args = append(args, "--fast-forward-duration", "5h") + } + if verb == "poll" { + args = append(args, "--fast-forward-id", "YourFastForwardId") + } + res := execute(t, args...) + require.EqualError(t, res.Err, `required flag(s) "`+noun+`-id" not set`) + }) + } + type invalidFlagsCase struct { + name, verb string + flags []string + want string + } + cases := []invalidFlagsCase{ + {"missing poll ID", "poll", nil, `required flag(s) "fast-forward-id" not set`}, + {"zero duration", "enable", []string{"--fast-forward-duration", "0s"}, "--fast-forward-duration must be greater than zero"}, + {"negative duration", "enable", []string{"--fast-forward-duration", "-1h"}, "--fast-forward-duration must be greater than zero"}, + {"malformed duration", "enable", []string{"--fast-forward-duration", "invalid"}, "invalid argument"}, + {"zero skip limit", "enable", []string{"--fast-forward-duration", "5h", "--max-skip-per-session", "0"}, "--max-skip-per-session must be greater than zero"}, + {"negative skip limit", "enable", []string{"--fast-forward-duration", "5h", "--max-skip-per-session", "-1"}, "--max-skip-per-session must be greater than zero"}, + {"skip limit too large", "enable", []string{"--fast-forward-duration", "5h", "--max-skip-per-session", "10001"}, "--max-skip-per-session must be between 1 and 10000"}, + {"malformed skip limit", "enable", []string{"--fast-forward-duration", "5h", "--max-skip-per-session", "abc"}, "invalid argument"}, + {"malformed propagation", "enable", []string{"--fast-forward-duration", "5h", "--disable-propagation=abc"}, "invalid argument"}, + {"unsupported disable setting", "disable", []string{"--disable-propagation"}, "unknown flag: --disable-propagation"}, + } + if noun == "workflow" { + cases = append(cases, invalidFlagsCase{ + "ID without duration", "enable", []string{"--fast-forward-id", "YourFastForwardId"}, "--fast-forward-id requires --fast-forward-duration"}) + } else { + cases = append(cases, invalidFlagsCase{ + "malformed poll timeout", "poll", []string{"--fast-forward-id", "YourFastForwardId", "--timeout", "invalid"}, "invalid argument"}) + } + for _, tc := range cases { + t.Run(tc.name, func(t *testing.T) { + args := append([]string{noun, "time-skipping", tc.verb, idFlag, "YourExecutionId"}, tc.flags...) + res := execute(t, args...) + require.ErrorContains(t, res.Err, tc.want) + require.NotContains(t, res.Stdout.String(), "Time skipping: enabled") + }) + } + }) + } +} diff --git a/internal/temporalcli/commands.workflow_test.go b/internal/temporalcli/commands.workflow_test.go index a451776b4..f3c06b3b2 100644 --- a/internal/temporalcli/commands.workflow_test.go +++ b/internal/temporalcli/commands.workflow_test.go @@ -22,6 +22,7 @@ import ( "go.temporal.io/sdk/worker" "go.temporal.io/sdk/workflow" "google.golang.org/grpc" + "google.golang.org/protobuf/encoding/protojson" ) func (s *SharedServerSuite) TestWorkflow_Signal_SingleWorkflowSuccess() { @@ -58,6 +59,7 @@ func (s *SharedServerSuite) TestWorkflow_Signal_SingleWorkflowSuccess() { } func (s *SharedServerSuite) TestWorkflow_TimeSkippingEnablePollDisable() { + s.useTimeSkippingServer() s.Worker().OnDevWorkflow(func(ctx workflow.Context, a any) (any, error) { if err := workflow.Sleep(ctx, 10*time.Hour); err != nil { return nil, err @@ -1692,3 +1694,89 @@ func (s *SharedServerSuite) testWorkflowMetadata(json bool) { s.Error(res.Err) s.Contains(res.Err.Error(), "query was rejected, workflow has status: Completed") } + +func (s *SharedServerSuite) TestWorkflow_TimeSkippingMinimalLifecycle() { + s.useTimeSkippingServer() + s.Worker().OnDevWorkflow(func(ctx workflow.Context, input any) (any, error) { + return nil, workflow.Sleep(ctx, 10*time.Hour) + }) + run, err := s.Client.ExecuteWorkflow(s.Context, + client.StartWorkflowOptions{TaskQueue: s.Worker().Options.TaskQueue}, DevWorkflow, nil) + s.NoError(err) + defer func() { _ = s.Client.CancelWorkflow(s.Context, run.GetID(), "") }() + + res := s.Execute("workflow", "time-skipping", "enable", "--address", s.Address(), + "--workflow-id", run.GetID(), "--fast-forward-duration", "5h") + s.NoError(res.Err) + s.Contains(res.Stdout.String(), "Time skipping: enabled") + match := regexp.MustCompile(`(?m)^Fast-forward ID: (\S+)$`).FindStringSubmatch(res.Stdout.String()) + s.Len(match, 2) + fastForwardID := match[1] + _, err = uuid.Parse(fastForwardID) + s.NoError(err) + s.Contains(res.Stdout.String(), "--fast-forward-id "+fastForwardID) + s.NotContains(res.Stdout.String(), "--run-id") + + res = s.Execute("workflow", "time-skipping", "poll", "--address", s.Address(), + "--workflow-id", run.GetID(), "--fast-forward-id", fastForwardID) + s.NoError(res.Err) + s.Equal("completed", strings.TrimSpace(res.Stdout.String())) + + res = s.Execute("workflow", "describe", "--address", s.Address(), "--workflow-id", run.GetID()) + s.NoError(res.Err) + s.Contains(res.Stdout.String(), "Time Skipping:") + s.Contains(res.Stdout.String(), fastForwardID) + s.ContainsOnSameLine(res.Stdout.String(), "DisablePropagation", "false") + s.ContainsOnSameLine(res.Stdout.String(), "HasCompleted", "true") + + for _, output := range []string{"json", "jsonl"} { + res = s.Execute("workflow", "describe", "--address", s.Address(), "--workflow-id", run.GetID(), "--output", output) + s.NoError(res.Err) + var description workflowservice.DescribeWorkflowExecutionResponse + s.NoError(protojson.Unmarshal(res.Stdout.Bytes(), &description)) + s.Equal(run.GetID(), description.GetWorkflowExecutionInfo().GetExecution().GetWorkflowId()) + s.Equal("DevWorkflow", description.GetWorkflowExecutionInfo().GetType().GetName()) + info := description.GetWorkflowExtendedInfo().GetTimeSkippingInfo() + s.NotNil(info) + s.Equal(fastForwardID, info.GetFastForwardInfo().GetFastForwardId()) + s.True(info.GetFastForwardInfo().GetHasCompleted()) + s.False(info.GetEffectiveConfig().GetDisablePropagation()) + if output == "jsonl" { + s.Len(strings.Split(strings.TrimSpace(res.Stdout.String()), "\n"), 1) + } + } + + res = s.Execute("workflow", "time-skipping", "disable", "--address", s.Address(), "--workflow-id", run.GetID()) + s.NoError(res.Err) + s.Contains(res.Stdout.String(), "Time skipping: disabled") + res = s.Execute("workflow", "describe", "--address", s.Address(), "--workflow-id", run.GetID()) + s.NoError(res.Err) + s.ContainsOnSameLine(res.Stdout.String(), "EffectiveEnabled", "false") +} + +func (s *SharedServerSuite) TestWorkflow_TimeSkippingEnableWithoutFastForward() { + s.useTimeSkippingServer() + s.Worker().OnDevWorkflow(func(ctx workflow.Context, input any) (any, error) { + workflow.GetSignalChannel(ctx, "finish").Receive(ctx, nil) + return nil, nil + }) + run, err := s.Client.ExecuteWorkflow(s.Context, + client.StartWorkflowOptions{TaskQueue: s.Worker().Options.TaskQueue}, DevWorkflow, nil) + s.NoError(err) + defer func() { _ = s.Client.CancelWorkflow(s.Context, run.GetID(), "") }() + + res := s.Execute("workflow", "time-skipping", "enable", "--address", s.Address(), "--workflow-id", run.GetID()) + s.NoError(res.Err) + s.Contains(res.Stdout.String(), "Time skipping: enabled") + s.NotContains(res.Stdout.String(), "Fast-forward ID:") + s.NotContains(res.Stdout.String(), "Poll fast-forward:") + res = s.Execute("workflow", "describe", "--address", s.Address(), "--workflow-id", run.GetID()) + s.NoError(res.Err) + s.ContainsOnSameLine(res.Stdout.String(), "EffectiveEnabled", "true") + s.ContainsOnSameLine(res.Stdout.String(), "DisablePropagation", "false") + res = s.Execute("workflow", "time-skipping", "disable", "--address", s.Address(), "--workflow-id", run.GetID()) + s.NoError(res.Err) + res = s.Execute("workflow", "describe", "--address", s.Address(), "--workflow-id", run.GetID()) + s.NoError(res.Err) + s.ContainsOnSameLine(res.Stdout.String(), "EffectiveEnabled", "false") +} diff --git a/internal/temporalcli/commands.workflow_time_skipping.go b/internal/temporalcli/commands.workflow_time_skipping.go index 12646ddbd..bf13d96e7 100644 --- a/internal/temporalcli/commands.workflow_time_skipping.go +++ b/internal/temporalcli/commands.workflow_time_skipping.go @@ -3,56 +3,32 @@ package temporalcli import ( "errors" "fmt" - "math" - "time" - "github.com/google/uuid" commonpb "go.temporal.io/api/common/v1" enumspb "go.temporal.io/api/enums/v1" workflowservice "go.temporal.io/api/workflowservice/v1" "go.temporal.io/sdk/client" ) -func workflowTimeSkippingConfig(duration time.Duration, hasDuration bool, fastForwardID string, disablePropagation bool, maxSkips int) (*client.TimeSkippingConfig, error) { - if hasDuration && duration <= 0 { - return nil, errors.New("--fast-forward-duration must be greater than zero") - } - if !hasDuration && fastForwardID != "" { - return nil, errors.New("--fast-forward-id requires --fast-forward-duration") - } - if maxSkips < 0 || maxSkips > math.MaxInt32 { - return nil, fmt.Errorf("--max-skip-per-session must be between 0 and %d", math.MaxInt32) - } - config := &client.TimeSkippingConfig{ - Enabled: true, - DisablePropagation: disablePropagation, - MaxSessionSkipCount: int32(maxSkips), - } - if hasDuration { - if fastForwardID == "" { - fastForwardID = uuid.NewString() - } - config.FastForwardConfig = &client.FastForwardConfig{ID: fastForwardID, Duration: duration} - } - return config, nil -} - func (c *TemporalWorkflowTimeSkippingEnableCommand) run(cctx *CommandContext, args []string) error { if c.Command.Flags().Changed("max-skip-per-session") && c.MaxSkipPerSession <= 0 { return errors.New("--max-skip-per-session must be greater than zero") } - config, err := workflowTimeSkippingConfig(c.FastForwardDuration.Duration(), c.Command.Flags().Changed("fast-forward-duration"), c.FastForwardId, c.DisablePropagation, c.MaxSkipPerSession) + config, err := timeSkippingConfig(c.FastForwardDuration.Duration(), c.Command.Flags().Changed("fast-forward-duration"), c.FastForwardId, c.DisablePropagation, c.MaxSkipPerSession) if err != nil { return err } - return patchWorkflowTimeSkipping(cctx, c.Parent.Parent, c.WorkflowId, c.RunId, config) + return updateWorkflowOptionsForTimeSkipping(cctx, c.Parent.Parent, c.WorkflowId, c.RunId, config) } func (c *TemporalWorkflowTimeSkippingDisableCommand) run(cctx *CommandContext, args []string) error { - return patchWorkflowTimeSkipping(cctx, c.Parent.Parent, c.WorkflowId, c.RunId, &client.TimeSkippingConfig{Enabled: false}) + return updateWorkflowOptionsForTimeSkipping(cctx, c.Parent.Parent, c.WorkflowId, c.RunId, &client.TimeSkippingConfig{Enabled: false}) } -func patchWorkflowTimeSkipping(cctx *CommandContext, parent *TemporalWorkflowCommand, workflowID, runID string, config *client.TimeSkippingConfig) error { +func updateWorkflowOptionsForTimeSkipping(cctx *CommandContext, parent *TemporalWorkflowCommand, workflowID, runID string, config *client.TimeSkippingConfig) error { + if config == nil { + return errors.New("time-skipping configuration is required") + } cl, err := dialClient(cctx, &parent.ClientOptions) if err != nil { return err diff --git a/internal/temporalcli/commands.workflow_time_skipping_internal_test.go b/internal/temporalcli/commands.workflow_time_skipping_internal_test.go index 56eeb0783..a224b1e2a 100644 --- a/internal/temporalcli/commands.workflow_time_skipping_internal_test.go +++ b/internal/temporalcli/commands.workflow_time_skipping_internal_test.go @@ -2,33 +2,12 @@ package temporalcli import ( "testing" - "time" "github.com/stretchr/testify/require" enumspb "go.temporal.io/api/enums/v1" workflowservice "go.temporal.io/api/workflowservice/v1" ) -func TestWorkflowTimeSkippingConfig(t *testing.T) { - config, err := workflowTimeSkippingConfig(0, false, "", false, 0) - require.NoError(t, err) - require.True(t, config.Enabled) - require.Nil(t, config.FastForwardConfig) - require.False(t, config.DisablePropagation) - - config, err = workflowTimeSkippingConfig(5*time.Hour, true, "YourFastForwardId", true, 17) - require.NoError(t, err) - require.True(t, config.DisablePropagation) - require.Equal(t, int32(17), config.MaxSessionSkipCount) - require.Equal(t, "YourFastForwardId", config.FastForwardConfig.ID) - require.Equal(t, 5*time.Hour, config.FastForwardConfig.Duration) - - _, err = workflowTimeSkippingConfig(0, false, "YourFastForwardId", false, 0) - require.EqualError(t, err, "--fast-forward-id requires --fast-forward-duration") - _, err = workflowTimeSkippingConfig(0, true, "", false, 0) - require.EqualError(t, err, "--fast-forward-duration must be greater than zero") -} - func TestWorkflowTimeSkippingPollResult(t *testing.T) { for _, tc := range []struct { result enumspb.FastForwardPollingResult @@ -47,4 +26,18 @@ func TestWorkflowTimeSkippingPollResult(t *testing.T) { require.Equal(t, tc.status, status) require.Equal(t, tc.reason, reason) } + for _, tc := range []struct { + name string + response *workflowservice.PollWorkflowExecutionTimeSkippingResponse + }{ + {name: "nil response"}, + {name: "empty response", response: &workflowservice.PollWorkflowExecutionTimeSkippingResponse{}}, + } { + t.Run(tc.name, func(t *testing.T) { + status, reason, err := workflowTimeSkippingPollResult(tc.response) + require.ErrorContains(t, err, "unknown fast-forward polling result") + require.Empty(t, status) + require.Empty(t, reason) + }) + } } diff --git a/internal/temporalcli/commands.yaml b/internal/temporalcli/commands.yaml index 8f2601b6b..da991771b 100644 --- a/internal/temporalcli/commands.yaml +++ b/internal/temporalcli/commands.yaml @@ -3743,7 +3743,20 @@ commands: - name: temporal schedule time-skipping summary: Manage Schedule time skipping (Experimental) description: | - Enable or disable Schedule time skipping. For example: + Schedule time-skipping commands: + + - `temporal schedule time-skipping enable`: Enable time skipping with a + fast-forward duration. + - `temporal schedule time-skipping disable`: Disable time skipping. + - `temporal schedule time-skipping poll`: Poll a fast-forward result. + + `temporal schedule describe` shows the new `TimeSkippingInfo` field, + including the effective configuration and fast-forward status. + + - name: temporal schedule time-skipping enable + summary: Enable Schedule time skipping (Experimental) + description: | + Enable time skipping for a Schedule: ``` temporal schedule time-skipping enable \ @@ -3752,47 +3765,50 @@ commands: --fast-forward-duration 5h ``` - Use enable to set a fast-forward target for the Schedule. - - - name: temporal schedule time-skipping disable - summary: Disable Schedule time skipping (Experimental) - description: | - Disable time skipping for a Schedule: + Each enable call sets the complete time-skipping configuration. Specify + every optional setting you want to override; omitted settings use their + defaults. + Check the effective values, including defaults, with: ``` - temporal schedule time-skipping disable \ + temporal schedule describe \ --namespace YourNamespace \ --schedule-id YourScheduleId ``` - - The Schedule remains available after time skipping is disabled. option-sets: - schedule-id + - max-skip-per-session + options: + - name: fast-forward-duration + type: duration + required: true + description: Fast-forward the Schedule's virtual time by this duration. Must be greater than zero. + - name: fast-forward-id + type: string + description: Identify this fast-forward in Schedule status. Generated if omitted. Not an idempotency key. + - name: disable-propagation + type: bool + description: | + Defaults to false. Omit this flag or set it to false to propagate the + time-skipping enabled state to Workflows started by this Schedule. + Set it to true, or specify it without a value, to disable propagation. + Fast-forward targets are never propagated. Virtual time is propagated + regardless of this flag. - - name: temporal schedule time-skipping enable - summary: Enable Schedule time skipping (Experimental) + - name: temporal schedule time-skipping disable + summary: Disable Schedule time skipping (Experimental) description: | - Enable time skipping for a Schedule and set a fast-forward target: + Disable time skipping for a Schedule: ``` - temporal schedule time-skipping enable \ + temporal schedule time-skipping disable \ --namespace YourNamespace \ - --schedule-id YourScheduleId \ - --fast-forward-duration 5h + --schedule-id YourScheduleId ``` - The fast-forward target is relative to the current virtual time. + No other time-skipping flags are needed. option-sets: - schedule-id - - schedule-time-skipping-options - options: - - name: fast-forward-duration - type: duration - required: true - description: Set a fast-forward target this far ahead of the current virtual time. Must be greater than zero. - - name: fast-forward-id - type: string - description: Identify this fast-forward in Schedule status. Generated if omitted. Not an idempotency key. - name: temporal schedule time-skipping poll summary: Poll a Schedule fast-forward (Experimental) @@ -4028,11 +4044,6 @@ commands: Keys must be identifiers, and values must be JSON values. For example: `YourKey="YourString"` Can be passed multiple times. - - name: dynamic-config-file - type: string - description: | - Path to a dynamic configuration YAML file. Values passed with - `--dynamic-config-value` take precedence over values from this file. - name: log-config type: bool description: Print the server config to stderr. @@ -5046,20 +5057,20 @@ commands: - name: temporal workflow time-skipping summary: Manage Workflow time skipping (Experimental) description: | - Enable or disable time skipping for a Workflow Execution. For example: + Workflow time-skipping commands: - ``` - temporal workflow time-skipping enable \ - --namespace YourNamespace \ - --workflow-id YourWorkflowId - ``` + - `temporal workflow time-skipping enable`: Enable time skipping with an + optional fast-forward duration. + - `temporal workflow time-skipping disable`: Disable time skipping. + - `temporal workflow time-skipping poll`: Poll a fast-forward result. - Use poll to check the result of a fast-forward. + `temporal workflow describe` shows the `Time Skipping` section, including + the effective configuration and fast-forward status. - name: temporal workflow time-skipping enable summary: Enable Workflow time skipping (Experimental) description: | - Enable time skipping for a Workflow Execution, optionally with a fast-forward target: + Enable time skipping for a Workflow Execution: ``` temporal workflow time-skipping enable \ @@ -5068,17 +5079,34 @@ commands: --fast-forward-duration 5h ``` - Each call replaces the time-skipping configuration and starts a new skip session. + --fast-forward-duration is optional. Each enable call replaces the complete + time-skipping configuration and starts a new skip session. Specify every + optional setting you want to override; omitted settings use their defaults. + Check the effective values, including defaults, with: + + ``` + temporal workflow describe \ + --namespace YourNamespace \ + --workflow-id YourWorkflowId + ``` option-sets: - workflow-reference - - workflow-time-skipping-options + - max-skip-per-session options: - name: fast-forward-duration type: duration - description: Set a fast-forward target this far ahead of the current virtual time. + description: Fast-forward the Workflow Execution's virtual time by this duration. Must be greater than zero. - name: fast-forward-id type: string description: Identify this fast-forward in Workflow status and when polling for completion. Generated if omitted. Not an idempotency key. Requires --fast-forward-duration. + - name: disable-propagation + type: bool + description: | + Defaults to false. Omit this flag or set it to false to propagate the + time-skipping enabled state to child Workflows started by this Workflow. + Set it to true, or specify it without a value, to disable propagation. + Fast-forward targets are never propagated. Virtual time is propagated + regardless of this flag. - name: temporal workflow time-skipping disable summary: Disable Workflow time skipping (Experimental) @@ -5091,7 +5119,7 @@ commands: --workflow-id YourWorkflowId ``` - The Workflow Execution remains available after time skipping is disabled. + No other time-skipping flags are needed. option-sets: - workflow-reference @@ -5107,6 +5135,7 @@ commands: --fast-forward-id YourFastForwardId ``` + Reports `completed`, `poll timed out`, or `failed` with a reason. A server-side poll timeout means the caller may poll again. option-sets: - workflow-reference @@ -5980,6 +6009,24 @@ option-sets: required: true short: s + - name: max-skip-per-session + options: + - name: max-skip-per-session + type: int + description: | + Limit the number of time skips in a single time-skipping session. + A session starts when time skipping is enabled and ends when it is + automatically disabled. Updating the time-skipping configuration + resets the session. Omit to use the server default, which is 200 and + can be configured through the `system.timeSkippingMaxSkipPerSession` + dynamic config. Usually leave this unset unless a previous test + reached the limit and time skipping turned off automatically; then + set a higher value. If specified, must be between 1 and 10000. Use + `temporal schedule describe` or + `temporal workflow describe` to check `MaxSessionSkipCount`, + `CurrentSessionSkipCount`, and `EffectiveEnabled` in the time-skipping + status. + - name: schedule-configuration options: - name: calendar @@ -6032,29 +6079,6 @@ option-sets: For a list of time zones, see: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones. - - name: workflow-time-skipping-options - options: - - name: disable-propagation - type: bool - description: | - Defaults to false. Omit this flag or set it to false to propagate the - time-skipping enabled state to child Workflows started by this Workflow. - Set it to true, or specify it without a value, to disable propagation. - Fast-forward targets are never propagated. Virtual time is propagated - regardless of this flag. - - name: max-skip-per-session - type: int - description: Limit the number of time skips in this session. Omit to use the server default. - - - name: schedule-time-skipping-options - options: - - name: disable-propagation - type: bool - description: Do not propagate time skipping to Workflows started by this Schedule. - - name: max-skip-per-session - type: int - description: Override the server default maximum skips per session. - - name: schedule-create-only options: - name: schedule-search-attribute diff --git a/internal/temporalcli/commands_test.go b/internal/temporalcli/commands_test.go index 125e6330b..dce5e3e8d 100644 --- a/internal/temporalcli/commands_test.go +++ b/internal/temporalcli/commands_test.go @@ -234,7 +234,6 @@ func (s *SharedServerSuite) SetupSuite() { StartOptions: devserver.StartOptions{ // Enable for operator cluster commands EnableGlobalNamespace: true, - EnableTimeSkipping: true, DynamicConfigValues: map[string]any{ "frontend.enableUpdateWorkflowExecutionAsyncAccepted": true, // Allow a high rate of change to namespaces, particularly @@ -277,6 +276,19 @@ func (s *SharedServerSuite) TearDownSuite() { s.Stop() } +// Use a separate server so CHASM Schedule creation does not change the behavior +// expected by existing Schedule tests in the shared server suite. +func (s *SharedServerSuite) useTimeSkippingServer() { + sharedServer := s.DevServer + s.DevServer = StartDevServer(s.T(), DevServerOptions{ + StartOptions: devserver.StartOptions{EnableTimeSkipping: true}, + }) + s.T().Cleanup(func() { + s.DevServer.Stop() + s.DevServer = sharedServer + }) +} + func (s *SharedServerSuite) Stop() { s.DevServer.Stop() } diff --git a/internal/temporalcli/timeskipping.go b/internal/temporalcli/timeskipping.go new file mode 100644 index 000000000..f51631771 --- /dev/null +++ b/internal/temporalcli/timeskipping.go @@ -0,0 +1,80 @@ +package temporalcli + +import ( + "errors" + "fmt" + "time" + + "github.com/google/uuid" + commonpb "go.temporal.io/api/common/v1" + "go.temporal.io/sdk/client" +) + +const maxUserSetSkipPerSession = 10_000 + +func timeSkippingConfig(duration time.Duration, hasDuration bool, fastForwardID string, disablePropagation bool, maxSkips int) (*client.TimeSkippingConfig, error) { + if hasDuration && duration <= 0 { + return nil, errors.New("--fast-forward-duration must be greater than zero") + } + if !hasDuration && fastForwardID != "" { + return nil, errors.New("--fast-forward-id requires --fast-forward-duration") + } + if maxSkips < 0 || maxSkips > maxUserSetSkipPerSession { + return nil, fmt.Errorf("--max-skip-per-session must be between 1 and %d", maxUserSetSkipPerSession) + } + config := &client.TimeSkippingConfig{ + Enabled: true, + DisablePropagation: disablePropagation, + MaxSessionSkipCount: int32(maxSkips), + } + if hasDuration { + if fastForwardID == "" { + fastForwardID = uuid.NewString() + } + config.FastForwardConfig = &client.FastForwardConfig{ID: fastForwardID, Duration: duration} + } + return config, nil +} + +type printableTimeSkippingInfo struct { + EffectiveEnabled bool + DisablePropagation bool + MaxSessionSkipCount int32 + CurrentSessionSkipCount int32 + CurrentTime time.Time `cli:",cardOmitEmpty"` + FastForwardInfo *printableTimeSkippingFastForwardInfo `cli:",cardOmitEmpty"` +} + +type printableTimeSkippingFastForwardInfo struct { + Id string + Duration string + TargetTime time.Time `cli:",cardOmitEmpty"` + HasCompleted bool +} + +func timeSkippingToPrintable(info *commonpb.TimeSkippingInfo) *printableTimeSkippingInfo { + if info == nil { + return nil + } + + out := &printableTimeSkippingInfo{ + EffectiveEnabled: info.GetEffectiveConfig().GetEnabled(), + DisablePropagation: info.GetEffectiveConfig().GetDisablePropagation(), + MaxSessionSkipCount: info.GetEffectiveConfig().GetMaxSessionSkipCount(), + CurrentSessionSkipCount: info.GetCurrentSessionSkipCount(), + } + if currentTime := info.GetCurrentTime(); currentTime != nil { + out.CurrentTime = currentTime.AsTime() + } + if ff := info.GetFastForwardInfo(); ff != nil { + out.FastForwardInfo = &printableTimeSkippingFastForwardInfo{ + Id: ff.GetFastForwardId(), + Duration: formatDuration(ff.GetFastForwardDuration().AsDuration()), + HasCompleted: ff.GetHasCompleted(), + } + if targetTime := ff.GetTargetTime(); targetTime != nil { + out.FastForwardInfo.TargetTime = targetTime.AsTime() + } + } + return out +} diff --git a/internal/temporalcli/timeskipping_test.go b/internal/temporalcli/timeskipping_test.go new file mode 100644 index 000000000..d28657cf0 --- /dev/null +++ b/internal/temporalcli/timeskipping_test.go @@ -0,0 +1,183 @@ +package temporalcli + +import ( + "fmt" + "testing" + "time" + + "github.com/stretchr/testify/require" + commonpb "go.temporal.io/api/common/v1" + "google.golang.org/protobuf/types/known/durationpb" + "google.golang.org/protobuf/types/known/timestamppb" +) + +func TestPatchTimeSkippingNilConfig(t *testing.T) { + for _, tc := range []struct { + name string + patch func() error + }{ + { + name: "schedule", + patch: func() error { + return patchScheduleTimeSkipping(nil, nil, "YourScheduleId", nil) + }, + }, + { + name: "workflow", + patch: func() error { + return updateWorkflowOptionsForTimeSkipping(nil, nil, "YourWorkflowId", "", nil) + }, + }, + } { + t.Run(tc.name, func(t *testing.T) { + require.EqualError(t, tc.patch(), "time-skipping configuration is required") + }) + } +} + +func TestTimeSkippingConfig(t *testing.T) { + for _, tc := range []struct { + name string + duration time.Duration + hasDuration bool + fastForwardID string + disablePropagation bool + maxSkips int + wantErr string + }{ + {name: "no fast-forward uses defaults"}, + {name: "minimum user skip limit", maxSkips: 1}, + {name: "maximum user skip limit", maxSkips: 10_000}, + {name: "fast-forward with explicit ID", duration: 5 * time.Hour, hasDuration: true, fastForwardID: "YourFastForwardId", disablePropagation: true, maxSkips: 17}, + {name: "fast-forward generates ID", duration: time.Hour, hasDuration: true}, + {name: "fast-forward with maximum user skip limit", duration: time.Hour, hasDuration: true, maxSkips: 10_000}, + {name: "zero duration", hasDuration: true, wantErr: "--fast-forward-duration must be greater than zero"}, + {name: "negative duration", duration: -time.Second, hasDuration: true, wantErr: "--fast-forward-duration must be greater than zero"}, + {name: "ID without duration", fastForwardID: "YourFastForwardId", wantErr: "--fast-forward-id requires --fast-forward-duration"}, + {name: "negative skip limit", maxSkips: -1, wantErr: "--max-skip-per-session must be between 1 and 10000"}, + {name: "skip limit too large", maxSkips: 10_001, wantErr: "--max-skip-per-session must be between 1 and 10000"}, + {name: "fast-forward with skip limit too large", duration: time.Hour, hasDuration: true, maxSkips: 10_001, wantErr: "--max-skip-per-session must be between 1 and 10000"}, + } { + t.Run(tc.name, func(t *testing.T) { + config, err := timeSkippingConfig(tc.duration, tc.hasDuration, tc.fastForwardID, tc.disablePropagation, tc.maxSkips) + if tc.wantErr != "" { + require.EqualError(t, err, tc.wantErr) + require.Nil(t, config) + return + } + require.NoError(t, err) + require.True(t, config.Enabled) + require.Equal(t, tc.disablePropagation, config.DisablePropagation) + require.Equal(t, int32(tc.maxSkips), config.MaxSessionSkipCount) + if !tc.hasDuration { + require.Nil(t, config.FastForwardConfig) + return + } + require.NotNil(t, config.FastForwardConfig) + require.Equal(t, tc.duration, config.FastForwardConfig.Duration) + if tc.fastForwardID == "" { + require.NotEmpty(t, config.FastForwardConfig.ID) + } else { + require.Equal(t, tc.fastForwardID, config.FastForwardConfig.ID) + } + }) + } +} + +func TestTimeSkippingToPrintable(t *testing.T) { + targetTime := time.Date(2026, time.September, 27, 12, 0, 0, 0, time.UTC) + config := &commonpb.TimeSkippingConfig{ + Enabled: true, + DisablePropagation: true, + MaxSessionSkipCount: 200, + FastForwardConfig: &commonpb.FastForwardConfig{ + Id: "ff-id", + Duration: durationpb.New(5 * time.Hour), + }, + } + info := &commonpb.TimeSkippingInfo{ + CurrentTime: timestamppb.New(targetTime.Add(-time.Hour)), + EffectiveConfig: config, + CurrentSessionSkipCount: 4, + FastForwardInfo: &commonpb.TimeSkippingFastForwardInfo{ + FastForwardDuration: durationpb.New(5 * time.Hour), + FastForwardId: "ff-id", + TargetTime: timestamppb.New(targetTime), + HasCompleted: true, + }, + } + + printable := timeSkippingToPrintable(info) + require.True(t, printable.EffectiveEnabled) + require.True(t, printable.DisablePropagation) + require.Equal(t, int32(200), printable.MaxSessionSkipCount) + require.Equal(t, int32(4), printable.CurrentSessionSkipCount) + require.Equal(t, "ff-id", printable.FastForwardInfo.Id) + require.Equal(t, "5h 0m 0s", printable.FastForwardInfo.Duration) + require.Equal(t, targetTime, printable.FastForwardInfo.TargetTime) + require.True(t, printable.FastForwardInfo.HasCompleted) + + config.DisablePropagation = false + require.False(t, timeSkippingToPrintable(info).DisablePropagation) +} + +func TestTimeSkippingToPrintableNilValues(t *testing.T) { + t.Run("nil info", func(t *testing.T) { + require.Nil(t, timeSkippingToPrintable(nil)) + }) + + t.Run("empty info", func(t *testing.T) { + require.Equal(t, &printableTimeSkippingInfo{}, timeSkippingToPrintable(&commonpb.TimeSkippingInfo{})) + }) + + currentTime := time.Date(2026, time.October, 27, 12, 0, 0, 0, time.UTC) + targetTime := currentTime.Add(5 * time.Hour) + // Exercise every combination of the optional config, current time, + // fast-forward info, duration, and target time. Nested fields cannot be + // present when their parent fast-forward info is nil. + for mask := 0; mask < 32; mask++ { + hasConfig := mask&1 != 0 + hasCurrentTime := mask&2 != 0 + hasFastForward := mask&4 != 0 + hasDuration := mask&8 != 0 + hasTargetTime := mask&16 != 0 + if !hasFastForward && (hasDuration || hasTargetTime) { + continue + } + name := fmt.Sprintf("config=%t/current_time=%t/fast_forward=%t/duration=%t/target_time=%t", + hasConfig, hasCurrentTime, hasFastForward, hasDuration, hasTargetTime) + t.Run(name, func(t *testing.T) { + info := &commonpb.TimeSkippingInfo{CurrentSessionSkipCount: 4} + want := &printableTimeSkippingInfo{CurrentSessionSkipCount: 4} + if hasConfig { + info.EffectiveConfig = &commonpb.TimeSkippingConfig{ + Enabled: true, DisablePropagation: true, MaxSessionSkipCount: 200, + } + want.EffectiveEnabled = true + want.DisablePropagation = true + want.MaxSessionSkipCount = 200 + } + if hasCurrentTime { + info.CurrentTime = timestamppb.New(currentTime) + want.CurrentTime = currentTime + } + if hasFastForward { + info.FastForwardInfo = &commonpb.TimeSkippingFastForwardInfo{ + FastForwardId: "ff-id", HasCompleted: true, + } + want.FastForwardInfo = &printableTimeSkippingFastForwardInfo{ + Id: "ff-id", HasCompleted: true, Duration: "0s", + } + if hasDuration { + info.FastForwardInfo.FastForwardDuration = durationpb.New(5 * time.Hour) + want.FastForwardInfo.Duration = "5h 0m 0s" + } + if hasTargetTime { + info.FastForwardInfo.TargetTime = timestamppb.New(targetTime) + want.FastForwardInfo.TargetTime = targetTime + } + } + require.Equal(t, want, timeSkippingToPrintable(info)) + }) + } +} From 030c0e46ac16c55bb8b813d9b7fa1bbf5b00f384 Mon Sep 17 00:00:00 2001 From: Feiyang Xie Date: Tue, 27 Oct 2026 19:28:33 -0700 Subject: [PATCH 04/13] simplify cmd design and descriptions --- internal/temporalcli/commands.gen.go | 27 +++------- internal/temporalcli/commands.schedule.go | 20 +++----- .../temporalcli/commands.schedule_test.go | 9 +--- .../commands.time_skipping_test.go | 2 +- internal/temporalcli/commands.yaml | 50 ++----------------- 5 files changed, 23 insertions(+), 85 deletions(-) diff --git a/internal/temporalcli/commands.gen.go b/internal/temporalcli/commands.gen.go index f3f4844f3..2a128e863 100644 --- a/internal/temporalcli/commands.gen.go +++ b/internal/temporalcli/commands.gen.go @@ -2810,11 +2810,7 @@ func NewTemporalScheduleTimeSkippingCommand(cctx *CommandContext, parent *Tempor s.Parent = parent s.Command.Use = "time-skipping" s.Command.Short = "Manage Schedule time skipping (Experimental)" - if hasHighlighting { - s.Command.Long = "Schedule time-skipping commands:\n\n- \x1b[1mtemporal schedule time-skipping enable\x1b[0m: Enable time skipping with a\n fast-forward duration.\n- \x1b[1mtemporal schedule time-skipping disable\x1b[0m: Disable time skipping.\n- \x1b[1mtemporal schedule time-skipping poll\x1b[0m: Poll a fast-forward result.\n\n\x1b[1mtemporal schedule describe\x1b[0m shows the new \x1b[1mTimeSkippingInfo\x1b[0m field,\nincluding the effective configuration and fast-forward status." - } else { - s.Command.Long = "Schedule time-skipping commands:\n\n- `temporal schedule time-skipping enable`: Enable time skipping with a\n fast-forward duration.\n- `temporal schedule time-skipping disable`: Disable time skipping.\n- `temporal schedule time-skipping poll`: Poll a fast-forward result.\n\n`temporal schedule describe` shows the new `TimeSkippingInfo` field,\nincluding the effective configuration and fast-forward status." - } + s.Command.Long = "Manage Schedule time skipping." s.Command.Args = cobra.NoArgs s.Command.AddCommand(&NewTemporalScheduleTimeSkippingDisableCommand(cctx, &s).Command) s.Command.AddCommand(&NewTemporalScheduleTimeSkippingEnableCommand(cctx, &s).Command) @@ -2866,9 +2862,9 @@ func NewTemporalScheduleTimeSkippingEnableCommand(cctx *CommandContext, parent * s.Command.Use = "enable [flags]" s.Command.Short = "Enable Schedule time skipping (Experimental)" if hasHighlighting { - s.Command.Long = "Enable time skipping for a Schedule:\n\n\x1b[1mtemporal schedule time-skipping enable \\\n --namespace YourNamespace \\\n --schedule-id YourScheduleId \\\n --fast-forward-duration 5h\x1b[0m\n\nEach enable call sets the complete time-skipping configuration. Specify\nevery optional setting you want to override; omitted settings use their\ndefaults.\nCheck the effective values, including defaults, with:\n\n\x1b[1mtemporal schedule describe \\\n --namespace YourNamespace \\\n --schedule-id YourScheduleId\x1b[0m" + s.Command.Long = "Enable time skipping for a Schedule:\n\n\x1b[1mtemporal schedule time-skipping enable \\\n --namespace YourNamespace \\\n --schedule-id YourScheduleId \\\n --fast-forward-duration 5h\x1b[0m" } else { - s.Command.Long = "Enable time skipping for a Schedule:\n\n```\ntemporal schedule time-skipping enable \\\n --namespace YourNamespace \\\n --schedule-id YourScheduleId \\\n --fast-forward-duration 5h\n```\n\nEach enable call sets the complete time-skipping configuration. Specify\nevery optional setting you want to override; omitted settings use their\ndefaults.\nCheck the effective values, including defaults, with:\n\n```\ntemporal schedule describe \\\n --namespace YourNamespace \\\n --schedule-id YourScheduleId\n```" + s.Command.Long = "Enable time skipping for a Schedule:\n\n```\ntemporal schedule time-skipping enable \\\n --namespace YourNamespace \\\n --schedule-id YourScheduleId \\\n --fast-forward-duration 5h\n```" } s.Command.Args = cobra.NoArgs s.FastForwardDuration = 0 @@ -2891,7 +2887,6 @@ type TemporalScheduleTimeSkippingPollCommand struct { Command cobra.Command ScheduleIdOptions FastForwardId string - Timeout cliext.FlagDuration } func NewTemporalScheduleTimeSkippingPollCommand(cctx *CommandContext, parent *TemporalScheduleTimeSkippingCommand) *TemporalScheduleTimeSkippingPollCommand { @@ -2901,15 +2896,13 @@ func NewTemporalScheduleTimeSkippingPollCommand(cctx *CommandContext, parent *Te s.Command.Use = "poll [flags]" s.Command.Short = "Poll a Schedule fast-forward (Experimental)" if hasHighlighting { - s.Command.Long = "Poll Schedule status for the result of a specific fast-forward:\n\n\x1b[1mtemporal schedule time-skipping poll \\\n --namespace YourNamespace \\\n --schedule-id YourScheduleId \\\n --fast-forward-id YourFastForwardId \\\n --timeout 5m\x1b[0m\n\nA poll timeout means the fast-forward may still be running; poll again to check its status." + s.Command.Long = "Poll Schedule status for the result of a specific fast-forward:\n\n\x1b[1mtemporal schedule time-skipping poll \\\n --namespace YourNamespace \\\n --schedule-id YourScheduleId \\\n --fast-forward-id YourFastForwardId\x1b[0m\n\nWaits up to 10 seconds. If the poll times out, poll again to check its status." } else { - s.Command.Long = "Poll Schedule status for the result of a specific fast-forward:\n\n```\ntemporal schedule time-skipping poll \\\n --namespace YourNamespace \\\n --schedule-id YourScheduleId \\\n --fast-forward-id YourFastForwardId \\\n --timeout 5m\n```\n\nA poll timeout means the fast-forward may still be running; poll again to check its status." + s.Command.Long = "Poll Schedule status for the result of a specific fast-forward:\n\n```\ntemporal schedule time-skipping poll \\\n --namespace YourNamespace \\\n --schedule-id YourScheduleId \\\n --fast-forward-id YourFastForwardId\n```\n\nWaits up to 10 seconds. If the poll times out, poll again to check its status." } s.Command.Args = cobra.NoArgs s.Command.Flags().StringVar(&s.FastForwardId, "fast-forward-id", "", "ID of the fast-forward to poll. Required.") _ = cobra.MarkFlagRequired(s.Command.Flags(), "fast-forward-id") - s.Timeout = 0 - s.Command.Flags().Var(&s.Timeout, "timeout", "Maximum time to wait. Omit to wait until completion or interruption.") s.ScheduleIdOptions.BuildFlags(s.Command.Flags()) s.Command.Run = func(c *cobra.Command, args []string) { if err := s.run(cctx, args); err != nil { @@ -5623,11 +5616,7 @@ func NewTemporalWorkflowTimeSkippingCommand(cctx *CommandContext, parent *Tempor s.Parent = parent s.Command.Use = "time-skipping" s.Command.Short = "Manage Workflow time skipping (Experimental)" - if hasHighlighting { - s.Command.Long = "Workflow time-skipping commands:\n\n- \x1b[1mtemporal workflow time-skipping enable\x1b[0m: Enable time skipping with an\n optional fast-forward duration.\n- \x1b[1mtemporal workflow time-skipping disable\x1b[0m: Disable time skipping.\n- \x1b[1mtemporal workflow time-skipping poll\x1b[0m: Poll a fast-forward result.\n\n\x1b[1mtemporal workflow describe\x1b[0m shows the \x1b[1mTime Skipping\x1b[0m section, including\nthe effective configuration and fast-forward status." - } else { - s.Command.Long = "Workflow time-skipping commands:\n\n- `temporal workflow time-skipping enable`: Enable time skipping with an\n optional fast-forward duration.\n- `temporal workflow time-skipping disable`: Disable time skipping.\n- `temporal workflow time-skipping poll`: Poll a fast-forward result.\n\n`temporal workflow describe` shows the `Time Skipping` section, including\nthe effective configuration and fast-forward status." - } + s.Command.Long = "Manage Workflow time skipping." s.Command.Args = cobra.NoArgs s.Command.AddCommand(&NewTemporalWorkflowTimeSkippingDisableCommand(cctx, &s).Command) s.Command.AddCommand(&NewTemporalWorkflowTimeSkippingEnableCommand(cctx, &s).Command) @@ -5679,9 +5668,9 @@ func NewTemporalWorkflowTimeSkippingEnableCommand(cctx *CommandContext, parent * s.Command.Use = "enable [flags]" s.Command.Short = "Enable Workflow time skipping (Experimental)" if hasHighlighting { - s.Command.Long = "Enable time skipping for a Workflow Execution:\n\n\x1b[1mtemporal workflow time-skipping enable \\\n --namespace YourNamespace \\\n --workflow-id YourWorkflowId \\\n --fast-forward-duration 5h\x1b[0m\n\n--fast-forward-duration is optional. Each enable call replaces the complete\ntime-skipping configuration and starts a new skip session. Specify every\noptional setting you want to override; omitted settings use their defaults.\nCheck the effective values, including defaults, with:\n\n\x1b[1mtemporal workflow describe \\\n --namespace YourNamespace \\\n --workflow-id YourWorkflowId\x1b[0m" + s.Command.Long = "Enable time skipping for a Workflow Execution:\n\n\x1b[1mtemporal workflow time-skipping enable \\\n --namespace YourNamespace \\\n --workflow-id YourWorkflowId \\\n --fast-forward-duration 5h\x1b[0m" } else { - s.Command.Long = "Enable time skipping for a Workflow Execution:\n\n```\ntemporal workflow time-skipping enable \\\n --namespace YourNamespace \\\n --workflow-id YourWorkflowId \\\n --fast-forward-duration 5h\n```\n\n--fast-forward-duration is optional. Each enable call replaces the complete\ntime-skipping configuration and starts a new skip session. Specify every\noptional setting you want to override; omitted settings use their defaults.\nCheck the effective values, including defaults, with:\n\n```\ntemporal workflow describe \\\n --namespace YourNamespace \\\n --workflow-id YourWorkflowId\n```" + s.Command.Long = "Enable time skipping for a Workflow Execution:\n\n```\ntemporal workflow time-skipping enable \\\n --namespace YourNamespace \\\n --workflow-id YourWorkflowId \\\n --fast-forward-duration 5h\n```" } s.Command.Args = cobra.NoArgs s.FastForwardDuration = 0 diff --git a/internal/temporalcli/commands.schedule.go b/internal/temporalcli/commands.schedule.go index f3a0399c1..801728fe2 100644 --- a/internal/temporalcli/commands.schedule.go +++ b/internal/temporalcli/commands.schedule.go @@ -594,7 +594,10 @@ func (c *TemporalScheduleTimeSkippingEnableCommand) run(cctx *CommandContext, ar } // TODO: need to change to SDK polling. -const scheduleTimeSkippingPollInterval = 500 * time.Millisecond +const ( + scheduleTimeSkippingPollInterval = 500 * time.Millisecond + scheduleTimeSkippingPollTimeout = 10 * time.Second +) func scheduleTimeSkippingPollStatus(info *commonpb.TimeSkippingInfo, fastForwardID string) (string, string) { ff := info.GetFastForwardInfo() @@ -614,15 +617,8 @@ func scheduleTimeSkippingPollStatus(info *commonpb.TimeSkippingInfo, fastForward } func (c *TemporalScheduleTimeSkippingPollCommand) run(cctx *CommandContext, args []string) error { - if c.Command.Flags().Changed("timeout") && c.Timeout.Duration() <= 0 { - return errors.New("--timeout must be greater than zero") - } - ctx := context.Context(cctx) - if c.Timeout.Duration() > 0 { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, c.Timeout.Duration()) - defer cancel() - } + ctx, cancel := context.WithTimeout(cctx, scheduleTimeSkippingPollTimeout) + defer cancel() cl, err := dialClient(cctx, &c.Parent.Parent.ClientOptions) if err != nil { return err @@ -635,7 +631,7 @@ func (c *TemporalScheduleTimeSkippingPollCommand) run(cctx *CommandContext, args desc, err := handle.Describe(ctx) if err != nil { if errors.Is(ctx.Err(), context.DeadlineExceeded) { - cctx.Printer.Println("poll timed out") + cctx.Printer.Println("poll timed out; try again") return nil } return err @@ -652,7 +648,7 @@ func (c *TemporalScheduleTimeSkippingPollCommand) run(cctx *CommandContext, args select { case <-ctx.Done(): if errors.Is(ctx.Err(), context.DeadlineExceeded) { - cctx.Printer.Println("poll timed out") + cctx.Printer.Println("poll timed out; try again") return nil } return ctx.Err() diff --git a/internal/temporalcli/commands.schedule_test.go b/internal/temporalcli/commands.schedule_test.go index 31e32cfcf..1195b451e 100644 --- a/internal/temporalcli/commands.schedule_test.go +++ b/internal/temporalcli/commands.schedule_test.go @@ -140,10 +140,9 @@ func (s *SharedServerSuite) TestSchedule_TimeSkippingEnableGeneratesFastForwardI "--address", s.Address(), "--schedule-id", schedID, "--fast-forward-id", fastForwardID, - "--timeout", "200ms", ) s.NoError(res.Err) - s.Equal("poll timed out", strings.TrimSpace(res.Stdout.String())) + s.Equal("poll timed out; try again", strings.TrimSpace(res.Stdout.String())) } func (s *SharedServerSuite) TestSchedule_TimeSkippingPollTimeout() { @@ -166,10 +165,9 @@ func (s *SharedServerSuite) TestSchedule_TimeSkippingPollTimeout() { "--address", s.Address(), "--schedule-id", schedID, "--fast-forward-id", "YourFastForwardId", - "--timeout", "200ms", ) s.NoError(res.Err) - s.Equal("poll timed out", strings.TrimSpace(res.Stdout.String())) + s.Equal("poll timed out; try again", strings.TrimSpace(res.Stdout.String())) } } @@ -196,7 +194,6 @@ func (s *SharedServerSuite) TestSchedule_TimeSkippingMinimalLifecycle() { "--address", s.Address(), "--schedule-id", schedID, "--fast-forward-id", fastForwardID, - "--timeout", "10s", ) s.NoError(res.Err) s.Equal("completed", strings.TrimSpace(res.Stdout.String())) @@ -271,7 +268,6 @@ func (s *SharedServerSuite) TestSchedule_TimeSkippingPollFailed() { "--address", s.Address(), "--schedule-id", schedID, "--fast-forward-id", "OriginalFastForwardId", - "--timeout", "5s", ) require.NoError(t, res.Err) require.Regexp(t, `^failed: \S`, strings.TrimSpace(res.Stdout.String())) @@ -944,7 +940,6 @@ func (s *SharedServerSuite) TestSchedule_TimeSkippingPropagatesWithSkipOverlap() "--address", s.Address(), "--schedule-id", scheduleID, "--fast-forward-id", "ThreeActionsWithPropagation", - "--timeout", "30s", ) s.NoError(res.Err) s.Contains(res.Stdout.String(), "completed") diff --git a/internal/temporalcli/commands.time_skipping_test.go b/internal/temporalcli/commands.time_skipping_test.go index 5be529577..31f53dde3 100644 --- a/internal/temporalcli/commands.time_skipping_test.go +++ b/internal/temporalcli/commands.time_skipping_test.go @@ -69,7 +69,7 @@ func TestTimeSkippingInvalidFlags(t *testing.T) { "ID without duration", "enable", []string{"--fast-forward-id", "YourFastForwardId"}, "--fast-forward-id requires --fast-forward-duration"}) } else { cases = append(cases, invalidFlagsCase{ - "malformed poll timeout", "poll", []string{"--fast-forward-id", "YourFastForwardId", "--timeout", "invalid"}, "invalid argument"}) + "unsupported poll timeout", "poll", []string{"--fast-forward-id", "YourFastForwardId", "--timeout", "5m"}, "unknown flag: --timeout"}) } for _, tc := range cases { t.Run(tc.name, func(t *testing.T) { diff --git a/internal/temporalcli/commands.yaml b/internal/temporalcli/commands.yaml index da991771b..6ac7cc478 100644 --- a/internal/temporalcli/commands.yaml +++ b/internal/temporalcli/commands.yaml @@ -3743,15 +3743,7 @@ commands: - name: temporal schedule time-skipping summary: Manage Schedule time skipping (Experimental) description: | - Schedule time-skipping commands: - - - `temporal schedule time-skipping enable`: Enable time skipping with a - fast-forward duration. - - `temporal schedule time-skipping disable`: Disable time skipping. - - `temporal schedule time-skipping poll`: Poll a fast-forward result. - - `temporal schedule describe` shows the new `TimeSkippingInfo` field, - including the effective configuration and fast-forward status. + Manage Schedule time skipping. - name: temporal schedule time-skipping enable summary: Enable Schedule time skipping (Experimental) @@ -3764,17 +3756,6 @@ commands: --schedule-id YourScheduleId \ --fast-forward-duration 5h ``` - - Each enable call sets the complete time-skipping configuration. Specify - every optional setting you want to override; omitted settings use their - defaults. - Check the effective values, including defaults, with: - - ``` - temporal schedule describe \ - --namespace YourNamespace \ - --schedule-id YourScheduleId - ``` option-sets: - schedule-id - max-skip-per-session @@ -3819,11 +3800,10 @@ commands: temporal schedule time-skipping poll \ --namespace YourNamespace \ --schedule-id YourScheduleId \ - --fast-forward-id YourFastForwardId \ - --timeout 5m + --fast-forward-id YourFastForwardId ``` - A poll timeout means the fast-forward may still be running; poll again to check its status. + Waits up to 10 seconds. If the poll times out, poll again to check its status. option-sets: - schedule-id options: @@ -3831,9 +3811,6 @@ commands: type: string required: true description: ID of the fast-forward to poll. - - name: timeout - type: duration - description: Maximum time to wait. Omit to wait until completion or interruption. - name: temporal schedule update summary: Update Schedule details @@ -5057,15 +5034,7 @@ commands: - name: temporal workflow time-skipping summary: Manage Workflow time skipping (Experimental) description: | - Workflow time-skipping commands: - - - `temporal workflow time-skipping enable`: Enable time skipping with an - optional fast-forward duration. - - `temporal workflow time-skipping disable`: Disable time skipping. - - `temporal workflow time-skipping poll`: Poll a fast-forward result. - - `temporal workflow describe` shows the `Time Skipping` section, including - the effective configuration and fast-forward status. + Manage Workflow time skipping. - name: temporal workflow time-skipping enable summary: Enable Workflow time skipping (Experimental) @@ -5078,17 +5047,6 @@ commands: --workflow-id YourWorkflowId \ --fast-forward-duration 5h ``` - - --fast-forward-duration is optional. Each enable call replaces the complete - time-skipping configuration and starts a new skip session. Specify every - optional setting you want to override; omitted settings use their defaults. - Check the effective values, including defaults, with: - - ``` - temporal workflow describe \ - --namespace YourNamespace \ - --workflow-id YourWorkflowId - ``` option-sets: - workflow-reference - max-skip-per-session From bd13bebdf68acd697aa4992aabff73958c572892 Mon Sep 17 00:00:00 2001 From: Feiyang Xie Date: Tue, 27 Oct 2026 19:46:29 -0700 Subject: [PATCH 05/13] bug fixes --- internal/devserver/server_test.go | 107 +++++++++++---------- internal/devserver/time_skipping_config.go | 21 +--- 2 files changed, 56 insertions(+), 72 deletions(-) diff --git a/internal/devserver/server_test.go b/internal/devserver/server_test.go index 36fff743f..e0fd5f7f5 100644 --- a/internal/devserver/server_test.go +++ b/internal/devserver/server_test.go @@ -20,81 +20,82 @@ func timeSkippingConfigForTest(values map[string]any, enabled bool) dynamicconfi } func TestDevServerTimeSkippingDynamicConfigPrecedence(t *testing.T) { - disabled := map[dynamicconfig.Key]any{ - dynamicconfig.WorkflowTimeSkippingEnabled.Key(): false, - dynamicconfig.CHASMSchedulerTimeSkippingEnabled.Key(): false, - dynamicconfig.EnableCHASMSchedulerCreation.Key(): false, - dynamicconfig.CHASMSchedulerCreationRolloutPercent.Key(): 0, - dynamicconfig.EnableCHASMSchedulerRouting.Key(): false, - } type wantConfig struct { workflow, schedule, creation, routing bool rollout, maxSkip int } serverDefaults := wantConfig{routing: true, maxSkip: 200} allEnabled := wantConfig{workflow: true, schedule: true, creation: true, routing: true, rollout: 100, maxSkip: 200} - allDisabled := wantConfig{maxSkip: 200} - granularDisabled := wantConfig{maxSkip: 50} - - granular := make(map[string]any, len(disabled)+1) - globalScalar := make(map[string]any, len(disabled)) - globalYAML := make(map[string]any, len(disabled)) - for key, value := range disabled { - granular[key.String()] = []dynamicconfig.ConstrainedValue{{ - Value: value, Constraints: dynamicconfig.Constraints{Namespace: "timeskipping-test"}, - }} - globalScalar[key.String()] = value - globalYAML[key.String()] = []dynamicconfig.ConstrainedValue{{Value: value}} - } - granular[dynamicconfig.TimeSkippingMaxSkipPerSession.Key().String()] = []dynamicconfig.ConstrainedValue{{ - Value: 50, Constraints: dynamicconfig.Constraints{Namespace: "timeskipping-test"}, - }} for _, tc := range []struct { name string enabled bool explicit map[string]any - wantTest wantConfig - wantElse wantConfig - shape string + want wantConfig }{ - {name: "flag off", wantTest: serverDefaults, wantElse: serverDefaults, shape: "absent"}, - {name: "no explicit config", enabled: true, wantTest: allEnabled, wantElse: allEnabled, shape: "defaults"}, - {name: "namespace explicit config", enabled: true, explicit: granular, wantTest: granularDisabled, wantElse: allEnabled, shape: "granular"}, - {name: "global explicit scalar config", enabled: true, explicit: globalScalar, wantTest: allDisabled, wantElse: allDisabled, shape: "global"}, - {name: "global explicit YAML config", enabled: true, explicit: globalYAML, wantTest: allDisabled, wantElse: allDisabled, shape: "global"}, + {name: "flag off uses server defaults", want: serverDefaults}, + {name: "flag on without explicit config", enabled: true, want: allEnabled}, + { + name: "explicit global config overrides all time-skipping defaults", + enabled: true, + explicit: map[string]any{ + dynamicconfig.WorkflowTimeSkippingEnabled.Key().String(): false, + dynamicconfig.CHASMSchedulerTimeSkippingEnabled.Key().String(): false, + dynamicconfig.EnableCHASMSchedulerCreation.Key().String(): false, + dynamicconfig.CHASMSchedulerCreationRolloutPercent.Key().String(): 0, + dynamicconfig.EnableCHASMSchedulerRouting.Key().String(): false, + }, + want: wantConfig{maxSkip: 200}, + }, + { + name: "partial global override preserves other defaults", + enabled: true, + explicit: map[string]any{ + dynamicconfig.CHASMSchedulerTimeSkippingEnabled.Key().String(): false, + }, + want: wantConfig{workflow: true, creation: true, routing: true, rollout: 100, maxSkip: 200}, + }, + { + name: "explicit global max skip overrides server default", + enabled: true, + explicit: map[string]any{ + dynamicconfig.TimeSkippingMaxSkipPerSession.Key().String(): 50, + }, + want: wantConfig{workflow: true, schedule: true, creation: true, routing: true, rollout: 100, maxSkip: 50}, + }, + { + name: "flag off preserves explicit global config", + explicit: map[string]any{ + dynamicconfig.WorkflowTimeSkippingEnabled.Key().String(): true, + }, + want: wantConfig{workflow: true, routing: true, maxSkip: 200}, + }, } { t.Run(tc.name, func(t *testing.T) { raw := timeSkippingConfigForTest(tc.explicit, tc.enabled) + for key, value := range tc.explicit { + require.Equal(t, value, raw[dynamicconfig.MakeKey(key)], "explicit key %s was replaced", key) + } for key, fallback := range timeSkippingDynamicConfigDefaults { - switch tc.shape { - case "absent": + if _, explicit := tc.explicit[key.String()]; explicit { + continue + } + if tc.enabled { + require.Equal(t, fallback, raw[key], "key %s", key) + } else { _, present := raw[key] require.False(t, present, "unexpected override for %s", key) - case "defaults": - require.Equal(t, fallback, raw[key], "key %s", key) - case "granular": - require.Len(t, tc.explicit[key.String()].([]dynamicconfig.ConstrainedValue), 1, "input for %s was mutated", key) - require.Equal(t, []dynamicconfig.ConstrainedValue{ - {Value: disabled[key], Constraints: dynamicconfig.Constraints{Namespace: "timeskipping-test"}}, - {Value: fallback}, - }, raw[key], "key %s", key) - case "global": - require.Equal(t, tc.explicit[key.String()], raw[key], "key %s was replaced or appended to", key) } } config := dynamicconfig.NewCollection(raw, log.NewNoopLogger()) - for namespace, want := range map[string]wantConfig{ - "timeskipping-test": tc.wantTest, - "another-namespace": tc.wantElse, - } { + for _, namespace := range []string{"timeskipping-test", "another-namespace"} { t.Run(namespace, func(t *testing.T) { - require.Equal(t, want.workflow, dynamicconfig.WorkflowTimeSkippingEnabled.Get(config)(namespace)) - require.Equal(t, want.schedule, dynamicconfig.CHASMSchedulerTimeSkippingEnabled.Get(config)(namespace)) - require.Equal(t, want.creation, dynamicconfig.EnableCHASMSchedulerCreation.Get(config)(namespace)) - require.Equal(t, want.rollout, dynamicconfig.CHASMSchedulerCreationRolloutPercent.Get(config)(namespace)) - require.Equal(t, want.routing, dynamicconfig.EnableCHASMSchedulerRouting.Get(config)(namespace)) - require.Equal(t, want.maxSkip, dynamicconfig.TimeSkippingMaxSkipPerSession.Get(config)(namespace)) + require.Equal(t, tc.want.workflow, dynamicconfig.WorkflowTimeSkippingEnabled.Get(config)(namespace)) + require.Equal(t, tc.want.schedule, dynamicconfig.CHASMSchedulerTimeSkippingEnabled.Get(config)(namespace)) + require.Equal(t, tc.want.creation, dynamicconfig.EnableCHASMSchedulerCreation.Get(config)(namespace)) + require.Equal(t, tc.want.rollout, dynamicconfig.CHASMSchedulerCreationRolloutPercent.Get(config)(namespace)) + require.Equal(t, tc.want.routing, dynamicconfig.EnableCHASMSchedulerRouting.Get(config)(namespace)) + require.Equal(t, tc.want.maxSkip, dynamicconfig.TimeSkippingMaxSkipPerSession.Get(config)(namespace)) }) } }) diff --git a/internal/devserver/time_skipping_config.go b/internal/devserver/time_skipping_config.go index 1310d0242..69c5e8b9f 100644 --- a/internal/devserver/time_skipping_config.go +++ b/internal/devserver/time_skipping_config.go @@ -38,26 +38,9 @@ var timeSkippingDynamicConfigDefaults = map[dynamicconfig.Key]any{ func applyTimeSkippingDynamicConfig(dynConf dynamicconfig.StaticClient) { for key, fallback := range timeSkippingDynamicConfigDefaults { - value, exists := dynConf[key] - if !exists { + // Explicit dynamic config values take precedence over these defaults. + if _, exists := dynConf[key]; !exists { dynConf[key] = fallback - continue - } - // Explicit global values win. Constrained values need the default as a - // fallback for namespaces they do not match. - constrained, ok := value.([]dynamicconfig.ConstrainedValue) - if !ok { - continue - } - hasGlobal := false - for _, entry := range constrained { - if entry.Constraints == (dynamicconfig.Constraints{}) { - hasGlobal = true - break - } - } - if !hasGlobal { - dynConf[key] = append(append([]dynamicconfig.ConstrainedValue(nil), constrained...), dynamicconfig.ConstrainedValue{Value: fallback}) } } } From d756c5675a345649e228ad2aaa012a1ffadea635 Mon Sep 17 00:00:00 2001 From: Feiyang Xie Date: Tue, 27 Oct 2026 19:56:29 -0700 Subject: [PATCH 06/13] update server verstion --- go.mod | 2 +- go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index e6936f0a1..48d13fe1a 100644 --- a/go.mod +++ b/go.mod @@ -20,7 +20,7 @@ require ( go.temporal.io/api v1.64.1-0.20261030195137-01272cbd37c9 go.temporal.io/sdk v1.49.1-0.20261021203027-733b3b459a02 go.temporal.io/sdk/contrib/envconfig v1.1.0 - go.temporal.io/server v1.29.0-135.0.0.20261027191414-bf81a4c20009 + go.temporal.io/server v1.33.0-165.0 golang.org/x/exp v0.0.0-20260611194520-c48552f49976 golang.org/x/mod v0.41.0 golang.org/x/term v0.47.0 diff --git a/go.sum b/go.sum index f5d4d8eac..dcaa0afd3 100644 --- a/go.sum +++ b/go.sum @@ -545,6 +545,8 @@ go.temporal.io/sdk/contrib/envconfig v1.1.0 h1:9HGsyrZytjdcZeWJwQlczqYulMhmHS2PR go.temporal.io/sdk/contrib/envconfig v1.1.0/go.mod h1:th96Zl21YH2mHEe3uZ5Dw0KwZFSF4I2oSwTcUxGA19Y= go.temporal.io/server v1.29.0-135.0.0.20261027191414-bf81a4c20009 h1:gFi39tM7NtedBMryDl6loxvKKpi7eESvZfGaWH46Qcc= go.temporal.io/server v1.29.0-135.0.0.20261027191414-bf81a4c20009/go.mod h1:qqkCsy2vnbqJILCAlQQpoXxjywHmnZ3rKWEPyqEqcis= +go.temporal.io/server v1.33.0-165.0 h1:sZTroQeeST1c/H7k7JIsDznAfKoIt1J1mePc5yKhynA= +go.temporal.io/server v1.33.0-165.0/go.mod h1:+eRNFeKRF3IPSXzBCy9PhrSw1zXFrdw1MrxdRhuaa7w= go.temporal.io/server v1.33.0-166.3 h1:y3tLzHag7F6Pv5EieBUJk2+RlTkUhKT1TaC7k5k2HcQ= go.temporal.io/server v1.33.0-166.3/go.mod h1:SP/bukdhfHYhAlaz7oghgdNZvJtEaBmPjzvSbvkS2jk= go.temporal.io/testx v0.0.0-20261029001555-ddcb0739798d h1:SK9slpVz38T0H1ldMpsh/GFWrVTZw7gWC3i2An0rviI= From 5bc44ba8ddad833c45c49cef5486e6e35e238f10 Mon Sep 17 00:00:00 2001 From: Greg Travis Date: Wed, 28 Oct 2026 16:54:05 -0400 Subject: [PATCH 07/13] Update with SDK's newly-exposed polling. --- go.mod | 2 +- go.sum | 2 + internal/temporalcli/commands.schedule.go | 73 ++++++------------- .../temporalcli/commands.schedule_test.go | 3 +- .../commands.workflow_time_skipping.go | 47 ++++-------- ...ds.workflow_time_skipping_internal_test.go | 43 ----------- internal/temporalcli/timeskipping.go | 30 ++++++++ 7 files changed, 72 insertions(+), 128 deletions(-) delete mode 100644 internal/temporalcli/commands.workflow_time_skipping_internal_test.go diff --git a/go.mod b/go.mod index 48d13fe1a..c2ae4bd04 100644 --- a/go.mod +++ b/go.mod @@ -18,7 +18,7 @@ require ( github.com/temporalio/cli/cliext v0.0.0 github.com/temporalio/ui-server/v2 v2.56.4 go.temporal.io/api v1.64.1-0.20261030195137-01272cbd37c9 - go.temporal.io/sdk v1.49.1-0.20261021203027-733b3b459a02 + go.temporal.io/sdk v1.49.1-0.20261028204201-93056ed9a9de go.temporal.io/sdk/contrib/envconfig v1.1.0 go.temporal.io/server v1.33.0-165.0 golang.org/x/exp v0.0.0-20260611194520-c48552f49976 diff --git a/go.sum b/go.sum index dcaa0afd3..1fb84f8f9 100644 --- a/go.sum +++ b/go.sum @@ -539,6 +539,8 @@ go.temporal.io/sdk v1.49.0 h1:CtGI0BUe/SCo3eoqTwuWWtXKueii9GBVus7KrKKH1Vo= go.temporal.io/sdk v1.49.0/go.mod h1:xP0FulN5JJSfisESUP60LlWsrKz2tLSStGjVdk8r5cc= go.temporal.io/sdk v1.49.1-0.20261021203027-733b3b459a02 h1:D0ypFFAz7SNeOQTD72WkdPK8O4XgaB03uMmyTHtVsB8= go.temporal.io/sdk v1.49.1-0.20261021203027-733b3b459a02/go.mod h1:OsF05yeW+3KDYpBEn8BQmj78RXX3qWo/SPJr3s5PLK4= +go.temporal.io/sdk v1.49.1-0.20261028204201-93056ed9a9de h1:uI7eiW/cJ0Q/HKKPMiCrL0lBIEmkB4LrNaZ8Ev7YUi8= +go.temporal.io/sdk v1.49.1-0.20261028204201-93056ed9a9de/go.mod h1:OsF05yeW+3KDYpBEn8BQmj78RXX3qWo/SPJr3s5PLK4= go.temporal.io/sdk/contrib/envconfig v1.0.2 h1:MGHfsuPUtsf7X9M6WYn3zYJj/mWsuYHnA1uuiL0KEuE= go.temporal.io/sdk/contrib/envconfig v1.0.2/go.mod h1:MuMiH7hksps2uXnmKuAWaP9P6WbkSDy62kl64t1VJVg= go.temporal.io/sdk/contrib/envconfig v1.1.0 h1:9HGsyrZytjdcZeWJwQlczqYulMhmHS2PRcarcFRjMRE= diff --git a/internal/temporalcli/commands.schedule.go b/internal/temporalcli/commands.schedule.go index 801728fe2..30ea7a850 100644 --- a/internal/temporalcli/commands.schedule.go +++ b/internal/temporalcli/commands.schedule.go @@ -19,6 +19,7 @@ import ( schedpb "go.temporal.io/api/schedule/v1" "go.temporal.io/api/workflowservice/v1" "go.temporal.io/sdk/client" + "go.temporal.io/sdk/timeskipping" ) type printableSchedule struct { @@ -106,7 +107,7 @@ func describeResultToPrintable(id string, desc *client.ScheduleDescription) *pri MissedCatchupWindow: desc.Info.NumActionsMissedCatchupWindow, SkippedOverlap: desc.Info.NumActionsSkippedOverlap, } - out.TimeSkippingInfo = timeSkippingToPrintable(desc.Info.TimeSkippingInfo) + out.TimeSkippingInfo = clientTimeSkippingToPrintable(desc.Info.TimeSkippingInfo) return out } @@ -593,28 +594,7 @@ func (c *TemporalScheduleTimeSkippingEnableCommand) run(cctx *CommandContext, ar return patchScheduleTimeSkipping(cctx, c.Parent.Parent, c.ScheduleId, config) } -// TODO: need to change to SDK polling. -const ( - scheduleTimeSkippingPollInterval = 500 * time.Millisecond - scheduleTimeSkippingPollTimeout = 10 * time.Second -) - -func scheduleTimeSkippingPollStatus(info *commonpb.TimeSkippingInfo, fastForwardID string) (string, string) { - ff := info.GetFastForwardInfo() - if ff == nil || ff.GetFastForwardId() == "" { - return "failed", "fast-forward was removed or was not found in Schedule status" - } - if ff.GetFastForwardId() != fastForwardID { - return "failed", fmt.Sprintf("fast-forward was replaced by %q", ff.GetFastForwardId()) - } - if ff.GetHasCompleted() { - return "completed", "" - } - if !info.GetEffectiveConfig().GetEnabled() { - return "failed", "time skipping was disabled before fast-forward completed" - } - return "pending", "" -} +const scheduleTimeSkippingPollTimeout = 10 * time.Second func (c *TemporalScheduleTimeSkippingPollCommand) run(cctx *CommandContext, args []string) error { ctx, cancel := context.WithTimeout(cctx, scheduleTimeSkippingPollTimeout) @@ -625,36 +605,25 @@ func (c *TemporalScheduleTimeSkippingPollCommand) run(cctx *CommandContext, args } defer cl.Close() handle := cl.ScheduleClient().GetHandle(ctx, c.ScheduleId) - ticker := time.NewTicker(scheduleTimeSkippingPollInterval) - defer ticker.Stop() - for { - desc, err := handle.Describe(ctx) - if err != nil { - if errors.Is(ctx.Err(), context.DeadlineExceeded) { - cctx.Printer.Println("poll timed out; try again") - return nil - } - return err - } - status, reason := scheduleTimeSkippingPollStatus(desc.Info.TimeSkippingInfo, c.FastForwardId) - if status != "pending" { - if reason == "" { - cctx.Printer.Println(status) - } else { - cctx.Printer.Printlnf("%s: %s", status, reason) - } - return nil - } - select { - case <-ctx.Done(): - if errors.Is(ctx.Err(), context.DeadlineExceeded) { - cctx.Printer.Println("poll timed out; try again") - return nil - } - return ctx.Err() - case <-ticker.C: - } + + res, err := timeskipping.PollScheduleFastForward(ctx, handle, + timeskipping.PollScheduleFastForwardOptions{FastForwardID: c.FastForwardId}) + if err != nil && !errors.Is(ctx.Err(), context.DeadlineExceeded) { + return err } + switch { + case res.Completed: + cctx.Printer.Println("completed") + case res.FailedReason != "": + // The SDK names the ways a fast-forward stops being completable: + // superseded, time skipping switched off, never enabled. + cctx.Printer.Printlnf("failed: %s", res.FailedReason) + default: + // The SDK bounds the wait by our context, so reaching here is this + // command's own timeout rather than anything wrong with the fast-forward. + cctx.Printer.Println("poll timed out; try again") + } + return nil } func printScheduleTimeSkippingResult( diff --git a/internal/temporalcli/commands.schedule_test.go b/internal/temporalcli/commands.schedule_test.go index 1195b451e..46add6586 100644 --- a/internal/temporalcli/commands.schedule_test.go +++ b/internal/temporalcli/commands.schedule_test.go @@ -959,7 +959,8 @@ func (s *SharedServerSuite) TestSchedule_TimeSkippingPropagatesWithSkipOverlap() s.NotNil(description.Schedule.Policy) s.Equal(enums.SCHEDULE_OVERLAP_POLICY_SKIP, description.Schedule.Policy.Overlap) s.NotNil(description.Info.TimeSkippingInfo) - s.False(description.Info.TimeSkippingInfo.GetEffectiveConfig().GetDisablePropagation()) + s.NotNil(description.Info.TimeSkippingInfo.EffectiveConfig) + s.False(description.Info.TimeSkippingInfo.EffectiveConfig.DisablePropagation) workflowIDs := make(map[string]struct{}, 3) for i, action := range description.Info.RecentActions { diff --git a/internal/temporalcli/commands.workflow_time_skipping.go b/internal/temporalcli/commands.workflow_time_skipping.go index bf13d96e7..e619e2036 100644 --- a/internal/temporalcli/commands.workflow_time_skipping.go +++ b/internal/temporalcli/commands.workflow_time_skipping.go @@ -1,13 +1,12 @@ package temporalcli import ( + "context" "errors" "fmt" - commonpb "go.temporal.io/api/common/v1" - enumspb "go.temporal.io/api/enums/v1" - workflowservice "go.temporal.io/api/workflowservice/v1" "go.temporal.io/sdk/client" + "go.temporal.io/sdk/timeskipping" ) func (c *TemporalWorkflowTimeSkippingEnableCommand) run(cctx *CommandContext, args []string) error { @@ -71,44 +70,30 @@ func updateWorkflowOptionsForTimeSkipping(cctx *CommandContext, parent *Temporal return nil } -func workflowTimeSkippingPollResult(resp *workflowservice.PollWorkflowExecutionTimeSkippingResponse) (string, string, error) { - switch resp.GetFastForwardPollingResult() { - case enumspb.FAST_FORWARD_POLLING_RESULT_FAST_FORWARD_COMPLETED: - return "completed", "", nil - case enumspb.FAST_FORWARD_POLLING_RESULT_POLL_TIMEOUT: - return "poll timed out", "", nil - case enumspb.FAST_FORWARD_POLLING_RESULT_FAST_FORWARD_FAILED: - return "failed", resp.GetFailedReason(), nil - default: - return "", "", fmt.Errorf("unknown fast-forward polling result %v", resp.GetFastForwardPollingResult()) - } -} - func (c *TemporalWorkflowTimeSkippingPollCommand) run(cctx *CommandContext, args []string) error { cl, err := dialClient(cctx, &c.Parent.Parent.ClientOptions) if err != nil { return err } defer cl.Close() - resp, err := cl.WorkflowService().PollWorkflowExecutionTimeSkipping(cctx, &workflowservice.PollWorkflowExecutionTimeSkippingRequest{ - Namespace: c.Parent.Parent.Namespace, - WorkflowExecution: &commonpb.WorkflowExecution{ - WorkflowId: c.WorkflowId, - RunId: c.RunId, - }, - FastForwardId: c.FastForwardId, + // The SDK reissues the server long poll until our context ends, so a + // server-side poll window expiring is handled for us rather than being an + // outcome the user has to re-run on. + res, err := timeskipping.PollFastForward(cctx, cl, timeskipping.PollFastForwardOptions{ + WorkflowID: c.WorkflowId, + RunID: c.RunId, + FastForwardID: c.FastForwardId, }) if err != nil { return err } - status, reason, err := workflowTimeSkippingPollResult(resp) - if err != nil { - return err - } - if reason == "" { - cctx.Printer.Println(status) - } else { - cctx.Printer.Printlnf("%s: %s", status, reason) + switch { + case res.Completed: + cctx.Printer.Println("completed") + case errors.Is(cctx.Err(), context.DeadlineExceeded): + cctx.Printer.Println("poll timed out; try again") + default: + cctx.Printer.Printlnf("failed: %s", res.FailedReason) } return nil } diff --git a/internal/temporalcli/commands.workflow_time_skipping_internal_test.go b/internal/temporalcli/commands.workflow_time_skipping_internal_test.go deleted file mode 100644 index a224b1e2a..000000000 --- a/internal/temporalcli/commands.workflow_time_skipping_internal_test.go +++ /dev/null @@ -1,43 +0,0 @@ -package temporalcli - -import ( - "testing" - - "github.com/stretchr/testify/require" - enumspb "go.temporal.io/api/enums/v1" - workflowservice "go.temporal.io/api/workflowservice/v1" -) - -func TestWorkflowTimeSkippingPollResult(t *testing.T) { - for _, tc := range []struct { - result enumspb.FastForwardPollingResult - reason string - status string - }{ - {enumspb.FAST_FORWARD_POLLING_RESULT_FAST_FORWARD_COMPLETED, "", "completed"}, - {enumspb.FAST_FORWARD_POLLING_RESULT_POLL_TIMEOUT, "", "poll timed out"}, - {enumspb.FAST_FORWARD_POLLING_RESULT_FAST_FORWARD_FAILED, "time skipping disabled", "failed"}, - } { - status, reason, err := workflowTimeSkippingPollResult(&workflowservice.PollWorkflowExecutionTimeSkippingResponse{ - FastForwardPollingResult: tc.result, - FailedReason: tc.reason, - }) - require.NoError(t, err) - require.Equal(t, tc.status, status) - require.Equal(t, tc.reason, reason) - } - for _, tc := range []struct { - name string - response *workflowservice.PollWorkflowExecutionTimeSkippingResponse - }{ - {name: "nil response"}, - {name: "empty response", response: &workflowservice.PollWorkflowExecutionTimeSkippingResponse{}}, - } { - t.Run(tc.name, func(t *testing.T) { - status, reason, err := workflowTimeSkippingPollResult(tc.response) - require.ErrorContains(t, err, "unknown fast-forward polling result") - require.Empty(t, status) - require.Empty(t, reason) - }) - } -} diff --git a/internal/temporalcli/timeskipping.go b/internal/temporalcli/timeskipping.go index f51631771..12f469ca5 100644 --- a/internal/temporalcli/timeskipping.go +++ b/internal/temporalcli/timeskipping.go @@ -52,6 +52,8 @@ type printableTimeSkippingFastForwardInfo struct { HasCompleted bool } +// timeSkippingToPrintable renders the raw proto form, which is what +// DescribeWorkflowExecution still returns. func timeSkippingToPrintable(info *commonpb.TimeSkippingInfo) *printableTimeSkippingInfo { if info == nil { return nil @@ -78,3 +80,31 @@ func timeSkippingToPrintable(info *commonpb.TimeSkippingInfo) *printableTimeSkip } return out } + +// clientTimeSkippingToPrintable renders the SDK's typed form, which is what +// ScheduleHandle.Describe returns. The SDK has already done the proto decoding, +// so there are no timestamp nil checks to repeat here. +func clientTimeSkippingToPrintable(info *client.TimeSkippingInfo) *printableTimeSkippingInfo { + if info == nil { + return nil + } + + out := &printableTimeSkippingInfo{ + CurrentTime: info.CurrentTime, + CurrentSessionSkipCount: info.CurrentSessionSkipCount, + } + if cfg := info.EffectiveConfig; cfg != nil { + out.EffectiveEnabled = cfg.Enabled + out.DisablePropagation = cfg.DisablePropagation + out.MaxSessionSkipCount = cfg.MaxSessionSkipCount + } + if ff := info.FastForwardInfo; ff != nil { + out.FastForwardInfo = &printableTimeSkippingFastForwardInfo{ + Id: ff.ID, + Duration: formatDuration(ff.Duration), + TargetTime: ff.TargetTime, + HasCompleted: ff.HasCompleted, + } + } + return out +} From 42de0a64c4a772ce4f186d3d8acfa78a13aecb8d Mon Sep 17 00:00:00 2001 From: Feiyang Xie Date: Thu, 29 Oct 2026 10:11:38 -0700 Subject: [PATCH 08/13] refine time-skipping help and JSON output, fixes based on comments --- internal/devserver/time_skipping_config.go | 26 ---- internal/temporalcli/commands.gen.go | 20 +-- internal/temporalcli/commands.schedule.go | 46 ++---- .../temporalcli/commands.schedule_test.go | 85 +++++++++-- .../commands.time_skipping_test.go | 111 +++++++++++++- .../temporalcli/commands.workflow_test.go | 140 +++++++++++++++++- .../commands.workflow_time_skipping.go | 30 +--- internal/temporalcli/commands.yaml | 31 ++-- internal/temporalcli/timeskipping.go | 27 ++++ internal/temporalcli/timeskipping_test.go | 103 +++++++++++++ tmp/vts-manual-worker.go | 58 ++++++++ 11 files changed, 547 insertions(+), 130 deletions(-) create mode 100644 tmp/vts-manual-worker.go diff --git a/internal/devserver/time_skipping_config.go b/internal/devserver/time_skipping_config.go index 69c5e8b9f..cc48f542e 100644 --- a/internal/devserver/time_skipping_config.go +++ b/internal/devserver/time_skipping_config.go @@ -1,29 +1,3 @@ -// The MIT License -// -// Copyright (c) 2022 Temporal Technologies Inc. All rights reserved. -// -// Copyright (c) 2020 Uber Technologies, Inc. -// -// Copyright (c) 2021 Datadog, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - package devserver import "go.temporal.io/server/common/dynamicconfig" diff --git a/internal/temporalcli/commands.gen.go b/internal/temporalcli/commands.gen.go index 2a128e863..0066bbdda 100644 --- a/internal/temporalcli/commands.gen.go +++ b/internal/temporalcli/commands.gen.go @@ -2810,7 +2810,7 @@ func NewTemporalScheduleTimeSkippingCommand(cctx *CommandContext, parent *Tempor s.Parent = parent s.Command.Use = "time-skipping" s.Command.Short = "Manage Schedule time skipping (Experimental)" - s.Command.Long = "Manage Schedule time skipping." + s.Command.Long = "Manage Schedule time skipping, where a schedule's virtual clock fast-forwards when idle.\nUse time skipping in testing environments to efficiently evaluate the behavior of a schedule.\n\nNote: This is an experimental feature and may change in the future." s.Command.Args = cobra.NoArgs s.Command.AddCommand(&NewTemporalScheduleTimeSkippingDisableCommand(cctx, &s).Command) s.Command.AddCommand(&NewTemporalScheduleTimeSkippingEnableCommand(cctx, &s).Command) @@ -2862,9 +2862,9 @@ func NewTemporalScheduleTimeSkippingEnableCommand(cctx *CommandContext, parent * s.Command.Use = "enable [flags]" s.Command.Short = "Enable Schedule time skipping (Experimental)" if hasHighlighting { - s.Command.Long = "Enable time skipping for a Schedule:\n\n\x1b[1mtemporal schedule time-skipping enable \\\n --namespace YourNamespace \\\n --schedule-id YourScheduleId \\\n --fast-forward-duration 5h\x1b[0m" + s.Command.Long = "Enable time skipping for a Schedule:\n\n\x1b[1mtemporal schedule time-skipping enable \\\n --namespace YourNamespace \\\n --schedule-id YourScheduleId \\\n --fast-forward-duration 5h\x1b[0m\n\nOnce enabled, the Schedule advances its virtual clock during inactivity,\nallowing scheduled Workflows to start without waiting for wall-clock time." } else { - s.Command.Long = "Enable time skipping for a Schedule:\n\n```\ntemporal schedule time-skipping enable \\\n --namespace YourNamespace \\\n --schedule-id YourScheduleId \\\n --fast-forward-duration 5h\n```" + s.Command.Long = "Enable time skipping for a Schedule:\n\n```\ntemporal schedule time-skipping enable \\\n --namespace YourNamespace \\\n --schedule-id YourScheduleId \\\n --fast-forward-duration 5h\n```\n\nOnce enabled, the Schedule advances its virtual clock during inactivity,\nallowing scheduled Workflows to start without waiting for wall-clock time." } s.Command.Args = cobra.NoArgs s.FastForwardDuration = 0 @@ -2896,9 +2896,9 @@ func NewTemporalScheduleTimeSkippingPollCommand(cctx *CommandContext, parent *Te s.Command.Use = "poll [flags]" s.Command.Short = "Poll a Schedule fast-forward (Experimental)" if hasHighlighting { - s.Command.Long = "Poll Schedule status for the result of a specific fast-forward:\n\n\x1b[1mtemporal schedule time-skipping poll \\\n --namespace YourNamespace \\\n --schedule-id YourScheduleId \\\n --fast-forward-id YourFastForwardId\x1b[0m\n\nWaits up to 10 seconds. If the poll times out, poll again to check its status." + s.Command.Long = "Poll Schedule time-skipping status for a specific fast-forward setting:\n\n\x1b[1mtemporal schedule time-skipping poll \\\n --namespace YourNamespace \\\n --schedule-id YourScheduleId \\\n --fast-forward-id YourFastForwardId\x1b[0m\n\nUse the global \x1b[1m--command-timeout\x1b[0m flag to limit how long the poll waits.\nA failed fast-forward or poll timeout returns a nonzero exit status." } else { - s.Command.Long = "Poll Schedule status for the result of a specific fast-forward:\n\n```\ntemporal schedule time-skipping poll \\\n --namespace YourNamespace \\\n --schedule-id YourScheduleId \\\n --fast-forward-id YourFastForwardId\n```\n\nWaits up to 10 seconds. If the poll times out, poll again to check its status." + s.Command.Long = "Poll Schedule time-skipping status for a specific fast-forward setting:\n\n```\ntemporal schedule time-skipping poll \\\n --namespace YourNamespace \\\n --schedule-id YourScheduleId \\\n --fast-forward-id YourFastForwardId\n```\n\nUse the global `--command-timeout` flag to limit how long the poll waits.\nA failed fast-forward or poll timeout returns a nonzero exit status." } s.Command.Args = cobra.NoArgs s.Command.Flags().StringVar(&s.FastForwardId, "fast-forward-id", "", "ID of the fast-forward to poll. Required.") @@ -5616,7 +5616,7 @@ func NewTemporalWorkflowTimeSkippingCommand(cctx *CommandContext, parent *Tempor s.Parent = parent s.Command.Use = "time-skipping" s.Command.Short = "Manage Workflow time skipping (Experimental)" - s.Command.Long = "Manage Workflow time skipping." + s.Command.Long = "Manage Workflow time skipping, where a workflow skips time when idle.\nUse time skipping in testing environments to efficiently evaluate \nthe behavior of a workflow with extended periods of inactivity.\n\nNote: This is an experimental feature and may change in the future." s.Command.Args = cobra.NoArgs s.Command.AddCommand(&NewTemporalWorkflowTimeSkippingDisableCommand(cctx, &s).Command) s.Command.AddCommand(&NewTemporalWorkflowTimeSkippingEnableCommand(cctx, &s).Command) @@ -5668,9 +5668,9 @@ func NewTemporalWorkflowTimeSkippingEnableCommand(cctx *CommandContext, parent * s.Command.Use = "enable [flags]" s.Command.Short = "Enable Workflow time skipping (Experimental)" if hasHighlighting { - s.Command.Long = "Enable time skipping for a Workflow Execution:\n\n\x1b[1mtemporal workflow time-skipping enable \\\n --namespace YourNamespace \\\n --workflow-id YourWorkflowId \\\n --fast-forward-duration 5h\x1b[0m" + s.Command.Long = "Enable time skipping for a Workflow Execution:\n\n\x1b[1mtemporal workflow time-skipping enable \\\n --namespace YourNamespace \\\n --workflow-id YourWorkflowId\x1b[0m\nOnce enabled, the workflow execution skips time during inactivity, \nexpediting the completion of timers, retry waits, and start delays." } else { - s.Command.Long = "Enable time skipping for a Workflow Execution:\n\n```\ntemporal workflow time-skipping enable \\\n --namespace YourNamespace \\\n --workflow-id YourWorkflowId \\\n --fast-forward-duration 5h\n```" + s.Command.Long = "Enable time skipping for a Workflow Execution:\n\n```\ntemporal workflow time-skipping enable \\\n --namespace YourNamespace \\\n --workflow-id YourWorkflowId\n```\nOnce enabled, the workflow execution skips time during inactivity, \nexpediting the completion of timers, retry waits, and start delays." } s.Command.Args = cobra.NoArgs s.FastForwardDuration = 0 @@ -5701,9 +5701,9 @@ func NewTemporalWorkflowTimeSkippingPollCommand(cctx *CommandContext, parent *Te s.Command.Use = "poll [flags]" s.Command.Short = "Poll a Workflow fast-forward (Experimental)" if hasHighlighting { - s.Command.Long = "Poll for the result of a specific Workflow fast-forward:\n\n\x1b[1mtemporal workflow time-skipping poll \\\n --namespace YourNamespace \\\n --workflow-id YourWorkflowId \\\n --fast-forward-id YourFastForwardId\x1b[0m\n\nReports \x1b[1mcompleted\x1b[0m, \x1b[1mpoll timed out\x1b[0m, or \x1b[1mfailed\x1b[0m with a reason.\nA server-side poll timeout means the caller may poll again." + s.Command.Long = "Poll Workflow time-skipping status for a specific fast-forward setting:\n\n\x1b[1mtemporal workflow time-skipping poll \\\n --namespace YourNamespace \\\n --workflow-id YourWorkflowId \\\n --fast-forward-id YourFastForwardId\x1b[0m\n\nUse the global \x1b[1m--command-timeout\x1b[0m flag to limit how long the poll waits.\nA failed fast-forward or poll timeout returns a nonzero exit status." } else { - s.Command.Long = "Poll for the result of a specific Workflow fast-forward:\n\n```\ntemporal workflow time-skipping poll \\\n --namespace YourNamespace \\\n --workflow-id YourWorkflowId \\\n --fast-forward-id YourFastForwardId\n```\n\nReports `completed`, `poll timed out`, or `failed` with a reason.\nA server-side poll timeout means the caller may poll again." + s.Command.Long = "Poll Workflow time-skipping status for a specific fast-forward setting:\n\n```\ntemporal workflow time-skipping poll \\\n --namespace YourNamespace \\\n --workflow-id YourWorkflowId \\\n --fast-forward-id YourFastForwardId\n```\n\nUse the global `--command-timeout` flag to limit how long the poll waits.\nA failed fast-forward or poll timeout returns a nonzero exit status." } s.Command.Args = cobra.NoArgs s.Command.Flags().StringVar(&s.FastForwardId, "fast-forward-id", "", "ID of the fast-forward to poll. Required.") diff --git a/internal/temporalcli/commands.schedule.go b/internal/temporalcli/commands.schedule.go index 30ea7a850..119691d78 100644 --- a/internal/temporalcli/commands.schedule.go +++ b/internal/temporalcli/commands.schedule.go @@ -1,7 +1,6 @@ package temporalcli import ( - "context" "errors" "fmt" "regexp" @@ -575,7 +574,10 @@ func patchScheduleTimeSkipping(cctx *CommandContext, parent *TemporalScheduleCom if err != nil { return err } - printScheduleTimeSkippingResult(cctx, "updated", parent.Namespace, scheduleID, config) + if cctx.JSONOutput { + return printTimeSkippingUpdateJSON(cctx, config) + } + printScheduleTimeSkippingResult(cctx, "updated", scheduleID, config) return nil } @@ -594,42 +596,28 @@ func (c *TemporalScheduleTimeSkippingEnableCommand) run(cctx *CommandContext, ar return patchScheduleTimeSkipping(cctx, c.Parent.Parent, c.ScheduleId, config) } -const scheduleTimeSkippingPollTimeout = 10 * time.Second - func (c *TemporalScheduleTimeSkippingPollCommand) run(cctx *CommandContext, args []string) error { - ctx, cancel := context.WithTimeout(cctx, scheduleTimeSkippingPollTimeout) - defer cancel() cl, err := dialClient(cctx, &c.Parent.Parent.ClientOptions) if err != nil { return err } defer cl.Close() - handle := cl.ScheduleClient().GetHandle(ctx, c.ScheduleId) + handle := cl.ScheduleClient().GetHandle(cctx, c.ScheduleId) - res, err := timeskipping.PollScheduleFastForward(ctx, handle, + res, err := timeskipping.PollScheduleFastForward(cctx, handle, timeskipping.PollScheduleFastForwardOptions{FastForwardID: c.FastForwardId}) - if err != nil && !errors.Is(ctx.Err(), context.DeadlineExceeded) { + if err != nil { return err } - switch { - case res.Completed: - cctx.Printer.Println("completed") - case res.FailedReason != "": - // The SDK names the ways a fast-forward stops being completable: - // superseded, time skipping switched off, never enabled. - cctx.Printer.Printlnf("failed: %s", res.FailedReason) - default: - // The SDK bounds the wait by our context, so reaching here is this - // command's own timeout rather than anything wrong with the fast-forward. - cctx.Printer.Println("poll timed out; try again") + if !res.Completed { + return fmt.Errorf("fast-forward failed: %s", res.FailedReason) } - return nil + return printTimeSkippingPollCompleted(cctx) } func printScheduleTimeSkippingResult( cctx *CommandContext, action string, - namespace string, scheduleID string, config *client.TimeSkippingConfig, ) { @@ -648,20 +636,6 @@ func printScheduleTimeSkippingResult( if ff := config.FastForwardConfig; ff != nil { cctx.Printer.Printlnf("Fast-forward duration: %s", formatDuration(ff.Duration)) cctx.Printer.Printlnf("Fast-forward ID: %s", ff.ID) - cctx.Printer.Println("Poll fast-forward:") - cctx.Printer.Printlnf(" temporal schedule time-skipping poll --namespace %s --schedule-id %s --fast-forward-id %s", namespace, scheduleID, ff.ID) - } - cctx.Printer.Println() - if config.Enabled { - cctx.Printer.Println("Check status:") - } else { - cctx.Printer.Println("Check status of time skipping:") - } - cctx.Printer.Printlnf(" temporal schedule describe --namespace %s --schedule-id %s", namespace, scheduleID) - if config.Enabled { - cctx.Printer.Println() - cctx.Printer.Println("Disable time skipping:") - cctx.Printer.Printlnf(" temporal schedule time-skipping disable --namespace %s --schedule-id %s", namespace, scheduleID) } } diff --git a/internal/temporalcli/commands.schedule_test.go b/internal/temporalcli/commands.schedule_test.go index 46add6586..cfdfd6134 100644 --- a/internal/temporalcli/commands.schedule_test.go +++ b/internal/temporalcli/commands.schedule_test.go @@ -82,6 +82,8 @@ func (s *SharedServerSuite) TestSchedule_TimeSkippingEnable() { s.Contains(res.Stdout.String(), "Time skipping: enabled") s.Contains(res.Stdout.String(), "Fast-forward duration: 5h 0m 0s") s.Contains(res.Stdout.String(), "Fast-forward ID: YourFastForwardId") + s.NotContains(res.Stdout.String(), "Check status") + s.NotContains(res.Stdout.String(), "temporal schedule describe") s.Contains(res.Stdout.String(), "Maximum skips per session: 17") res = s.Execute( "schedule", "describe", @@ -124,7 +126,9 @@ func (s *SharedServerSuite) TestSchedule_TimeSkippingEnableGeneratesFastForwardI fastForwardID := match[1] _, err := uuid.Parse(fastForwardID) require.NoError(s.T(), err) - s.Contains(res.Stdout.String(), "temporal schedule time-skipping poll --namespace default --schedule-id "+schedID+" --fast-forward-id "+fastForwardID) + s.NotContains(res.Stdout.String(), "Poll fast-forward:") + s.NotContains(res.Stdout.String(), "Disable time skipping:") + s.NotContains(res.Stdout.String(), "temporal schedule ") res = s.Execute( "schedule", "describe", @@ -140,9 +144,10 @@ func (s *SharedServerSuite) TestSchedule_TimeSkippingEnableGeneratesFastForwardI "--address", s.Address(), "--schedule-id", schedID, "--fast-forward-id", fastForwardID, + "--command-timeout", "200ms", ) - s.NoError(res.Err) - s.Equal("poll timed out; try again", strings.TrimSpace(res.Stdout.String())) + s.ErrorIs(res.Err, context.DeadlineExceeded) + s.Empty(res.Stdout.String()) } func (s *SharedServerSuite) TestSchedule_TimeSkippingPollTimeout() { @@ -158,17 +163,27 @@ func (s *SharedServerSuite) TestSchedule_TimeSkippingPollTimeout() { ) s.NoError(res.Err) - // A timeout leaves the fast-forward available to poll again. - for range 2 { - res = s.Execute( - "schedule", "time-skipping", "poll", - "--address", s.Address(), - "--schedule-id", schedID, - "--fast-forward-id", "YourFastForwardId", - ) - s.NoError(res.Err) - s.Equal("poll timed out; try again", strings.TrimSpace(res.Stdout.String())) + // Each timeout leaves the same fast-forward available to poll again. + for _, tc := range []struct { + name, timeout string + minimum, maximum time.Duration + }{ + {name: "short command timeout", timeout: "200ms", minimum: 100 * time.Millisecond, maximum: 5 * time.Second}, + {name: "command timeout extends beyond former cap", timeout: "12s", minimum: 11 * time.Second, maximum: 17 * time.Second}, + } { + s.T().Run(tc.name, func(t *testing.T) { + ctx, cancel := context.WithTimeout(s.Context, 20*time.Second) + defer cancel() + started := time.Now() + res := s.ExecuteWithContext(ctx, "schedule", "time-skipping", "poll", "--address", s.Address(), + "--schedule-id", schedID, "--fast-forward-id", "YourFastForwardId", "--command-timeout", tc.timeout) + require.ErrorIs(t, res.Err, context.DeadlineExceeded) + require.Empty(t, res.Stdout.String()) + require.GreaterOrEqual(t, time.Since(started), tc.minimum) + require.Less(t, time.Since(started), tc.maximum) + }) } + } func (s *SharedServerSuite) TestSchedule_TimeSkippingMinimalLifecycle() { @@ -269,8 +284,9 @@ func (s *SharedServerSuite) TestSchedule_TimeSkippingPollFailed() { "--schedule-id", schedID, "--fast-forward-id", "OriginalFastForwardId", ) - require.NoError(t, res.Err) - require.Regexp(t, `^failed: \S`, strings.TrimSpace(res.Stdout.String())) + require.ErrorContains(t, res.Err, "fast-forward failed:") + require.Regexp(t, `^fast-forward failed: \S`, res.Err.Error()) + require.Empty(t, res.Stdout.String()) }) } } @@ -980,3 +996,42 @@ func (s *SharedServerSuite) TestSchedule_TimeSkippingPropagatesWithSkipOverlap() s.True(workflowDescription.GetWorkflowExtendedInfo().GetTimeSkippingInfo().GetEffectiveConfig().GetEnabled()) } } + +func (s *SharedServerSuite) TestSchedule_TimeSkippingUpdateJSON() { + s.useTimeSkippingServer() + for _, output := range []string{"json", "jsonl"} { + s.T().Run(output, func(t *testing.T) { + schedID, _, res := s.createSchedule("--interval", "10d", "--paused") + require.NoError(t, res.Err) + res = s.Execute("schedule", "time-skipping", "enable", "--address", s.Address(), + "--schedule-id", schedID, "--fast-forward-duration", "5h", "--output", output) + require.NoError(t, res.Err) + var result struct { + Enabled bool `json:"enabled"` + FastForwardID string `json:"fastForwardId"` + } + require.NoError(t, json.Unmarshal(res.Stdout.Bytes(), &result)) + require.True(t, result.Enabled) + _, err := uuid.Parse(result.FastForwardID) + require.NoError(t, err) + if output == "jsonl" { + require.Len(t, strings.Split(strings.TrimSpace(res.Stdout.String()), "\n"), 1) + } + res = s.Execute("schedule", "describe", "--address", s.Address(), "--schedule-id", schedID, "--output", "json") + require.NoError(t, res.Err) + var description workflowservice.DescribeScheduleResponse + require.NoError(t, protojson.Unmarshal(res.Stdout.Bytes(), &description)) + require.Equal(t, result.FastForwardID, description.GetInfo().GetTimeSkippingInfo().GetFastForwardInfo().GetFastForwardId()) + + res = s.Execute("schedule", "time-skipping", "disable", "--address", s.Address(), + "--schedule-id", schedID, "--output", output) + require.NoError(t, res.Err) + require.JSONEq(t, `{"enabled":false}`, res.Stdout.String()) + + res = s.Execute("schedule", "time-skipping", "enable", "--address", s.Address(), + "--schedule-id", schedID+"-missing", "--fast-forward-duration", "5h", "--output", output) + require.Error(t, res.Err) + require.Empty(t, res.Stdout.String()) + }) + } +} diff --git a/internal/temporalcli/commands.time_skipping_test.go b/internal/temporalcli/commands.time_skipping_test.go index 31f53dde3..9697b4c22 100644 --- a/internal/temporalcli/commands.time_skipping_test.go +++ b/internal/temporalcli/commands.time_skipping_test.go @@ -1,11 +1,20 @@ package temporalcli_test import ( + "bytes" "context" + "os" + "os/exec" + "slices" + "strings" "testing" + "time" + "github.com/google/uuid" "github.com/stretchr/testify/require" "github.com/temporalio/cli/internal/temporalcli" + "go.temporal.io/sdk/client" + "go.temporal.io/sdk/workflow" ) // Validate user input through the public CLI without contacting a server. @@ -67,9 +76,6 @@ func TestTimeSkippingInvalidFlags(t *testing.T) { if noun == "workflow" { cases = append(cases, invalidFlagsCase{ "ID without duration", "enable", []string{"--fast-forward-id", "YourFastForwardId"}, "--fast-forward-id requires --fast-forward-duration"}) - } else { - cases = append(cases, invalidFlagsCase{ - "unsupported poll timeout", "poll", []string{"--fast-forward-id", "YourFastForwardId", "--timeout", "5m"}, "unknown flag: --timeout"}) } for _, tc := range cases { t.Run(tc.name, func(t *testing.T) { @@ -82,3 +88,102 @@ func TestTimeSkippingInvalidFlags(t *testing.T) { }) } } + +// Run the CLI in a child process so its default Fail handler can call os.Exit. +// The regular command harness replaces that handler and only captures an error. +func TestTimeSkippingCLIProcess(t *testing.T) { + if os.Getenv("TEMPORAL_CLI_TIME_SKIPPING_TEST_PROCESS") != "1" { + return + } + separator := slices.Index(os.Args, "--") + if separator < 0 { + t.Fatal("missing CLI arguments") + } + options := temporalcli.CommandOptions{Args: os.Args[separator+1:]} + options.DeprecatedEnvConfig.DisableEnvConfig = true + options.DeprecatedEnvConfig.EnvConfigName = "default" + temporalcli.Execute(context.Background(), options) + os.Exit(0) +} + +func (s *SharedServerSuite) TestTimeSkipping_PollExitStatus() { + s.useTimeSkippingServer() + s.Worker().OnDevWorkflow(func(ctx workflow.Context, input any) (any, error) { + return nil, workflow.Sleep(ctx, 10*time.Hour) + }) + for _, noun := range []string{"workflow", "schedule"} { + for _, outcome := range []string{"completed", "failed", "timeout"} { + s.T().Run(noun+" "+outcome, func(t *testing.T) { + var id string + if noun == "workflow" { + taskQueue := s.Worker().Options.TaskQueue + if outcome != "completed" { + // Keep fast-forward pending without an active worker. + taskQueue = uuid.NewString() + } + run, err := s.Client.ExecuteWorkflow(s.Context, + client.StartWorkflowOptions{TaskQueue: taskQueue}, DevWorkflow, nil) + require.NoError(t, err) + id = run.GetID() + defer func() { _ = s.Client.CancelWorkflow(s.Context, id, "") }() + } else { + args := []string{"--interval", "10d"} + if outcome != "completed" { + args = append(args, "--paused") + } + var res *CommandResult + id, _, res = s.createSchedule(args...) + require.NoError(t, res.Err) + } + idFlag := "--" + noun + "-id" + res := s.Execute(noun, "time-skipping", "enable", "--address", s.Address(), + idFlag, id, "--fast-forward-duration", "5h", "--fast-forward-id", "ExitStatusTest") + require.NoError(t, res.Err) + if outcome == "failed" { + res = s.Execute(noun, "time-skipping", "disable", "--address", s.Address(), idFlag, id) + require.NoError(t, res.Err) + } + timeout := "15s" + if outcome == "timeout" { + timeout = "200ms" + } + for _, format := range []string{"text", "json", "jsonl"} { + ctx, cancel := context.WithTimeout(s.Context, 20*time.Second) + defer cancel() + cmd := exec.CommandContext(ctx, os.Args[0], "-test.run=^TestTimeSkippingCLIProcess$", "--", + noun, "time-skipping", "poll", "--address", s.Address(), "--namespace", s.Namespace(), + idFlag, id, "--fast-forward-id", "ExitStatusTest", "--command-timeout", timeout) + if format != "text" { + cmd.Args = append(cmd.Args, "--output", format) + } + cmd.Env = append(os.Environ(), "TEMPORAL_CLI_TIME_SKIPPING_TEST_PROCESS=1") + var stdout, stderr bytes.Buffer + cmd.Stdout, cmd.Stderr = &stdout, &stderr + err := cmd.Run() + if outcome == "completed" { + require.NoError(t, err, "stderr: %s", stderr.String()) + if format == "text" { + require.Equal(t, "completed", strings.TrimSpace(stdout.String())) + } else { + require.JSONEq(t, `{"completed":true}`, stdout.String()) + if format == "jsonl" { + require.Len(t, strings.Split(strings.TrimSpace(stdout.String()), "\n"), 1) + } + } + require.Empty(t, stderr.String()) + continue + } + var exitErr *exec.ExitError + require.ErrorAs(t, err, &exitErr) + require.Equal(t, 1, exitErr.ExitCode(), "stderr: %s", stderr.String()) + require.Empty(t, stdout.String()) + if outcome == "failed" { + require.Regexp(t, `Error: fast-forward failed: \S`, stderr.String()) + } else { + require.Equal(t, "Error: program interrupted", strings.TrimSpace(stderr.String())) + } + } + }) + } + } +} diff --git a/internal/temporalcli/commands.workflow_test.go b/internal/temporalcli/commands.workflow_test.go index f3c06b3b2..2e837036a 100644 --- a/internal/temporalcli/commands.workflow_test.go +++ b/internal/temporalcli/commands.workflow_test.go @@ -9,6 +9,7 @@ import ( "strconv" "strings" "sync" + "testing" "time" "github.com/google/uuid" @@ -86,11 +87,10 @@ func (s *SharedServerSuite) TestWorkflow_TimeSkippingEnablePollDisable() { ) s.NoError(res.Err) s.Contains(res.Stdout.String(), "Fast-forward ID: WorkflowPollId") - statusCommand := fmt.Sprintf("temporal workflow describe --namespace %s --workflow-id %s --run-id %s", s.Namespace(), run.GetID(), run.GetRunID()) - pollCommand := fmt.Sprintf("temporal workflow time-skipping poll --namespace %s --workflow-id %s --run-id %s --fast-forward-id WorkflowPollId", s.Namespace(), run.GetID(), run.GetRunID()) - s.Contains(res.Stdout.String(), statusCommand) - s.Contains(res.Stdout.String(), pollCommand) - s.Less(strings.Index(res.Stdout.String(), "Check status:"), strings.Index(res.Stdout.String(), "Fast-forward ID:")) + s.NotContains(res.Stdout.String(), "Check status") + s.NotContains(res.Stdout.String(), "temporal workflow describe") + s.NotContains(res.Stdout.String(), "Poll fast-forward:") + s.NotContains(res.Stdout.String(), "temporal workflow ") res = s.Execute( "workflow", "time-skipping", "poll", @@ -119,7 +119,8 @@ func (s *SharedServerSuite) TestWorkflow_TimeSkippingEnablePollDisable() { ) s.NoError(res.Err) s.Contains(res.Stdout.String(), "Time skipping: disabled") - s.Contains(res.Stdout.String(), statusCommand) + s.NotContains(res.Stdout.String(), "Check status") + s.NotContains(res.Stdout.String(), "temporal workflow describe") s.NotContains(res.Stdout.String(), "Poll fast-forward:") s.NoError(s.Client.CancelWorkflow(s.Context, run.GetID(), run.GetRunID())) } @@ -1780,3 +1781,130 @@ func (s *SharedServerSuite) TestWorkflow_TimeSkippingEnableWithoutFastForward() s.NoError(res.Err) s.ContainsOnSameLine(res.Stdout.String(), "EffectiveEnabled", "false") } + +func (s *SharedServerSuite) TestWorkflow_TimeSkippingUpdateJSON() { + s.useTimeSkippingServer() + s.Worker().OnDevWorkflow(func(ctx workflow.Context, input any) (any, error) { + return nil, workflow.Sleep(ctx, 10*time.Hour) + }) + for _, output := range []string{"json", "jsonl"} { + s.T().Run(output, func(t *testing.T) { + run, err := s.Client.ExecuteWorkflow(s.Context, + client.StartWorkflowOptions{TaskQueue: s.Worker().Options.TaskQueue}, DevWorkflow, nil) + require.NoError(t, err) + defer func() { _ = s.Client.CancelWorkflow(s.Context, run.GetID(), "") }() + res := s.Execute("workflow", "time-skipping", "enable", "--address", s.Address(), + "--workflow-id", run.GetID(), "--fast-forward-duration", "5h", "--output", output) + require.NoError(t, res.Err) + var result struct { + Enabled bool `json:"enabled"` + FastForwardID string `json:"fastForwardId"` + } + require.NoError(t, json.Unmarshal(res.Stdout.Bytes(), &result)) + require.True(t, result.Enabled) + _, err = uuid.Parse(result.FastForwardID) + require.NoError(t, err) + if output == "jsonl" { + require.Len(t, strings.Split(strings.TrimSpace(res.Stdout.String()), "\n"), 1) + } + res = s.Execute("workflow", "describe", "--address", s.Address(), "--workflow-id", run.GetID(), "--output", "json") + require.NoError(t, res.Err) + var description workflowservice.DescribeWorkflowExecutionResponse + require.NoError(t, protojson.Unmarshal(res.Stdout.Bytes(), &description)) + require.Equal(t, result.FastForwardID, description.GetWorkflowExtendedInfo().GetTimeSkippingInfo().GetFastForwardInfo().GetFastForwardId()) + + res = s.Execute("workflow", "time-skipping", "disable", "--address", s.Address(), + "--workflow-id", run.GetID(), "--output", output) + require.NoError(t, res.Err) + require.JSONEq(t, `{"enabled":false}`, res.Stdout.String()) + + res = s.Execute("workflow", "time-skipping", "enable", "--address", s.Address(), + "--workflow-id", run.GetID()+"-missing", "--fast-forward-duration", "5h", "--output", output) + require.Error(t, res.Err) + require.Empty(t, res.Stdout.String()) + }) + } +} + +func (s *SharedServerSuite) TestWorkflow_TimeSkippingPollTimeoutAndRetry() { + s.useTimeSkippingServer() + taskQueue := uuid.NewString() + // Leave the Workflow Task unprocessed so fast-forward remains pending. + run, err := s.Client.ExecuteWorkflow(s.Context, + client.StartWorkflowOptions{TaskQueue: taskQueue}, "TimeSkippingPollWorkflow") + s.NoError(err) + defer func() { _ = s.Client.CancelWorkflow(s.Context, run.GetID(), "") }() + + res := s.Execute("workflow", "time-skipping", "enable", "--address", s.Address(), + "--workflow-id", run.GetID(), "--fast-forward-duration", "5h", "--fast-forward-id", "YourFastForwardId") + s.NoError(res.Err) + args := []string{"workflow", "time-skipping", "poll", "--address", s.Address(), + "--workflow-id", run.GetID(), "--fast-forward-id", "YourFastForwardId"} + + for _, timeout := range []string{"200ms", "500ms"} { + s.T().Run("command timeout "+timeout, func(t *testing.T) { + ctx, cancel := context.WithTimeout(s.Context, 10*time.Second) + defer cancel() + res := s.ExecuteWithContext(ctx, append(args, "--command-timeout", timeout)...) + require.ErrorIs(t, res.Err, context.DeadlineExceeded) + require.Empty(t, res.Stdout.String()) + }) + } + + canceled, stop := context.WithCancel(s.Context) + stop() + res = s.ExecuteWithContext(canceled, args...) + s.ErrorContains(res.Err, "canceled") + s.Empty(res.Stdout.String()) + + // With no command timeout, polling must outlive the former 10-second cap. + ctx, cancel := context.WithTimeout(s.Context, 25*time.Second) + defer cancel() + resultCh := make(chan *CommandResult, 1) + go func() { resultCh <- s.ExecuteWithContext(ctx, args...) }() + select { + case result := <-resultCh: + s.FailNow("poll returned before fast-forward completed", "error: %v, stdout: %s", result.Err, result.Stdout.String()) + case <-time.After(11 * time.Second): + } + + // Caller timeouts did not stop the original fast-forward. Let it progress. + w := worker.New(s.Client, taskQueue, worker.Options{}) + w.RegisterWorkflowWithOptions(func(ctx workflow.Context) error { + return workflow.Sleep(ctx, 10*time.Hour) + }, workflow.RegisterOptions{Name: "TimeSkippingPollWorkflow"}) + s.NoError(w.Start()) + defer w.Stop() + res = <-resultCh + s.NoError(res.Err) + s.Equal("completed", strings.TrimSpace(res.Stdout.String())) +} + +func (s *SharedServerSuite) TestWorkflow_TimeSkippingPollFailed() { + s.useTimeSkippingServer() + for _, change := range []string{"disabled", "replaced"} { + s.T().Run(change, func(t *testing.T) { + // Without a worker, the original fast-forward remains pending. + run, err := s.Client.ExecuteWorkflow(s.Context, + client.StartWorkflowOptions{TaskQueue: uuid.NewString()}, "TimeSkippingPollWorkflow") + require.NoError(t, err) + defer func() { _ = s.Client.CancelWorkflow(s.Context, run.GetID(), "") }() + res := s.Execute("workflow", "time-skipping", "enable", "--address", s.Address(), + "--workflow-id", run.GetID(), "--fast-forward-duration", "5h", "--fast-forward-id", "OriginalFastForwardId") + require.NoError(t, res.Err) + if change == "disabled" { + res = s.Execute("workflow", "time-skipping", "disable", "--address", s.Address(), + "--workflow-id", run.GetID()) + } else { + res = s.Execute("workflow", "time-skipping", "enable", "--address", s.Address(), + "--workflow-id", run.GetID(), "--fast-forward-duration", "5h", "--fast-forward-id", "ReplacementFastForwardId") + } + require.NoError(t, res.Err) + res = s.Execute("workflow", "time-skipping", "poll", "--address", s.Address(), + "--workflow-id", run.GetID(), "--fast-forward-id", "OriginalFastForwardId", "--command-timeout", "5s") + require.ErrorContains(t, res.Err, "fast-forward failed:") + require.Regexp(t, `^fast-forward failed: \S`, res.Err.Error()) + require.Empty(t, res.Stdout.String()) + }) + } +} diff --git a/internal/temporalcli/commands.workflow_time_skipping.go b/internal/temporalcli/commands.workflow_time_skipping.go index e619e2036..49c666f59 100644 --- a/internal/temporalcli/commands.workflow_time_skipping.go +++ b/internal/temporalcli/commands.workflow_time_skipping.go @@ -1,7 +1,6 @@ package temporalcli import ( - "context" "errors" "fmt" @@ -44,7 +43,7 @@ func updateWorkflowOptionsForTimeSkipping(cctx *CommandContext, parent *Temporal return err } if cctx.JSONOutput { - return nil + return printTimeSkippingUpdateJSON(cctx, config) } cctx.Printer.Printlnf("Workflow time skipping updated: %s", workflowID) if config.Enabled { @@ -52,20 +51,8 @@ func updateWorkflowOptionsForTimeSkipping(cctx *CommandContext, parent *Temporal } else { cctx.Printer.Println("Time skipping: disabled") } - cctx.Printer.Println("Check status:") - cmd := fmt.Sprintf(" temporal workflow describe --namespace %s --workflow-id %s", parent.Namespace, workflowID) - if runID != "" { - cmd += " --run-id " + runID - } - cctx.Printer.Println(cmd) if ff := config.FastForwardConfig; ff != nil { cctx.Printer.Printlnf("Fast-forward ID: %s", ff.ID) - cctx.Printer.Println("Poll fast-forward:") - cmd := fmt.Sprintf(" temporal workflow time-skipping poll --namespace %s --workflow-id %s", parent.Namespace, workflowID) - if runID != "" { - cmd += " --run-id " + runID - } - cctx.Printer.Println(cmd + " --fast-forward-id " + ff.ID) } return nil } @@ -76,9 +63,7 @@ func (c *TemporalWorkflowTimeSkippingPollCommand) run(cctx *CommandContext, args return err } defer cl.Close() - // The SDK reissues the server long poll until our context ends, so a - // server-side poll window expiring is handled for us rather than being an - // outcome the user has to re-run on. + // The SDK retries server poll timeouts until the command context ends. res, err := timeskipping.PollFastForward(cctx, cl, timeskipping.PollFastForwardOptions{ WorkflowID: c.WorkflowId, RunID: c.RunId, @@ -87,13 +72,8 @@ func (c *TemporalWorkflowTimeSkippingPollCommand) run(cctx *CommandContext, args if err != nil { return err } - switch { - case res.Completed: - cctx.Printer.Println("completed") - case errors.Is(cctx.Err(), context.DeadlineExceeded): - cctx.Printer.Println("poll timed out; try again") - default: - cctx.Printer.Printlnf("failed: %s", res.FailedReason) + if !res.Completed { + return fmt.Errorf("fast-forward failed: %s", res.FailedReason) } - return nil + return printTimeSkippingPollCompleted(cctx) } diff --git a/internal/temporalcli/commands.yaml b/internal/temporalcli/commands.yaml index 6ac7cc478..d82da7262 100644 --- a/internal/temporalcli/commands.yaml +++ b/internal/temporalcli/commands.yaml @@ -3743,7 +3743,10 @@ commands: - name: temporal schedule time-skipping summary: Manage Schedule time skipping (Experimental) description: | - Manage Schedule time skipping. + Manage Schedule time skipping, where a schedule's virtual clock fast-forwards when idle. + Use time skipping in testing environments to efficiently evaluate the behavior of a schedule. + + Note: This is an experimental feature and may change in the future. - name: temporal schedule time-skipping enable summary: Enable Schedule time skipping (Experimental) @@ -3756,6 +3759,9 @@ commands: --schedule-id YourScheduleId \ --fast-forward-duration 5h ``` + + Once enabled, the Schedule advances its virtual clock during inactivity, + allowing scheduled Workflows to start without waiting for wall-clock time. option-sets: - schedule-id - max-skip-per-session @@ -3794,7 +3800,7 @@ commands: - name: temporal schedule time-skipping poll summary: Poll a Schedule fast-forward (Experimental) description: | - Poll Schedule status for the result of a specific fast-forward: + Poll Schedule time-skipping status for a specific fast-forward setting: ``` temporal schedule time-skipping poll \ @@ -3803,7 +3809,8 @@ commands: --fast-forward-id YourFastForwardId ``` - Waits up to 10 seconds. If the poll times out, poll again to check its status. + Use the global `--command-timeout` flag to limit how long the poll waits. + A failed fast-forward or poll timeout returns a nonzero exit status. option-sets: - schedule-id options: @@ -5034,7 +5041,11 @@ commands: - name: temporal workflow time-skipping summary: Manage Workflow time skipping (Experimental) description: | - Manage Workflow time skipping. + Manage Workflow time skipping, where a workflow skips time when idle. + Use time skipping in testing environments to efficiently evaluate + the behavior of a workflow with extended periods of inactivity. + + Note: This is an experimental feature and may change in the future. - name: temporal workflow time-skipping enable summary: Enable Workflow time skipping (Experimental) @@ -5044,9 +5055,11 @@ commands: ``` temporal workflow time-skipping enable \ --namespace YourNamespace \ - --workflow-id YourWorkflowId \ - --fast-forward-duration 5h + --workflow-id YourWorkflowId ``` + Once enabled, the workflow execution skips time during inactivity, + expediting the completion of timers, retry waits, and start delays. + option-sets: - workflow-reference - max-skip-per-session @@ -5084,7 +5097,7 @@ commands: - name: temporal workflow time-skipping poll summary: Poll a Workflow fast-forward (Experimental) description: | - Poll for the result of a specific Workflow fast-forward: + Poll Workflow time-skipping status for a specific fast-forward setting: ``` temporal workflow time-skipping poll \ @@ -5093,8 +5106,8 @@ commands: --fast-forward-id YourFastForwardId ``` - Reports `completed`, `poll timed out`, or `failed` with a reason. - A server-side poll timeout means the caller may poll again. + Use the global `--command-timeout` flag to limit how long the poll waits. + A failed fast-forward or poll timeout returns a nonzero exit status. option-sets: - workflow-reference options: diff --git a/internal/temporalcli/timeskipping.go b/internal/temporalcli/timeskipping.go index 12f469ca5..7de39fe21 100644 --- a/internal/temporalcli/timeskipping.go +++ b/internal/temporalcli/timeskipping.go @@ -6,6 +6,7 @@ import ( "time" "github.com/google/uuid" + "github.com/temporalio/cli/internal/printer" commonpb "go.temporal.io/api/common/v1" "go.temporal.io/sdk/client" ) @@ -36,6 +37,32 @@ func timeSkippingConfig(duration time.Duration, hasDuration bool, fastForwardID return config, nil } +type timeSkippingUpdateResult struct { + Enabled bool `json:"enabled"` + FastForwardID string `json:"fastForwardId,omitempty"` +} + +func printTimeSkippingUpdateJSON(cctx *CommandContext, config *client.TimeSkippingConfig) error { + if config == nil { + return errors.New("time-skipping configuration is required") + } + result := timeSkippingUpdateResult{Enabled: config.Enabled} + if ff := config.FastForwardConfig; ff != nil { + result.FastForwardID = ff.ID + } + return cctx.Printer.PrintStructured(result, printer.StructuredOptions{}) +} + +func printTimeSkippingPollCompleted(cctx *CommandContext) error { + if cctx.JSONOutput { + return cctx.Printer.PrintStructured(struct { + Completed bool `json:"completed"` + }{Completed: true}, printer.StructuredOptions{}) + } + cctx.Printer.Println("completed") + return nil +} + type printableTimeSkippingInfo struct { EffectiveEnabled bool DisablePropagation bool diff --git a/internal/temporalcli/timeskipping_test.go b/internal/temporalcli/timeskipping_test.go index d28657cf0..186a5c3f1 100644 --- a/internal/temporalcli/timeskipping_test.go +++ b/internal/temporalcli/timeskipping_test.go @@ -1,12 +1,19 @@ package temporalcli import ( + "bytes" + "encoding/json" + "errors" "fmt" + "strings" "testing" "time" + "github.com/google/uuid" "github.com/stretchr/testify/require" + "github.com/temporalio/cli/internal/printer" commonpb "go.temporal.io/api/common/v1" + "go.temporal.io/sdk/client" "google.golang.org/protobuf/types/known/durationpb" "google.golang.org/protobuf/types/known/timestamppb" ) @@ -181,3 +188,99 @@ func TestTimeSkippingToPrintableNilValues(t *testing.T) { }) } } + +func TestPrintTimeSkippingUpdateJSON(t *testing.T) { + for _, format := range []string{"json", "jsonl"} { + t.Run(format, func(t *testing.T) { + for _, tc := range []struct { + name string + enabled bool + forward bool + id string + }{ + {name: "enabled with generated fast-forward ID", enabled: true, forward: true}, + {name: "enabled with explicit fast-forward ID", enabled: true, forward: true, id: "YourFastForwardId"}, + {name: "enabled without fast-forward", enabled: true}, + {name: "disabled"}, + } { + t.Run(tc.name, func(t *testing.T) { + config := &client.TimeSkippingConfig{Enabled: false} + if tc.enabled { + var err error + config, err = timeSkippingConfig(time.Hour, tc.forward, tc.id, false, 0) + require.NoError(t, err) + } + var output bytes.Buffer + cctx := &CommandContext{JSONOutput: true} + cctx.Printer = &printer.Printer{Output: &output, JSON: true} + if format == "json" { + cctx.Printer.JSONIndent = " " + } + require.NoError(t, printTimeSkippingUpdateJSON(cctx, config)) + var result map[string]any + require.NoError(t, json.Unmarshal(output.Bytes(), &result)) + want := map[string]any{"enabled": tc.enabled} + if tc.forward { + id, ok := result["fastForwardId"].(string) + require.True(t, ok) + require.Equal(t, config.FastForwardConfig.ID, id) + if tc.id == "" { + _, err := uuid.Parse(id) + require.NoError(t, err) + } else { + require.Equal(t, tc.id, id) + } + want["fastForwardId"] = id + } + require.Equal(t, want, result) + if format == "jsonl" { + require.Len(t, strings.Split(strings.TrimSpace(output.String()), "\n"), 1) + } + }) + } + }) + } + t.Run("nil config", func(t *testing.T) { + require.EqualError(t, printTimeSkippingUpdateJSON(nil, nil), "time-skipping configuration is required") + }) + t.Run("output error is returned", func(t *testing.T) { + wantErr := errors.New("write failed") + cctx := &CommandContext{JSONOutput: true, Printer: &printer.Printer{ + JSON: true, Output: timeSkippingResultErrorWriter{err: wantErr}, + }} + require.ErrorIs(t, printTimeSkippingUpdateJSON(cctx, &client.TimeSkippingConfig{}), wantErr) + }) +} + +type timeSkippingResultErrorWriter struct{ err error } + +func (w timeSkippingResultErrorWriter) Write([]byte) (int, error) { return 0, w.err } + +func TestPrintTimeSkippingPollCompleted(t *testing.T) { + for _, format := range []string{"text", "json", "jsonl"} { + t.Run(format, func(t *testing.T) { + var output bytes.Buffer + cctx := &CommandContext{JSONOutput: format != "text"} + cctx.Printer = &printer.Printer{Output: &output, JSON: cctx.JSONOutput} + if format == "json" { + cctx.Printer.JSONIndent = " " + } + require.NoError(t, printTimeSkippingPollCompleted(cctx)) + if format == "text" { + require.Equal(t, "completed\n", output.String()) + } else { + require.JSONEq(t, `{"completed":true}`, output.String()) + if format == "jsonl" { + require.Len(t, strings.Split(strings.TrimSpace(output.String()), "\n"), 1) + } + } + }) + } + t.Run("output error is returned", func(t *testing.T) { + wantErr := errors.New("write failed") + cctx := &CommandContext{JSONOutput: true, Printer: &printer.Printer{ + JSON: true, Output: timeSkippingResultErrorWriter{err: wantErr}, + }} + require.ErrorIs(t, printTimeSkippingPollCompleted(cctx), wantErr) + }) +} diff --git a/tmp/vts-manual-worker.go b/tmp/vts-manual-worker.go new file mode 100644 index 000000000..87a789bb0 --- /dev/null +++ b/tmp/vts-manual-worker.go @@ -0,0 +1,58 @@ +package main + +import ( + "context" + "log" + "time" + + "go.temporal.io/sdk/client" + "go.temporal.io/sdk/worker" + "go.temporal.io/sdk/workflow" +) + +func TimerWorkflow(ctx workflow.Context) error { + return workflow.Sleep(ctx, 10*time.Hour) +} + +func FiveSecondActivity(ctx context.Context) error { + select { + case <-time.After(5 * time.Second): + return nil + case <-ctx.Done(): + return ctx.Err() + } +} + +func ActivityTimerActivityWorkflow(ctx workflow.Context) error { + ctx = workflow.WithActivityOptions(ctx, workflow.ActivityOptions{ + StartToCloseTimeout: time.Minute, + }) + + if err := workflow.ExecuteActivity(ctx, FiveSecondActivity).Get(ctx, nil); err != nil { + return err + } + if err := workflow.Sleep(ctx, 24*time.Hour); err != nil { + return err + } + return workflow.ExecuteActivity(ctx, FiveSecondActivity).Get(ctx, nil) +} + +func main() { + c, err := client.Dial(client.Options{ + HostPort: "127.0.0.1:7233", + Namespace: "timeskipping-test", + }) + if err != nil { + log.Fatal(err) + } + defer c.Close() + + w := worker.New(c, "vts-test-queue", worker.Options{}) + w.RegisterWorkflow(TimerWorkflow) + w.RegisterWorkflow(ActivityTimerActivityWorkflow) + w.RegisterActivity(FiveSecondActivity) + + if err := w.Run(worker.InterruptCh()); err != nil { + log.Fatal(err) + } +} From fe24891a965e741d3e66f9f604816578b081a78c Mon Sep 17 00:00:00 2001 From: Feiyang Xie Date: Thu, 29 Oct 2026 15:24:27 -0700 Subject: [PATCH 09/13] udpate to server to a feature branch --- go.mod | 2 +- go.sum | 16 +++++ .../temporalcli/commands.workflow_test.go | 4 +- tmp/vts-manual-worker.go | 58 ------------------- 4 files changed, 19 insertions(+), 61 deletions(-) delete mode 100644 tmp/vts-manual-worker.go diff --git a/go.mod b/go.mod index c2ae4bd04..9f996eaaf 100644 --- a/go.mod +++ b/go.mod @@ -20,7 +20,7 @@ require ( go.temporal.io/api v1.64.1-0.20261030195137-01272cbd37c9 go.temporal.io/sdk v1.49.1-0.20261028204201-93056ed9a9de go.temporal.io/sdk/contrib/envconfig v1.1.0 - go.temporal.io/server v1.33.0-165.0 + go.temporal.io/server v1.29.0-135.0.0.20261029221550-8a1919f5b298 golang.org/x/exp v0.0.0-20260611194520-c48552f49976 golang.org/x/mod v0.41.0 golang.org/x/term v0.47.0 diff --git a/go.sum b/go.sum index 1fb84f8f9..7e27737f7 100644 --- a/go.sum +++ b/go.sum @@ -529,6 +529,8 @@ go.opentelemetry.io/proto/otlp v1.11.0 h1:5rrYs0Ykyj50sdU/JU0x8etU+LubXWb+gED6Tb go.opentelemetry.io/proto/otlp v1.11.0/go.mod h1:SmVizdCOAm3XBtG1g1NnOdhW6jtddT72hLMhv8VwA8E= go.temporal.io/api v1.63.8-0.20261016215345-3926793dec12 h1:Ellxop5uzsvgK0CZEg/aOvXHBZLl4LbgBeuVzjSLiqc= go.temporal.io/api v1.63.8-0.20261016215345-3926793dec12/go.mod h1:acM0I9WPuYg8W3Pd9jOZvEgi7mRUttUQ4+e7fowKVnM= +go.temporal.io/api v1.64.1-0.20261027235544-fa71e29e58da h1:MwXLtFKsQ3qAghiPjlKfXPLKL1vVxnbksxfdXv9cDnc= +go.temporal.io/api v1.64.1-0.20261027235544-fa71e29e58da/go.mod h1:acM0I9WPuYg8W3Pd9jOZvEgi7mRUttUQ4+e7fowKVnM= go.temporal.io/api v1.64.1-0.20261030195137-01272cbd37c9 h1:ZJb+HC/3UhzBBnvzKhGOVNf6WSDpNPBDn94vhEBfZVo= go.temporal.io/api v1.64.1-0.20261030195137-01272cbd37c9/go.mod h1:acM0I9WPuYg8W3Pd9jOZvEgi7mRUttUQ4+e7fowKVnM= go.temporal.io/auto-scaled-workers v0.0.0-20261013231030-67ffdef6330d h1:cKo/dGcLpFAZXKxIAR2sg9hI+h8/8Z0tNHxXA7LCRVI= @@ -547,6 +549,8 @@ go.temporal.io/sdk/contrib/envconfig v1.1.0 h1:9HGsyrZytjdcZeWJwQlczqYulMhmHS2PR go.temporal.io/sdk/contrib/envconfig v1.1.0/go.mod h1:th96Zl21YH2mHEe3uZ5Dw0KwZFSF4I2oSwTcUxGA19Y= go.temporal.io/server v1.29.0-135.0.0.20261027191414-bf81a4c20009 h1:gFi39tM7NtedBMryDl6loxvKKpi7eESvZfGaWH46Qcc= go.temporal.io/server v1.29.0-135.0.0.20261027191414-bf81a4c20009/go.mod h1:qqkCsy2vnbqJILCAlQQpoXxjywHmnZ3rKWEPyqEqcis= +go.temporal.io/server v1.29.0-135.0.0.20261029221550-8a1919f5b298 h1:6QPCXAf7yfa7SvI09XzS2D9tAG6SbbTFVT24wt+iFD0= +go.temporal.io/server v1.29.0-135.0.0.20261029221550-8a1919f5b298/go.mod h1:5HOYvdlHebW+gFKd8FcgWV1L0Rrnzll8XgaGXxeetHc= go.temporal.io/server v1.33.0-165.0 h1:sZTroQeeST1c/H7k7JIsDznAfKoIt1J1mePc5yKhynA= go.temporal.io/server v1.33.0-165.0/go.mod h1:+eRNFeKRF3IPSXzBCy9PhrSw1zXFrdw1MrxdRhuaa7w= go.temporal.io/server v1.33.0-166.3 h1:y3tLzHag7F6Pv5EieBUJk2+RlTkUhKT1TaC7k5k2HcQ= @@ -586,6 +590,8 @@ golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5y golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= golang.org/x/crypto v0.56.0 h1:GUh5Ii4J5jtcseSMiRqr1jXCNHoxjeV9Fmekc2oLy6Y= golang.org/x/crypto v0.56.0/go.mod h1:OMW5y6CY9l38uPLmxU6l6pwcXp1obtLo3e6gT7gQR2I= +golang.org/x/crypto v0.57.0 h1:3ZVCjf8Ggz7zneR/EHRVx68Ctf+2pmIMP2UFhh9cC6M= +golang.org/x/crypto v0.57.0/go.mod h1:Fdz0i5U6CoizGwLda9DttjSk6qlZo25zYNtR+ycvuZA= golang.org/x/crypto v0.58.0 h1:COkYLr4k7nDI4r6QtMML2AfzeIswWHAJthLS6K/M/54= golang.org/x/crypto v0.58.0/go.mod h1:Xh+kl5A+M0gMiWDytH2Hhr5Z7WbNCpv/eB/EFgfSk+w= golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -622,6 +628,8 @@ golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/net v0.58.0 h1:ynWG7rqYi4ccpTEuPZ2QGWHktVEM9DMCj9yzDE0Q7To= golang.org/x/net v0.58.0/go.mod h1:YwCddHnFlT7eLQqVprV19OnhLGtc5xOKgE0RyqgfWAU= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.60.0 h1:79p50tfZlm0J9YfoDsSi639qSXNGVwEzOPLCxM2FsYU= +golang.org/x/net v0.60.0/go.mod h1:2DA/G1UfVbCpQPeWTmMPGY7Cs2PkBkwu743bVX5PIVg= golang.org/x/net v0.62.0 h1:18ELalfM5+XNRwzM2nYqXsZQ9ByS1uhj2O/U7+5jqRY= golang.org/x/net v0.62.0/go.mod h1:WgDCOTH8iwtB66T4/GfI94AHo/hhdb7Hah9NDseQfiI= golang.org/x/oauth2 v0.36.0 h1:peZ/1z27fi9hUOFCAZaHyrpWG5lwe0RJEEEeH0ThlIs= @@ -634,6 +642,8 @@ golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek= golang.org/x/sync v0.22.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0= +golang.org/x/sync v0.23.0 h1:KameEIfc1IkluZyXWLn39Wd4tURc6GbCiISGiZm2bQk= +golang.org/x/sync v0.23.0/go.mod h1:sUUOizhqBxiL6pEWpqNLUiaJn1ShEbZ6BBqskPbjZm0= golang.org/x/sync v0.24.0 h1:iqiDrGoDgyuvAKrhLQthUEzU/R378N78gXbBjxed7oA= golang.org/x/sync v0.24.0/go.mod h1:sUUOizhqBxiL6pEWpqNLUiaJn1ShEbZ6BBqskPbjZm0= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -652,6 +662,8 @@ golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs= golang.org/x/sys v0.47.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= +golang.org/x/sys v0.48.0 h1:bbX/i/6MgT9BVLM9RT1thmxL04yeTAhbEz4SyadbXoo= +golang.org/x/sys v0.48.0/go.mod h1:hNLxWAXmnKAxqDtdwIYC4bM9oQPEecfsnNMuSxOs3og= golang.org/x/sys v0.49.0 h1:XbzkgYJHdqh/8m2Uu0W/dQv8nktxx4BFHp1M0gROTXA= golang.org/x/sys v0.49.0/go.mod h1:hNLxWAXmnKAxqDtdwIYC4bM9oQPEecfsnNMuSxOs3og= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -661,6 +673,8 @@ golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuX golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U= golang.org/x/term v0.45.0 h1:NwWyBmoJCbfTHpxrWoZ9C6/VxOf7ic219I8xZZFdrf0= golang.org/x/term v0.45.0/go.mod h1:9aqxs0blBcrm/n0L9QW0aRVD+ktan8ssZromtqJC43w= +golang.org/x/term v0.46.0 h1:3+OXuTbaKDgwk8jTi3aSLHRlmWqHEUDUtxnbFigO4YE= +golang.org/x/term v0.46.0/go.mod h1:+K02xbkittuwc0Am4abfA3Fc+XRGXkvBXNO88NCXPoc= golang.org/x/term v0.47.0 h1:cpyOwQkr2Nzxe2p6KnrTG7Ei2wtzjsuSjhpXXepZ/BM= golang.org/x/term v0.47.0/go.mod h1:efAfAuG6RKABvg1ArGebRkvX6LXul14SM67o2e4mUCY= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= @@ -672,6 +686,8 @@ golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.41.0 h1:vz/seA0lnX87Othu2f/0L24RcgrXD9/YFTSuGjj3rH8= golang.org/x/text v0.41.0/go.mod h1:jvf1O8ajNzZqhSrQBPbutR/EB83Cc0CFrezNQIwbb5M= +golang.org/x/text v0.42.0 h1:JbOZXgfeCPU9gacVtYliJqOhD+zhrEqK4LfdpmlUZqI= +golang.org/x/text v0.42.0/go.mod h1:ojzP1Z+2QtioaF8DTtO8K5q7JWVVYwZKenzujK0Zd0E= golang.org/x/text v0.43.0 h1:1QivrlhwAsnMOcqgOdl9my7s9OyZl8O5/UGUTJVXoWc= golang.org/x/text v0.43.0/go.mod h1:hbSIYA/amXcRXTFSZqh8tWHEoqRvvbKPJ2uz/KU+a+s= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= diff --git a/internal/temporalcli/commands.workflow_test.go b/internal/temporalcli/commands.workflow_test.go index 2e837036a..59bdae7c5 100644 --- a/internal/temporalcli/commands.workflow_test.go +++ b/internal/temporalcli/commands.workflow_test.go @@ -1715,8 +1715,8 @@ func (s *SharedServerSuite) TestWorkflow_TimeSkippingMinimalLifecycle() { fastForwardID := match[1] _, err = uuid.Parse(fastForwardID) s.NoError(err) - s.Contains(res.Stdout.String(), "--fast-forward-id "+fastForwardID) - s.NotContains(res.Stdout.String(), "--run-id") + s.NotContains(res.Stdout.String(), "Poll fast-forward:") + s.NotContains(res.Stdout.String(), "temporal workflow ") res = s.Execute("workflow", "time-skipping", "poll", "--address", s.Address(), "--workflow-id", run.GetID(), "--fast-forward-id", fastForwardID) diff --git a/tmp/vts-manual-worker.go b/tmp/vts-manual-worker.go deleted file mode 100644 index 87a789bb0..000000000 --- a/tmp/vts-manual-worker.go +++ /dev/null @@ -1,58 +0,0 @@ -package main - -import ( - "context" - "log" - "time" - - "go.temporal.io/sdk/client" - "go.temporal.io/sdk/worker" - "go.temporal.io/sdk/workflow" -) - -func TimerWorkflow(ctx workflow.Context) error { - return workflow.Sleep(ctx, 10*time.Hour) -} - -func FiveSecondActivity(ctx context.Context) error { - select { - case <-time.After(5 * time.Second): - return nil - case <-ctx.Done(): - return ctx.Err() - } -} - -func ActivityTimerActivityWorkflow(ctx workflow.Context) error { - ctx = workflow.WithActivityOptions(ctx, workflow.ActivityOptions{ - StartToCloseTimeout: time.Minute, - }) - - if err := workflow.ExecuteActivity(ctx, FiveSecondActivity).Get(ctx, nil); err != nil { - return err - } - if err := workflow.Sleep(ctx, 24*time.Hour); err != nil { - return err - } - return workflow.ExecuteActivity(ctx, FiveSecondActivity).Get(ctx, nil) -} - -func main() { - c, err := client.Dial(client.Options{ - HostPort: "127.0.0.1:7233", - Namespace: "timeskipping-test", - }) - if err != nil { - log.Fatal(err) - } - defer c.Close() - - w := worker.New(c, "vts-test-queue", worker.Options{}) - w.RegisterWorkflow(TimerWorkflow) - w.RegisterWorkflow(ActivityTimerActivityWorkflow) - w.RegisterActivity(FiveSecondActivity) - - if err := w.Run(worker.InterruptCh()); err != nil { - log.Fatal(err) - } -} From ab894f94715c783dbf7887eb503cf28efc87539d Mon Sep 17 00:00:00 2001 From: Feiyang Xie Date: Fri, 30 Oct 2026 15:52:08 -0700 Subject: [PATCH 10/13] fix tests --- go.sum | 2 + .../temporalcli/commands.schedule_test.go | 55 +++++++++++-------- .../commands.time_skipping_test.go | 7 ++- .../temporalcli/commands.workflow_test.go | 33 +++++------ 4 files changed, 56 insertions(+), 41 deletions(-) diff --git a/go.sum b/go.sum index 7e27737f7..900e46ddf 100644 --- a/go.sum +++ b/go.sum @@ -555,6 +555,8 @@ go.temporal.io/server v1.33.0-165.0 h1:sZTroQeeST1c/H7k7JIsDznAfKoIt1J1mePc5yKhy go.temporal.io/server v1.33.0-165.0/go.mod h1:+eRNFeKRF3IPSXzBCy9PhrSw1zXFrdw1MrxdRhuaa7w= go.temporal.io/server v1.33.0-166.3 h1:y3tLzHag7F6Pv5EieBUJk2+RlTkUhKT1TaC7k5k2HcQ= go.temporal.io/server v1.33.0-166.3/go.mod h1:SP/bukdhfHYhAlaz7oghgdNZvJtEaBmPjzvSbvkS2jk= +go.temporal.io/testx v0.0.0-20261028001837-eec3975de26f h1:D61aaxDgdkRK9CvGxxgDH26oqABa/TIgsbEjb89NMoY= +go.temporal.io/testx v0.0.0-20261028001837-eec3975de26f/go.mod h1:T3nNOPpInc8t5TL9vz9li9untPQANYexE36UQeXObqQ= go.temporal.io/testx v0.0.0-20261029001555-ddcb0739798d h1:SK9slpVz38T0H1ldMpsh/GFWrVTZw7gWC3i2An0rviI= go.temporal.io/testx v0.0.0-20261029001555-ddcb0739798d/go.mod h1:nL3IFIKnioDnUxNaqKLyzR2tZUK6THrXsaQuVjNYVX8= go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= diff --git a/internal/temporalcli/commands.schedule_test.go b/internal/temporalcli/commands.schedule_test.go index cfdfd6134..17eaa42a6 100644 --- a/internal/temporalcli/commands.schedule_test.go +++ b/internal/temporalcli/commands.schedule_test.go @@ -19,9 +19,11 @@ import ( "github.com/temporalio/cli/internal/temporalcli" "go.temporal.io/api/enums/v1" "go.temporal.io/api/operatorservice/v1" + "go.temporal.io/api/serviceerror" "go.temporal.io/api/workflowservice/v1" "go.temporal.io/sdk/client" "go.temporal.io/sdk/workflow" + "google.golang.org/grpc/codes" "google.golang.org/protobuf/encoding/protojson" ) @@ -138,7 +140,7 @@ func (s *SharedServerSuite) TestSchedule_TimeSkippingEnableGeneratesFastForwardI require.NoError(s.T(), res.Err) s.Contains(res.Stdout.String(), `"Id":"`+fastForwardID+`"`) - // The generated ID is usable in the suggested poll command. + // The generated ID is usable in a poll command. res = s.Execute( "schedule", "time-skipping", "poll", "--address", s.Address(), @@ -146,14 +148,14 @@ func (s *SharedServerSuite) TestSchedule_TimeSkippingEnableGeneratesFastForwardI "--fast-forward-id", fastForwardID, "--command-timeout", "200ms", ) - s.ErrorIs(res.Err, context.DeadlineExceeded) + s.Error(res.Err) s.Empty(res.Stdout.String()) } func (s *SharedServerSuite) TestSchedule_TimeSkippingPollTimeout() { s.useTimeSkippingServer() schedID, _, res := s.createSchedule("--interval", "10d", "--paused") - s.NoError(res.Err) + require.NoError(s.T(), res.Err) res = s.Execute( "schedule", "time-skipping", "enable", "--address", s.Address(), @@ -161,29 +163,34 @@ func (s *SharedServerSuite) TestSchedule_TimeSkippingPollTimeout() { "--fast-forward-duration", "5h", "--fast-forward-id", "YourFastForwardId", ) - s.NoError(res.Err) + require.NoError(s.T(), res.Err) - // Each timeout leaves the same fast-forward available to poll again. - for _, tc := range []struct { - name, timeout string - minimum, maximum time.Duration - }{ - {name: "short command timeout", timeout: "200ms", minimum: 100 * time.Millisecond, maximum: 5 * time.Second}, - {name: "command timeout extends beyond former cap", timeout: "12s", minimum: 11 * time.Second, maximum: 17 * time.Second}, - } { - s.T().Run(tc.name, func(t *testing.T) { - ctx, cancel := context.WithTimeout(s.Context, 20*time.Second) - defer cancel() - started := time.Now() - res := s.ExecuteWithContext(ctx, "schedule", "time-skipping", "poll", "--address", s.Address(), - "--schedule-id", schedID, "--fast-forward-id", "YourFastForwardId", "--command-timeout", tc.timeout) - require.ErrorIs(t, res.Err, context.DeadlineExceeded) - require.Empty(t, res.Stdout.String()) - require.GreaterOrEqual(t, time.Since(started), tc.minimum) - require.Less(t, time.Since(started), tc.maximum) - }) + checkPending := func() { + res := s.Execute("schedule", "describe", "--address", s.Address(), + "--schedule-id", schedID, "--output", "json") + require.NoError(s.T(), res.Err) + var description workflowservice.DescribeScheduleResponse + require.NoError(s.T(), protojson.Unmarshal(res.Stdout.Bytes(), &description)) + info := description.GetInfo().GetTimeSkippingInfo() + require.NotNil(s.T(), info.GetFastForwardInfo()) + s.Equal("YourFastForwardId", info.GetFastForwardInfo().GetFastForwardId()) + s.True(info.GetEffectiveConfig().GetEnabled()) + s.False(info.GetFastForwardInfo().GetHasCompleted()) } - + checkPending() + + ctx, cancel := context.WithTimeout(s.Context, 10*time.Second) + defer cancel() + started := time.Now() + res = s.ExecuteWithContext(ctx, "schedule", "time-skipping", "poll", "--address", s.Address(), + "--schedule-id", schedID, "--fast-forward-id", "YourFastForwardId", "--command-timeout", "200ms") + // Accept both context and service deadline errors without relying on their wrapping. + s.Equal(codes.DeadlineExceeded, serviceerror.ToStatus(res.Err).Code()) + s.Empty(res.Stdout.String()) + s.GreaterOrEqual(time.Since(started), 100*time.Millisecond) + s.Less(time.Since(started), 5*time.Second) + s.NoError(ctx.Err(), "the outer test deadline must not cause the poll timeout") + checkPending() } func (s *SharedServerSuite) TestSchedule_TimeSkippingMinimalLifecycle() { diff --git a/internal/temporalcli/commands.time_skipping_test.go b/internal/temporalcli/commands.time_skipping_test.go index 9697b4c22..b00a64b4d 100644 --- a/internal/temporalcli/commands.time_skipping_test.go +++ b/internal/temporalcli/commands.time_skipping_test.go @@ -159,6 +159,7 @@ func (s *SharedServerSuite) TestTimeSkipping_PollExitStatus() { cmd.Env = append(os.Environ(), "TEMPORAL_CLI_TIME_SKIPPING_TEST_PROCESS=1") var stdout, stderr bytes.Buffer cmd.Stdout, cmd.Stderr = &stdout, &stderr + started := time.Now() err := cmd.Run() if outcome == "completed" { require.NoError(t, err, "stderr: %s", stderr.String()) @@ -180,7 +181,11 @@ func (s *SharedServerSuite) TestTimeSkipping_PollExitStatus() { if outcome == "failed" { require.Regexp(t, `Error: fast-forward failed: \S`, stderr.String()) } else { - require.Equal(t, "Error: program interrupted", strings.TrimSpace(stderr.String())) + // RPC cancellation may arrive before the global deadline handler. + require.Regexp(t, `^Error: \S`, stderr.String()) + require.NotContains(t, stderr.String(), "fast-forward failed:") + require.GreaterOrEqual(t, time.Since(started), 100*time.Millisecond) + require.Less(t, time.Since(started), 5*time.Second) } } }) diff --git a/internal/temporalcli/commands.workflow_test.go b/internal/temporalcli/commands.workflow_test.go index 59bdae7c5..23734a059 100644 --- a/internal/temporalcli/commands.workflow_test.go +++ b/internal/temporalcli/commands.workflow_test.go @@ -1841,13 +1841,23 @@ func (s *SharedServerSuite) TestWorkflow_TimeSkippingPollTimeoutAndRetry() { args := []string{"workflow", "time-skipping", "poll", "--address", s.Address(), "--workflow-id", run.GetID(), "--fast-forward-id", "YourFastForwardId"} - for _, timeout := range []string{"200ms", "500ms"} { - s.T().Run("command timeout "+timeout, func(t *testing.T) { + for _, tc := range []struct { + timeout string + minimum time.Duration + }{ + {timeout: "200ms", minimum: 100 * time.Millisecond}, + {timeout: "500ms", minimum: 400 * time.Millisecond}, + } { + s.T().Run("command timeout "+tc.timeout, func(t *testing.T) { ctx, cancel := context.WithTimeout(s.Context, 10*time.Second) defer cancel() - res := s.ExecuteWithContext(ctx, append(args, "--command-timeout", timeout)...) - require.ErrorIs(t, res.Err, context.DeadlineExceeded) + started := time.Now() + res := s.ExecuteWithContext(ctx, append(args, "--command-timeout", tc.timeout)...) + // Expiration can surface as either a context or an RPC error. + require.Error(t, res.Err) require.Empty(t, res.Stdout.String()) + require.GreaterOrEqual(t, time.Since(started), tc.minimum) + require.Less(t, time.Since(started), 5*time.Second) }) } @@ -1857,17 +1867,6 @@ func (s *SharedServerSuite) TestWorkflow_TimeSkippingPollTimeoutAndRetry() { s.ErrorContains(res.Err, "canceled") s.Empty(res.Stdout.String()) - // With no command timeout, polling must outlive the former 10-second cap. - ctx, cancel := context.WithTimeout(s.Context, 25*time.Second) - defer cancel() - resultCh := make(chan *CommandResult, 1) - go func() { resultCh <- s.ExecuteWithContext(ctx, args...) }() - select { - case result := <-resultCh: - s.FailNow("poll returned before fast-forward completed", "error: %v, stdout: %s", result.Err, result.Stdout.String()) - case <-time.After(11 * time.Second): - } - // Caller timeouts did not stop the original fast-forward. Let it progress. w := worker.New(s.Client, taskQueue, worker.Options{}) w.RegisterWorkflowWithOptions(func(ctx workflow.Context) error { @@ -1875,7 +1874,9 @@ func (s *SharedServerSuite) TestWorkflow_TimeSkippingPollTimeoutAndRetry() { }, workflow.RegisterOptions{Name: "TimeSkippingPollWorkflow"}) s.NoError(w.Start()) defer w.Stop() - res = <-resultCh + ctx, cancel := context.WithTimeout(s.Context, 10*time.Second) + defer cancel() + res = s.ExecuteWithContext(ctx, args...) s.NoError(res.Err) s.Equal("completed", strings.TrimSpace(res.Stdout.String())) } From d11336f8aef3d8c87ed905aa71b5e2c94ce93fc4 Mon Sep 17 00:00:00 2001 From: Feiyang Xie Date: Sun, 1 Nov 2026 17:04:57 -0800 Subject: [PATCH 11/13] change to server main commit --- go.mod | 2 +- go.sum | 144 ++++++++++----------------------------------------------- 2 files changed, 26 insertions(+), 120 deletions(-) diff --git a/go.mod b/go.mod index 9f996eaaf..bc9b6a233 100644 --- a/go.mod +++ b/go.mod @@ -20,7 +20,7 @@ require ( go.temporal.io/api v1.64.1-0.20261030195137-01272cbd37c9 go.temporal.io/sdk v1.49.1-0.20261028204201-93056ed9a9de go.temporal.io/sdk/contrib/envconfig v1.1.0 - go.temporal.io/server v1.29.0-135.0.0.20261029221550-8a1919f5b298 + go.temporal.io/server v1.29.0-135.0.0.20261030183317-69c692e8773e golang.org/x/exp v0.0.0-20260611194520-c48552f49976 golang.org/x/mod v0.41.0 golang.org/x/term v0.47.0 diff --git a/go.sum b/go.sum index 900e46ddf..0cf4ab086 100644 --- a/go.sum +++ b/go.sum @@ -29,8 +29,6 @@ filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4 filippo.io/edwards25519 v1.2.0 h1:crnVqOiS4jqYleHd9vaKZ+HKtHfllngJIiOpNpoJsjo= filippo.io/edwards25519 v1.2.0/go.mod h1:xzAOLCNug/yB62zG1bQ8uziwrIqIuxhctzJT18Q77mc= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/BurntSushi/toml v1.4.0 h1:kuoIxZQy2WRRk1pttg9asf+WVv6tWQuBNVmK8+nqPr0= -github.com/BurntSushi/toml v1.4.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= github.com/BurntSushi/toml v1.6.0 h1:dRaEfpa2VI55EwlIW72hMRHdWouJeRF7TPYhI+AUQjk= github.com/BurntSushi/toml v1.6.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= @@ -162,8 +160,6 @@ github.com/facebookgo/clock v0.0.0-20150410010913-600d898af40a h1:yDWHCSQ40h88yi github.com/facebookgo/clock v0.0.0-20150410010913-600d898af40a/go.mod h1:7Ga40egUymuWXxAe151lTNnCv97MddSOVsjpPPkityA= github.com/fatih/color v1.19.0 h1:Zp3PiM21/9Ld6FzSKyL5c/BULoe/ONr9KlbYVOfG8+w= github.com/fatih/color v1.19.0/go.mod h1:zNk67I0ZUT1bEGsSGyCZYZNrHuTkJJB+r6Q9VuMi0LE= -github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= -github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/felixge/httpsnoop v1.1.0 h1:3YtUj32ZZkqZtt3sZZsClsymw/QDuVfpNhoA31zeORc= github.com/felixge/httpsnoop v1.1.0/go.mod h1:Zqxgdd+1Rkcz8euOqdr7lqgCRJztwr5hp9vDSi5UZCE= github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k= @@ -176,8 +172,6 @@ github.com/fxamacker/cbor/v2 v2.9.1/go.mod h1:vM4b+DJCtHn+zz7h3FFp/hDAI9WNWCsZj2 github.com/go-faker/faker/v4 v4.7.0 h1:VboC02cXHl/NuQh5lM2W8b87yp4iFXIu59x4w0RZi4E= github.com/go-faker/faker/v4 v4.7.0/go.mod h1:u1dIRP5neLB6kTzgyVjdBOV5R1uP7BdxkcWk7tiKQXk= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= -github.com/go-jose/go-jose/v4 v4.1.4 h1:moDMcTHmvE6Groj34emNPLs/qtYXRVcd6S7NHbHz3kA= -github.com/go-jose/go-jose/v4 v4.1.4/go.mod h1:x4oUasVrzR7071A4TnHLGSPpNOm2a21K9Kf04k1rs08= github.com/go-jose/go-jose/v4 v4.1.6 h1:sNRkftxFJxwsILiQukqp5z83QBSmntVwmgRY7AqBDO4= github.com/go-jose/go-jose/v4 v4.1.6/go.mod h1:x4oUasVrzR7071A4TnHLGSPpNOm2a21K9Kf04k1rs08= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= @@ -187,56 +181,30 @@ github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-openapi/jsonpointer v1.0.0 h1:kR9tHqY0CtZaOPVFm622dPVNhrvYpwr4uCxgL3h1H8s= github.com/go-openapi/jsonpointer v1.0.0/go.mod h1:Z3rw7dWu1p9IgitXCFamSlA5lmDiklEB6vkaxcNZW5Y= -github.com/go-openapi/jsonreference v0.21.5 h1:6uCGVXU/aNF13AQNggxfysJ+5ZcU4nEAe+pJyVWRdiE= -github.com/go-openapi/jsonreference v0.21.5/go.mod h1:u25Bw85sX4E2jzFodh1FOKMTZLcfifd1Q+iKKOUxExw= github.com/go-openapi/jsonreference v1.0.0 h1:jlmTr6torcd1YgDQvSfNmRtKzYDO4FGBkrAdlAVWnpY= github.com/go-openapi/jsonreference v1.0.0/go.mod h1:jtwdyGbJk0Xhe5Y+rwtglQP6Sb1WZST4rT32LWB+sv0= -github.com/go-openapi/swag v0.27.1 h1:VotvOLWW8q/EAxB0YdsBBGC8XYyeL1YwBj2ungAGPNg= -github.com/go-openapi/swag v0.27.1/go.mod h1:GTkJPwHfhJp6MWr4/rCh64HVI3Ofu+tcsbfjfHmTxpE= github.com/go-openapi/swag v0.28.0 h1:xkgbOSKj6DZziNpyqRRAOt3GJGtgjgsd2RoyT30VWuw= github.com/go-openapi/swag v0.28.0/go.mod h1:4qYnT3Cqr1p1VknOdPo70evN4rgQnAg6jwApHyxSGIg= -github.com/go-openapi/swag/cmdutils v0.27.1 h1:I7sYqaWVl5mq0NEmNQkAmFDyNin9ufvMX/p2zwtQaOE= -github.com/go-openapi/swag/cmdutils v0.27.1/go.mod h1:Sm1MVFMkF6guJJ+pQqHnQA3N0j9qALV3NxzDSv6bETM= github.com/go-openapi/swag/cmdutils v0.28.0 h1:7TOeNtkYru1SG8Y34tDh9WBbLsMqGnptuxWiHREPZ4Q= github.com/go-openapi/swag/cmdutils v0.28.0/go.mod h1:Sm1MVFMkF6guJJ+pQqHnQA3N0j9qALV3NxzDSv6bETM= -github.com/go-openapi/swag/conv v0.27.1 h1:8wi9ZG+olmY1wXphl93EWniPtbSPkXM/feH7FgjsvrU= -github.com/go-openapi/swag/conv v0.27.1/go.mod h1:QbqMivkpKhC3g1B1GGGOJ6ANewI3S62dbzYu3Duowqs= github.com/go-openapi/swag/conv v0.28.0 h1:GtqqbyFe7vR5Y7ehxG9W6/OvrSFdf1OLeTGp40TqxH8= github.com/go-openapi/swag/conv v0.28.0/go.mod h1:mbUE+mzctnhxi864m0Q07SpN8OowD9JhxmxuYvZZD/k= -github.com/go-openapi/swag/fileutils v0.27.1 h1:QQqBSoi5mW4XpU85nS0mLcA+zAE6vLzrb0QkmLKf9oM= -github.com/go-openapi/swag/fileutils v0.27.1/go.mod h1:VvJFZLTZS0AI854gEQz5tk7dBESdLjiNUMSZ/th2ry8= github.com/go-openapi/swag/fileutils v0.28.0 h1:Z04XWQD7R8Eq+7GnOrjovBxPPmZzsS4gt2H2GPGIViU= github.com/go-openapi/swag/fileutils v0.28.0/go.mod h1:VvJFZLTZS0AI854gEQz5tk7dBESdLjiNUMSZ/th2ry8= -github.com/go-openapi/swag/jsonutils v0.27.1 h1:SVgK3i4USzCU5mibOOS/l4ea2h9UQXy7J7RNLTjuXjU= -github.com/go-openapi/swag/jsonutils v0.27.1/go.mod h1:tdlEpZqdcQ17uj6J4YdK9vd8It5qWMwjWXOs0tjpRlk= github.com/go-openapi/swag/jsonutils v0.28.0 h1:YIch6FwO7RXzeAnbO8Tu7dWBZeUEH+4nA0HXltVTnv4= github.com/go-openapi/swag/jsonutils v0.28.0/go.mod h1:CYM3WlTUcagR2ZoHdz54di/cbBqt82tuxuXgAjxw+mg= -github.com/go-openapi/swag/loading v0.27.1 h1:/DxUgDXKbBX4bcn7r9uEXfJyzN5XpiJmZplzQTjrRCY= -github.com/go-openapi/swag/loading v0.27.1/go.mod h1:jvGh3iA2+zyUUycB5fgJWzeHnhrpvGnJJM0RVE9ZShE= github.com/go-openapi/swag/loading v0.28.0 h1:td8QZdZC9MIYGGSnSPKShKiK22I2tU5UQvuUhIBPRLU= github.com/go-openapi/swag/loading v0.28.0/go.mod h1:rXB0QiQX5mMveXEA7ouM4KiiM9jVJe4K6BVbwhD1M4k= -github.com/go-openapi/swag/mangling v0.27.1 h1:yC9D0HyUE8gbP+BfmGx9+AA89ikwZTMjESK3OnnoaqA= -github.com/go-openapi/swag/mangling v0.27.1/go.mod h1:jtBE2+V+3pILxOR7Vgce+Cwp6A2PgZbvVqfNntbVs0w= github.com/go-openapi/swag/mangling v0.28.0 h1:pH8eyeNO9SLYsTMWJrurnNfKmDa28XrlA+HePVD53VM= github.com/go-openapi/swag/mangling v0.28.0/go.mod h1:jtBE2+V+3pILxOR7Vgce+Cwp6A2PgZbvVqfNntbVs0w= -github.com/go-openapi/swag/netutils v0.27.1 h1:mICMFoS82F5TZ4Zy3cqmcQk+BFeCp3Uyq3Np7GI0/qU= -github.com/go-openapi/swag/netutils v0.27.1/go.mod h1:J+WYyFMLtvtCGqa6jLv+YNUmIKI3ZRQRrvfNDMoQoEQ= github.com/go-openapi/swag/netutils v0.28.0 h1:YXN6TALEi2pzts8/8GNm6T61HTAZsieukGZidap989k= github.com/go-openapi/swag/netutils v0.28.0/go.mod h1:J+WYyFMLtvtCGqa6jLv+YNUmIKI3ZRQRrvfNDMoQoEQ= -github.com/go-openapi/swag/pools v0.27.1 h1:9LeadcMyb2GJCbXX5hVQDbZ2Lq9TL4dCs/nx1j5DO0E= -github.com/go-openapi/swag/pools v0.27.1/go.mod h1:kVQefhSK5RWuRe7BXsL8htgBPAMpN7HDGpGEknqugeE= github.com/go-openapi/swag/pools v0.28.0 h1:HPMZWSAfce3rdVTFcjFiCIBtDg9h4x2QlRrHipwhxeU= github.com/go-openapi/swag/pools v0.28.0/go.mod h1:kVQefhSK5RWuRe7BXsL8htgBPAMpN7HDGpGEknqugeE= -github.com/go-openapi/swag/stringutils v0.27.1 h1:ZXePZ0r2p1qSjo8tD3Un4vFj8+FqlCkczxDrJIhYUp8= -github.com/go-openapi/swag/stringutils v0.27.1/go.mod h1:lzRN95CxXmA03XcDWHLOb6nOMcxCqR5rGY0lOgsfRoM= github.com/go-openapi/swag/stringutils v0.28.0 h1:ixsc9iYgDPubHL/8nSkbnryEHpD2VRlBMLKpQyPXcDU= github.com/go-openapi/swag/stringutils v0.28.0/go.mod h1:lzRN95CxXmA03XcDWHLOb6nOMcxCqR5rGY0lOgsfRoM= -github.com/go-openapi/swag/typeutils v0.27.1 h1:KSTdFlfnse4r6dP9IrEnwMldjE+zs71UeEB3//PtVXc= -github.com/go-openapi/swag/typeutils v0.27.1/go.mod h1:Srm0xFNRZ1Y+vCxJclo5qzx8aj+1pAKda/YfFPrG0dQ= github.com/go-openapi/swag/typeutils v0.28.0 h1:nRBKSBXjDgf01VDPB3fWeD9nQuhCOVeIYAkUx2tbkyY= github.com/go-openapi/swag/typeutils v0.28.0/go.mod h1:Srm0xFNRZ1Y+vCxJclo5qzx8aj+1pAKda/YfFPrG0dQ= -github.com/go-openapi/swag/yamlutils v0.27.1 h1:ftxv6xvXb1E3zohUc+okZ9nSqNb9StQX/FXnKZ98sQA= -github.com/go-openapi/swag/yamlutils v0.27.1/go.mod h1:bnxFIB1qewGRiZHypXGZ3fNgf13/0HfRgnS/iZBDrOo= github.com/go-openapi/swag/yamlutils v0.28.0 h1:TV3JXH6DS46KUroDtMLAYHGkdWf5VDq3wVWFirmzROY= github.com/go-openapi/swag/yamlutils v0.28.0/go.mod h1:x0q/yndZHEgk9Rx3DyDqzFUmHy55KTvIZldvF2dTJXs= github.com/go-sql-driver/mysql v1.8.1/go.mod h1:wEBSXgmK//2ZFJyE+qWnIsVGmvmEKlqwuVSjsCm7DZg= @@ -257,8 +225,6 @@ github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6 github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v1.0.0 h1:Oy607GVXHs7RtbggtPBnr2RmDArIsAefDwvrdWvRhGs= github.com/golang/snappy v1.0.0/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/gomarkdown/markdown v0.0.0-20260411013819-759bbc3e3207 h1:p7t34F7K4OCRQblcDhNJnP46Uaarz3z2cLcvOZYxWn8= -github.com/gomarkdown/markdown v0.0.0-20260411013819-759bbc3e3207/go.mod h1:JDGcbDT52eL4fju3sZ4TeHGsQwhG9nbDV21aMyhwPoA= github.com/gomarkdown/markdown v0.0.0-20260724235538-61af6e1e6971 h1:Qoqh9ZuBuqoeWZSyTfv+n1lezKuAyMFMQzOewVvFFTo= github.com/gomarkdown/markdown v0.0.0-20260724235538-61af6e1e6971/go.mod h1:JDGcbDT52eL4fju3sZ4TeHGsQwhG9nbDV21aMyhwPoA= github.com/google/gnostic-models v0.7.1 h1:SisTfuFKJSKM5CPZkffwi6coztzzeYUhc3v4yxLWH8c= @@ -288,8 +254,6 @@ github.com/gorilla/securecookie v1.1.2 h1:YCIWL56dvtr73r6715mJs5ZvhtnY73hBvEF8kX github.com/gorilla/securecookie v1.1.2/go.mod h1:NfCASbcHqRSY+3a8tlWJwsQap2VX5pwzwo4h3eOamfo= github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.3 h1:B+8ClL/kCQkRiU82d9xajRPKYMrB7E0MbtzWVi1K4ns= github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.3/go.mod h1:NbCUVmiS4foBGBHOYlCT25+YmGpJ32dZPi75pGEUpj4= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.29.0 h1:5VipnvEpbqr2gA2VbM+nYVbkIF28c5ZQfqCBQ5g2xfk= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.29.0/go.mod h1:Hyl3n6Twe1hvtd9XUXDec4pTvgMSEixRuQKPTMH2bNs= github.com/grpc-ecosystem/grpc-gateway/v2 v2.30.0 h1:/Tnpcb2E0Pz/tN9s3bfEY2Q8ePCEX9iuS+cneUwncnw= github.com/grpc-ecosystem/grpc-gateway/v2 v2.30.0/go.mod h1:zOBXOsUaBSjKgmH4OGzV1esUpR3oUSCPYVd2cUBjKYY= github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed h1:5upAirOpQc1Q53c0bnx2ufif5kANL7bfZWcc6VJWJd8= @@ -323,8 +287,6 @@ github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHm github.com/jung-kurt/gofpdf v1.0.3-0.20190309125859-24315acbbda5/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/klauspost/compress v1.18.7 h1:aUyZsS4kH3QTKurYhAOwAHxllVPnOthb3vPfnF1Ehjw= -github.com/klauspost/compress v1.18.7/go.mod h1:cwPg85FWrGar70rWktvGQj8/hthj3wpl0PGDogxkrSQ= github.com/klauspost/compress v1.20.4 h1:dD0v/bvxtjCBqQu6sx1TNWkalEY5lNTIe+HY9w8TeNI= github.com/klauspost/compress v1.20.4/go.mod h1:LUdAzn7YLVvxLpc7y3V1m40wESHTgc1422pwwBSKYuI= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= @@ -338,8 +300,6 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/labstack/echo/v4 v4.15.4 h1:DL45vVYa+BWE+XuW+zZNd9H0YEdZ80UAWJGcTVW4EVs= -github.com/labstack/echo/v4 v4.15.4/go.mod h1:CuMetKIRwsuO/qlAgMq+KTAalwGoB/h4tC+yPdrTj1g= github.com/labstack/echo/v4 v4.16.4 h1:sQ9yq/FgkY7zWZKaRIvNJAQ1ybWVJrm+z37SWI8keRY= github.com/labstack/echo/v4 v4.16.4/go.mod h1:V/EQaTVHYJH92QhbQe7kFQ4mjgcjxLQQUQtAN87zZdw= github.com/labstack/gommon v0.5.0 h1:6VSQ2NOzsnEJ5W6+84E0RbcaDDmgB6NIAzWCczTEe6c= @@ -355,9 +315,9 @@ github.com/mattn/go-colorable v0.1.15 h1:+u9SLTRGnXv73cEsnsmoZBom+dMU88B2M0aDcWy github.com/mattn/go-colorable v0.1.15/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8= github.com/mattn/go-isatty v0.0.23 h1:cYwCQTQf3HB6xUC+BtyCLZNr7IzbOmoZbmssVNzSyiQ= github.com/mattn/go-isatty v0.0.23/go.mod h1:nMCL3Zebbrt45jsMDgnfIwz6ydEQApk5oEI3HqDio6A= +github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/mattn/go-runewidth v0.0.23 h1:7ykA0T0jkPpzSvMS5i9uoNn2Xy3R383f9HDx3RybWcw= github.com/mattn/go-runewidth v0.0.23/go.mod h1:XBkDxAl56ILZc9knddidhrOlY5R/pDhgLpndooCuJAs= -github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/mattn/go-sqlite3 v1.14.22 h1:2gZY6PC6kBnID23Tichd1K+Z0oS6nE/XwU+Vz/5o4kU= github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= @@ -415,9 +375,9 @@ github.com/robfig/cron v1.2.0 h1:ZjScXvvxeQ63Dbyxy76Fj3AT3Ut0aKsyd2/tl3DTMuQ= github.com/robfig/cron v1.2.0/go.mod h1:JGuDeoQd7Z6yL4zQhZ3OPEVHB7fL6Ka6skscFHfmt2k= github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs= github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro= +github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= -github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/samuel/go-thrift v0.0.0-20190219015601-e8b6b52668fe/go.mod h1:Vrkh1pnjV9Bl8c3P9zH0/D4NlOHWP5d4/hF4YTULaec= github.com/shopspring/decimal v1.4.0 h1:bxl37RwXBklmTi0C79JfXCEBD1cqqHt0bbgBAGFp81k= @@ -432,33 +392,29 @@ github.com/spf13/cast v1.10.0 h1:h2x0u2shc1QuLHfxi+cTJvs30+ZAHOGRic8uyGTDWxY= github.com/spf13/cast v1.10.0/go.mod h1:jNfB8QC9IA6ZuY2ZjDp0KtFO2LZZlg4S/7bzP6qqeHo= github.com/spf13/cobra v1.10.2 h1:DMTTonx5m65Ic0GOoRY2c16WCbHxOOw6xxezuLaBpcU= github.com/spf13/cobra v1.10.2/go.mod h1:7C1pvHqHw5A4vrJfjNwvOdzYu0Gml16OCs2GRiTUUS4= +github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk= github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spiffe/go-spiffe/v2 v2.7.0 h1:uXe1MflJoHw58wAUvxVlcM7WpKtijWG7I1UidcGh6g4= github.com/spiffe/go-spiffe/v2 v2.7.0/go.mod h1:47Q0Q9/AqGha8QLHp+kxpH4Wca7X7EnOtlIJy3mxZ3U= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.5.3 h1:jmXUvGomnU1o3W/V5h2VEradbpJDwGrzugQQvL0POH4= github.com/stretchr/objx v0.5.3/go.mod h1:rDQraq+vQZU7Fde9LOZLr8Tax6zZvy4kuNKF+QYS+U0= -github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= -github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/temporalio/ringpop-go v0.1.1 h1:2V4wwgWrA+99cyvrhkFs8hvj2DaqQmJ68sG28gic6f0= -github.com/temporalio/ringpop-go v0.1.1/go.mod h1:RE+CHmY+kOZQk47AQaVzwrGmxpflnLgTd6EOK0853j4= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= github.com/temporalio/ringpop-go v0.1.3 h1:DbjgzTIpXrTJ5qCvQh7r+q4OM23Asy1CNHeRz5bD5Y0= github.com/temporalio/ringpop-go v0.1.3/go.mod h1:RE+CHmY+kOZQk47AQaVzwrGmxpflnLgTd6EOK0853j4= github.com/temporalio/sqlparser v0.1.0 h1:jHbQyN3bfVLWGYPC/tLHpdjJxuL1YKOd1sf5OQPRM7o= github.com/temporalio/sqlparser v0.1.0/go.mod h1:143qKdh3G45IgV9p+gbAwp3ikRDI8mxsijFiXDfuxsw= -github.com/temporalio/tchannel-go v1.22.1 h1:H1hsQvAk0ExXgzGI3Qll6M0WjAlu2ysL2FtvZ/jdkU4= github.com/temporalio/tchannel-go v1.22.1-0.20220818200552-1be8d8cffa5b/go.mod h1:c+V9Z/ZgkzAdyGvHrvC5AsXgN+M9Qwey04cBdKYzV7U= +github.com/temporalio/tchannel-go v1.22.1 h1:H1hsQvAk0ExXgzGI3Qll6M0WjAlu2ysL2FtvZ/jdkU4= github.com/temporalio/tchannel-go v1.22.1/go.mod h1:ezRQRwu9KQXy8Wuuv1aaFFxoCNz5CeNbVOOkh3xctbY= -github.com/temporalio/ui-server/v2 v2.54.1 h1:V45S+OatX/PbOz5TAtd+T94hm4tfGHc1j5dZAHo+Ouw= -github.com/temporalio/ui-server/v2 v2.54.1/go.mod h1:KmNitkJBhWV2rRQ8k2Q1Jpc4C9SDNOYM9uPW852pz4Y= github.com/temporalio/ui-server/v2 v2.56.4 h1:8CClJYPjZBEMbQm9Ztjb++4GsBO2GJ1o70BxV2PW6ZQ= github.com/temporalio/ui-server/v2 v2.56.4/go.mod h1:pOXxPlKkQm3U32u38cwHzpXvf0CbRxlpQtwGL6+XFtM= github.com/tidwall/btree v1.8.1 h1:27ehoXvm5AG/g+1VxLS1SD3vRhp/H7LuEfwNvddEdmA= @@ -493,12 +449,8 @@ go.opentelemetry.io/collector/pdata v1.56.0 h1:W+QAfN2Iz8SNss1T5JNzRWFnw+7oP1vXB go.opentelemetry.io/collector/pdata v1.56.0/go.mod h1:usR9utboXufbD1rp1oJy+3smQXXpZ+CsI3WN7QsiOs0= go.opentelemetry.io/contrib/detectors/gcp v1.44.0 h1:NmLfL734pJhM0JKaYd2Y28+nY9dPRWYAAbxhRCrKXPw= go.opentelemetry.io/contrib/detectors/gcp v1.44.0/go.mod h1:tNAsgd8avTGke1+MndXlU5Cru4PQ9Ai/cCNWQv/ZJ/s= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.68.0 h1:0Qx7VGBacMm9ZENQ7TnNObTYI4ShC+lHI16seduaxZo= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.68.0/go.mod h1:Sje3i3MjSPKTSPvVWCaL8ugBzJwik3u4smCjUeuupqg= go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.70.0 h1:oECp5f+hN7nkwjU/8BxQ/q23bGPb8FIrD839owX222E= go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.70.0/go.mod h1:DqEFwLumhzMBDQv9PcWbyoDxHI/4lAk6CM4nJBH39sc= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.68.0 h1:CqXxU8VOmDefoh0+ztfGaymYbhdB/tT3zs79QaZTNGY= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.68.0/go.mod h1:BuhAPThV8PBHBvg8ZzZ/Ok3idOdhWIodywz2xEcRbJo= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.70.0 h1:LMuyCAyfalSjDyjdC65nK6N0zoTT63+E/u95X0JovZI= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.70.0/go.mod h1:085m8qbm4hgc8rZWGDEa4vmyyo2c3nPxUslYUKUIU04= go.opentelemetry.io/otel v1.45.0 h1:pdrWmLHofpubmArBv1LgFSv1Z0Ie/ppdZzu+kUN5EeU= @@ -527,42 +479,22 @@ go.opentelemetry.io/otel/trace v1.45.0 h1:l/mP6Uv7oNO7/TblbhpbgMidxhq1uO/rPsikOy go.opentelemetry.io/otel/trace v1.45.0/go.mod h1:qoJJA2xNMnxRrdISU/kLtfUH2wNeQbiv+jhs/CxI8bc= go.opentelemetry.io/proto/otlp v1.11.0 h1:5rrYs0Ykyj50sdU/JU0x8etU+LubXWb+gED6TbEdMIk= go.opentelemetry.io/proto/otlp v1.11.0/go.mod h1:SmVizdCOAm3XBtG1g1NnOdhW6jtddT72hLMhv8VwA8E= -go.temporal.io/api v1.63.8-0.20261016215345-3926793dec12 h1:Ellxop5uzsvgK0CZEg/aOvXHBZLl4LbgBeuVzjSLiqc= -go.temporal.io/api v1.63.8-0.20261016215345-3926793dec12/go.mod h1:acM0I9WPuYg8W3Pd9jOZvEgi7mRUttUQ4+e7fowKVnM= -go.temporal.io/api v1.64.1-0.20261027235544-fa71e29e58da h1:MwXLtFKsQ3qAghiPjlKfXPLKL1vVxnbksxfdXv9cDnc= -go.temporal.io/api v1.64.1-0.20261027235544-fa71e29e58da/go.mod h1:acM0I9WPuYg8W3Pd9jOZvEgi7mRUttUQ4+e7fowKVnM= go.temporal.io/api v1.64.1-0.20261030195137-01272cbd37c9 h1:ZJb+HC/3UhzBBnvzKhGOVNf6WSDpNPBDn94vhEBfZVo= go.temporal.io/api v1.64.1-0.20261030195137-01272cbd37c9/go.mod h1:acM0I9WPuYg8W3Pd9jOZvEgi7mRUttUQ4+e7fowKVnM= -go.temporal.io/auto-scaled-workers v0.0.0-20261013231030-67ffdef6330d h1:cKo/dGcLpFAZXKxIAR2sg9hI+h8/8Z0tNHxXA7LCRVI= -go.temporal.io/auto-scaled-workers v0.0.0-20261013231030-67ffdef6330d/go.mod h1:DpnPBMkwtk/08wMxwR3u3mIOshsgK/V7KKLh1QzNdjw= go.temporal.io/auto-scaled-workers v0.0.0-20261030203857-75274b664c29 h1:wr2yPeTpZAvovJ1tQviQFfcZQRuqvdhU1T+6yvZ23S0= go.temporal.io/auto-scaled-workers v0.0.0-20261030203857-75274b664c29/go.mod h1:Wcxj1DAGbC/tQwcfX8VjGhVKM9+/idGDQIvYx/gf13Y= -go.temporal.io/sdk v1.49.0 h1:CtGI0BUe/SCo3eoqTwuWWtXKueii9GBVus7KrKKH1Vo= -go.temporal.io/sdk v1.49.0/go.mod h1:xP0FulN5JJSfisESUP60LlWsrKz2tLSStGjVdk8r5cc= -go.temporal.io/sdk v1.49.1-0.20261021203027-733b3b459a02 h1:D0ypFFAz7SNeOQTD72WkdPK8O4XgaB03uMmyTHtVsB8= -go.temporal.io/sdk v1.49.1-0.20261021203027-733b3b459a02/go.mod h1:OsF05yeW+3KDYpBEn8BQmj78RXX3qWo/SPJr3s5PLK4= go.temporal.io/sdk v1.49.1-0.20261028204201-93056ed9a9de h1:uI7eiW/cJ0Q/HKKPMiCrL0lBIEmkB4LrNaZ8Ev7YUi8= go.temporal.io/sdk v1.49.1-0.20261028204201-93056ed9a9de/go.mod h1:OsF05yeW+3KDYpBEn8BQmj78RXX3qWo/SPJr3s5PLK4= -go.temporal.io/sdk/contrib/envconfig v1.0.2 h1:MGHfsuPUtsf7X9M6WYn3zYJj/mWsuYHnA1uuiL0KEuE= -go.temporal.io/sdk/contrib/envconfig v1.0.2/go.mod h1:MuMiH7hksps2uXnmKuAWaP9P6WbkSDy62kl64t1VJVg= go.temporal.io/sdk/contrib/envconfig v1.1.0 h1:9HGsyrZytjdcZeWJwQlczqYulMhmHS2PRcarcFRjMRE= go.temporal.io/sdk/contrib/envconfig v1.1.0/go.mod h1:th96Zl21YH2mHEe3uZ5Dw0KwZFSF4I2oSwTcUxGA19Y= -go.temporal.io/server v1.29.0-135.0.0.20261027191414-bf81a4c20009 h1:gFi39tM7NtedBMryDl6loxvKKpi7eESvZfGaWH46Qcc= -go.temporal.io/server v1.29.0-135.0.0.20261027191414-bf81a4c20009/go.mod h1:qqkCsy2vnbqJILCAlQQpoXxjywHmnZ3rKWEPyqEqcis= -go.temporal.io/server v1.29.0-135.0.0.20261029221550-8a1919f5b298 h1:6QPCXAf7yfa7SvI09XzS2D9tAG6SbbTFVT24wt+iFD0= -go.temporal.io/server v1.29.0-135.0.0.20261029221550-8a1919f5b298/go.mod h1:5HOYvdlHebW+gFKd8FcgWV1L0Rrnzll8XgaGXxeetHc= -go.temporal.io/server v1.33.0-165.0 h1:sZTroQeeST1c/H7k7JIsDznAfKoIt1J1mePc5yKhynA= -go.temporal.io/server v1.33.0-165.0/go.mod h1:+eRNFeKRF3IPSXzBCy9PhrSw1zXFrdw1MrxdRhuaa7w= -go.temporal.io/server v1.33.0-166.3 h1:y3tLzHag7F6Pv5EieBUJk2+RlTkUhKT1TaC7k5k2HcQ= -go.temporal.io/server v1.33.0-166.3/go.mod h1:SP/bukdhfHYhAlaz7oghgdNZvJtEaBmPjzvSbvkS2jk= +go.temporal.io/server v1.29.0-135.0.0.20261030183317-69c692e8773e h1:EkdLWsOI9yn+8c9pOrVDzPr/51iJ4VODZSD61f7TxFE= +go.temporal.io/server v1.29.0-135.0.0.20261030183317-69c692e8773e/go.mod h1:5HOYvdlHebW+gFKd8FcgWV1L0Rrnzll8XgaGXxeetHc= go.temporal.io/testx v0.0.0-20261028001837-eec3975de26f h1:D61aaxDgdkRK9CvGxxgDH26oqABa/TIgsbEjb89NMoY= go.temporal.io/testx v0.0.0-20261028001837-eec3975de26f/go.mod h1:T3nNOPpInc8t5TL9vz9li9untPQANYexE36UQeXObqQ= -go.temporal.io/testx v0.0.0-20261029001555-ddcb0739798d h1:SK9slpVz38T0H1ldMpsh/GFWrVTZw7gWC3i2An0rviI= -go.temporal.io/testx v0.0.0-20261029001555-ddcb0739798d/go.mod h1:nL3IFIKnioDnUxNaqKLyzR2tZUK6THrXsaQuVjNYVX8= -go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= -go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= +go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= +go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= go.uber.org/dig v1.19.0 h1:BACLhebsYdpQ7IROQ1AGPjrXcP5dF80U3gKoFzbaq/4= go.uber.org/dig v1.19.0/go.mod h1:Us0rSJiThwCv2GteUN0Q7OKvU7n5J4dxZ9JKUXozFdE= go.uber.org/fx v1.24.0 h1:wE8mruvpg2kiiL1Vqd0CC+tr0/24XIB10Iwp2lLWzkg= @@ -571,10 +503,10 @@ go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= go.uber.org/mock v0.6.0 h1:hyF9dfmbgIX5EfOdasqLsWD6xqpNZlXblLB/Dbnwv3Y= go.uber.org/mock v0.6.0/go.mod h1:KiVJ4BqZJaMj4svdfmHM0AUx4NJYO8ZNpPnZn1Z+BBU= -go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= -go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= go.uber.org/multierr v1.7.0/go.mod h1:7EAYxJLBy9rStEaz58O2t4Uvip6FSURkq8/ppBp95ak= +go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= +go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA= go.uber.org/zap v1.14.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= go.uber.org/zap v1.27.1 h1:08RqriUEv8+ArZRYSTXy1LeBScaMpVSTBhCeaZYfMYc= @@ -590,10 +522,6 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= -golang.org/x/crypto v0.56.0 h1:GUh5Ii4J5jtcseSMiRqr1jXCNHoxjeV9Fmekc2oLy6Y= -golang.org/x/crypto v0.56.0/go.mod h1:OMW5y6CY9l38uPLmxU6l6pwcXp1obtLo3e6gT7gQR2I= -golang.org/x/crypto v0.57.0 h1:3ZVCjf8Ggz7zneR/EHRVx68Ctf+2pmIMP2UFhh9cC6M= -golang.org/x/crypto v0.57.0/go.mod h1:Fdz0i5U6CoizGwLda9DttjSk6qlZo25zYNtR+ycvuZA= golang.org/x/crypto v0.58.0 h1:COkYLr4k7nDI4r6QtMML2AfzeIswWHAJthLS6K/M/54= golang.org/x/crypto v0.58.0/go.mod h1:Xh+kl5A+M0gMiWDytH2Hhr5Z7WbNCpv/eB/EFgfSk+w= golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -612,11 +540,11 @@ golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKG golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.41.0 h1:qJmnOUb4YB+FsEuM3HcWucdZASCPGhsX6uljO6pog0c= -golang.org/x/mod v0.41.0/go.mod h1:Ek9pY8RKWXwsWvd3rQiHYtMqkjSUV+s1Rj7j4H5Ur6o= golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.41.0 h1:qJmnOUb4YB+FsEuM3HcWucdZASCPGhsX6uljO6pog0c= +golang.org/x/mod v0.41.0/go.mod h1:Ek9pY8RKWXwsWvd3rQiHYtMqkjSUV+s1Rj7j4H5Ur6o= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -625,13 +553,9 @@ golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwY golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= -golang.org/x/net v0.58.0 h1:ynWG7rqYi4ccpTEuPZ2QGWHktVEM9DMCj9yzDE0Q7To= -golang.org/x/net v0.58.0/go.mod h1:YwCddHnFlT7eLQqVprV19OnhLGtc5xOKgE0RyqgfWAU= -golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.60.0 h1:79p50tfZlm0J9YfoDsSi639qSXNGVwEzOPLCxM2FsYU= -golang.org/x/net v0.60.0/go.mod h1:2DA/G1UfVbCpQPeWTmMPGY7Cs2PkBkwu743bVX5PIVg= golang.org/x/net v0.62.0 h1:18ELalfM5+XNRwzM2nYqXsZQ9ByS1uhj2O/U7+5jqRY= golang.org/x/net v0.62.0/go.mod h1:WgDCOTH8iwtB66T4/GfI94AHo/hhdb7Hah9NDseQfiI= golang.org/x/oauth2 v0.36.0 h1:peZ/1z27fi9hUOFCAZaHyrpWG5lwe0RJEEEeH0ThlIs= @@ -642,10 +566,6 @@ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek= -golang.org/x/sync v0.22.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0= -golang.org/x/sync v0.23.0 h1:KameEIfc1IkluZyXWLn39Wd4tURc6GbCiISGiZm2bQk= -golang.org/x/sync v0.23.0/go.mod h1:sUUOizhqBxiL6pEWpqNLUiaJn1ShEbZ6BBqskPbjZm0= golang.org/x/sync v0.24.0 h1:iqiDrGoDgyuvAKrhLQthUEzU/R378N78gXbBjxed7oA= golang.org/x/sync v0.24.0/go.mod h1:sUUOizhqBxiL6pEWpqNLUiaJn1ShEbZ6BBqskPbjZm0= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -661,39 +581,27 @@ golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs= -golang.org/x/sys v0.47.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= -golang.org/x/sys v0.48.0 h1:bbX/i/6MgT9BVLM9RT1thmxL04yeTAhbEz4SyadbXoo= -golang.org/x/sys v0.48.0/go.mod h1:hNLxWAXmnKAxqDtdwIYC4bM9oQPEecfsnNMuSxOs3og= golang.org/x/sys v0.49.0 h1:XbzkgYJHdqh/8m2Uu0W/dQv8nktxx4BFHp1M0gROTXA= golang.org/x/sys v0.49.0/go.mod h1:hNLxWAXmnKAxqDtdwIYC4bM9oQPEecfsnNMuSxOs3og= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= +golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U= -golang.org/x/term v0.45.0 h1:NwWyBmoJCbfTHpxrWoZ9C6/VxOf7ic219I8xZZFdrf0= -golang.org/x/term v0.45.0/go.mod h1:9aqxs0blBcrm/n0L9QW0aRVD+ktan8ssZromtqJC43w= -golang.org/x/term v0.46.0 h1:3+OXuTbaKDgwk8jTi3aSLHRlmWqHEUDUtxnbFigO4YE= -golang.org/x/term v0.46.0/go.mod h1:+K02xbkittuwc0Am4abfA3Fc+XRGXkvBXNO88NCXPoc= golang.org/x/term v0.47.0 h1:cpyOwQkr2Nzxe2p6KnrTG7Ei2wtzjsuSjhpXXepZ/BM= golang.org/x/term v0.47.0/go.mod h1:efAfAuG6RKABvg1ArGebRkvX6LXul14SM67o2e4mUCY= -golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= -golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= -golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.41.0 h1:vz/seA0lnX87Othu2f/0L24RcgrXD9/YFTSuGjj3rH8= -golang.org/x/text v0.41.0/go.mod h1:jvf1O8ajNzZqhSrQBPbutR/EB83Cc0CFrezNQIwbb5M= -golang.org/x/text v0.42.0 h1:JbOZXgfeCPU9gacVtYliJqOhD+zhrEqK4LfdpmlUZqI= -golang.org/x/text v0.42.0/go.mod h1:ojzP1Z+2QtioaF8DTtO8K5q7JWVVYwZKenzujK0Zd0E= -golang.org/x/text v0.43.0 h1:1QivrlhwAsnMOcqgOdl9my7s9OyZl8O5/UGUTJVXoWc= -golang.org/x/text v0.43.0/go.mod h1:hbSIYA/amXcRXTFSZqh8tWHEoqRvvbKPJ2uz/KU+a+s= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.43.0 h1:1QivrlhwAsnMOcqgOdl9my7s9OyZl8O5/UGUTJVXoWc= +golang.org/x/text v0.43.0/go.mod h1:hbSIYA/amXcRXTFSZqh8tWHEoqRvvbKPJ2uz/KU+a+s= golang.org/x/time v0.15.0 h1:bbrp8t3bGUeFOx08pvsMYRTCVSMk89u4tKbNOZbp88U= golang.org/x/time v0.15.0/go.mod h1:Y4YMaQmXwGQZoFaVFk4YpCt4FLQMYKZe9oeV/f4MSno= golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -707,21 +615,19 @@ golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.1.8/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU= -golang.org/x/tools v0.49.0 h1:3NI7VXzL9+1WZD52Dx2ttoPwD5DWrFGpl9mFZDlmisI= -golang.org/x/tools v0.49.0/go.mod h1:SJNXV9DBKT0UbdttsQjbfJlAE/q+y36++zo3uL3N0Oo= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/tools v0.51.0 h1:k4Xc/1Om9jwkBJBo4NVLMSARBoWtK10mx+W5BnXCeAI= golang.org/x/tools v0.51.0/go.mod h1:9eEncMayCV6zRMGhR5eZEC2iBx98qWcF1HZ9Z7wJOoA= -golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gonum.org/v1/gonum v0.0.0-20180816165407-929014505bf4/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo= +gonum.org/v1/gonum v0.8.2/go.mod h1:oe/vMfY3deqTw+1EZJhuvEW2iwGF1bW9wwu7XCu0+v0= gonum.org/v1/gonum v0.17.0 h1:VbpOemQlsSMrYmn7T2OUvQ4dqxQXU+ouZFQsZOx50z4= gonum.org/v1/gonum v0.17.0/go.mod h1:El3tOrEuMpv2UdMrbNlKEh9vd86bmQ6vqIcDwxEOc1E= -gonum.org/v1/gonum v0.8.2/go.mod h1:oe/vMfY3deqTw+1EZJhuvEW2iwGF1bW9wwu7XCu0+v0= gonum.org/v1/netlib v0.0.0-20190313105609-8cb42192e0e0/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw= gonum.org/v1/plot v0.0.0-20190515093506-e2840ee46a6b/go.mod h1:Wt8AAjI+ypCyYX3nZBvf6cAIx93T+c/OS2HFAYskSZc= google.golang.org/api v0.276.0 h1:nVArUtfLEihtW+b0DdcqRGK1xoEm2+ltAihyztq7MKY= From 15594ab4598bfd118fe22fb85a7f5285cc16e6d8 Mon Sep 17 00:00:00 2001 From: Feiyang Xie Date: Wed, 2 Dec 2026 13:29:18 -0800 Subject: [PATCH 12/13] Upgrade embedded server to v1.33.0-168.3 --- go.mod | 4 ++-- go.sum | 12 ++++++------ internal/temporalcli/commands.gen.go | 9 +++++---- internal/temporalcli/commands.time_skipping_test.go | 2 ++ internal/temporalcli/commands.workflow_test.go | 1 - .../temporalcli/commands.workflow_time_skipping.go | 1 - internal/temporalcli/commands.yaml | 7 +++++-- 7 files changed, 20 insertions(+), 16 deletions(-) diff --git a/go.mod b/go.mod index bc9b6a233..00416e8a7 100644 --- a/go.mod +++ b/go.mod @@ -17,10 +17,10 @@ require ( github.com/stretchr/testify v1.12.1 github.com/temporalio/cli/cliext v0.0.0 github.com/temporalio/ui-server/v2 v2.56.4 - go.temporal.io/api v1.64.1-0.20261030195137-01272cbd37c9 + go.temporal.io/api v1.64.3 go.temporal.io/sdk v1.49.1-0.20261028204201-93056ed9a9de go.temporal.io/sdk/contrib/envconfig v1.1.0 - go.temporal.io/server v1.29.0-135.0.0.20261030183317-69c692e8773e + go.temporal.io/server v1.33.0-168.3 golang.org/x/exp v0.0.0-20260611194520-c48552f49976 golang.org/x/mod v0.41.0 golang.org/x/term v0.47.0 diff --git a/go.sum b/go.sum index 0cf4ab086..763fcd56d 100644 --- a/go.sum +++ b/go.sum @@ -479,18 +479,18 @@ go.opentelemetry.io/otel/trace v1.45.0 h1:l/mP6Uv7oNO7/TblbhpbgMidxhq1uO/rPsikOy go.opentelemetry.io/otel/trace v1.45.0/go.mod h1:qoJJA2xNMnxRrdISU/kLtfUH2wNeQbiv+jhs/CxI8bc= go.opentelemetry.io/proto/otlp v1.11.0 h1:5rrYs0Ykyj50sdU/JU0x8etU+LubXWb+gED6TbEdMIk= go.opentelemetry.io/proto/otlp v1.11.0/go.mod h1:SmVizdCOAm3XBtG1g1NnOdhW6jtddT72hLMhv8VwA8E= -go.temporal.io/api v1.64.1-0.20261030195137-01272cbd37c9 h1:ZJb+HC/3UhzBBnvzKhGOVNf6WSDpNPBDn94vhEBfZVo= -go.temporal.io/api v1.64.1-0.20261030195137-01272cbd37c9/go.mod h1:acM0I9WPuYg8W3Pd9jOZvEgi7mRUttUQ4+e7fowKVnM= +go.temporal.io/api v1.64.3 h1:Q2oP9jVB5pSputb2j3BLAEjJsi8A2tSzMojqcSGyga0= +go.temporal.io/api v1.64.3/go.mod h1:acM0I9WPuYg8W3Pd9jOZvEgi7mRUttUQ4+e7fowKVnM= go.temporal.io/auto-scaled-workers v0.0.0-20261030203857-75274b664c29 h1:wr2yPeTpZAvovJ1tQviQFfcZQRuqvdhU1T+6yvZ23S0= go.temporal.io/auto-scaled-workers v0.0.0-20261030203857-75274b664c29/go.mod h1:Wcxj1DAGbC/tQwcfX8VjGhVKM9+/idGDQIvYx/gf13Y= go.temporal.io/sdk v1.49.1-0.20261028204201-93056ed9a9de h1:uI7eiW/cJ0Q/HKKPMiCrL0lBIEmkB4LrNaZ8Ev7YUi8= go.temporal.io/sdk v1.49.1-0.20261028204201-93056ed9a9de/go.mod h1:OsF05yeW+3KDYpBEn8BQmj78RXX3qWo/SPJr3s5PLK4= go.temporal.io/sdk/contrib/envconfig v1.1.0 h1:9HGsyrZytjdcZeWJwQlczqYulMhmHS2PRcarcFRjMRE= go.temporal.io/sdk/contrib/envconfig v1.1.0/go.mod h1:th96Zl21YH2mHEe3uZ5Dw0KwZFSF4I2oSwTcUxGA19Y= -go.temporal.io/server v1.29.0-135.0.0.20261030183317-69c692e8773e h1:EkdLWsOI9yn+8c9pOrVDzPr/51iJ4VODZSD61f7TxFE= -go.temporal.io/server v1.29.0-135.0.0.20261030183317-69c692e8773e/go.mod h1:5HOYvdlHebW+gFKd8FcgWV1L0Rrnzll8XgaGXxeetHc= -go.temporal.io/testx v0.0.0-20261028001837-eec3975de26f h1:D61aaxDgdkRK9CvGxxgDH26oqABa/TIgsbEjb89NMoY= -go.temporal.io/testx v0.0.0-20261028001837-eec3975de26f/go.mod h1:T3nNOPpInc8t5TL9vz9li9untPQANYexE36UQeXObqQ= +go.temporal.io/server v1.33.0-168.3 h1:CSzVO6eM/qgd3jbLLh6IKBXe05DIWcv3RPeHViLfOIc= +go.temporal.io/server v1.33.0-168.3/go.mod h1:VZr6mUoqAe1bPiJeINuggEOZgqUfR3o7059vGuvEsh4= +go.temporal.io/testx v0.0.0-20261112171501-c4cea589f218 h1:ZUWWvMMda6gW5w+w2CjbZpM18wdXUQ3kM0bB5jADu0A= +go.temporal.io/testx v0.0.0-20261112171501-c4cea589f218/go.mod h1:nL3IFIKnioDnUxNaqKLyzR2tZUK6THrXsaQuVjNYVX8= go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= diff --git a/internal/temporalcli/commands.gen.go b/internal/temporalcli/commands.gen.go index 0066bbdda..452b4277e 100644 --- a/internal/temporalcli/commands.gen.go +++ b/internal/temporalcli/commands.gen.go @@ -5688,9 +5688,9 @@ func NewTemporalWorkflowTimeSkippingEnableCommand(cctx *CommandContext, parent * } type TemporalWorkflowTimeSkippingPollCommand struct { - Parent *TemporalWorkflowTimeSkippingCommand - Command cobra.Command - WorkflowReferenceOptions + Parent *TemporalWorkflowTimeSkippingCommand + Command cobra.Command + WorkflowId string FastForwardId string } @@ -5706,9 +5706,10 @@ func NewTemporalWorkflowTimeSkippingPollCommand(cctx *CommandContext, parent *Te s.Command.Long = "Poll Workflow time-skipping status for a specific fast-forward setting:\n\n```\ntemporal workflow time-skipping poll \\\n --namespace YourNamespace \\\n --workflow-id YourWorkflowId \\\n --fast-forward-id YourFastForwardId\n```\n\nUse the global `--command-timeout` flag to limit how long the poll waits.\nA failed fast-forward or poll timeout returns a nonzero exit status." } s.Command.Args = cobra.NoArgs + s.Command.Flags().StringVarP(&s.WorkflowId, "workflow-id", "w", "", "Workflow ID. Required.") + _ = cobra.MarkFlagRequired(s.Command.Flags(), "workflow-id") s.Command.Flags().StringVar(&s.FastForwardId, "fast-forward-id", "", "ID of the fast-forward to poll. Required.") _ = cobra.MarkFlagRequired(s.Command.Flags(), "fast-forward-id") - s.WorkflowReferenceOptions.BuildFlags(s.Command.Flags()) s.Command.Run = func(c *cobra.Command, args []string) { if err := s.run(cctx, args); err != nil { cctx.Options.Fail(err) diff --git a/internal/temporalcli/commands.time_skipping_test.go b/internal/temporalcli/commands.time_skipping_test.go index b00a64b4d..ed9e7b68c 100644 --- a/internal/temporalcli/commands.time_skipping_test.go +++ b/internal/temporalcli/commands.time_skipping_test.go @@ -74,6 +74,8 @@ func TestTimeSkippingInvalidFlags(t *testing.T) { {"unsupported disable setting", "disable", []string{"--disable-propagation"}, "unknown flag: --disable-propagation"}, } if noun == "workflow" { + cases = append(cases, invalidFlagsCase{ + "poll with run ID", "poll", []string{"--fast-forward-id", "YourFastForwardId", "--run-id", "YourRunId"}, "unknown flag: --run-id"}) cases = append(cases, invalidFlagsCase{ "ID without duration", "enable", []string{"--fast-forward-id", "YourFastForwardId"}, "--fast-forward-id requires --fast-forward-duration"}) } diff --git a/internal/temporalcli/commands.workflow_test.go b/internal/temporalcli/commands.workflow_test.go index 23734a059..2f16ade14 100644 --- a/internal/temporalcli/commands.workflow_test.go +++ b/internal/temporalcli/commands.workflow_test.go @@ -96,7 +96,6 @@ func (s *SharedServerSuite) TestWorkflow_TimeSkippingEnablePollDisable() { "workflow", "time-skipping", "poll", "--address", s.Address(), "--workflow-id", run.GetID(), - "--run-id", run.GetRunID(), "--fast-forward-id", "WorkflowPollId", ) s.NoError(res.Err) diff --git a/internal/temporalcli/commands.workflow_time_skipping.go b/internal/temporalcli/commands.workflow_time_skipping.go index 49c666f59..368409494 100644 --- a/internal/temporalcli/commands.workflow_time_skipping.go +++ b/internal/temporalcli/commands.workflow_time_skipping.go @@ -66,7 +66,6 @@ func (c *TemporalWorkflowTimeSkippingPollCommand) run(cctx *CommandContext, args // The SDK retries server poll timeouts until the command context ends. res, err := timeskipping.PollFastForward(cctx, cl, timeskipping.PollFastForwardOptions{ WorkflowID: c.WorkflowId, - RunID: c.RunId, FastForwardID: c.FastForwardId, }) if err != nil { diff --git a/internal/temporalcli/commands.yaml b/internal/temporalcli/commands.yaml index d82da7262..db3ad0e75 100644 --- a/internal/temporalcli/commands.yaml +++ b/internal/temporalcli/commands.yaml @@ -5108,9 +5108,12 @@ commands: Use the global `--command-timeout` flag to limit how long the poll waits. A failed fast-forward or poll timeout returns a nonzero exit status. - option-sets: - - workflow-reference options: + - name: workflow-id + type: string + short: w + description: Workflow ID. + required: true - name: fast-forward-id type: string required: true From e8ea04b90e75ddcef0f53fca97e20edb00d1778b Mon Sep 17 00:00:00 2001 From: Feiyang Xie Date: Wed, 2 Dec 2026 18:37:59 -0800 Subject: [PATCH 13/13] upgrade sdk version to main --- go.mod | 6 +++--- go.sum | 12 ++++++------ internal/temporalcli/commands.schedule.go | 4 ++-- .../temporalcli/commands.workflow_time_skipping.go | 3 +-- 4 files changed, 12 insertions(+), 13 deletions(-) diff --git a/go.mod b/go.mod index 00416e8a7..826ecae1a 100644 --- a/go.mod +++ b/go.mod @@ -10,15 +10,15 @@ require ( github.com/fatih/color v1.19.0 github.com/google/uuid v1.6.0 github.com/mattn/go-isatty v0.0.23 - github.com/nexus-rpc/sdk-go v0.7.0 + github.com/nexus-rpc/sdk-go v0.8.0 github.com/olekukonko/tablewriter v0.0.5 github.com/spf13/cobra v1.10.2 github.com/spf13/pflag v1.0.10 github.com/stretchr/testify v1.12.1 github.com/temporalio/cli/cliext v0.0.0 github.com/temporalio/ui-server/v2 v2.56.4 - go.temporal.io/api v1.64.3 - go.temporal.io/sdk v1.49.1-0.20261028204201-93056ed9a9de + go.temporal.io/api v1.64.4 + go.temporal.io/sdk v1.52.1-0.20261202231524-20e9cbc2994f go.temporal.io/sdk/contrib/envconfig v1.1.0 go.temporal.io/server v1.33.0-168.3 golang.org/x/exp v0.0.0-20260611194520-c48552f49976 diff --git a/go.sum b/go.sum index 763fcd56d..13dc24398 100644 --- a/go.sum +++ b/go.sum @@ -338,8 +338,8 @@ github.com/ncruces/go-strftime v1.0.0 h1:HMFp8mLCTPp341M/ZnA4qaf7ZlsbTc+miZjCLOF github.com/ncruces/go-strftime v1.0.0/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls= github.com/nexus-rpc/nexus-proto-annotations v0.1.0 h1:2fELd+9sqUtNu6Fg//pw8YFsxOvp8vZ8hfP0nHhNI80= github.com/nexus-rpc/nexus-proto-annotations v0.1.0/go.mod h1:n3UjF1bPCW8llR8tHvbxJ+27yPWrhpo8w/Yg1IOuY0Y= -github.com/nexus-rpc/sdk-go v0.7.0 h1:38NrfY5rLnZAiMMs2ZfCKI/CSDzdfJG+27iAgfA8bUI= -github.com/nexus-rpc/sdk-go v0.7.0/go.mod h1:FHdPfVQwRuJFZFTF0Y2GOAxCrbIBNrcPna9slkGKPYk= +github.com/nexus-rpc/sdk-go v0.8.0 h1:xQbsF3KHlCwbIt7fMkAk6gx2iE/NYsg9pHRTZgq95VQ= +github.com/nexus-rpc/sdk-go v0.8.0/go.mod h1:FHdPfVQwRuJFZFTF0Y2GOAxCrbIBNrcPna9slkGKPYk= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= @@ -479,12 +479,12 @@ go.opentelemetry.io/otel/trace v1.45.0 h1:l/mP6Uv7oNO7/TblbhpbgMidxhq1uO/rPsikOy go.opentelemetry.io/otel/trace v1.45.0/go.mod h1:qoJJA2xNMnxRrdISU/kLtfUH2wNeQbiv+jhs/CxI8bc= go.opentelemetry.io/proto/otlp v1.11.0 h1:5rrYs0Ykyj50sdU/JU0x8etU+LubXWb+gED6TbEdMIk= go.opentelemetry.io/proto/otlp v1.11.0/go.mod h1:SmVizdCOAm3XBtG1g1NnOdhW6jtddT72hLMhv8VwA8E= -go.temporal.io/api v1.64.3 h1:Q2oP9jVB5pSputb2j3BLAEjJsi8A2tSzMojqcSGyga0= -go.temporal.io/api v1.64.3/go.mod h1:acM0I9WPuYg8W3Pd9jOZvEgi7mRUttUQ4+e7fowKVnM= +go.temporal.io/api v1.64.4 h1:SHiPMuT9j/txHwk9QAsFE4/KNMcXtgD9z9f5L4ERBLU= +go.temporal.io/api v1.64.4/go.mod h1:acM0I9WPuYg8W3Pd9jOZvEgi7mRUttUQ4+e7fowKVnM= go.temporal.io/auto-scaled-workers v0.0.0-20261030203857-75274b664c29 h1:wr2yPeTpZAvovJ1tQviQFfcZQRuqvdhU1T+6yvZ23S0= go.temporal.io/auto-scaled-workers v0.0.0-20261030203857-75274b664c29/go.mod h1:Wcxj1DAGbC/tQwcfX8VjGhVKM9+/idGDQIvYx/gf13Y= -go.temporal.io/sdk v1.49.1-0.20261028204201-93056ed9a9de h1:uI7eiW/cJ0Q/HKKPMiCrL0lBIEmkB4LrNaZ8Ev7YUi8= -go.temporal.io/sdk v1.49.1-0.20261028204201-93056ed9a9de/go.mod h1:OsF05yeW+3KDYpBEn8BQmj78RXX3qWo/SPJr3s5PLK4= +go.temporal.io/sdk v1.52.1-0.20261202231524-20e9cbc2994f h1:Ze3hiwLZiFF4ifH0btrOV7UI63TFJHA2fH9+hyDzA+k= +go.temporal.io/sdk v1.52.1-0.20261202231524-20e9cbc2994f/go.mod h1:H0KRRzQ/L5EZwtVOIsOyqq16Gm/1meYGJhzwBCZ+lkk= go.temporal.io/sdk/contrib/envconfig v1.1.0 h1:9HGsyrZytjdcZeWJwQlczqYulMhmHS2PRcarcFRjMRE= go.temporal.io/sdk/contrib/envconfig v1.1.0/go.mod h1:th96Zl21YH2mHEe3uZ5Dw0KwZFSF4I2oSwTcUxGA19Y= go.temporal.io/server v1.33.0-168.3 h1:CSzVO6eM/qgd3jbLLh6IKBXe05DIWcv3RPeHViLfOIc= diff --git a/internal/temporalcli/commands.schedule.go b/internal/temporalcli/commands.schedule.go index 119691d78..f2105572a 100644 --- a/internal/temporalcli/commands.schedule.go +++ b/internal/temporalcli/commands.schedule.go @@ -570,7 +570,7 @@ func patchScheduleTimeSkipping(cctx *CommandContext, parent *TemporalScheduleCom return err } defer cl.Close() - err = cl.ScheduleClient().GetHandle(cctx, scheduleID).SetTimeSkippingConfig(cctx, client.ScheduleSetTimeSkippingConfigOptions{Config: config}) + err = timeskipping.SetScheduleTimeSkippingConfig(cctx, cl.ScheduleClient().GetHandle(cctx, scheduleID), timeskipping.ScheduleSetTimeSkippingConfigOptions{Config: config}) if err != nil { return err } @@ -605,7 +605,7 @@ func (c *TemporalScheduleTimeSkippingPollCommand) run(cctx *CommandContext, args handle := cl.ScheduleClient().GetHandle(cctx, c.ScheduleId) res, err := timeskipping.PollScheduleFastForward(cctx, handle, - timeskipping.PollScheduleFastForwardOptions{FastForwardID: c.FastForwardId}) + timeskipping.SchedulePollFastForwardOptions{FastForwardID: c.FastForwardId}) if err != nil { return err } diff --git a/internal/temporalcli/commands.workflow_time_skipping.go b/internal/temporalcli/commands.workflow_time_skipping.go index 368409494..689126d7d 100644 --- a/internal/temporalcli/commands.workflow_time_skipping.go +++ b/internal/temporalcli/commands.workflow_time_skipping.go @@ -64,8 +64,7 @@ func (c *TemporalWorkflowTimeSkippingPollCommand) run(cctx *CommandContext, args } defer cl.Close() // The SDK retries server poll timeouts until the command context ends. - res, err := timeskipping.PollFastForward(cctx, cl, timeskipping.PollFastForwardOptions{ - WorkflowID: c.WorkflowId, + res, err := timeskipping.PollWorkflowFastForward(cctx, cl, cl.GetWorkflow(cctx, c.WorkflowId, ""), timeskipping.PollWorkflowFastForwardOptions{ FastForwardID: c.FastForwardId, }) if err != nil {