en un clic
analyses-snapshot-testing
// Conventions for the analyses snapshot testing framework in analyses-snapshot-testing/. Use when working with protocol analysis snapshots, adding protocols, updating snapshots, or running snapshot tests.
// Conventions for the analyses snapshot testing framework in analyses-snapshot-testing/. Use when working with protocol analysis snapshots, adding protocols, updating snapshots, or running snapshot tests.
CSS Modules conventions, Stylelint rules, design tokens (spacing, colors, typography, border-radius), and patterns for the Opentrons monorepo. Use when working with .module.css files or styling React components in app/, components/, protocol-visualization/, protocol-designer/, or other JS packages.
Vite demo and Playwright + Applitools tests for packed @opentrons JS packages in js-package-testing/. Covers components, shared-data, step-generation, and protocol-visualization. Use for integration testing, package linking, or visual testing.
TypeScript conventions, React patterns, testing, styling, and import rules for the Opentrons monorepo JS/TS packages. Use when working with TypeScript or React files in app/, components/, shared-data/, step-generation/, protocol-designer/, protocol-visualization/, opentrons-ai-client/, or other JS/TS packages.
Protocol Designer (PD) application architecture, Redux slices, step/timeline system, domain concepts, and dev workflow. Use when working with files in protocol-designer/ or discussing PD features, steps, timelines, or protocol design.
Component creation checklist and ai-client-specific patterns for React .tsx files in opentrons-ai-client/ and protocol-designer/. Use when creating new React components in these packages.
Conventions for the opentrons-ai-client React/TypeScript frontend — project structure, API integration, state management (Jotai), feature flags, types, and testing. Use when working with files in opentrons-ai-client/ or discussing the AI client application.
| name | analyses-snapshot-testing |
| description | Conventions for the analyses snapshot testing framework in analyses-snapshot-testing/. Use when working with protocol analysis snapshots, adding protocols, updating snapshots, or running snapshot tests. |
The analyses-snapshot-testing directory validates that protocol analysis output remains consistent across code changes by comparing JSON results against committed snapshots.
files/protocols/) — testing protocols organized by source (standard, Protocol Designer exports, Protocol Library imports, generators)automation/analyze.py) — runs protocol analysis in subprocess, 120-second timeout, JSON outputtests/__snapshots__/) — committed JSON snapshots managed by syrupy with custom JSON extensiontests/) — analyses_snapshot_test.py (main), audit_snapshot_test.py (audit), custom_json_snapshot_extension.py (serialization)automation/audit_snapshots.py) — validates snapshots: Flex_S protocols must have zero errors; non-Flex (i.e., OT2) protocols are expected to have errorsautomation/data/) — protocols.py (auto-generated), protocols_with_overrides.py (manual), protocol_registry.py (combined)citools/, .github/workflows/) — matrix-based parallel execution via Docker{Robot}_{Status}_{Version}_{Source}_{Pipettes}_{Modules}_{Overrides}\_{Description}
Flex (one legacy OT2 protocol is kept to verify it properly fails with an OT-2 compatibility error)S (Success) or X (Failure expected)v2_19) or PD (Protocol Designer)PL_ (Protocol Library) or MPL_ (Manual Protocol Library)P1000M_P50MGRIP, HS, MM, MB, TC, TMOverrides if protocol has parameter overridesExample: Flex_S_v2_19_P1000M_GRIP_HS_TM_MB_KAPALibraryQuant.py
files/protocols/ following naming conventionmake prep (auto-updates automation/data/protocols.py, displays snapshot command)make snapshot-test-update PROTOCOL_NAMES=YourProtocolName OVERRIDE_PROTOCOL_NAMES=noneprotocols.pyfiles/protocols/generators/automation/data/protocols_with_overrides.pymake snapshot-test-update PROTOCOL_NAMES=none OVERRIDE_PROTOCOL_NAMES=YourOverrideProtocolmake snapshot-test-update # All
make snapshot-test-update PROTOCOL_NAMES="P1,P2" OVERRIDE_PROTOCOL_NAMES=none # Specific
make snapshot-test # All (reduced verbosity)
make snapshot-test PROTOCOL_NAMES=Flex_S_v2_19_Example OVERRIDE_PROTOCOL_NAMES=none # Specific
uv run python -m pytest -k analyses_snapshot_test -vv --tb=short # Verbose debugging
api/, shared-data/)automation/data/protocols.py)make preptests/custom_json_snapshot_extension.py)replacement_patternsid_keys_to_replacePrerequisites: Python 3.10+, uv, Node.js/pnpm (for prettier)
cd analyses-snapshot-testing
make setup # Creates uv venv and installs dependencies
The setup script (bootstrap_uv_env.py) installs api and shared-data as editable packages so analysis uses local code.
# Setup
make setup # Initial environment setup
make teardown # Remove virtual environment
# Testing
make snapshot-test # Run all snapshot tests
make snapshot-test-update # Update all snapshots
make snapshot-audit-test # Validate snapshot audit metadata
# Protocol Management
make prep # Regenerate protocol registry
make generate-protocols # Generate override protocols
# Formatting
make format # Format Python + Markdown
make ruff # Format and lint Python
# CI Simulation
make gen-chunks # Generate protocol chunks
make analyze-chunk CHUNK=chunk_0.json # Analyze specific chunk
Workflow (analyses-snapshot-test.yaml) triggers on:
api/, shared-data/, or this directoryPR label gen-analyses-snapshot-pr auto-opens a PR with updated snapshots on failure.
make snapshot-test-update PROTOCOL_NAMES=...), fix code if notmake prep, verify file exists and follows naming conventionautomation/analyze.pymake setup, ensure uv is installed