Skip to content

feat(data): persist data in git repo #401

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ReenigneArcher
Copy link
Member

@ReenigneArcher ReenigneArcher commented May 12, 2025

Description

This PR migrates DBs from using shelve to json so the data can be stored in a private git repo. The DBs are using tinydb which is a new dependency for the project.

This change is necessary in order to prepare for #365

TODO:

  • add git repo integration
  • remove oauth_states from discord_bot.db as it does not need to persist
  • unit testing
  • update readme
  • investigate the below error
Ignoring exception in on_ready
Traceback (most recent call last):
  File "C:\Users\ReenigneArcher\Dev\git\support-bot\.venv\Lib\site-packages\discord\client.py", line 412, in _run_event
    await coro(*args, **kwargs)
  File "C:\Users\ReenigneArcher\Dev\git\support-bot\src\discord_bot\cogs\support_commands.py", line 41, in on_ready
    self.self_update.start()
  File "C:\Users\ReenigneArcher\Dev\git\support-bot\.venv\Lib\site-packages\discord\ext\tasks\__init__.py", line 327, in start
    raise RuntimeError("Task is already launched and is not completed.")
RuntimeError: Task is already launched and is not completed.
Ignoring exception in on_ready
Traceback (most recent call last):
  File "C:\Users\ReenigneArcher\Dev\git\support-bot\.venv\Lib\site-packages\discord\client.py", line 412, in _run_event
    await coro(*args, **kwargs)
  File "C:\Users\ReenigneArcher\Dev\git\support-bot\src\discord_bot\bot.py", line 80, in on_ready
    self.clean_ephemeral_cache.start(bot=self)
  File "C:\Users\ReenigneArcher\Dev\git\support-bot\.venv\Lib\site-packages\discord\ext\tasks\__init__.py", line 327, in start
    raise RuntimeError("Task is already launched and is not completed.")
RuntimeError: Task is already launched and is not completed.

Screenshot

Issues Fixed or Closed

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Dependency update (updates to dependencies)
  • Documentation update (changes to documentation)
  • Repository update (changes to repository files, e.g. .github/...)

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated the in code docstring/documentation-blocks for new or existing methods/components

Copy link

codecov bot commented May 12, 2025

Codecov Report

Attention: Patch coverage is 72.41379% with 32 lines in your changes missing coverage. Please review.

Project coverage is 66.05%. Comparing base (77db212) to head (2452e19).

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/common/database.py 52.00% 24 Missing ⚠️
src/discord_bot/tasks.py 60.00% 4 Missing ⚠️
src/discord_bot/cogs/github_commands.py 0.00% 2 Missing ⚠️
src/reddit_bot/bot.py 94.73% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #401      +/-   ##
==========================================
- Coverage   69.20%   66.05%   -3.15%     
==========================================
  Files          21       21              
  Lines        1104     1146      +42     
==========================================
- Hits          764      757       -7     
- Misses        340      389      +49     
Files with missing lines Coverage Δ
src/common/webapp.py 96.87% <100.00%> (+0.07%) ⬆️
src/discord_bot/bot.py 88.77% <100.00%> (-0.12%) ⬇️
src/discord_bot/cogs/github_commands.py 41.46% <0.00%> (+1.92%) ⬆️
src/reddit_bot/bot.py 71.19% <94.73%> (+0.51%) ⬆️
src/discord_bot/tasks.py 67.36% <60.00%> (-20.50%) ⬇️
src/common/database.py 60.65% <52.00%> (-39.35%) ⬇️

@ReenigneArcher ReenigneArcher force-pushed the feat/data/persist-data-in-git-repo branch 17 times, most recently from 3e5fb8c to f4b6b5d Compare May 14, 2025 00:36
@ReenigneArcher ReenigneArcher force-pushed the feat/data/persist-data-in-git-repo branch from f4b6b5d to 2452e19 Compare May 14, 2025 01:35
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
2 New issues
2 New Code Smells (required ≤ 0)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

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