/platform-tests-investigate-and-fix:measure-flakinessfrom platform-tests-investigate-and-fix
Re-runs a failing Apify Actor run in parallel to measure flakiness rate before filing a bug issue. Helps determine if a failure is frequent, infrequent, or rare.
Ships in platform-tests-investigate-and-fix. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Use this only when both are true:
The Apify API token is in the TESTER_APIFY_TOKEN environment variable. It is always set, so there's no need to check for it.
From the failing run (the run the failed test started; its link is in the test log), get the Actor ID, build number, memory, timeout and input. For example, you can get the first four from GET https://api.apify.com/v2/actor-runs/{runId}.
Decide how to tell whether a finished run hit the same failure. Check what the failed test assertion checked — e.g. the run's status, its dataset item count against the expected minimum, a field missing from items, a log line.
Start runs of the same Actor at once, with the same build, memory, timeout and input. For example, you can start each with POST https://api.apify.com/v2/acts/{actorId}/runs. If a run can't start because the account's memory limit is reached, start it once earlier runs finish.
Alongside the test's exact input, if the need arises, you can also run other inputs when the bug isn't directly related to what the test checks, to get a better picture of how often it happens. E.g. if the test scrapes a list page, and the investigation showed that one specific item failed to be scraped while others were fine, likely because of the detail page parser, you can also scrape that item's direct URL. Its rate might be more characteristic of the bug: the list page's content keeps changing, so its reproduction might fail in only a few % of runs, while the direct URL's might fail in closer to 100%.
Decide on your own how many runs you need, up to !echo "$MAX_FLAKINESS_RUNS" in total. The point isn't a statistically significant rate, but a rough idea of whether the failure is frequent, infrequent or a once-in-a-lifetime event. For example:
Wait until every run has finished, then apply the check from step 2 to each. If there were no or almost no reproductions and you can't tell yet how often the failure happens, start more runs and check them the same way, but up to !echo "$MAX_FLAKINESS_RUNS" in total.
Add a short ## Flakiness section to the issue, right after the Summary:
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
Other plugins' skills for the same job
npx claudepluginhub apify/apify-test-tools --plugin platform-tests-investigate-and-fix2 skills in this plugin