Commit d3b28c8
Major improvements to modlog publisher - multi-subreddit support, removal reason fixes, and transparency (#1)
* Add major improvements to modlog publisher
- Add configuration limits and validation system with automatic enforcement
- Implement database schema versioning and migration system (v0 -> v2)
- Add improved action tracking with display IDs (P1a2b3c format) and metadata
- Update wiki table format with new ID column for better content tracking
- Add error handling improvements for continuous mode with exponential backoff
- Add new CLI options: --show-config-limits, --force-migrate
- Update configuration template with new defaults and additional options
- Update README with comprehensive documentation for all new features
- Replace OOP architecture with simpler functional approach
- Add comprehensive database queries for content lifecycle tracking
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Add automatic config file update functionality
- Auto-updates config file when new defaults are available
- Creates backup before making changes (.backup extension)
- Preserves existing user settings
- Add --no-auto-update-config flag to disable if needed
- Update documentation with auto-update information
- Handles errors gracefully with fallback to in-memory defaults
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Fix modlog data type handling and add configurable action filtering
- Fix timestamp handling for both datetime objects and Unix timestamps
- Fix moderator name handling for both string and object types
- Fix target attribute handling to prevent 'str' object has no attribute 'name' errors
- Add moderator name censoring: AutoMod, Reddit, HumanModerator
- Add configurable wiki_actions filter (default: removals and removal reasons only)
- Preserve original wiki content formatting
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Add force refresh functionality for wiki rebuilding from database
* Improve modlog output with markdown links and configurable moderator anonymization
- Convert inquiry URLs to markdown format ([Inquire](url) instead of plain URLs)
- Add configurable moderator anonymization (anonymize_moderators setting)
- Store removal reasons from Reddit API in database (new removal_reason column)
- Update database schema to version 3 with proper migration
- Update CLAUDE.md and README.md with new features and configuration options
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Fix removal reason storage to show content instead of numbers
- Process removal reasons properly by stripping whitespace before storage
- Update database query in get_recent_actions_from_db to include removal_reason column
- Use actual removal reason content in MockAction instead of hardcoded text
- Add test script to verify removal reason processing without Reddit API calls
- Fix database schema query to use created_at instead of timestamp for consistency
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Add wiki hash caching to avoid unnecessary Reddit updates
- Cache SHA-256 hashes of wiki content per subreddit/page in database
- Skip Reddit API calls when content hasn't changed
- Add --force option to bypass hash check when needed
- Add v4 database migration for wiki_hash_cache table
- Update all wiki update calls to use hash caching
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Fix critical bugs: subreddit mixing and invalid IDs
- Add subreddit column to database to prevent mixing modlogs from different subreddits
- Fix ID generation to never use user IDs, always use post/comment/action IDs
- Add email address censoring in removal reasons
- Update database schema to version 5
- Fix get_recent_actions_from_db to filter by subreddit
- Update store_processed_action to include subreddit context
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Fix critical modlog bugs: proper IDs, removal reasons, and subreddit safety
- Fixed removal reasons showing as numbers by checking mod_note field
- Fixed display IDs to use permalinks instead of user IDs
- Added strict subreddit validation to prevent mixed subreddit wiki corruption
- Enhanced target ID extraction to get actual post/comment IDs
- Added bot attribution footer to wiki pages
- Improved permalink generation for better content linking
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Fix --force-refresh functionality and improve permalink handling
- Fix case-insensitive subreddit matching in database queries
- Add subreddit extraction from permalinks
- Simplify content link formatting to match main branch approach
- Use actual Reddit permalinks for removed content
- Add database update function for missing subreddit entries
- Improve safety checks to prevent mixed subreddit data
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Improve force-refresh to fetch all modlog actions and update database
- Force-refresh now fetches all modlog actions from Reddit to populate database
- Store ALL action types in database but only show removal actions in wiki
- Separate database population from wiki display logic
- Ensure comprehensive modlog data collection while maintaining wiki focus
Testing with Usenet subreddit
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Fix content links and align modmail with main branch
- Remove user profile fallback links - NEVER link to user profiles
- Prioritize actual content permalinks (posts/comments) over user profiles
- Implement proper content ID extraction for markdown ID field
- Align modmail inquiry format with main branch (detailed prefilled message)
- Add content link guidelines to CLAUDE.md
- Fix case sensitivity in subreddit validation
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Fix wiki table to match requirements: proper content IDs and no user profile links
- ID field now shows actual Reddit content IDs (t3_abc123, t1_def456) instead of user-based IDs
- Content links only point to actual removed posts/comments, never user profiles
- Show '-' for ID field when no content ID available (unlinkable actions)
- Remove action ID fallback - only use actual content IDs for linking removals
- Enable proper linking of removal actions with their removal reasons via content ID
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Fix content field formatting to match main branch approach
- Use main branch logic for comment/post detection (permalink slash count)
- Show actual titles when available
- Show 'Comment by u/username' for comments without titles
- Show 'Post by u/username' for posts without titles
- Only create links for actual content URLs, not user profiles
- Maintain main branch content field behavior while adding ID column
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Fix removal reason display to show actual text instead of numbers
- Always prioritize mod_note (actual removal reason text) over numeric details
- Show 'Removal reason applied' instead of 'Removal reason #7' for numeric details
- Improve ID extraction to handle more cases (though many will still be '-' due to Reddit API limitations)
- Apply consistent removal reason handling in both storage and display functions
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Fix modlog markdown format to match main branch requirements
- Add ID column back for tracking actions across the table
- Fix removal reason prioritization to show text first, not numbers
- For addremovalreason actions, use mod_note instead of details
- Extract short content IDs from permalinks for table tracking
- Ensure AutoModerator shows correctly (not HumanModerator)
- Content links point to actual posts/comments, not user profiles
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Update documentation to reflect v2.0 improvements and fixes
- Update README.md with current wiki output format examples
- Add section on recent improvements including content linking fixes
- Update database query examples to include subreddit column
- Document intelligent removal reason handling (text over numbers)
- Add multi-subreddit support documentation
- Update CLAUDE.md with new database operations and schema info
- Document content ID extraction and tracking features
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Add content ID to modmail inquiries for easier tracking
- Include content ID in modmail subject line: [ID: 1mkz4jm]
- Add Content ID field to modmail body for moderator reference
- Enables moderators to quickly cross-reference inquiries with modlog entries
- Improves modmail workflow and response efficiency
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Rename and improve force command options for clarity
- Replace --force with more intuitive options:
- --force-modlog: Fetch ALL from Reddit API and rebuild
- --force-wiki: Force wiki update (bypass cache)
- --force-all: Do both (replaces old --force)
- Update documentation with clear explanations and examples
- Add usage guidance for when to use each force option
- Maintain backwards compatibility during transition
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Fix multi-subreddit database support
Removes the erroneous error condition that prevented the application from
working with databases containing multiple subreddits. The application now
properly supports multi-subreddit databases by filtering results by the
requested subreddit while providing informational logging about available
subreddits.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Fix target_author display showing [deleted] instead of actual usernames
Updates the database query to include target_author column and properly
populates MockAction objects with actual usernames from the database,
preventing the fallback to [deleted] placeholder text.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Update CLAUDE.md
* fixes
* Update modlog_wiki_publisher.py
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Update modlog_wiki_publisher.py
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* fix: don't force wiki just because modlog
* human fixups
* Update modlog_wiki_publisher.py
* Update modlog_wiki_publisher.py
* Update modlog_wiki_publisher.py
* Update modlog_wiki_publisher.py
* Update modlog_wiki_publisher.py
* Update modlog_wiki_publisher.py
* Update modlog_wiki_publisher.py
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Update modlog_wiki_publisher.py
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Fix removal reason display to show actual text instead of generic message
Changes action.description to action.details (Reddit API field) and updates
logic to only show generic message for removal reason template numbers 1-15,
allowing actual removal reason text to display properly.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Show all removal reason information, never use generic message
Removes logic that hides removal reason template numbers (1-15) behind
generic "Removal reason applied" message. Now shows all available removal
reason data including template numbers for full transparency.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Fix duplicate IDs and removal reason display consistency
- Reorder regex patterns to extract comment IDs before post IDs, fixing duplicate ID issue
- Fix display logic to use action.details consistently with storage logic
- Ensures removal reasons show properly in wiki output
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Update documentation and fix --force-wiki functionality
- Update README.md with latest improvements and multi-subreddit support
- Update CLAUDE.md with v2.1 improvements summary
- Fix --force-wiki to rebuild from database without API calls
- Ensure --force-wiki always recreates wiki using existing data
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Remove fallback text in MockAction details
* docs: refactor CLAUDE.md for better organization
- Reorganized sections for clarity and logical flow
- Added prominent venv path requirement
- Grouped configuration options by category
- Enhanced development guidelines section
- Improved formatting and structure
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* fix: addremovalreason actions now show actual removal reason text instead of template numbers
- For addremovalreason actions, use description field which contains actual text like 'Invites - No asking'
- Fixes template numbers (6, 9, etc) showing instead of meaningful removal reasons
- Maintains existing logic for other action types using mod_note and details fields
- Improves removal reason transparency for manual moderator actions
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* docs: update README with latest transparency improvements
- Updated sample wiki output to show actual removal reasons
- Enhanced database schema documentation with transparency details
- Updated features to highlight complete removal reason transparency
- Shows AutoModerator rule text and addremovalreason descriptions
- Documents unique content ID tracking improvements
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* fix: resolve undefined variables and code quality issues
- Add missing BASE_BACKOFF_WAIT and MAX_BACKOFF_WAIT constants for exponential backoff
- Initialize first_run_force variable in continuous mode function
- Add sanitize_for_markdown() helper function to eliminate code duplication
- Replace all instances of pipe character replacement with consistent helper function
- Improves code maintainability and prevents NameError exceptions
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* refactor: add helper function for config access with default fallback
- Add get_config_with_default() helper to eliminate code duplication
- Replace 7 instances of config.get(key, CONFIG_LIMITS[key]['default']) pattern
- Improve code maintainability and consistency
- Add validation for unknown config keys
- Reduces repetitive nested dictionary access throughout codebase
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* fix: correct database column name mismatch in force refresh query
Fixed incorrect variable name 'timestamp' to 'created_at' to match
the database schema. This was causing force-wiki operations to fail
with "table processed_actions has no column named timestamp" error.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* feat: add TRACE level logging for Reddit API debugging
Added TRACE level (level 5) logging for prawcore and urllib3 when
debug mode is enabled, providing detailed Reddit API request/response
information for troubleshooting authentication and API issues.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* fix: ensure regular wiki updates show all relevant actions not just new ones
Modified regular operation logic to rebuild wiki from ALL relevant
actions in database (within retention period) rather than only new
actions, matching the behavior of force operations for consistent
wiki display.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
---------
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>1 parent d8e0bc0 commit d3b28c8
5 files changed
Lines changed: 1651 additions & 870 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
| 20 | + | |
19 | 21 | | |
20 | 22 | | |
21 | | - | |
22 | | - | |
23 | | - | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
| 31 | + | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
| 34 | + | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
38 | 41 | | |
39 | 42 | | |
40 | | - | |
| 43 | + | |
41 | 44 | | |
42 | 45 | | |
43 | 46 | | |
44 | 47 | | |
45 | | - | |
46 | | - | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
47 | 56 | | |
48 | 57 | | |
49 | 58 | | |
| |||
53 | 62 | | |
54 | 63 | | |
55 | 64 | | |
| 65 | + | |
56 | 66 | | |
57 | 67 | | |
58 | 68 | | |
59 | 69 | | |
60 | 70 | | |
61 | 71 | | |
62 | 72 | | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
63 | 85 | | |
64 | 86 | | |
65 | 87 | | |
| |||
80 | 102 | | |
81 | 103 | | |
82 | 104 | | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
83 | 166 | | |
84 | 167 | | |
85 | | - | |
86 | | - | |
87 | | - | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
15 | 20 | | |
16 | 21 | | |
17 | 22 | | |
| |||
67 | 72 | | |
68 | 73 | | |
69 | 74 | | |
70 | | - | |
| 75 | + | |
| 76 | + | |
71 | 77 | | |
72 | 78 | | |
73 | 79 | | |
74 | 80 | | |
75 | 81 | | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
84 | 94 | | |
85 | 95 | | |
86 | 96 | | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
87 | 109 | | |
88 | 110 | | |
89 | 111 | | |
90 | 112 | | |
91 | 113 | | |
92 | | - | |
| 114 | + | |
93 | 115 | | |
94 | | - | |
95 | | - | |
96 | | - | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
97 | 121 | | |
98 | 122 | | |
99 | 123 | | |
| |||
122 | 146 | | |
123 | 147 | | |
124 | 148 | | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
125 | 181 | | |
126 | 182 | | |
127 | 183 | | |
128 | 184 | | |
129 | 185 | | |
130 | 186 | | |
131 | 187 | | |
132 | | - | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
133 | 192 | | |
134 | 193 | | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
135 | 203 | | |
136 | 204 | | |
137 | 205 | | |
138 | 206 | | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
139 | 219 | | |
140 | 220 | | |
141 | 221 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
10 | 9 | | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
15 | 23 | | |
0 commit comments