Skip to content

[WIP] feat: configurable DB path, timestamped reports, web UI tag/country buttons, test fixes#2583

Draft
JulioSilva123 wants to merge 2 commits into
soxoj:mainfrom
JulioSilva123:JulioSilva123
Draft

[WIP] feat: configurable DB path, timestamped reports, web UI tag/country buttons, test fixes#2583
JulioSilva123 wants to merge 2 commits into
soxoj:mainfrom
JulioSilva123:JulioSilva123

Conversation

@JulioSilva123

Copy link
Copy Markdown

Summary of changes

1. Dependency fixes

  • chardet 7.1.0 β†’ 5.2.0 (incompatible with requests 2.32.3)
  • requests 2.32.5 (non-existent/spurious version) β†’ 2.32.3

2. Test fixes

  • pytest.ini: restored to original after dependency fix
  • tests/test_db_updater.py:137: endswith("custom/path.json") β†’ endswith(os.path.join("custom", "path.json")) (Windows compatibility)
  • tests/test_executors.py: async ordering asserts replaced with set() (flaky tests)

3. Configurable DB path via settings.json

  • maigret/resources/settings.json: added "db_home_path" field
  • maigret/settings.py: added db_home_path to Settings class, removed ~/.maigret/settings.json from path list
  • maigret/db_updater.py: refactored β€” module-level constants MAIGRET_HOME, CACHED_DB_PATH, STATE_PATH replaced by home parameter in resolve_db_path and force_update
  • maigret/maigret.py: passes settings.db_home_path to resolve_db_path and force_update

4. Timestamped report filenames

  • maigret/maigret.py: report filename template now includes YYYYMMDD_HHMMSS (e.g., report_20260501_001327_johndoe_plain.html)

5. Web UI β€” tag/country select all buttons

  • maigret/web/templates/index.html: added 4 buttons in the Filters section:
    • Select All Tags / Clear All Tags (categories)
    • Select All Countries / Clear All Countries (countries)
  • Tags now have data-group="category" or data-group="country" attributes

@soxoj

soxoj commented May 5, 2026

Copy link
Copy Markdown
Owner

Hey @JulioSilva123, thanks for the PR! I took a look and I'd like to ask for some changes before we can merge.

A few things I noticed:

The description doesn't match what's actually in the diff β€” it mentions chardet and requests version bumps and a pytest.ini restore, but none of that is in the changed files. Could you clean up the description so it reflects the current state? Makes review a lot easier.

In maigret/settings.py, the new entry path.join(os.getcwd(), 'settings.json') duplicates a line that was already there. Also, dropping ~/.maigret/settings.json from the search path is a silent break for anyone who keeps their settings there β€” could we keep it as a fallback?

The bigger concern is the default DB location. Right now it effectively moves from ~/.maigret/ to the current working directory (via "db_home_path": "db" plus the MAIGRET_HOME_DB env fallback to .). That means a db/ folder will get created wherever the user runs maigret from, and existing users' cached DBs at ~/.maigret/data.json will be orphaned. I'd suggest keeping ~/.maigret/ as the default and letting db_home_path override it when set explicitly. Also, having both an env var and a settings field as separate sources of truth is a bit confusing β€” could we pick one?

The timestamped report filenames are a behavior change too. Previously running maigret twice on the same username would overwrite the report; now every run leaves a new file behind, which will pile up over time. I think this should be opt-in via a flag rather than the default.

Finally, this PR bundles five pretty unrelated changes (DB path config, report timestamps, web UI buttons, flaky executor test fix, db_updater test refactor). Would you mind splitting it? The pure test fixes especially are easy to land on their own quickly β€” the set() comparison for the async executor tests and the Windows-path fix in test_db_updater.py look good and I'd be happy to merge those right away in a separate PR.

Thanks again for the work!

@soxoj soxoj marked this pull request as draft May 22, 2026 14:35
@soxoj soxoj changed the title feat: configurable DB path, timestamped reports, web UI tag/country buttons, test fixes [WIP] feat: configurable DB path, timestamped reports, web UI tag/country buttons, test fixes Jun 7, 2026
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