一键导入
hgraf-write-e2e-scenario
Pattern for writing a new end-to-end test in tests/e2e/ — real ADK + real harmonograf server, scripted FakeLlm for determinism.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Pattern for writing a new end-to-end test in tests/e2e/ — real ADK + real harmonograf server, scripted FakeLlm for determinism.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Understand and safely change heartbeat interval, stuck threshold, and timeout constants — client cadence, server detection math, frontend signal.
Add a new AnnotationKind — proto, storage, ingress RPC, optional downstream delivery to agents, frontend authoring UI, tests.
Add a new agent Capability — proto enum, client advertisement, server ingest, frontend gating in the control UI.
Add a new ControlKind — capability advertisement, client handler, server routing, ack semantics, frontend button, and tests — all the way through.
Add a new drift kind end-to-end. Goldfive owns the detector + enum; harmonograf reflects the kind through the intervention aggregator and the UI timeline.
Script a complex multi-turn FakeLlm scenario — function calls, tool chains, drift events, side-effect hooks, partial responses — for deterministic adk test coverage.
| name | hgraf-write-e2e-scenario |
| description | Pattern for writing a new end-to-end test in tests/e2e/ — real ADK + real harmonograf server, scripted FakeLlm for determinism. |
You need a hermetic end-to-end test that exercises the full stack —
real google.adk runtime, real harmonograf_client, real
harmonograf_server (in-process) — but with deterministic, scripted
LLM output. Use this for:
Do not use this skill for tests that don't need ADK at all —
prefer pytest unit tests under client/tests/ or server/tests/.
They run 10-100× faster.
Harmonograf's e2e suite is in tests/e2e/. It composes:
harmonograf_server started in-process on an ephemeral
port with either an in-memory or sqlite-backed store.harmonograf_client.Client(...) pointing at that server.HarmonografTelemetryPlugin.goldfive.wrap(...) for orchestration flows.FakeLlm so the model never goes off-script.The conftest under tests/e2e/ exposes server fixtures. Prefer the
in-memory store for speed and the sqlite-backed one only when the
test verifies persistence / migration.
Construct a list of LlmResponse objects using ADK's own types:
from google.adk.models.llm_response import LlmResponse
from google.genai.types import Content, Part, FunctionCall
responses = [
LlmResponse(content=Content(parts=[Part(text="I'll call the search tool.")])),
LlmResponse(content=Content(parts=[Part(function_call=FunctionCall(
name="web_search", args={"query": "..."}))])),
# ...
]
Wrap them in a FakeLlm class that advances a cursor each call.
With the client configured against the local server, run the agent. Spans, heartbeats, and goldfive events flow through the real wire into the in-process server.
ListInterventions, WatchSession,
GetSpanTree) to verify end-user-facing shape.Client, assert the server sees
nothing; emit the first envelope, assert Hello lands.Agent row per ADK agent with hgraf.agent.*
metadata populated.HarmonografTelemetryPlugin
twice; assert spans don't double-emit.status=CANCELLED.ListInterventions returns one
card, not three.make e2e
# or for one file:
cd tests/e2e && uv run pytest test_<scenario>.py -q
Some e2e tests need KIKUCHI_LLM_URL for real-LLM scenarios; those
are gated and skipped by default.
Client and never emits will not connect at all. That's correct
per #85 — emit something before asserting server-side state.Agent", a goldfive.wrap run will now have N agents.
Update assertions to match the per-agent shape.<client>:<name> shape or
query the server for the registered ids.dev-guide/testing.md — the four-tier test hierarchy.hgraf-add-fake-llm-scenario — complex turn scripting.