test: close remaining coverage gaps to 100% on application source + s… - #23
Merged
Merged
Conversation
…cripts Application-source line coverage (api/, audit/, consumers/, db/, schemas/, services/, worker/, scripts/ -- excluding tests/ itself, which trivially self-covers and shouldn't count toward the metric, per commit 4d27381) was 84% (234 lines missing out of 1465), driven almost entirely by scripts/ -- audit_retention_cleanup.py (27%), verify_audit_integrity.py (26%), and provision_audit_db_users.py (0%) had never been brought up to the bar the rest of the codebase holds, since they were added after that earlier 100% milestone. - audit/record_integrity.py: _canonical_json's non-JSON-string fallback branch, and both verify_*_hash functions' fail-closed `except Exception` wrapper (via a value whose __format__ raises) - consumers/quarantine.py: new tests/test_quarantine.py -- classify_poison_reason's well-formed-JSON-object branches and QuarantineSink.write's idempotent-duplicate (IntegrityError -> rollback) path - services/audit_health_service.py: XINFO CONSUMERS failure degrading only consumer stats, and _int_env's malformed-value except branch - scripts/redis_acl_safety.py: RedisEnvironment's repr/eq/hash, DisposableAttestation.generate_nonce, gate construction against an UNKNOWN (not just unreachable) environment, AuthenticatedSession's double-close/context-manager/best-effort-cleanup behavior, and authenticate()'s own error-conversion branches -- mocked redis.Redis is used only for this generic control-flow plumbing, never in place of the real-Docker-Redis tests that prove actual AUTH/ACL semantics - scripts/verify_audit_integrity.py: new tests/test_verify_audit_integrity.py -- _resolve_secret/_resolve_session, verify_audit_events/ verify_quarantine_records (valid/tampered/no-baseline/structural/ duplicate-id cases), _report, _write_status_file, main()'s full pass/fail/exception-safety flow, and the __main__ guard - scripts/audit_retention_cleanup.py: new tests/test_audit_retention_cleanup.py -- _count_eligible/_delete_eligible against a real SQLite engine (legal-hold exclusion proven end to end), _write_status_file, and main()'s dry-run/execute/partial-result/failed-table/status-file paths - scripts/provision_audit_db_users.py: new tests/test_provision_audit_db_users.py -- _required_env, _connect_admin's URL parsing, _create_user_and_grants' per-table GRANT issuance (and that audit_writer/audit_reader never get a DELETE grant), and main()'s full provisioning + cleanup-on- exception flow, all against a mocked pymysql.connect 574 tests pass (up from 495); ruff check is clean on every file touched here. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…cripts
Application-source line coverage (api/, audit/, consumers/, db/, schemas/, services/, worker/, scripts/ -- excluding tests/ itself, which trivially self-covers and shouldn't count toward the metric, per commit 4d27381) was 84% (234 lines missing out of 1465), driven almost entirely by scripts/ -- audit_retention_cleanup.py (27%), verify_audit_integrity.py (26%), and provision_audit_db_users.py (0%) had never been brought up to the bar the rest of the codebase holds, since they were added after that earlier 100% milestone.
except Exceptionwrapper (via a value whose format raises)574 tests pass (up from 495); ruff check is clean on every file touched here.