Skip to content

Conversation

Copy link

Copilot AI commented Nov 25, 2025

The TUI had a duplicate on_button_pressed method where the second definition silently overrode the first, breaking tab navigation. Additionally, the main() entry point referenced in pyproject.toml was missing.

Bug Fixes

  • Merged duplicate on_button_pressed handlers - Tab navigation buttons and action buttons now both work
  • Added missing main() function - Entry point for rescrape console script

Hardening

  • Input validation:

    • Subreddit names: alphanumeric, underscores, hyphens only
    • Post limit: 1-1000 range with capping
    • Query length: 3-500 characters
    • Sort/time filter normalized to lowercase
  • State tracking for export:

    • Added current_subreddit, current_research_query, current_research_results
    • Enabled research results export to Obsidian

UI Improvements

  • action_toggle_tab cycles through Results → Research → Log
  • action_switch_to_assistant actually switches tabs
  • External CSS file loading with inline fallback
  • Updated rescrape.tcss with missing selectors (.hidden, #tab_nav, containers)

Tests

  • Added 13 TUI-specific tests covering bindings, methods, input validation, and CSS
# Before: second handler overwrote first, breaking tab nav
def on_button_pressed(self, event):  # Tab navigation
    ...
def on_button_pressed(self, event):  # Actions - this was the only one called
    ...

# After: single unified handler
def on_button_pressed(self, event):
    if event.button.id == "show_results_btn":
        self.show_results_tab()
    elif event.button.id == "scrape_button":
        self.start_scraping()
    # ...

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • huggingface.co
    • Triggering command: /usr/bin/python python -m pytest tests/ -v --no-cov (dns block)
    • Triggering command: /usr/bin/python python -m pytest tests/test_tui.py -v --no-cov (dns block)
    • Triggering command: /usr/bin/python python -m pytest tests/test_tui.py tests/test_imports.py tests/test_main.py -v --no-cov (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

consolidation and hardening + TUI review


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 3 commits November 25, 2025 05:34
…input validation

Co-authored-by: Camier <8348793+Camier@users.noreply.github.com>
Co-authored-by: Camier <8348793+Camier@users.noreply.github.com>
…est logic

Co-authored-by: Camier <8348793+Camier@users.noreply.github.com>
Copilot AI changed the title [WIP] Consolidate and harden user interface components Fix TUI duplicate event handler and harden input validation Nov 25, 2025
Copilot AI requested a review from Camier November 25, 2025 05:55
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