From a3094777d0f2e549ba28198669b80180ea112b7d Mon Sep 17 00:00:00 2001 From: "tbhb.dev Agent" Date: Wed, 25 Nov 2026 04:06:05 +0000 Subject: [PATCH 1/2] build: pin the Temporal CLI and test the dev server Generated-by: LLM effort=medium;harness=claude-code:2.1.331;model=anthropic:claude-haiku-5-5;session=sha-256-64:c0f9bb806fecbdfc;started_at=2026-11-24T21:24:43Z;subagent=sha-256-64:093f04a7d32cf99a;surface=cli Assisted-by: LLM effort=medium;harness=claude-code:2.1.331;model=anthropic:claude-sonnet-5-5;session=sha-256-64:c0f9bb806fecbdfc;started_at=2026-11-24T16:06:49Z;surface=cli --- BUILD.bazel | 60 ++++++++++++++++++++++++++++++ MODULE.bazel | 39 +++++++++++++++++++ tests/lib/temporal_dev_server.sh | 62 +++++++++++++++++++++++++++++++ tests/temporal_dev_server_test.sh | 12 ++++++ 4 files changed, 173 insertions(+) create mode 100644 tests/lib/temporal_dev_server.sh create mode 100755 tests/temporal_dev_server_test.sh diff --git a/BUILD.bazel b/BUILD.bazel index ac0c2b0..6b8e6df 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -4,6 +4,7 @@ load("@bazel_env.bzl", "bazel_env") load("@bazelrc-preset.bzl", "bazelrc_preset") load("@buildifier_prebuilt//:rules.bzl", "buildifier", "buildifier_test") +load("@rules_shell//shell:sh_test.bzl", "sh_test") load("@tbhb_rules//format:defs.bzl", "format", "format_test") load( "@tbhb_rules//lint:defs.bzl", @@ -336,6 +337,64 @@ format_test( formatters = FORMATTERS, ) +# Match the CLI binary to the platform running the development tools. +config_setting( + name = "temporal_linux_amd64", + constraint_values = [ + "@platforms//os:linux", + "@platforms//cpu:x86_64", + ], +) + +config_setting( + name = "temporal_linux_arm64", + constraint_values = [ + "@platforms//os:linux", + "@platforms//cpu:aarch64", + ], +) + +config_setting( + name = "temporal_darwin_arm64", + constraint_values = [ + "@platforms//os:macos", + "@platforms//cpu:aarch64", + ], +) + +config_setting( + name = "temporal_windows_amd64", + constraint_values = [ + "@platforms//os:windows", + "@platforms//cpu:x86_64", + ], +) + +alias( + name = "temporal", + actual = select({ + ":temporal_darwin_arm64": "@temporal_cli_darwin_arm64//:temporal", + ":temporal_linux_amd64": "@temporal_cli_linux_amd64//:temporal", + ":temporal_linux_arm64": "@temporal_cli_linux_arm64//:temporal", + ":temporal_windows_amd64": "@temporal_cli_windows_amd64//:temporal.exe", + }), +) + +sh_test( + name = "temporal_dev_server_test", + size = "medium", + srcs = ["tests/temporal_dev_server_test.sh"], + args = ["$(rootpath :temporal)"], + data = [ + "tests/lib/temporal_dev_server.sh", + ":temporal", + ], + target_compatible_with = select({ + "@platforms//os:windows": ["@platforms//:incompatible"], + "//conditions:default": [], + }), +) + # `bazel run //:bazel_env` puts shims for the Bazel-pinned tools in # .bazel_env/bin, which mise adds to PATH. Git hooks call them directly, so # a commit never waits on the Bazel server. bazel_env.bzl builds its bin @@ -359,6 +418,7 @@ bazel_env( "ryl": "@tbhb_rules_ryl//:ryl", "shellcheck": "@tbhb_rules_shellcheck//:shellcheck", "shfmt": "@tbhb_rules_shfmt//:shfmt", + "temporal": ":temporal", "tombi": "@tbhb_rules_tombi//:tombi", "vale": "@tbhb_rules_vale//:vale", "zizmor": "@tbhb_rules_zizmor//:zizmor", diff --git a/MODULE.bazel b/MODULE.bazel index 4d73eb3..da9d179 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -47,11 +47,50 @@ use_repo( # Dev dependencies: tooling that only this workspace needs. bazel_dep(name = "buildifier_prebuilt", version = "10.1.0", dev_dependency = True) bazel_dep(name = "bazelrc-preset.bzl", version = "1.10.0", dev_dependency = True) +bazel_dep(name = "platforms", version = "1.1.0", dev_dependency = True) +bazel_dep(name = "rules_shell", version = "0.6.1", dev_dependency = True) # Stable paths and PATH shims (.bazel_env/bin) for the Bazel-pinned tools, # which git hooks and editors call without starting Bazel. bazel_dep(name = "bazel_env.bzl", version = "0.10.0", dev_dependency = True) +# Temporal CLI for local development and the dev-server smoke test. +http_archive = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") + +_TEMPORAL_RELEASE = "https://github.com/temporalio/cli/releases/download/v1.10.0/" + +http_archive( + name = "temporal_cli_linux_amd64", + build_file_content = 'exports_files(["temporal"])', + dev_dependency = True, + sha256 = "521f461f3d108902763bb71e85cd0fd382dc9357b59604ae03da6ae734d16890", + url = _TEMPORAL_RELEASE + "temporal_cli_1.10.0_linux_amd64.tar.gz", +) + +http_archive( + name = "temporal_cli_linux_arm64", + build_file_content = 'exports_files(["temporal"])', + dev_dependency = True, + sha256 = "6e526d2f089bf5acead2129f1f63e303b848410d5d9d86b9255359dcea6eaaa8", + url = _TEMPORAL_RELEASE + "temporal_cli_1.10.0_linux_arm64.tar.gz", +) + +http_archive( + name = "temporal_cli_darwin_arm64", + build_file_content = 'exports_files(["temporal"])', + dev_dependency = True, + sha256 = "40a76ef7d525e6195b083e4cd50b184cc3bb242fea7f8dda2b9a8698ecbb7379", + url = _TEMPORAL_RELEASE + "temporal_cli_1.10.0_darwin_arm64.tar.gz", +) + +http_archive( + name = "temporal_cli_windows_amd64", + build_file_content = 'exports_files(["temporal.exe"])', + dev_dependency = True, + sha256 = "b95695d08a564621b02322592bbb525a924f76cc892084fc3dd7d2e90f42b8bd", + url = _TEMPORAL_RELEASE + "temporal_cli_1.10.0_windows_amd64.zip", +) + # Pinned copies of the SchemaStore schemas that pyproject.toml's embedded # tombi schema refers to by URL, so //:tombi_test validates offline. Pinned # to a SchemaStore commit, because www.schemastore.org serves whatever is diff --git a/tests/lib/temporal_dev_server.sh b/tests/lib/temporal_dev_server.sh new file mode 100644 index 0000000..375935d --- /dev/null +++ b/tests/lib/temporal_dev_server.sh @@ -0,0 +1,62 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: Apache-2.0 +# Copyright Tony Burns + +set -euo pipefail + +temporal_dev_server_start() { + local port attempt + TEMPORAL_SERVER_PID= + for ((port = 17233; port < 17333; port++)); do + if ! (echo >"/dev/tcp/127.0.0.1/$port") 2>/dev/null; then + break + fi + done + if ((port == 17333)); then + echo "No free Temporal port found" >&2 + return 1 + fi + + "$TEMPORAL" server start-dev --headless --port "$port" >"$TEST_TMPDIR/temporal-server.log" 2>&1 & + TEMPORAL_SERVER_PID=$! + echo "Started Temporal dev server (PID $TEMPORAL_SERVER_PID, port $port)" + for ((attempt = 0; attempt < 30; attempt++)); do + if ! kill -0 "$TEMPORAL_SERVER_PID" 2>/dev/null; then + echo "Temporal dev server exited before becoming healthy" >&2 + cat "$TEST_TMPDIR/temporal-server.log" >&2 + return 1 + fi + if "$TEMPORAL" operator cluster health --address "127.0.0.1:$port" --command-timeout 1s >"$TEST_TMPDIR/temporal-health.log" 2>&1; then + echo "Temporal dev server is healthy" + cat "$TEST_TMPDIR/temporal-health.log" + return 0 + fi + sleep 1 + done + echo "Timed out waiting for Temporal dev server health" >&2 + cat "$TEST_TMPDIR/temporal-server.log" "$TEST_TMPDIR/temporal-health.log" >&2 + return 1 +} + +temporal_dev_server_stop() { + local attempt leaked=0 + if [[ -z ${TEMPORAL_SERVER_PID:-} ]]; then + return 0 + fi + kill "$TEMPORAL_SERVER_PID" 2>/dev/null || true + for ((attempt = 0; attempt < 10; attempt++)); do + if ! kill -0 "$TEMPORAL_SERVER_PID" 2>/dev/null; then + break + fi + sleep 1 + done + if kill -0 "$TEMPORAL_SERVER_PID" 2>/dev/null; then + echo "Temporal dev server leaked after shutdown; killing it" >&2 + kill -KILL "$TEMPORAL_SERVER_PID" + leaked=1 + fi + wait "$TEMPORAL_SERVER_PID" || true + echo "Stopped and reaped Temporal dev server (PID $TEMPORAL_SERVER_PID)" + TEMPORAL_SERVER_PID= + return "$leaked" +} diff --git a/tests/temporal_dev_server_test.sh b/tests/temporal_dev_server_test.sh new file mode 100755 index 0000000..af06c3a --- /dev/null +++ b/tests/temporal_dev_server_test.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: Apache-2.0 +# Copyright Tony Burns + +set -euo pipefail + +TEMPORAL="$PWD/$1" +# shellcheck source=tests/lib/temporal_dev_server.sh +source "$TEST_SRCDIR/$TEST_WORKSPACE/tests/lib/temporal_dev_server.sh" +trap 'temporal_dev_server_stop || exit 1' EXIT + +temporal_dev_server_start From 70fbe0926b1c64f36e33050f4bfd457cc68aecd5 Mon Sep 17 00:00:00 2001 From: "tbhb.dev Agent" Date: Tue, 24 Nov 2026 23:22:18 -0500 Subject: [PATCH 2/2] chore: refresh the head for CI Generated-by: LLM effort=medium;harness=claude-code:2.1.331;model=anthropic:claude-haiku-5-5;session=sha-256-64:c0f9bb806fecbdfc;started_at=2026-11-24T21:24:43Z;subagent=sha-256-64:093f04a7d32cf99a;surface=cli Assisted-by: LLM effort=medium;harness=claude-code:2.1.331;model=anthropic:claude-sonnet-5-5;session=sha-256-64:c0f9bb806fecbdfc;started_at=2026-11-24T16:06:49Z;surface=cli