Test Amplification Skill
When to Use
- A pygraphistry feature area is stable enough to use but still yields recurring bugs.
- You need to grow tests from evidence, not random additions.
- You want reusable patterns that apply beyond one subsystem (for example, beyond GFQL).
Goal
Turn historical and newly found bugs into:
- A reusable bug taxonomy.
- Prioritized concrete test tasks.
- Implemented tests (plus minimal fixes when needed).
- Clear validation evidence and checkpoint commits.
Required Inputs
- Current branch context.
- Target feature area(s).
- Existing test locations for those areas.
- Safety constraints (for example: pure vectorized path, pandas+cudf compatibility, remote protocol constraints).
Multi-Round Artifact Rules (Required)
This workflow is usually iterative. Keep artifacts cleanly separated by round, plus cumulative rollups.
Round IDs
- Use zero-padded round IDs:
round-001, round-002, ...
- Keep a stable task root:
Round-Scoped Artifacts
Per round, write under:
plans/<task>/rounds/round-00N/
Recommended files:
user_testing_playbook.md
feature-risk-analysis.md
discovery-matrix.md
bug-retro-5whys.md
taxonomy-and-task-plan.md
execution-report.md
metrics.md
Cumulative Artifacts
Maintain cumulative rollups under:
Recommended files:
feature-risk-analysis-cumulative.md
bug-retro-5whys-cumulative.md
taxonomy-cumulative.md
round-metrics-ledger.md
continue-or-halt-log.md
Naming Conventions
- Prefer deterministic names inside round folders (no random suffixes).
- If date is needed, use ISO format:
YYYY-MM-DD.
- Every round must update:
- one round-scoped
metrics.md
- cumulative
round-metrics-ledger.md
- cumulative
continue-or-halt-log.md
Parallel Subagent Protocol (Recommended When Available)
If parallel subagents are available (for example, Claude workers), use them with fixed artifact locations so work is crash-resumable.
Round folder layout for parallel work
Under each round:
plans/<task>/rounds/round-00N/findings/
plans/<task>/rounds/round-00N/findings/agent-01/
plans/<task>/rounds/round-00N/findings/agent-02/
plans/<task>/rounds/round-00N/findings/agent-03/
plans/<task>/rounds/round-00N/merge/
Required per-agent files:
task.md (assigned scope and constraints)
findings.md (bugs, repros, evidence)
proposed-tests.md (concrete test additions)
status.json (machine-readable state: in_progress|done|blocked)
Required merge files:
merge/triage.md (dedupe + severity + priority)
merge/final-task-plan.md (selected tasks for implementation)
Assignment strategy
- Assign non-overlapping subsystems per agent (for example: remote/auth, connectors, compute, policy).
- Give each agent the same required scorecard format.
- Merge only after all
status.json files are done or explicitly blocked.
Core Workflow
0) User-Workflow Exploration (Required)
Use a user-testing exploration pass before adding tests.
Build 3-5 representative user stories from the feature area. For each story capture:
- workflow steps users run,
- expected outcomes,
- likely friction points,
- representative test files,
- likely bug classes.
Artifact:
AI_PROGRESS/<task>/user_testing_playbook.md
1) Feature Surface Inventory
Inventory what changed (or is risky) in this area:
- API/AST surface
- runtime/executor/evaluator paths
- validator/schema scanning paths
- transport/session/metadata paths (if remote)
- existing tests and known blind spots
Artifact:
plans/<task>/feature-risk-analysis-<date>.md
2) Discovery Matrix
Run a small probe matrix that compares:
- validator accept/reject,
- runtime behavior,
- expected semantics.
Prioritize mismatches:
- validator accepts + runtime fails,
- validator rejects + runtime supports,
- runtime succeeds with wrong semantics.
3) 5-Whys Per Bug Class
For each bug class, record:
- Symptom
- How found
- Why #1..#5
- Why prior tests missed it
- Root cause family
Artifact:
plans/<task>/bug-retro-5whys-<date>.md
4) Derive Abstract Taxonomy
Convert bug roots into reusable categories. Typical categories:
- precedence/token boundary issues,
- lexical scanning/quote-awareness issues,
- validator/runtime parity drift,
- schema inference lexical issues,
- capability-shape failfast gaps,
- null/empty semantic gaps,
- state/session lifecycle issues,
- remote metadata hydration/transport contract issues.
5) Convert to Concrete Tasks
For each category define concrete tests:
- exact file(s),
- test names,
- expected behavior,
- whether minimal fix is expected.
Prefer colocated tests in existing subsystem files.
6) Implement Tests + Minimal Fixes
Rules:
- Prefer red->green (add test, then fix).
- Keep fixes narrowly scoped to test-driven findings.
- No broad refactors during amplification phases.
7) DRY Pass
Before final validation:
- remove duplication in new tests,
- keep readability high,
- avoid helper sprawl.
8) Safety Gates (Required)
Run and record outputs.
Baseline static gates:
python -m py_compile <touched_files>
ruff check <touched_files>
mypy --ignore-missing-imports --follow-imports=skip --explicit-package-bases <touched_files>
Focused tests:
PYTHONPATH=. pytest -q <focused_test_files>
Broad sanity (env-available):
PYTHONPATH=. pytest -q <broader_test_set>
Best-effort backend parity (if applicable):
PYTHONPATH=. pytest -q <tests> -k cudf
9) Round Scorecard + Continue/Halt Decision (Required)
Each round must publish a scorecard and an operator-facing decision note.
Required scorecard fields:
tests_added (new test cases)
tests_modified (existing tests changed)
new_bug_classes_found
new_bug_instances_found
bug_instances_fixed
bug_instances_open (found - fixed)
bug_fix_rate_pct = fixed / found * 100 (if found > 0)
new_bug_class_fix_rate_pct = classes_fixed / classes_found * 100 (if classes_found > 0)
tests_per_fix = tests_added / max(fixed, 1)
focus_gate_pass (yes/no)
broad_gate_pass (yes/no/partial + env gaps)
Decision note must include:
continue or halt
- one-paragraph rationale based on marginal ROI trend
- explicit next highest-ROI bug classes if continuing
Important:
- This is a required decision record, not a forced halt.
- If the operator/user asked for multiple rounds, choose
continue unless there is a blocker or clear diminishing-return stop condition.
halt should be used when:
- explicit user directive to stop,
- no actionable high-ROI targets remain,
- hard blocker prevents meaningful progress.
10) Checkpointing + Plan Update
After gates pass:
git add <touched_files>
git commit -m "phase-<id>: <short amplification summary>"
Update plan with:
- commands run,
- outputs,
- commit hash,
- env gaps.
- round scorecard values,
- continue/halt decision.
Domain Packs (PyGraphistry-Specific)
Use the pack(s) matching the work area.
A) Visualization/Upload/Render
Representative files:
graphistry/tests/test_plotter.py
graphistry/tests/test_arrow_uploader.py
graphistry/tests/render/test_resolve_render_mode.py
graphistry/tests/test_dataset_id_invalidation.py
Bug styles:
- encoding metadata loss,
- dtype coercion regressions,
- dataset lifecycle invalidation bugs.
Useful test styles:
- metadata round-trip,
- dtype matrix tests,
- lifecycle mutation/invalidation tests.
B) Remote/Auth/Session/Trace
Representative files:
graphistry/tests/test_chain_remote_auth.py
graphistry/tests/test_gfql_remote_metadata.py
graphistry/tests/test_gfql_remote_persistence.py
graphistry/tests/test_trace_headers_behavior.py
graphistry/tests/test_certificate_validation_session.py
Bug styles:
- token/session leakage across clients,
- metadata hydration mismatches,
- missing trace/cert propagation.
Useful test styles:
- request contract assertions,
- multi-client isolation tests,
- hydration parity tests.
C) Connectors/Ingestion
Representative files:
graphistry/tests/test_kusto.py
graphistry/tests/test_spanner.py
graphistry/tests/test_gremlin.py
graphistry/tests/test_tigergraph.py
graphistry/tests/test_nodexl.py
graphistry/tests/test_gexf.py
Bug styles:
- return-shape ambiguity (single vs multiple tables),
- dynamic column flattening drift,
- credential/no-credential path regressions.
Useful test styles:
- mocked connector contracts,
- optional live credential smoke tests,
- malformed payload tests.
D) Graph Compute (Hop/Chain/GFQL)
Representative files:
graphistry/tests/compute/test_hop.py
graphistry/tests/compute/test_chain.py
graphistry/tests/compute/test_call_operations.py
graphistry/tests/compute/gfql/test_row_pipeline_ops.py
Bug styles:
- precedence/parser boundary bugs,
- validator/runtime parity drift,
- backend parity divergence.
Useful test styles:
- semantic operator matrix,
- validator/runtime parity table,
- pandas baseline + cudf best-effort checks.
E) Policy/Governance Hooks
Representative files:
graphistry/tests/test_policy_*.py
graphistry/tests/test_policy_integration.py
graphistry/tests/compute/gfql/test_policy_shortcuts.py
Bug styles:
- phase ordering regressions,
- closure state leakage,
- exception contract drift.
Useful test styles:
- phase-state transition tests,
- negative-path policy exception tests,
- cross-operation coverage matrix.
F) Layouts/Plugins/Optional Deps
Representative files:
graphistry/tests/layout/*
graphistry/tests/plugins/*
graphistry/tests/test_layout.py
Bug styles:
- optional-dependency behavior drift,
- plugin fallback failures,
- algorithm-specific edge-case regressions.
Useful test styles:
- conditional import/fallback tests,
- deterministic small-graph golden tests,
- edge-case topology fixtures.
Plan Phase Skeleton
Use this in plan.md:
### Phase X.Y: Test Amplification Cycle
**Status:** 🔄 IN_PROGRESS
#### X.Y.1 User-workflow exploration
#### X.Y.2 Feature/risk inventory
#### X.Y.3 Discovery matrix
#### X.Y.4 5-Whys capture
#### X.Y.5 Taxonomy derivation
#### X.Y.6 Concrete task plan
#### X.Y.7 Implement tests (+minimal fixes)
#### X.Y.8 DRY pass
#### X.Y.9 Validation
#### X.Y.10 Round scorecard + continue/halt decision
#### X.Y.11 Checkpoint
Round Scorecard Template
Use this in plans/<task>/rounds/round-00N/metrics.md:
# Round 00N Metrics
- tests_added:
- tests_modified:
- new_bug_classes_found:
- new_bug_instances_found:
- bug_instances_fixed:
- bug_instances_open:
- bug_fix_rate_pct:
- new_bug_class_fix_rate_pct:
- tests_per_fix:
- focus_gate_pass:
- broad_gate_pass:
- env_gaps:
## Continue/Halt
- decision: continue | halt
- rationale:
- next_targets:
Anti-Patterns
- Jumping directly into test writing without bug-class derivation.
- Validator-only checks or runtime-only checks without parity coverage.
- Over-generalized guidance with no concrete files/patterns.
- Large refactors during an amplification pass.
Done Criteria
- User-workflow exploration artifact exists.
- Feature/risk + 5-Whys artifacts exist (round + cumulative).
- Taxonomy -> concrete tasks mapping documented.
- New high-ROI tests landed (minimal fixes only as needed).
- Focused/broad gates pass or env limitations are clearly documented.
- Round scorecard and continue/halt decision are recorded.
- Plan and commit checkpoints are updated.
1---2name: test-amplification3description: Methodical bug-driven test amplification for pygraphistry features. Use when hardening a feature area via user-workflow exploration, 5-Whys retrospectives, bug-taxonomy derivation, concrete test planning, implementation, and safety-gated validation.4---56# Test Amplification Skill78## When to Use910- A pygraphistry feature area is stable enough to use but still yields recurring bugs.11- You need to grow tests from evidence, not random additions.12- You want reusable patterns that apply beyond one subsystem (for example, beyond GFQL).1314## Goal1516Turn historical and newly found bugs into:171. A reusable bug taxonomy.182. Prioritized concrete test tasks.193. Implemented tests (plus minimal fixes when needed).204. Clear validation evidence and checkpoint commits.2122## Required Inputs2324- Current branch context.25- Target feature area(s).26- Existing test locations for those areas.27- Safety constraints (for example: pure vectorized path, pandas+cudf compatibility, remote protocol constraints).2829## Multi-Round Artifact Rules (Required)3031This workflow is usually iterative. Keep artifacts cleanly separated by round, plus cumulative rollups.3233### Round IDs3435- Use zero-padded round IDs: `round-001`, `round-002`, ...36- Keep a stable task root:37 - `plans/<task>/`3839### Round-Scoped Artifacts4041Per round, write under:42- `plans/<task>/rounds/round-00N/`4344Recommended files:45- `user_testing_playbook.md`46- `feature-risk-analysis.md`47- `discovery-matrix.md`48- `bug-retro-5whys.md`49- `taxonomy-and-task-plan.md`50- `execution-report.md`51- `metrics.md`5253### Cumulative Artifacts5455Maintain cumulative rollups under:56- `plans/<task>/cumulative/`5758Recommended files:59- `feature-risk-analysis-cumulative.md`60- `bug-retro-5whys-cumulative.md`61- `taxonomy-cumulative.md`62- `round-metrics-ledger.md`63- `continue-or-halt-log.md`6465### Naming Conventions6667- Prefer deterministic names inside round folders (no random suffixes).68- If date is needed, use ISO format: `YYYY-MM-DD`.69- Every round must update:70 1. one round-scoped `metrics.md`71 2. cumulative `round-metrics-ledger.md`72 3. cumulative `continue-or-halt-log.md`7374## Parallel Subagent Protocol (Recommended When Available)7576If parallel subagents are available (for example, Claude workers), use them with fixed artifact locations so work is crash-resumable.7778### Round folder layout for parallel work7980Under each round:81- `plans/<task>/rounds/round-00N/findings/`82- `plans/<task>/rounds/round-00N/findings/agent-01/`83- `plans/<task>/rounds/round-00N/findings/agent-02/`84- `plans/<task>/rounds/round-00N/findings/agent-03/`85- `plans/<task>/rounds/round-00N/merge/`8687Required per-agent files:88- `task.md` (assigned scope and constraints)89- `findings.md` (bugs, repros, evidence)90- `proposed-tests.md` (concrete test additions)91- `status.json` (machine-readable state: `in_progress|done|blocked`)9293Required merge files:94- `merge/triage.md` (dedupe + severity + priority)95- `merge/final-task-plan.md` (selected tasks for implementation)9697### Assignment strategy9899- Assign non-overlapping subsystems per agent (for example: remote/auth, connectors, compute, policy).100- Give each agent the same required scorecard format.101- Merge only after all `status.json` files are `done` or explicitly `blocked`.102103## Core Workflow104105### 0) User-Workflow Exploration (Required)106107Use a user-testing exploration pass before adding tests.108109Build 3-5 representative user stories from the feature area. For each story capture:110- workflow steps users run,111- expected outcomes,112- likely friction points,113- representative test files,114- likely bug classes.115116Artifact:117- `AI_PROGRESS/<task>/user_testing_playbook.md`118119### 1) Feature Surface Inventory120121Inventory what changed (or is risky) in this area:122- API/AST surface123- runtime/executor/evaluator paths124- validator/schema scanning paths125- transport/session/metadata paths (if remote)126- existing tests and known blind spots127128Artifact:129- `plans/<task>/feature-risk-analysis-<date>.md`130131### 2) Discovery Matrix132133Run a small probe matrix that compares:134- validator accept/reject,135- runtime behavior,136- expected semantics.137138Prioritize mismatches:139- validator accepts + runtime fails,140- validator rejects + runtime supports,141- runtime succeeds with wrong semantics.142143### 3) 5-Whys Per Bug Class144145For each bug class, record:146- Symptom147- How found148- Why #1..#5149- Why prior tests missed it150- Root cause family151152Artifact:153- `plans/<task>/bug-retro-5whys-<date>.md`154155### 4) Derive Abstract Taxonomy156157Convert bug roots into reusable categories. Typical categories:158- precedence/token boundary issues,159- lexical scanning/quote-awareness issues,160- validator/runtime parity drift,161- schema inference lexical issues,162- capability-shape failfast gaps,163- null/empty semantic gaps,164- state/session lifecycle issues,165- remote metadata hydration/transport contract issues.166167### 5) Convert to Concrete Tasks168169For each category define concrete tests:170- exact file(s),171- test names,172- expected behavior,173- whether minimal fix is expected.174175Prefer colocated tests in existing subsystem files.176177### 6) Implement Tests + Minimal Fixes178179Rules:180- Prefer red->green (add test, then fix).181- Keep fixes narrowly scoped to test-driven findings.182- No broad refactors during amplification phases.183184### 7) DRY Pass185186Before final validation:187- remove duplication in new tests,188- keep readability high,189- avoid helper sprawl.190191### 8) Safety Gates (Required)192193Run and record outputs.194195Baseline static gates:196```bash197python -m py_compile <touched_files>198ruff check <touched_files>199mypy --ignore-missing-imports --follow-imports=skip --explicit-package-bases <touched_files>200```201202Focused tests:203```bash204PYTHONPATH=. pytest -q <focused_test_files>205```206207Broad sanity (env-available):208```bash209PYTHONPATH=. pytest -q <broader_test_set>210```211212Best-effort backend parity (if applicable):213```bash214PYTHONPATH=. pytest -q <tests> -k cudf215```216217### 9) Round Scorecard + Continue/Halt Decision (Required)218219Each round must publish a scorecard and an operator-facing decision note.220221Required scorecard fields:222- `tests_added` (new test cases)223- `tests_modified` (existing tests changed)224- `new_bug_classes_found`225- `new_bug_instances_found`226- `bug_instances_fixed`227- `bug_instances_open` (found - fixed)228- `bug_fix_rate_pct` = `fixed / found * 100` (if found > 0)229- `new_bug_class_fix_rate_pct` = `classes_fixed / classes_found * 100` (if classes_found > 0)230- `tests_per_fix` = `tests_added / max(fixed, 1)`231- `focus_gate_pass` (yes/no)232- `broad_gate_pass` (yes/no/partial + env gaps)233234Decision note must include:235- `continue` or `halt`236- one-paragraph rationale based on marginal ROI trend237- explicit next highest-ROI bug classes if continuing238239Important:240- This is a **required decision record**, not a forced halt.241- If the operator/user asked for multiple rounds, choose `continue` unless there is a blocker or clear diminishing-return stop condition.242- `halt` should be used when:243 - explicit user directive to stop,244 - no actionable high-ROI targets remain,245 - hard blocker prevents meaningful progress.246247### 10) Checkpointing + Plan Update248249After gates pass:250```bash251git add <touched_files>252git commit -m "phase-<id>: <short amplification summary>"253```254255Update plan with:256- commands run,257- outputs,258- commit hash,259- env gaps.260- round scorecard values,261- continue/halt decision.262263## Domain Packs (PyGraphistry-Specific)264265Use the pack(s) matching the work area.266267### A) Visualization/Upload/Render268Representative files:269- `graphistry/tests/test_plotter.py`270- `graphistry/tests/test_arrow_uploader.py`271- `graphistry/tests/render/test_resolve_render_mode.py`272- `graphistry/tests/test_dataset_id_invalidation.py`273274Bug styles:275- encoding metadata loss,276- dtype coercion regressions,277- dataset lifecycle invalidation bugs.278279Useful test styles:280- metadata round-trip,281- dtype matrix tests,282- lifecycle mutation/invalidation tests.283284### B) Remote/Auth/Session/Trace285Representative files:286- `graphistry/tests/test_chain_remote_auth.py`287- `graphistry/tests/test_gfql_remote_metadata.py`288- `graphistry/tests/test_gfql_remote_persistence.py`289- `graphistry/tests/test_trace_headers_behavior.py`290- `graphistry/tests/test_certificate_validation_session.py`291292Bug styles:293- token/session leakage across clients,294- metadata hydration mismatches,295- missing trace/cert propagation.296297Useful test styles:298- request contract assertions,299- multi-client isolation tests,300- hydration parity tests.301302### C) Connectors/Ingestion303Representative files:304- `graphistry/tests/test_kusto.py`305- `graphistry/tests/test_spanner.py`306- `graphistry/tests/test_gremlin.py`307- `graphistry/tests/test_tigergraph.py`308- `graphistry/tests/test_nodexl.py`309- `graphistry/tests/test_gexf.py`310311Bug styles:312- return-shape ambiguity (single vs multiple tables),313- dynamic column flattening drift,314- credential/no-credential path regressions.315316Useful test styles:317- mocked connector contracts,318- optional live credential smoke tests,319- malformed payload tests.320321### D) Graph Compute (Hop/Chain/GFQL)322Representative files:323- `graphistry/tests/compute/test_hop.py`324- `graphistry/tests/compute/test_chain.py`325- `graphistry/tests/compute/test_call_operations.py`326- `graphistry/tests/compute/gfql/test_row_pipeline_ops.py`327328Bug styles:329- precedence/parser boundary bugs,330- validator/runtime parity drift,331- backend parity divergence.332333Useful test styles:334- semantic operator matrix,335- validator/runtime parity table,336- pandas baseline + cudf best-effort checks.337338### E) Policy/Governance Hooks339Representative files:340- `graphistry/tests/test_policy_*.py`341- `graphistry/tests/test_policy_integration.py`342- `graphistry/tests/compute/gfql/test_policy_shortcuts.py`343344Bug styles:345- phase ordering regressions,346- closure state leakage,347- exception contract drift.348349Useful test styles:350- phase-state transition tests,351- negative-path policy exception tests,352- cross-operation coverage matrix.353354### F) Layouts/Plugins/Optional Deps355Representative files:356- `graphistry/tests/layout/*`357- `graphistry/tests/plugins/*`358- `graphistry/tests/test_layout.py`359360Bug styles:361- optional-dependency behavior drift,362- plugin fallback failures,363- algorithm-specific edge-case regressions.364365Useful test styles:366- conditional import/fallback tests,367- deterministic small-graph golden tests,368- edge-case topology fixtures.369370## Plan Phase Skeleton371372Use this in `plan.md`:373374```markdown375### Phase X.Y: Test Amplification Cycle376**Status:** 🔄 IN_PROGRESS377378#### X.Y.1 User-workflow exploration379#### X.Y.2 Feature/risk inventory380#### X.Y.3 Discovery matrix381#### X.Y.4 5-Whys capture382#### X.Y.5 Taxonomy derivation383#### X.Y.6 Concrete task plan384#### X.Y.7 Implement tests (+minimal fixes)385#### X.Y.8 DRY pass386#### X.Y.9 Validation387#### X.Y.10 Round scorecard + continue/halt decision388#### X.Y.11 Checkpoint389```390391## Round Scorecard Template392393Use this in `plans/<task>/rounds/round-00N/metrics.md`:394395```markdown396# Round 00N Metrics397398- tests_added:399- tests_modified:400- new_bug_classes_found:401- new_bug_instances_found:402- bug_instances_fixed:403- bug_instances_open:404- bug_fix_rate_pct:405- new_bug_class_fix_rate_pct:406- tests_per_fix:407- focus_gate_pass:408- broad_gate_pass:409- env_gaps:410411## Continue/Halt412- decision: continue | halt413- rationale:414- next_targets:415```416417## Anti-Patterns418419- Jumping directly into test writing without bug-class derivation.420- Validator-only checks or runtime-only checks without parity coverage.421- Over-generalized guidance with no concrete files/patterns.422- Large refactors during an amplification pass.423424## Done Criteria425426- User-workflow exploration artifact exists.427- Feature/risk + 5-Whys artifacts exist (round + cumulative).428- Taxonomy -> concrete tasks mapping documented.429- New high-ROI tests landed (minimal fixes only as needed).430- Focused/broad gates pass or env limitations are clearly documented.431- Round scorecard and continue/halt decision are recorded.432- Plan and commit checkpoints are updated.