Skip to content

refactor: move regex_chans table to orm class - #1097

Open
linuxdaemon wants to merge 1 commit into
mainfrom
regex-chans-orm
Open

linuxdaemon wants to merge 1 commit into
mainfrom
regex-chans-orm

Conversation

@linuxdaemon

Copy link
Copy Markdown
Member

No description provided.

@codecov

codecov Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.78%. Comparing base (36868b3) to head (96b05a8).
⚠️ Report is 2 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1097   +/-   ##
=======================================
  Coverage   87.78%   87.78%           
=======================================
  Files         299      299           
  Lines       22298    22305    +7     
  Branches     1846     1846           
=======================================
+ Hits        19574    19581    +7     
  Misses       2321     2321           
  Partials      403      403           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The migration still declares the existing string-valued status column as Boolean in both affected locations, which can rewrite ENABLED/DISABLED values incorrectly and break cache status handling.

1 open issue
What changed in this PR

Refactors the regex_chans persistence layer from a standalone SQLAlchemy table to an ORM model, with a migration that updates the existing schema and corresponding test and type-checking updates.

Changes:

  • Introduces the RegexChans ORM model with composite primary keys and updates database operations.
  • Adds a migration to rebuild the legacy table without the redundant unique constraint.
  • Updates regex channel tests and removes obsolete basedpyright diagnostics.
File Description
tests/​plugin_tests/​test_regex_chans.py Updates fixtures, database setup, assertions, and logging expectations to use the RegexChans ORM model.
plugins/​core/​regex_chans.py Replaces the standalone table with the RegexChans ORM class and updates cache and database operations.
alembic/​versions/​d3c591b463b1_remove_extraneous_regex_chans_constraint.py Rebuilds the legacy regex_chans table with composite primary-key columns and supports downgrade.
.basedpyright/​baseline.json Removes obsolete type-checking baseline entries resolved by the ORM refactor.

Review effort: Lite

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The migration can silently delete existing settings with empty connection or channel values, so its filtering must be corrected to preserve data or explicitly report discarded rows.

1 open issue
1 resolved since last review

Review effort: Lite

[
dict(row)
for row in old_ignores
if row["connection"] and row["channel"]

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The migration’s truthiness check discards valid settings with empty-string keys, causing permanent data loss and unexpectedly re-enabling disabled regex hooks after upgrade.

1 open issue

Review effort: Balanced

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.

2 participants