migrate-harness-tests-to-state-transition-test

migrate-harness-tests-to-state-transition-test is a skill for Claude Code, Codex from canonical/copilot-collections. It costs 49 tokens per session (1,586 once invoked), scanned A, original, Apache-2.0.

A migration guide for Juju charm tests that replaces the older Harness testing style with state-transition tests. Juju is a system for deploying and managing applications, and charms are its deployment packages.

In plain words
What is it for?
Use it to find Harness-based tests, model relations and other state explicitly, update dependencies, and preserve continuous-integration checks during the migration.
Why use it?
It helps tests match how Juju actually emits events while removing testing APIs that newer versions no longer support.

Skill for Claude CodeCodex ✓ vendor

Written for no agent in particular: nothing here depends on one.

Good fit Use it to find Harness-based tests, model relations and other state explicitly, update dependencies, and preserve continuous-integration checks during the migration.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/canonical/copilot-collections/migrate-harness-tests-to-state-transition-test
About the project

Canonical Copilot Collections is a repository for organizing and distributing GitHub Copilot instructions, prompts, agents, and skills across Canonical repositories. Teams configure repositories to subscribe to shared collections, such as Python, documentation, or Juju development guidance, and keep those assets synchronized.

canonical/copilot-collections · 29 stars · on GitHub

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add canonical/copilot-collections --skill migrate-harness-tests-to-state-transition-test
Clone the repo
git clone --depth 1 https://github.com/canonical/copilot-collections

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for migrate-harness-tests-to-state-transition-test

README.md
[![agentmods](https://agentmods.dev/badge/skills/canonical/copilot-collections/migrate-harness-tests-to-state-transition-test/github.svg)](https://agentmods.dev/skills/canonical/copilot-collections/migrate-harness-tests-to-state-transition-test)
Your own site
<a href="https://agentmods.dev/skills/canonical/copilot-collections/migrate-harness-tests-to-state-transition-test"><img src="https://agentmods.dev/badge/skills/canonical/copilot-collections/migrate-harness-tests-to-state-transition-test/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for migrate-harness-tests-to-state-transition-test

Your own site · 80×15
<a href="https://agentmods.dev/skills/canonical/copilot-collections/migrate-harness-tests-to-state-transition-test"><img src="https://agentmods.dev/badge/skills/canonical/copilot-collections/migrate-harness-tests-to-state-transition-test.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 49 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,586 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00049 $0.01586
Opus 5 $0.00024 $0.00793
Sonnet 5 $0.00010 $0.00317
Haiku 4.5 $0.00005 $0.00159

Measured 11d ago against content hash 0222b035fa4f, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

migrate-harness-tests-to-state-transition-test scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 11d ago.

The scan reads SKILL.md. This mod also ships 1 executable file (scripts/find_harness_tests.py), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/migrate-harness-tests-to-state-transition-test/SKILL.md · 86 lines

How it starts

The opening of the file, as written. The whole thing — 86 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Migrate Harness Tests To State Transition Test

Overview

Guide charm maintainers through replacing deprecated Harness-based unit tests with deterministic state-transition tests that mirror how Juju actually fires events. Use this skill whenever a test still instantiates testing.Harness or chains multiple events inside one fixture.

When To Use

  • ops.testing.Harness (or Scenario Harness helpers) still appear in tests or fixtures.
  • Migration requires modeling relations, containers, secrets, or actions with testing.State.
  • CI must stay green while Harness-only helpers (add_relation, evaluate_status, etc.) are removed.

Preflight Checks

  • Inspect pyproject.toml (or requirements files) before touching code; ensure ops[testing] is present in every dependency group that executes Scenario/state-transition tests. Remove legacy ops-scenario if it lingers.
  • Match the repo’s package manager: use uv add --group unit ops[testing] (and mirror across groups) when [tool.uv] or uv.lock exists; otherwise edit the appropriate requirements.txt, Poetry group, etc.
  • After dependency edits, re-sync the exact groups you touched (uv sync --group unit --group lint, poetry install, etc.) so the virtualenv contains Scenario Context.
  • Re-run the project’s bootstrap entrypoint (uv sync, pip install -r requirements.txt, make setup, …) to align local + CI execution before rewriting tests.

Mandatory Plan & Ledger

Create a written task list before editing files and keep it updated:

  1. Record the migration goal (e.g., "Drop Harness from tests/unit/test_charm.py") plus all files involved.
  2. Add explicit tasks for every preflight requirement: dependency inspection, disposable venv creation, environment sync commands, bootstrap targets.
  3. Inventory Harness usage with the detector script, note each file’s assertions, and migrate files one by one in ledger order.
  4. Pair every code-change task with an immediate verification task (targeted pytest/tox command). Log the command, exit code, and timestamp when marking done.
  5. If a command fails, append remediation + re-run tasks; do not advance to the next file until the paired verification succeeds.

Read the full file on GitHub · 86 lines

Files

What ships with it

3 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 11d ago First seen · 86 lines · 49 tokens per session scan A 0222b035fa4f

Subscribe to this mod's changes

migrate-harness-tests-to-state-transition-test is a skill published in the GitHub repository canonical/copilot-collections (29 stars, last pushed 9d ago), licensed Apache-2.0. It adds 49 tokens to every session and 1,586 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.