Skip to content

refactor: add structured logging, fix error handling, and validate inputs#63

Merged
maskedsyntax merged 1 commit into
mainfrom
refactor/error-handling-logging-validation
Feb 19, 2026
Merged

refactor: add structured logging, fix error handling, and validate inputs#63
maskedsyntax merged 1 commit into
mainfrom
refactor/error-handling-logging-validation

Conversation

@maskedsyntax
Copy link
Copy Markdown
Member

Summary

  • Created hashprep/utils/logging.py with structured logging infrastructure (NullHandler pattern for library best practice)
  • Replaced all bare except Exception blocks with specific exception types (ValueError, LinAlgError, RuntimeWarning, OSError) across checks and summaries
  • Added input validation at system boundaries in DatasetAnalyzer.__init__ (type checks, duplicate columns, target column existence) and check_drift()

Test plan

  • All 82 existing tests pass
  • Verify logging output when logging.basicConfig() is configured by consumer
  • Confirm specific exceptions are caught correctly in edge cases

…puts

- Add hashprep/utils/logging.py with package-level structured logger
- Replace 8 bare `except Exception` blocks with specific exception types
  (ValueError, LinAlgError, RuntimeWarning, OSError) and debug logging
- Add input validation in DatasetAnalyzer.__init__:
  - TypeError if input is not a DataFrame
  - ValueError for duplicate column names
  - ValueError if target_col not found in DataFrame
  - TypeError if comparison_df is not a DataFrame
- Add input validation in check_drift() for both DataFrames
@vercel
Copy link
Copy Markdown

vercel Bot commented Feb 19, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
hashprep Ready Ready Preview, Comment Feb 19, 2026 11:18am

@maskedsyntax maskedsyntax merged commit 9f63435 into main Feb 19, 2026
2 checks passed
@maskedsyntax maskedsyntax deleted the refactor/error-handling-logging-validation branch February 19, 2026 11:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant