Codumentor logo Codumentor

Bug Report Plugin

The Bug Report plugin provides a user-facing form for submitting bug reports and feedback. Submissions are forwarded to a backend issue tracker (Redmine) and stored locally in a SQLite database for admin review.

Overview

The Bug Report plugin:

  1. Provides a UI widget ("Report a Problem") in the header menu
  2. Accepts bug reports and feedback submissions from users
  3. Forwards submissions to a configured backend (Redmine) as new issues
  4. Stores a local record of every submission for admin review
  5. Provides an admin panel card to view recent submissions

Configuration

Redmine Backend

plugins:
  - module: codumentor.plugins.bug_report
    class: BugReportPlugin
    priority: 90
    args:
      backend:
        type: redmine
        url: "https://redmine.example.com"
        api_key: "${REDMINE_API_KEY}"
        project_id: "codumentor"
        tracker_id: 1
        status_id: 1
        parent_issue_id: 37210
        custom_fields:
          - id: 33
            source: user.display_name
          - name: "Reporter Email"
            source: user.email
          - id: 40
            value: "Codumentor"

Configuration Parameters

Backend (required)

ParameterTypeDescription
typestrBackend type. Currently only "redmine" is supported.
urlstrBase URL of the Redmine instance (e.g. https://redmine.example.com).
api_keystrRedmine API key for authentication. Supports ${ENV_VAR} expansion.
project_idstrRedmine project identifier where issues are created.

Issue Fields

ParameterTypeDescription
tracker_idintRedmine tracker ID for the created issue. Used for both bug and feedback submissions. Default: 1.
status_idintRedmine issue status ID on creation. Optional — omitted if not set.
parent_issue_idintRedmine parent issue ID to create a subtask relationship. Optional — omitted if not set.

Custom Fields

ParameterTypeDescription
custom_fieldslistList of custom field entries to include with every submission.

Each entry has two parts:

custom_fields:
  - id: 33
    source: user.display_name    # injected from context
  - name: "Reporter Email"       # identified by name instead of id
    source: user.email
  - id: 40
    value: "Codumentor"          # constant

##### Injection context

source: paths resolve against a stable, documented object built at submission time. Available keys:

PathDescription
user.idAuthenticated user ID, or "anonymous".
user.display_nameAuthenticated user's display name (empty for anonymous users).
user.emailReporter's email address (from the form).
report.type"bug" or "feedback".
report.summaryThe user-provided summary.
conversation.idConversation ID, if provided.

This context object and the field-resolution logic are backend-agnostic (backends/base.py), so future backends can reuse the same value/source mechanism.

API Reference

Submit a Report

POST /api/plugins/bug_report/submit

Creates a new bug report or feedback submission, forwards it to the configured backend, and stores a local record.

Request body:

FieldTypeRequiredDescription
report_typestrYes"bug" or "feedback"
summarystrYesShort title (1–200 characters)
detailsstrNoDetailed description (up to 5000 characters)
emailstrYesReporter's email address
include_conversationboolNoInclude conversation context (default: true)
conversation_idstrNoConversation ID to include
include_environmentboolNoInclude environment info (default: true)
environmentobjectNoCustom environment key-value pairs
attachment_filenamestrNoName of attached file
attachment_contentstrNoBase64-encoded attachment content

Response:

FieldTypeDescription
idstrBackend issue ID (e.g. Redmine issue number)
urlstrURL to view the issue in the backend
errorstrError message if submission failed

Admin: Recent Reports

GET /api/plugins/bug_report/admin/recent

Returns the 5 most recent bug report submissions. Requires admin:* permission.

Admin: Test Connection

POST /api/plugins/bug_report/admin/test

Tests connectivity to the configured backend. Requires admin:* permission.

Response:

FieldTypeDescription
okboolWhether the connection succeeded
messagestrHuman-readable status message

How It Works

Submission Flow

  1. User fills out the bug report form in the UI and submits
  2. The route handler extracts the authenticated user's display name and builds diagnostic info from conversation context and environment
  3. The payload is forwarded to the Redmine backend, which creates a new issue via the Redmine REST API
  4. The backend returns the new issue ID and URL
  5. A local record is stored in the SQLite database (data/bug_reports.sqlite3)

Issue Creation in Redmine

The backend constructs a Redmine issue with the following fields:

Custom Field Resolution

Each configured custom field is resolved at submission time by resolve_field in backends/base.py:

Example config entry:

custom_fields:
  - id: 33
    source: user.display_name

If the authenticated user's display name is "Katalin Schaffer", the submitted custom field will be:

{"id": 33, "value": "Katalin Schaffer"}

Local Storage

Submissions are stored in a SQLite database at data/bug_reports.sqlite3 (configurable via CODUMENTOR_DATA_DIR environment variable). The schema includes:

UI Integration

The plugin registers two UI widgets: