mcpbeat Sign in

Extending Personhog Test Harness Agent Skill

> When and how to add scenarios, chaos events, and invariants to the personhog e2e test harness (rust/personhog-test-harness). Use after fixing a bug or regression in the personhog leader path (leader, router, writer, replica, coordination protocol) so the fix gets a permanent regression scenario; when adding a new failure mode to test (crashes, drains, zombies, lag, failover); or when a new correctness property needs asserting during runs. Trigger handoff bug, eviction, writer lag, acked write.

1k tokens
context cost
the whole folder, loaded on every use
1
files
instructions only
0
copies elsewhere
how many repositories repackaged it
690
stars on the repo
on the repository, not the skill itself

Install

one command, takes just this skill from the repository
npx skills add https://github.com/PostHog/posthog --skill extending-personhog-test-harness

The instruction itself

5 sections, as written by the author

Extending 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 by GateArgs flags.
  • src/scenarios/gate.rsChaosEvent enum, 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 GateArgs flag, the ChaosEvent variant, and its

chaos_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.rs with an early bail! (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.rs with unit tests.

  • Add the scenario to the personhog-gate CI job in

.github/workflows/ci-rust.yml once 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.

Other skills for the same job

different authors, same section of the catalogue
Webapp Testing
by anthropics
vendor ×12

Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.

6k tokens scripts
Finishing A Development Branch
by ZhanlinCui
×7

Use when implementation is complete, all tests pass, and you need to decide how to integrate the work - guides completion of development work by presenting structured options for merge, PR, or cleanup

1k tokens
Test Driven Development
by w95
×7

Use when implementing any feature or bugfix, before writing implementation code

2k tokens
Systematic Debugging
by ratacat
×7

Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes

10k tokens scripts
Verification Before Completion
by ZhanlinCui
×6

Use when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions always

1k tokens
Backtest Expert
by BaggaT236
×3

Expert guidance for systematic backtesting of trading strategies. Use when developing, testing, stress-testing, or validating quantitative trading strategies. Covers "beating ideas to death" methodology, parameter robustness testing, slippage modeling, bias prevention, and interpreting backtest results. Applicable when user asks about backtesting, strategy validation, robustness testing, avoiding overfitting, or systematic trading development.

15k tokens scripts
Adaptyv
by christophacham
×3

Cloud laboratory platform for automated protein testing and validation. Use when designing proteins and needing experimental validation including binding assays, expression testing, thermostability measurements, enzyme activity assays, or protein sequence optimization. Also use for submitting experiments via API, tracking experiment status, downloading results, optimizing protein sequences for better expression using computational tools (NetSolP, SoluProt, SolubleMPNN, ESM), or managing protein design workflows with wet-lab validation.

16k tokens
Aeon
by christophacham
×3

This skill should be used for time series machine learning tasks including classification, regression, clustering, forecasting, anomaly detection, segmentation, and similarity search. Use when working with temporal data, sequential patterns, or time-indexed observations requiring specialized algorithms beyond standard ML approaches. Particularly suited for univariate and multivariate time series analysis with scikit-learn compatible APIs.

19k tokens

How to use it

Copy the folder

Take posthog/extending-personhog-test-harness from the repository into ~/.claude/skills for personal use, or into .claude/skills inside a project.

Check the name does not clash

The agent identifies a skill by the name field in its header. Two skills with the same name cannot sit side by side — one of them will be ignored.