mcpbeat Sign in

Pysa Integration Tests Agent Skill

Use when running, debugging, updating, or creating Pysa end-to-end integration tests. Use when taint analysis tests fail, when expected output files need updating, or when working with .models, .cg, .hofcg, .overrides files under `source/interprocedural_analyses/taint/test/integration`.

1k tokens
context cost
the whole folder, loaded on every use
1
files
instructions only
0
copies elsewhere
how many repositories repackaged it
7170
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/facebook/pyre-check --skill pysa-integration-tests

The instruction itself

9 sections, as written by the author

Pysa Integration Tests

Overview

End-to-end integration tests for the Pysa taint analysis engine. Each test is a .py file under source/interprocedural_analyses/taint/test/integration/. Tests run the full taint analysis pipeline and compare output against expected files.

Running Tests

All commands must be run from the source/ directory.

cd source

# Run ALL tests (parallelized with 16 shards)
OUNIT_SHARDS=16 dune exec interprocedural_analyses/taint/test/integrationTest.exe

# Run a SINGLE test (e.g., format.py)
PYSA_INTEGRATION_TEST=format.py dune exec interprocedural_analyses/taint/test/integrationTest.exe

With Pyrefly Frontend

After running ./facebook/scripts/setup.sh --local, Pyrefly is the default backend — tests use source/pyrefly.exe automatically. To override with a custom binary:

PYREFLY_BINARY=<path-to-binary> PYSA_INTEGRATION_TEST=format.py dune exec interprocedural_analyses/taint/test/integrationTest.exe

Test File Structure

Each test <name>.py may have these companion files:

| File | Required | Purpose |

|------|----------|---------|

| <name>.py | Yes | Python source code to analyze |

| <name>.py.pysa | No | Pysa model file: declares sources, sinks, TITO |

| <name>.py.config | No | Taint configuration: rules, sources, sinks, options |

| <name>.py.models | Yes | Expected output: taint models and issues (JSON) |

| <name>.py.cg | Yes | Expected output: call graph |

| <name>.py.hofcg | Yes | Expected output: higher-order call graph |

| <name>.py.overrides | Yes | Expected output: override graph |

| <name>.py.pyrefly.models | No | Expected Pyrefly output: models |

| <name>.py.pyrefly.cg | No | Expected Pyrefly output: call graph |

| <name>.py.pyrefly.hofcg | No | Expected Pyrefly output: higher-order call graph |

| <name>.py.pyrefly.overrides | No | Expected Pyrefly output: overrides |

Default models: When no .pysa and no .config file is present, the test runner automatically provides default test models (_test_sink, _test_source, etc.). When either file is present, the test must be self-contained.

Debugging Test Failures

When a test fails because expected output doesn't match:

  • The test runner prints a diff (may be truncated for large diffs)
  • It creates .actual files for each mismatched output (e.g., format.py.models.actual)
  • Use diff to compare expected vs actual:
diff source/interprocedural_analyses/taint/test/integration/format.py.models \
     source/interprocedural_analyses/taint/test/integration/format.py.models.actual

If the test fails with type errors or analysis errors (not output mismatches), the issue is in the Python source or model definitions.

Updating Expected Files

If the output changes are expected (e.g., you intentionally changed the analysis):

# Automatically moves all .actual files to their expected counterparts
facebook/scripts/in_path/pysa-update-expected

This replaces each <name>.py.<ext> with the corresponding <name>.py.<ext>.actual.

Always review the diff before updating — run sl diff after updating to verify changes are intentional.

Creating a New Test

  • Create <name>.py under source/interprocedural_analyses/taint/test/integration/
  • Optionally create <name>.py.pysa (model file) and/or <name>.py.config (taint config)
  • Run the test — the runner auto-creates missing expected output files on the first run:
PYSA_INTEGRATION_TEST=<name>.py dune exec interprocedural_analyses/taint/test/integrationTest.exe
  • Review the generated .models, .cg, .hofcg, .overrides files
  • Commit all files together

Common Mistakes

  • Wrong env var name: It's PYSA_INTEGRATION_TEST, not PYSA_TEST or similar
  • Forgetting the .py extension: Use PYSA_INTEGRATION_TEST=format.py, not format
  • Running from wrong directory: dune exec must be run from source/
  • Guessing OUnit flags: Don't use -- format to filter tests; use the PYSA_INTEGRATION_TEST env var
  • Manually editing expected files: Use pysa-update-expected instead; expected files are @generated
  • Forgetting OUNIT_SHARDS: Running all tests without OUNIT_SHARDS=16 is much slower

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 facebook/pysa-integration-tests 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.