Testing & CI Credibility (Reliability Story)

This project is intentionally built so the audit results are reproducible, and the core logic is testable without network access.


What “reliability” means here

Evidence
GitHub Actions run (passing)

Screenshot proof of a green pipeline run.

Actions Passed
Evidence
Local run (end-to-end)

Short clip showing ./run_audit.sh and the dashboard in action.

Local demo Video
GitHub Actions — passing pipeline
Local run — end-to-end demo (dashboard clip)

Test Suite Overview

The test suite is designed around a single principle:

Test the contract, not the environment.

Meaning:

What is tested

Area What the test proves Why it matters
Rule engine config audit_rules.yaml is parsed correctly Prevents “silent misconfiguration”
Ghost vendor detection Anti-join logic catches missing vendor IDs Finds supplier master integrity issues
PO variance math Variance threshold correctly flags outliers Prevents overspend / mismatched PO alignment
FOIP/PII scan behavior Name/email detection triggers as expected Prevents privacy leaks in notes/comments
AI confidence threshold Low-confidence entities don’t trigger false alerts Reduces “privacy alert noise”
pytest — local passing run

What is mocked (and why)

HuggingFace model loading is mocked in unit tests

The AI scanner uses a NER pipeline (which normally may download weights). In tests, the pipeline is replaced with a fake predictable model.

This ensures:

What we mock:

What we still test (real logic):

Unit tests — mocked brain (monkeypatch)

Why CI skips AI by default (SKIP_AI)

CI should be:

So the workflow uses an environment flag:

This mirrors real enterprise practice:

CI evidence — SKIP_AI behavior (Actions screenshot)

GitHub Actions Pipeline

The CI pipeline validates the project in an “audit-friendly” order:

  1. Generate synthetic ERP-like data (so CI always has inputs)
  2. Run the deterministic rule engine
  3. Skip AI scan (by default) using SKIP_AI=1
  4. Run unit tests (pytest -q)

Evidence artifacts produced in CI

The pipeline outputs evidence CSVs (for screenshots / demo assets) and run logs:

Evidence exports (folder view)

Local verification

Run tests

pytest -q

Run the full demo pipeline (includes AI unless you set SKIP_AI)

./run_audit.sh

Force skip AI locally (to simulate CI)

SKIP_AI=1 ./run_audit.sh

Known CI warning (and why it’s acceptable)

Some runners may show a PyTorch/NumPy warning (environment-specific). This does not affect the correctness of:

If you ever choose to enable AI scanning in CI, this can be addressed by pinning compatible versions.


Quality gates (what “passing” means)

A green CI run means:

Actions tab — succeeded