Skip to content

[STORY] Self-Monitoring Web UI Tab #74

@jsbattig

Description

@jsbattig

Part of: #71

Feature: Web UI and Observability

Story: Self-Monitoring Web UI Tab

Overview

Objective: Create a dedicated Self-Monitoring tab in the admin web UI with configuration and dashboard sections.

User Value: As an admin, I want a dedicated Self-Monitoring tab in the web UI so that I can configure the feature, view scan history, and monitor created issues all in one place.

Acceptance Criteria

AC1: Navigation Tab

Given the admin web UI navigation bar
When the Self-Monitoring tab is added
Then it appears after the "Logs" tab and before "Query"
And clicking it navigates to /admin/self-monitoring
And it shows aria-current="page" when active

AC2: Status Section

Given the Self-Monitoring page
When the status section is displayed
Then it shows: enabled/disabled state, last scan timestamp and result, next scheduled scan time
And if a scan is currently running, it shows "Running..." indicator

AC3: Configuration Section

Given the Self-Monitoring configuration section
When displayed
Then it shows:
  - Enable/disable toggle
  - Cadence dropdown (15min, 30min, 1hr, 6hr, 24hr)
  - Model selector dropdown (Opus, Sonnet) with Opus as default
  - Prompt editor textarea with current prompt_template
  - Visual indicator if prompt was user-modified (differs from default)
  - "Revert to Default" button (only shown if modified)
  - "Save" button

Given GitHub CI/CD is not configured
When admin tries to enable self-monitoring
Then an error message is displayed
And the toggle remains off

AC4: Scan History Section

Given the scan history section
When displayed
Then it shows a table with columns: Timestamp, Status, Issues Created, Details
And data is loaded from self_monitoring_scans SQLite table
And each row has a "View" link to see scan details
And failed scans show error message on expansion

AC5: Created Issues Section

Given the created issues section
When displayed
Then it shows a table with columns: Issue #, Title, Classification, Created
And data is loaded from self_monitoring_issues SQLite table (not fetched from GitHub)
And issue numbers are clickable links to GitHub
And classification shows: server_bug, client_misuse, or documentation_gap
And shows classification breakdown summary (counts by type)

AC6: Save Configuration

Given the admin modifies configuration settings
When they click Save
Then settings are persisted to config.json via config_manager
And if prompt was edited, prompt_user_modified is set to true
And success feedback is shown

Technical Requirements

Files to Create

  • src/code_indexer/server/web/templates/self_monitoring.html
  • src/code_indexer/server/web/routes/self_monitoring.py

Files to Modify

  • src/code_indexer/server/web/templates/base.html (add nav tab)
  • src/code_indexer/server/web/init.py (register routes)

Patterns to Follow

  • Existing config.html for configuration UI patterns
  • Existing dashboard.html for status/metrics display
  • HTMX for dynamic updates (already used in codebase)

Testing Requirements

  • Unit tests for route handlers
  • Unit tests for template rendering with mock data
  • Integration test for save configuration flow
  • E2E test for full page interaction

Definition of Done

  • Self-Monitoring tab appears in navigation
  • Status section shows current state
  • Configuration section with all controls works
  • Prompt editor with revert functionality works
  • Scan history loads from SQLite
  • Created issues list with GitHub links works
  • Save persists changes correctly
  • All tests pass
  • Code review approved

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions