Verification Loop¶
Note
Contributor Scope: This guide is for SDK contributors and maintainers
running pre-PR lint, static type-checking, and test gates locally. For
clinical Study schema validation, pre-live UAT checks, or 21 CFR Part 11
audit verification, see Data Dictionary Workflows and Rule Validation,
UAT Workflow Guide, and Audit Trails, 21 CFR Part 11 & Compliance Workflows.
Before proposing any code change, execute and pass all CI quality gates locally.
Read
.github/workflows/main.yml(thepre-commit,quality, andtestjobs) to identify the authoritative lint, format, type-check, and test commands.Run the full gate in order (contributors must execute
uvx pre-commit run --all-filesbefore opening pull requests):uvx pre-commit run --all-files hatch run ruff format --check . hatch run ruff check . hatch run typos --force-exclude . hatch run python -m imednet.models.engine --check hatch run python -m imednet.models.engine --typecheck hatch run mypy packages/core/src/imednet hatch run mypy packages/plugins-workflows/src/imednet_workflows hatch run mypy packages/providers-airflow/src/apache_airflow_providers_imednet hatch run mypy packages/plugins-sinks/src/imednet_sinks hatch run mypy packages/plugins-tui/src/imednet_tui hatch run mypy examples hatch run mypy tests/typing/endpoint_contracts.py hatch run pytest -q \ --cov=imednet \ --cov=imednet_workflows \ --cov=apache_airflow_providers_imednet \ --cov=imednet_sinks \ --cov=imednet_tui \ --cov-fail-under=90
Fix every reported error before marking a task complete. Re-run until the entire sequence exits 0.
Build documentation and confirm zero warnings:
hatch run docs
Canonical tasks¶
pyproject.toml defines hatch run verify-static (format, lint,
non-mutating typos --force-exclude . spell checking, ModelEngine
.pyi stub parity via python -m imednet.models.engine --check,
stub-free model body checking via python -m imednet.models.engine --typecheck,
and the typing targets), hatch run verify-tests (offline workspace tests and
90% coverage), hatch run docs (strict documentation checks), and
hatch run validate-package-consumption (isolated clean-venv wheel,
sdist archive inspection, clean-room sdist wheel rebuilds, tightened internal
Requires-Dist bounds, imednet.spi AST lower-bound and published plugin
tag compatibility, PEP 561 py.typed / mypy --strict consumer typing, and
optional-dependency smoke checks across all workspace packages and 21 extras;
pass --wheel-dir <dir> --require-prebuilt alongside
uvx --from "twine==7.0.0" twine check --strict <dir>/* to enforce exact
prebuilt distributions in parity with .github/workflows/release.yml, or run
python scripts/tighten_dependencies.py --verify-wheels <dir> and
python scripts/validate_package_consumption.py --verify-release --wheel-dir <dir>
directly to inspect built release wheel METADATA and imednet.spi tag
compatibility). Set IMEDNET_TEST_WHEELS=1
after installing built wheels into .venv to replicate CI wheel-mode pytest runs.
hatch run verify runs verify-static and verify-tests in order; the
Pipeline docs job runs uv run python scripts/build_docs.py once on the
synced .venv workspace. The expanded commands above are useful for diagnostics.
Install with uv sync --locked --all-packages --all-extras or the setup wizard;
no real credentials or live EDC access are required. Run pre-commit first and
uvx hatch run quality:all as well (supported across Python 3.11.5, 3.12, and
3.13 using the active interpreter without requiring a separate Python 3.11 binary)
for the full-workspace formatting, Ruff, non-mutating typos --force-exclude,
detect-secrets, imednet.models.engine --check and --typecheck, and
universal uv.lock dependency audit (scripts/audit_dependencies.py, which
exports PEP 751 pylock.toml and runs
uvx --from "pip-audit==2.10.1" pip-audit --locked -s osv across every external
package and platform/Python marker with zero ignored advisories) alongside the
package-scoped uvx-isolated semgrep, dead-code, and similarity gates. In CI,
the pre-commit job executes ruff-check, ruff-format, non-mutating
typos --force-exclude, detect-secrets, and scoped
imednet.models.engine --check once per workflow run; after plan, quality
(scripts/audit_dependencies.py universal pip-audit, uvx-isolated
semgrep, vulture, pylint similarity/duplication, strict mypy, and
non-mutating imednet.models.engine --check plus --typecheck; skipped only on
docs/, .agents/, or *.md diffs), build, docs, fuzzing, and
integration-sandbox run in parallel, followed by test package/Python matrix
shards (covering all non-live pytest items at >=90% coverage) and
validate-package-consumption, with ci-gate summarizing upstream job results.
The canonical lint:pylint-sim and duplication:check tasks retain their
documented scopes and thresholds.
Fuzzing and performance tracks require their pytest flags and write structured VerificationReport JSON files under gitignored reports/verification/ (with mutable fuzz corpora and crash/timeout artifacts under .cache/verification/): run pytest tests/core/test_performance.py -m performance (pass --update-perf-baseline when intentionally refreshing tests/core/baselines/performance_baseline.json), pytest tests/core/test_fuzz.py -m fuzzing (controlled by IMEDNET_FUZZ_RUNS defaulting to 25000, IMEDNET_FUZZ_MAX_TOTAL_TIME defaulting to 0, IMEDNET_FUZZ_UNIT_TIMEOUT defaulting to 10, and IMEDNET_FUZZ_REPRODUCER to replay a downloaded crash or timeout file locally), and python scripts/aggregate_verification.py --report-dir reports/verification --expect-track <track> (which exits 1 on missing tracks, malformed files, or status: "failed"). Container integration
requires IMEDNET_TEST_CONTAINERS=1 with docker compose up -d and
docker compose down -v teardown (see CONTRIBUTING.md). Live tests remain outside the default
suite and require explicit authorization and the live-test charter. Security
exception ownership and review dates are in Security audit policy.
With uv, run the expanded commands above via uv run and build documentation
with uv run python scripts/build_docs.py. The Hatch and uv routes use the
same repository configuration and installed package sources; do not skip gates
when using a different environment manager.