Skip to content

build: pin the Temporal server tool for tests - #5

Merged
tbhb-agent merged 2 commits into
mainfrom
agent/temporal-cli-pin
Nov 25, 2026
Merged

tbhb-agent merged 2 commits into
mainfrom
agent/temporal-cli-pin

Conversation

@tbhb-agent

Copy link
Copy Markdown
Collaborator

Why

The context graph's indexer tests need a local Temporal server. Each test target has to start its own server without a manual install. The repository needs a pinned binary, like its other tools.

Behavior change

The module pins Temporal command-line tool v1.10.0 for Linux amd64 and arm64, macOS arm64, and Windows amd64, each by sha256. The //:temporal alias selects the binary for the running platform, and bazel run //:bazel_env adds a temporal shim. A new temporal_dev_server_test runs the dev server on a free port. Its state stays in memory. The test waits for operator cluster health to answer, then stops the server. The helper in tests/lib/temporal_dev_server.sh is for later test targets to reuse.

Decisions

Chose a shell test over a Python test, because the binary is a Bazel-pinned file and the helper must run without a Python environment. Chose the official release archives, because the release checksums verify each pin.

Risk

Tech debt. Windows skips the dev-server test, although the CI matrix includes Windows. The port search is a best-effort check, so a port taken between the search and the start fails the test rather than retrying. No darwin amd64 pin exists, because the CI runners are arm64.

Verification

  • bazelisk test //...: 27 tests pass, including //:temporal_dev_server_test. Its log reports the server as healthy and then stopped.
  • bazelisk run //:format and bazelisk run //:format.check: both pass.
  • bazelisk run //:bazel_env: the shim runs and reports temporal version 1.10.0.
  • Each archive's sha256 matches the release's checksums.txt.

Opened-by: LLM effort=medium;harness=claude-code:2.1.331;model=anthropic:claude-sonnet-5-5;session=sha-256-64:c0f9bb806fecbdfc;surface=cli
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

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
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
@tbhb-agent
tbhb-agent merged commit 9e91df1 into main Nov 25, 2026
7 checks passed
@tbhb-agent
tbhb-agent deleted the agent/temporal-cli-pin branch November 25, 2026 04:27
tbhb-agent added a commit that referenced this pull request Nov 25, 2026
Why
The indexer needs Temporal workflows. Today nothing tests the Python SDK
against the pinned dev server. A tested echo workflow gives later slices
a working base.

Behavior change
The package depends on `temporalio`. `tbhbgraph.temporal` adds a ping
workflow that calls an echo activity. It also adds
`run_worker(address, task_queue)`, which takes the server address as an
argument. A pytest test starts the pinned `//:temporal` dev server on a
free localhost port. The test then runs the worker and the workflow. It
checks the echoed result and stops the server. `pytest_test` receives
the binary through `path_tools` and `TEMPORAL_BINARY`.

Decisions
Chose an in-process dev-server start in pytest over a bash helper call.
The test needs the Python client in the same process. Chose
`sandboxed=False` on the workflow, since the sandbox fails to import the
package and its Click dependency.

Risk
Tech debt, two items. Windows skips the dev-server test, the same gap as
#5. A port taken between the best-effort scan and the
start fails the test without a retry.

Security debt: the workflow runs outside the Temporal sandbox. The
sandbox's determinism checks don't run. The workflow doesn't do I/O.
Later slices add I/O, and the exposure grows with it. Re-enable the
sandbox once the plugin package stops importing Click at workflow load.

Verification
- `bazelisk test //...`: all targets pass, with 100% branch coverage.
  The pytest log shows the dev server start, the ping workflow echo
  through the activity, and the server stop.
- `bazelisk run //:format`: clean diff afterward.
- `bazelisk test //:ruff_test //:pyrefly_test //:deptry_test //:pylint_test //:vulture_test //:complexipy_test //:bandit_test //:pytest_test`:
  all pass.
- `bazelisk test //:pip_audit_test`: passes.
- `uv lock` with `uv` 0.13.7: `temporalio` 1.36.1 is at least five days
  old.
- `tbhbdev alpha pr check`: 137 code lines, 169 raw lines.

Generated-by: LLM effort=high;harness=codex:0.171.0;model=openai:gpt-6.1-sol;session=sha-256-64:dfcf609669cdcf62;surface=exec
Assisted-by: LLM effort=medium;harness=claude-code:2.1.331;model=anthropic:claude-haiku-5-5;session=sha-256-64:c0f9bb806fecbdfc;subagent=sha-256-64:093f04a7d32cf99a;surface=cli
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant