whodunit-chronicles 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +22 -226
  3. data/LICENSE +1 -1
  4. data/README.md +96 -599
  5. data/exe/whodunit-chronicles +6 -0
  6. data/lib/whodunit/chronicles/chronicler.rb +62 -0
  7. data/lib/whodunit/chronicles/cli.rb +131 -0
  8. data/lib/whodunit/chronicles/errors.rb +7 -33
  9. data/lib/whodunit/chronicles/ledger.rb +69 -0
  10. data/lib/whodunit/chronicles/ledger_entry.rb +143 -0
  11. data/lib/whodunit/chronicles/ledger_factory.rb +66 -0
  12. data/lib/whodunit/chronicles/ledgers/file_ledger.rb +56 -0
  13. data/lib/whodunit/chronicles/ledgers/memory_ledger.rb +29 -0
  14. data/lib/whodunit/chronicles/ledgers/sqlite_ledger.rb +172 -0
  15. data/lib/whodunit/chronicles/version.rb +2 -1
  16. data/lib/whodunit/chronicles.rb +12 -65
  17. data/lib/whodunit-chronicles.rb +0 -1
  18. data/sig/whodunit/chronicles/chronicler.rbs +14 -0
  19. data/sig/whodunit/chronicles/cli.rbs +17 -0
  20. data/sig/whodunit/chronicles/errors.rbs +15 -0
  21. data/sig/whodunit/chronicles/ledger.rbs +13 -0
  22. data/sig/whodunit/chronicles/ledger_entry.rbs +62 -0
  23. data/sig/whodunit/chronicles/ledger_factory.rbs +14 -0
  24. data/sig/whodunit/chronicles/ledgers/file_ledger.rbs +14 -0
  25. data/sig/whodunit/chronicles/ledgers/memory_ledger.rbs +12 -0
  26. data/sig/whodunit/chronicles/ledgers/sqlite_ledger.rbs +30 -0
  27. data/sig/whodunit/chronicles.rbs +5 -0
  28. metadata +40 -326
  29. data/.codeclimate.yml +0 -50
  30. data/.rubocop.yml +0 -93
  31. data/.yardopts +0 -14
  32. data/CODE_OF_CONDUCT.md +0 -132
  33. data/CONTRIBUTING.md +0 -186
  34. data/Rakefile +0 -18
  35. data/docker/mysql/init.sql +0 -33
  36. data/docker/postgres/init.sql +0 -40
  37. data/docker-compose.yml +0 -138
  38. data/examples/images/campaign-performance-analytics.png +0 -0
  39. data/examples/images/candidate-journey-analytics.png +0 -0
  40. data/examples/images/recruitment-funnel-analytics.png +0 -0
  41. data/lib/.gitkeep +0 -0
  42. data/lib/whodunit/chronicles/adapter_loader.rb +0 -69
  43. data/lib/whodunit/chronicles/adapters/mysql.rb +0 -261
  44. data/lib/whodunit/chronicles/adapters/postgresql.rb +0 -278
  45. data/lib/whodunit/chronicles/change_event.rb +0 -201
  46. data/lib/whodunit/chronicles/composite_processor.rb +0 -86
  47. data/lib/whodunit/chronicles/configuration.rb +0 -112
  48. data/lib/whodunit/chronicles/connection.rb +0 -88
  49. data/lib/whodunit/chronicles/persistence.rb +0 -129
  50. data/lib/whodunit/chronicles/processor.rb +0 -127
  51. data/lib/whodunit/chronicles/service.rb +0 -207
  52. data/lib/whodunit/chronicles/stream_adapter.rb +0 -91
  53. data/lib/whodunit/chronicles/table.rb +0 -120
  54. data/whodunit-chronicles.gemspec +0 -79
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fa4438fb3140657b7b9d92db2988c0ca511c9fc0138ba42cfad061ab91dc0ac4
4
- data.tar.gz: e3c5339e3ecce1b882be854bc906f9e1644bc812eb16302266d7b8ef68ba0f12
3
+ metadata.gz: c5860f6ea71bf324cb88c3962606f53c7292ba89cbf572ba408443f60248f366
4
+ data.tar.gz: 7333d83462ec43b3d93c38666ff51cacafff8af2579abc28594603e0d5e75a1a
5
5
  SHA512:
6
- metadata.gz: '03590c69049ab8670411b6beb0e5bbb8d3fcf0989b163541fa606be5fc1c7b41f20c4e6cb5160632ed411b056664f16aa153499c947cd24c612912ff58504354'
7
- data.tar.gz: 26d9cbc11e8efbf0aa716034b9ec46604d5bb78e066584f3e9674ef00732daf60fc7ba6a5506c3f9524b0ad216fcfb52e4418b2452451787b6c4498e84bab08a
6
+ metadata.gz: 8cce125043fb2152e3ba2e82a7c4df6a4294c624bce1278caa55ed4605166f7b658e7efe66b11a45168e154db8910a1cd5aca8c6266310e0df9e2943deb70880
7
+ data.tar.gz: 12bb800f8a9f0fe4b9f0355a2be1442195feeb58deab010bc25acdcc2e597cf041eb0c15bfe102b28f746b2c93e4aa1ff44677864ccaac9b2c2f501fcb03e8ff
data/CHANGELOG.md CHANGED
@@ -1,228 +1,24 @@
1
1
  # Changelog
2
2
 
3
- All notable changes to this project will be documented in this file.
4
-
5
- The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
- and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
-
8
-
9
- ## [0.3.0] - 2026-05-17
10
-
11
- ### Added
12
-
13
- - **`CompositeProcessor`** — fans out a single change event to multiple processors
14
- in sequence, enabling pipeline architectures (e.g. simultaneously storing audit
15
- records, streaming to Grafana, and triggering alerts) without coupling processors
16
- to each other. Fail-open by default: if one processor raises, the error is logged
17
- and the remaining processors still execute. Set `fail_fast: true` to halt the
18
- chain on the first error.
19
- - **Typed error hierarchy** base `Whodunit::Chronicles::Error` class with typed
20
- subclasses: `ConfigurationError`, `AdapterLoadError`, `ConnectionError`,
21
- `ProcessingError`, `PersistenceError`. Callers can now rescue the base class to
22
- catch all gem errors, or rescue specific subclasses for targeted handling.
23
- - **Lazy adapter loading** `pg` and `trilogy` are now required only when the
24
- matching adapter is actually used. A friendly `AdapterLoadError` with install
25
- instructions is raised if the gem is missing, instead of a cryptic `LoadError`.
26
- - **`bin/console`** — loads the gem with a sane test config and drops into Pry
27
- for interactive development.
28
- - **Docker Compose test environment** — spins up PostgreSQL 16 (`wal_level=logical`),
29
- MySQL 8, and MariaDB 11 with matching audit databases, init SQL scripts, test
30
- tables, publication setup, and replication role grants.
31
- - Development environment setup guide added to docs.
32
-
33
- ### Fixed
34
-
35
- - Gemspec `homepage_uri` metadata corrected.
36
- - `pg`, `trilogy`, and `bigdecimal` moved from runtime to `add_development_dependency`
37
- — consuming apps are no longer forced to install database adapters they don't use.
38
- - `rubocop-rake` and `rubocop-thread_safety` added to development dependencies.
39
-
40
- ### Chore
41
-
42
- - `Gemfile.lock` removed from repo.
43
- - `.gitignore` updated with recommended exclusions.
44
-
45
- ### Docs
46
-
47
- - Broken links in README fixed.
48
- - Development environment setup guide added.
49
-
50
- ### ⚠️ Breaking Changes
51
-
52
- - `pg`, `trilogy`, and `bigdecimal` are no longer runtime dependencies. If your
53
- application relies on them being pulled in transitively via `whodunit-chronicles`,
54
- add them explicitly to your own Gemfile.
55
- - remove ruby@3.1 from the supported versions of Ruby
56
-
57
- ## [0.2.0] - 2025-01-28
58
-
59
- ### Added
60
-
61
- - **MySQL/MariaDB Support**: Complete multi-database adapter architecture
62
- - MySQL adapter using trilogy gem for high-performance connections
63
- - Binary log streaming support for MySQL change capture
64
- - Cross-database compatibility testing
65
- - **Enhanced Testing Suite**: Comprehensive test coverage improvements
66
- - New test files: `table_test.rb`, `connection_test.rb`, `persistence_test.rb`
67
- - Enhanced PostgreSQL adapter tests with connection and replication scenarios
68
- - Increased line coverage from 91.28% to 97.29% (+6.01 percentage points)
69
- - 227 tests with 552 assertions providing robust validation
70
- - **Ruby 3.4+ Compatibility**: Forward compatibility improvements
71
- - Added `bigdecimal` dependency for Ruby 3.4+ support
72
- - Explicit dependency management for removed stdlib components
73
- - **CI/CD Enhancements**: Improved automation and quality gates
74
- - Matrix testing across PostgreSQL and MySQL databases
75
- - Enhanced MySQL integration testing with proper connection handling
76
- - Security scanning integration and automated dependency updates
77
-
78
- ### Changed
79
-
80
- - **Architecture Refactoring**: Modular component extraction
81
- - Extracted AuditProcessor into separate, focused components
82
- - Improved service layer with multi-adapter support patterns
83
- - Enhanced configuration system supporting both PostgreSQL and MySQL
84
- - **Database Adapter Pattern**: Extensible multi-database support
85
- - Abstract adapter base class for consistent interface
86
- - Database-specific implementations with optimized performance
87
- - Unified change event system across different database types
88
- - **Test Infrastructure**: Comprehensive testing improvements
89
- - Enhanced mock-based testing for complex database operations
90
- - Improved test organization with better separation of concerns
91
- - Integration test scenarios for real-world usage patterns
92
-
93
- ### Fixed
94
-
95
- - **MySQL CI Integration**: Resolved connection and setup issues
96
- - Fixed MySQL container configuration and health checks
97
- - Improved database readiness detection and timeout handling
98
- - Enhanced error reporting and debugging for CI environments
99
- - **Dependency Management**: Ruby version compatibility
100
- - Added explicit `bigdecimal ~> 3.1` dependency for Ruby 3.4+
101
- - Resolved trilogy gem loading issues in newer Ruby versions
102
- - Improved gem specification with proper version constraints
103
-
104
- ### Technical Improvements
105
-
106
- - **Code Coverage**: Significant testing improvements
107
- - Line coverage: 97.29% (647/665 lines covered)
108
- - Branch coverage: 83.6% (158/189 branches covered)
109
- - Comprehensive unit tests for all core modules
110
- - **Performance Optimizations**: Multi-adapter efficiency
111
- - Database-specific SQL generation and parameter binding
112
- - Optimized connection management across different adapters
113
- - Efficient batch processing for both PostgreSQL and MySQL
114
- - **Error Handling**: Enhanced resilience and debugging
115
- - Improved error messages and stack trace reporting
116
- - Better handling of database-specific error conditions
117
- - Enhanced logging for troubleshooting and monitoring
118
-
119
- ### Development Experience
120
-
121
- - **Documentation**: Enhanced developer resources
122
- - Updated README with MySQL/MariaDB configuration examples
123
- - Improved inline documentation for multi-adapter usage
124
- - Better error messages and troubleshooting guides
125
- - **Testing Framework**: Improved development workflow
126
- - Faster test execution with better mock strategies
127
- - More reliable CI/CD pipeline with matrix testing
128
- - Enhanced debugging capabilities for test failures
129
-
130
- ## [0.1.0] - 2025-01-21
131
-
132
- ### Added
133
-
134
- - Comprehensive GitHub Actions CI/CD pipeline with multi-Ruby testing
135
- - Automated security scanning with bundler-audit and CodeQL
136
- - YARD documentation generation with GitHub Pages deployment
137
- - Automated gem publishing workflow for tagged releases
138
- - Structured issue and pull request templates for better contributor experience
139
- - Dependabot configuration for automated dependency updates
140
- - Security scanning dependencies (bundler-audit, brakeman)
141
- - Comprehensive README with architecture diagrams and examples
142
- - RuboCop configuration with relaxed metrics for test files
143
-
144
- ### Changed
145
-
146
- - Updated dependencies to latest versions with security patches
147
- - Improved RuboCop configuration to exclude test files from ClassLength limits
148
- - Enhanced gemspec with proper metadata and security dependencies
149
-
150
- ## [0.1.0] - 2025-01-21
151
-
152
- ### Added
153
-
154
- - **Core Architecture**: Complete zero-latency audit streaming implementation
155
- - **PostgreSQL Adapter**: Logical replication streaming with WAL decoding
156
- - **ChangeEvent System**: Unified change representation across database adapters
157
- - **Processor**: Intelligent transformation of changes into audit records
158
- - **Configuration Management**: Comprehensive settings with validation using dry-configurable
159
- - **Service Orchestration**: Thread-safe service with error handling and retry logic
160
- - **Abstract Adapter Pattern**: Extensible design supporting multiple database systems
161
- - **User Attribution**: Automatic extraction of user information from creator/updater/deleter fields
162
- - **Batch Processing**: Efficient bulk processing of audit records
163
- - **Connection Management**: Robust database connection handling with retries
164
- - **Error Handling**: Comprehensive error recovery and logging
165
- - **Thread Safety**: Concurrent processing with thread pool management
166
-
167
- ### Technical Implementation
168
-
169
- - **Modern Ruby Support**: Ruby 3.1+ with frozen string literals
170
- - **Database Features**:
171
- - PostgreSQL logical replication with pgoutput plugin
172
- - Publication and replication slot management
173
- - WAL position tracking and resumption
174
- - Connection pooling and management
175
- - **Event Processing**:
176
- - Real-time change capture at database level
177
- - Structured change events with metadata
178
- - Configurable table and schema filtering
179
- - Transaction ID and sequence number tracking
180
- - **Audit Records**:
181
- - Complete before/after data capture
182
- - Calculated field-level changes
183
- - User attribution from standard columns
184
- - Timestamps and version tracking
185
- - JSON metadata storage
186
-
187
- ### Development & Testing
188
-
189
- - **Test Coverage**: 94.3% code coverage (447/474 lines)
190
- - **Testing Framework**: Minitest with shoulda-style assertions and mocha mocking
191
- - **Test Suite**: 129 tests covering all components with comprehensive error scenarios
192
- - **Code Quality**: RuboCop compliance with modern Ruby standards
193
- - **Security**: bundler-audit integration for vulnerability scanning
194
- - **Documentation**: Inline YARD documentation for all public APIs
195
-
196
- ### Dependencies
197
-
198
- - **Core**: concurrent-ruby, dry-configurable, dry-logger, pg
199
- - **Development**: minitest, rubocop, simplecov, yard
200
- - **Testing**: mocha for mocking, pry for debugging
201
- - **Security**: bundler-audit for vulnerability scanning
202
-
203
- ### Configuration Options
204
-
205
- - Database connection URLs (source and audit)
206
- - PostgreSQL publication and replication slot names
207
- - Batch processing sizes and retry policies
208
- - Table and schema inclusion/exclusion filters
209
- - Logging levels and output configuration
210
- - Thread pool and concurrency settings
211
-
212
- ### Performance Features
213
-
214
- - **Zero Application Overhead**: No Rails callbacks or Active Record hooks
215
- - **Efficient Streaming**: PostgreSQL logical replication optimization
216
- - **Memory Management**: Streaming processing without dataset loading
217
- - **Configurable Batching**: Tunable batch sizes for optimal throughput
218
- - **Connection Reuse**: Persistent connections with automatic recovery
219
- - **Background Processing**: Non-blocking operation with thread pools
220
-
221
- ### Production Ready Features
222
-
223
- - **Monitoring**: Service status and health checking
224
- - **Resilience**: Automatic retry logic with exponential backoff
225
- - **Graceful Shutdown**: Clean service termination
226
- - **Error Recovery**: Robust error handling with detailed logging
227
- - **Position Tracking**: WAL position persistence for reliable resumption
228
- - **Resource Management**: Bounded thread pools and memory usage
3
+ ## Unreleased
4
+
5
+ ## 0.4.0
6
+
7
+ - Rebuilt as a minimal CDC audit sink.
8
+ - Added `Chronicler` as a `CDC::Core::Processor`.
9
+ - Added runtime dependency on `cdc-core`.
10
+ - Added immutable `LedgerEntry`.
11
+ - Added `Ledger` base contract.
12
+ - Added `MemoryLedger`.
13
+ - Added `FileLedger`.
14
+ - Added `SQLiteLedger`.
15
+ - Added ledger lifecycle CLI.
16
+ - Added RBS signatures.
17
+ - Added 100% code coverage and 100% YARD coverage gates.
18
+ - Added runtime dependency on `sqlite3` for built-in SQLite ledger support.
19
+ - Added real SQLite integration coverage for persistence, custom tables, status counts, and duplicate event IDs.
20
+ - Clarified SQLite duplicate append behavior: duplicate `event_id` values raise `Whodunit::Chronicles::AppendError`.
21
+ - Added JSON status output and stricter option validation to the ledger lifecycle CLI.
22
+ - Improved CLI errors for malformed configuration, missing required ledger options, unsupported lifecycle methods, and failed verification.
23
+ - Completed the Steep-backed RBS quality gate.
24
+ - Added GitHub Actions workflows for generated YARD documentation and tagged RubyGems releases.
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2025 Ken C. Demanawa
3
+ Copyright (c) 2026 Kenneth C. Demanawa
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal