Skip to main content

shutdown-claim-audit

Offline audit of documented interruption promises against Python source.

A standard-library-only static CLI, version 0.1.0, for Python 3.9+. It executes no audited code, uses no network, and never reads .env contents. It reads root README.md and docs/**/*.md and compares their promises with AST evidence.

Usage

python3 -m pip install .
shutdown-claim-audit /path/to/project
python3 -m shutdown_claim_audit /path/to/project --json
shutdown-claim-audit . --ignore 'vendor/*' --fail-on HIGH --verbose
shutdown-claim-audit --version
PYTHONPATH=src python3 -m unittest discover -s tests -v
python3 -m build

The positional path defaults to the current directory. --ignore is repeatable and matches relative paths as globs. --json emits findings and verified_claims, plus extracted claims, production/test evidence, parse errors, and status. --verbose includes the complete report in text mode. Exit codes are 0 for PASS, 2 for threshold failure, and 1 for usage errors. The default threshold is MEDIUM; --fail-on HIGH still reports MEDIUM findings but does not fail them.

Rules

Exact rule identifiers are shown below to keep the tool's own docs neutral.

documented-graceful-claim-false
documented-graceful-claim-false-test-only
documented-abrupt-claim-false
documented-abrupt-claim-false-test-only
Family Condition Severity
graceful No production or test evidence HIGH
graceful Evidence only in tests/fixtures MEDIUM
abrupt Production evidence exists HIGH
abrupt Evidence only in tests/fixtures MEDIUM
Either No production source HIGH, no-source

Each family produces at most one finding with all relevant claim sentences and evidence. A production-backed graceful family or an abrupt family with no evidence anywhere is verified. No claims means PASS, regardless of evidence. Contradictory families are evaluated independently.

Claim vocabulary

Only these exact phrases count, with word boundaries after normalisation:

graceful shutdown
shuts down gracefully
shutdown gracefully
clean shutdown
cleanly shuts down
handles sigint
handles sigterm
handles ctrl c
handles sighup
catches keyboardinterrupt
handles keyboardinterrupt
graceful exit
exits gracefully
stops gracefully
terminates gracefully
signal handler
signal handling
shutdown handler
handles signals
handles termination signals
no graceful shutdown
does not handle sigint
does not handle sigterm
does not handle ctrl c
does not handle sighup
does not catch keyboardinterrupt
no cleanup on shutdown
no cleanup on exit
no signal handling
exits immediately

Normalisation lowercases, replaces n't with not, replaces hyphens with spaces, and collapses whitespace. Inline code counts as prose; fenced blocks are excluded. ABRUPT spans are matched and masked before GRACEFUL matching. A sentence with no/not/never/without suppresses GRACEFUL matches. ABRUPT negations still count. This is deliberately asymmetric:

doesn't handle sigterm => abrupt
never shuts down gracefully => no claim
does not claim graceful shutdown => no claim
graceful-shutdown => graceful
handles Ctrl-C => graceful

Bare “shutdown” and bare “signal” are not claims.

Named evidence

AST evidence Notes
signal.signal First argument SIGINT/SIGTERM/SIGHUP/SIGQUIT; SIG_DFL excluded; SIG_IGN counts
add_signal_handler Any receiver; same termination constants
except KeyboardInterrupt Direct name or name inside a tuple
signal.sigwait, signal.sigwaitinfo, signal.sigtimedwait, signal.pause Dotted calls and imported aliases

Imports and aliases are tracked per file. Attribute signal constants count; bare constants for the registration function require a signal import. The method form accepts bare constants without import tracking. Deliberately ignoring a signal via SIG_IGN counts as evidence. Items deduplicate by file, line, and kind.

Differentiation

  • error-claim-audit checks failure behaviour produced by code, rather than interruption responses.
  • locking-claim-audit checks cross-process exclusion, rather than teardown.
  • concurrency-claim-audit checks parallelism within a run.
  • bandit and ruff detect code issues rather than documentation promises.
  • The standard library signal and asyncio documentation describes primitives rather than comparing docs with implementation.

Honest limitations

Exact-phrase matching cannot understand arbitrary prose or resolve ambiguity. Dead code counts. A handler for only one termination constant verifies the entire positive family, even when the documentation names another constant. This checks existence, not coverage, actual cleanup quality, or runtime reachability. atexit.register does not count: it need not run on default SIGTERM termination. A try/finally alone does not count. signal.getsignal and signal.strsignal only inspect information and do not count. Strings and comments do not count. Shell/subprocess strings containing trap or kill are not parsed. Bare except and except Exception do not count. Dynamic imports, wrapper functions, and indirect registrations can be missed. Syntax errors are recorded in JSON; unparseable files contribute no evidence. This is a heuristic, not proof.

Production excludes tests/ directories, test_*.py, *_test.py, fixtures/, docs/, and examples/. Test evidence is collected separately from tests/fixtures and test-named modules. Symlinked files and symlinked directory contents are skipped. Ignore patterns remove docs and evidence alike. The tool reads only selected Markdown and source files; .env and .env.* contents are skipped. No audited source is imported or executed.

Development and packaging

Tests use unittest. The source distribution includes tests and all fixture files via MANIFEST.in. The wheel installs the package and console entry point. The package has no runtime dependencies and is licensed under MIT.

Metadata

Release files for shutdown-claim-audit 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for shutdown-claim-audit 0.1.0
File Size Uploaded Provenance Actions
shutdown_claim_audit-0.1.0.tar.gz 11.1 kB Without provenance Details for shutdown_claim_audit-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for shutdown-claim-audit 0.1.0
File Interpreter ABI Platform Actions
shutdown_claim_audit-0.1.0-py3-none-any.whl Python 3 none any Details for shutdown_claim_audit-0.1.0-py3-none-any.whl

Total release size: 19.9 kB

Release files / shutdown_claim_audit-0.1.0.tar.gz

Download URL shutdown_claim_audit-0.1.0.tar.gz
Size 11.1 kB
Tags Source
SHA-256 checksum
How to use checksums
dc64fa1913d6d6702df560d0f4ad5329921a27ee426c4ed0b8a036eb8bd27737
BLAKE2b-256 checksum
How to use checksums
2f5d8743d81cff6f614a3452e193ae67197bf8095110f6904a13217462b9c552
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / shutdown_claim_audit-0.1.0-py3-none-any.whl

Download URL shutdown_claim_audit-0.1.0-py3-none-any.whl
Size 8.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
107becf2d8d45bc8d792317e9ce70ca0087a8605b9e11547e8ce16423d91f540
BLAKE2b-256 checksum
How to use checksums
b5cea381b9c15f6a1620bf0856d5f5d1185dc92070bc6cfb0bc974efd48f1e77
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Security for shutdown-claim-audit 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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page