audit-autopilot
A domain-agnostic, zero-dependency Python 3.10+ toolkit for automated audit batch selection, pluggable audit execution with strict schema and hash verification, isolated candidate label storage, controlled label promotion, and anonymized regression test scaffold generation.
Key Capabilities
- Batch Selection: Reads candidate pool JSON (compatible with ranker/sampler outputs) and selects up to
Nunaudited, single-blocker records that include required artifacts per reason bucket, while tracking missing-evidence counts by bucket. - Pluggable Audit Adapters: Includes an
AuditAdapterprotocol, a deterministicMockAuditAdapterfor local runs and testing, and aSubprocessJsonAdapterfor integrating external audit workers over stdin/stdout JSON. - Tampering & Prompt-Injection Defense: Enforces strict JSON schema validation (
expected_actioninsubmit,hold,unsupported; non-emptyroot_cause_category;field_valuesdict;evidencestring; strictsha256equality with the input record; rejection of unexpected keys). Invalid or tampered responses are safely rejected without crashing the batch. - Strict Label Isolation: Writes newly audited results exclusively to an isolated
candidate_labels.jsonfile and never modifiesproduction_labels.jsonduring audit runs. - Controlled Promotion: Provides a
promotesubcommand that defaults to--dry-run(showing added/updated/unchanged diffs) and requires explicit--approveto merge selected candidates into a target production labels file. - Anonymized Regression Test Generation: When
>= 3audited candidates share the sameroot_cause_category, replaces entity names, store names, phone numbers, registration IDs, emails, and raw amounts with deterministic placeholders (ENTITY_001,STORE_001,000-0000-0000,1000, etc.), generates alayout_of(...)styleunittestscaffold, and verifies zero PII leakage viacheck_no_pii_leak.
Installation
Requires Python 3.10+ with zero third-party runtime dependencies.
pip install -e .
Or run directly from source:
PYTHONPATH=src python -m audit_autopilot.cli --help
CLI Usage
1. Run an audit batch
audit-autopilot run \
--pool candidate_pool.json \
--candidate-labels candidate_labels.json \
--production-labels production_labels.json \
--max-per-bucket 5 \
--adapter mock \
--tests-dir generated_tests \
--format table
Use --format json to emit the structured run summary JSON (audited_count, rejected_count, by_root_cause, pending_promotion_count, generated_test_files, missing_evidence_by_bucket).
2. Preview and promote candidate labels
Preview diff (default dry-run, never modifies the target file):
audit-autopilot promote \
--candidate-labels candidate_labels.json \
--production-labels production_labels.json \
--format table
Apply promotion explicitly:
audit-autopilot promote \
--candidate-labels candidate_labels.json \
--production-labels production_labels.json \
--approve
Filter to specific records with repeatable --record-id:
audit-autopilot promote \
--candidate-labels candidate_labels.json \
--production-labels production_labels.json \
--record-id rec-001 \
--record-id rec-002 \
--approve
3. Generate anonymized regression tests from candidate labels
audit-autopilot generate-tests \
--candidate-labels candidate_labels.json \
--output-dir generated_tests \
--min-cluster-size 3 \
--format json
Running Tests
PYTHONPATH=src python -m unittest discover -s tests -v
Project Structure
src/audit_autopilot/
__init__.py Public package exports
models.py Typed dataclasses for records, results, summaries, and diffs
adapters.py AuditAdapter protocol, strict validator, MockAuditAdapter, SubprocessJsonAdapter
anonymizer.py Deterministic anonymizer, PII leak verifier, unittest scaffold generator
pipeline.py Batch selector, isolated label persistence, end-to-end runner
promote.py Dry-run diffing and explicit-approval promotion logic
cli.py Command-line interface (run, promote, generate-tests)
py.typed PEP 561 type marker
docs/
REQUIREMENTS.md Functional and safety requirements specification
tests/
test_pipeline.py End-to-end pipeline, isolation, validation, and promotion tests
test_sanitization.py Repository hygiene and confidentiality checks
Metadata
Release files for audit-autopilot 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| audit_autopilot-0.1.0.tar.gz | 23.5 kB | Without provenance | Details for audit_autopilot-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| audit_autopilot-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for audit_autopilot-0.1.0-py3-none-any.whl |
Total release size: 43.5 kB
Release files / audit_autopilot-0.1.0.tar.gz
| Download URL | audit_autopilot-0.1.0.tar.gz |
|---|---|
| Size | 23.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
43520131b6af539ef08a2916b0aa900f43e4fdd5a16bf471aad8982aa9402ef6
|
|
BLAKE2b-256 checksum How to use checksums |
7f52047aa5aff01a452a1360af8f6201d2a7e60ad414b1d80478325e28cf2900
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.5
|
Release files / audit_autopilot-0.1.0-py3-none-any.whl
| Download URL | audit_autopilot-0.1.0-py3-none-any.whl |
|---|---|
| Size | 20.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fecd7b19adc653a356785ee11d433c6299643c4253f2ffaee4fd858637e2e13f
|
|
BLAKE2b-256 checksum How to use checksums |
445e9966a36a4a6d2f9e6a079de0d9a871dc70afc52b6e099c8655cd13ab8703
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.5
|
Security for audit-autopilot 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.