
Extending Personhog Test Harness
FreeEnhance your e2e testing for personhog scenarios.
Free · Opens the source repo
What Extending Personhog Test Harness does
The Extending Personhog Test Harness skill is designed for developers working with the personhog system, particularly those involved in end-to-end (e2e) testing. This skill provides guidance on how to effectively add scenarios, chaos events, and invariants to the personhog e2e test harness. By utilizing this skill, developers can ensure that fixes for bugs or regressions are validated through permanent regression tests, which helps maintain the integrity of the personhog leader path and its associated components.
The harness operates by spawning a real personhog stack and asserting that every acknowledged write is visible through multiple verification methods. This includes real-time visibility via read-your-write probers, end-of-run checks through strong reads, and durable checks using Postgres. The skill is particularly useful when introducing new failure modes or correctness properties, ensuring that the system can handle various disruptions, such as crashes, lag, or failovers.
To add a scenario, developers are guided to follow a structured process that includes defining new stack primitives, chaos events, and ensuring that the scenarios are deterministic. This process is crucial for validating fixes and ensuring that the test harness can reliably catch issues like eviction data loss or coordinator failover stalls. The skill emphasizes the importance of rehearsing scenarios locally to achieve consistent results before integrating them into CI workflows.
Overall, this skill is essential for developers who want to enhance the robustness of their personhog testing framework, allowing for a more resilient and reliable system that can adapt to various operational challenges and maintain correctness under stress conditions.
When to use it
Use this skill when you need to add new test scenarios or validate fixes in the personhog system after addressing bugs or regressions.
When not to use it
This skill is not suitable for unit testing or scenarios already covered by existing flags; it focuses exclusively on whole-stack behavior.
What you can build with it
Validating a Bug Fix
After fixing a bug in personhog, use this skill to create a regression scenario that ensures the issue does not reoccur.
Testing New Failure Modes
When introducing a new failure mode, leverage this skill to add chaos scenarios that validate the system's resilience.
Enhancing Existing Tests
Use this skill to refine and extend existing test scenarios, ensuring comprehensive coverage of personhog's behavior under various conditions.
How to install Extending Personhog Test Harness
View source1. Install with the skills CLI
npx skills add posthog/posthog/extending-personhog-test-harness --agent claude-code2. Or install it manually
Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.
Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs
Inside SKILL.md
Written by posthogExtending the personhog test harness
The harness (rust/personhog-test-harness/, see its README for usage) spawns a
real personhog stack and asserts one invariant three ways: every acked write
is visible afterwards — live via read-your-write probers, at end-of-run via
strong reads, and durably via Postgres at the acked version. It has caught real
bugs (eviction data loss, unordered lifecycle shutdown, coordinator failover
stalls) precisely because chaos scenarios run against those assertions.
When to add a scenario
Add one whenever you fix a personhog bug whose trigger the harness can reproduce — a crash, drain, restart, lag, election, or eviction condition. The fix's PR should show the scenario red before the fix and green after; that run becomes the permanent regression test. Also add one when introducing a new failure mode (a new process to disrupt, a new timing window) or a new correctness property (a new journal check).
Don't add scenarios for behavior already covered by an existing flag combination — compose existing flags instead — and don't add unit-testable logic here: the harness is for whole-stack behavior only.
Where things live
src/cli.rs— every scenario is driven byGateArgsflags.src/scenarios/gate.rs—ChaosEventenum,chaos_timeline()(offset-sorted events, paired stop/resume events), the dispatch loop, and verification ordering (probers → regressions → strong reads → Postgres quiesce).src/stack/mod.rs— stack primitives: spawn/kill/restart leaders (SIGKILL, SIGTERM drain, SIGSTOP/SIGCONT zombie), writer crash/pause, coordinator kill, etcd lease revocation, per-service env. New disruptions are new methods here.src/state.rs— the acked-write journal and its verifiers. New invariants go here, and their decision tables get unit tests: a false-negative verifier looks identical to a healthy stack, so e2e runs cannot reveal it.README.md— every scenario gets a runnable example; scenarios that stay red because of a known unfixed defect go in the "Known defects" section with their observable signature and fix direction.
Adding a chaos scenario
- Add the stack primitive if the disruption is new (prefer process signals and etcd operations; never disrupt the shared docker containers — they also serve the dev stack).
- Add the
GateArgsflag, theChaosEventvariant, and itschaos_timeline()entry. Timed events take an offset; paired disruptions (pause/resume) schedule both entries. State-triggered events (like--kill-handoff-target) poll etcd after their triggering event instead. - Guard invalid combinations in
gate.rswith an earlybail!(for example, coordinator kill requires two routers). - Rehearse locally until deterministic — three consecutive green runs is the bar (see the README for build and docker prerequisites). If timing makes a scenario a lottery, make it deterministic (the coordinator election is forced at bring-up for exactly this reason) rather than accepting flakes.
- Only failed-but-unacked requests are tolerable during chaos; the invariant
machinery needs no changes for a new disruption unless you're adding a new
property, in which case journal it in
state.rswith unit tests. - Add the scenario to the
personhog-gateCI job in.github/workflows/ci-rust.ymlonce rehearsed — extend an existing composite run if compatible (keep runs to roughly three disruption kinds so failures stay diagnosable), or add a step. Expected-red scenarios (documenting a known defect) stay out of CI until the defect is fixed.
Validating a fix with the harness
Run the harness binary against binaries built from the fix branch:
cargo build -p personhog-replica -p personhog-router -p personhog-leader -p personhog-writer
personhog-test-harness gate <scenario flags> --bin-dir <fix-worktree>/rust/target/debug
Show the same command red on the base branch and green on the fix in the PR's testing section.
Frequently asked questions about Extending Personhog Test Harness
Similar skills
Spring Boot Testing
Master testing techniques for Spring Boot 4 applications.
GitHub Issues
Manage GitHub issues efficiently with MCP tools.
Geofeed Tuner
Optimize your IP geolocation feeds in CSV format.
Batch Files
Master Windows batch scripting for automation and task management.
Adobe Illustrator Scripting
Automate your Illustrator workflows with ExtendScript.
Plugin Structure
Create and organize Claude Code plugins effectively.
