Skip to content

fix: SystemView vector metrics disconnected guard#31

Merged
thebtf merged 1 commit into
mainfrom
feat/v1.1-vector-metrics
Mar 20, 2026
Merged

fix: SystemView vector metrics disconnected guard#31
thebtf merged 1 commit into
mainfrom
feat/v1.1-vector-metrics

Conversation

@thebtf
Copy link
Copy Markdown
Owner

@thebtf thebtf commented Mar 20, 2026

Summary

  • T003: Added v-if/v-else guard for vector metrics when client is disconnected
  • T001-T002: Already implemented (pgvector instrumentation + real handler data)

Changes

  • SystemView.vue: Wrapped metric display in v-if="vectorMetrics.enabled" guard
  • Shows "Vector DB not connected" message when disabled
  • Prevents .toFixed() TypeError on undefined values

Test plan

  • System page shows metrics when vector DB connected
  • System page shows disconnected message gracefully when vector DB unavailable

Summary by CodeRabbit

  • Улучшения
    • Улучшено отображение раздела метрик векторной базы данных. Когда функция отключена, система показывает информационное сообщение со статусом вместо пустой сетки метрик. При активации компонента метрики и показатели задержек отображаются в полном объеме.

T003: Added v-if/v-else guard so .toFixed() is not called on undefined
when vector client returns {enabled: false} instead of numeric metrics.
T001-T002: Already implemented — pgvector instrumentation + handler use real data.
@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the SystemView by introducing robust error handling for vector metrics. It ensures that the user interface gracefully handles scenarios where the vector database is disconnected, preventing display errors and providing clear feedback to the user about the connection status, thereby improving the overall stability and user experience of the system monitoring page.

Highlights

  • Vector Metrics Display: Implemented a v-if/v-else guard for vector metrics to handle cases where the client is disconnected, preventing UI errors.
  • Error Handling: Added a message 'Vector database not available' or a custom message from vectorMetrics.message when the vector database is not connected.
  • UI Robustness: Prevented .toFixed() TypeError that could occur on undefined values when vector metrics data is not available.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 20, 2026

Пошаговое описание

Компонент SystemView.vue расширен логикой условного отображения для секции "Vector Metrics". Теперь при отключенном состоянии показывается статусная строка с иконкой, при включенном — выводятся карточки метрик и сетка персентилей задержки. Изменены только шаблонные директивы без модификации экспортируемых сущностей.

Изменения

Когорта / Файл(ы) Резюме
Условное отображение Vector Metrics
ui/src/views/SystemView.vue
Добавлена логика ветвления на основе vectorMetrics.enabled: при отключении отображается статусная строка с иконкой и сообщением об ошибке, при включении — исходные карточки метрик и сетка персентилей. Обновлено 36 строк, удалено 30 строк.

Оцененная трудоёмкость рецензирования

🎯 3 (Moderate) | ⏱️ ~20 минут

Стихотворение

🐰 Вектор танцует, теперь в стиле v-if!
Когда включен — метрики в пляс,
Отключен — статус, как мудрый совет.
Шаблонная логика светит для нас,
Условных путей хоровод — вот успех! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly relates to the main change: adding a guard for vector metrics when disconnected to prevent errors.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/v1.1-vector-metrics
📝 Coding Plan
  • Generate coding plan for human review comments

Comment @coderabbitai help to get the list of available commands and usage tips.

@thebtf
Copy link
Copy Markdown
Owner Author

thebtf commented Mar 20, 2026

@coderabbitai review

@thebtf
Copy link
Copy Markdown
Owner Author

thebtf commented Mar 20, 2026

@gemini-code-assist review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 20, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@thebtf
Copy link
Copy Markdown
Owner Author

thebtf commented Mar 20, 2026

@codex review

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request correctly adds a guard to prevent a TypeError when vector metrics are disabled, which is a good fix. The use of v-if/v-else is appropriate for this. I have added one suggestion to further improve the robustness of the component against potentially missing data from the API, even when metrics are enabled, by handling potential null or undefined values before calling .toFixed().

Comment thread ui/src/views/SystemView.vue
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@ui/src/views/SystemView.vue`:
- Around line 229-262: Create a discriminated union for VectorMetrics with a
boolean literal field enabled: one variant { enabled: true; query_count: number;
avg_latency_ms: number; p50_latency_ms: number; p95_latency_ms: number;
p99_latency_ms: number; total_documents: number; uptime: string } and the other
{ enabled: false; query_count?: number; avg_latency_ms?: undefined;
p50_latency_ms?: undefined; p95_latency_ms?: undefined; p99_latency_ms?:
undefined; total_documents?: number; uptime?: string } so the type encodes that
numeric latency fields exist only when enabled is true; then update usages in
SystemView.vue (this template) and Sidebar.vue to narrow on
vectorMetrics.enabled before calling .toFixed(1) or accessing latency fields
(e.g., wrap latency displays in an if/ternary that checks enabled or guard with
a type-narrowing branch) so TypeScript enforces safe access to the numeric
fields.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 8dfdca97-27ca-4c7d-8edd-020e79aa4099

📥 Commits

Reviewing files that changed from the base of the PR and between 723a72f and 6e3d0af.

📒 Files selected for processing (1)
  • ui/src/views/SystemView.vue

Comment thread ui/src/views/SystemView.vue
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request correctly adds a guard to the vector metrics display in SystemView.vue to prevent a TypeError when the vector database is not connected. The change checks vectorMetrics.enabled and shows a message instead of trying to render metrics with undefined values. I've added one suggestion to further improve the robustness of the component by defensively handling cases where latency values might be null even when metrics are enabled.

Comment thread ui/src/views/SystemView.vue
@thebtf thebtf merged commit d297df1 into main Mar 20, 2026
2 checks passed
@thebtf thebtf deleted the feat/v1.1-vector-metrics branch March 20, 2026 14:03
thebtf added a commit that referenced this pull request Apr 10, 2026
Root cause: HTTP WriteTimeout=60s (set by PR #31 security hardening)
closes idle SSE connections, EventSource fires onerror, dashboard shows
banner, client reconnects — repeat every minute.

Fix: SSE handler now sends a comment-line keepalive ': keepalive\n\n'
every 25s. Comments are ignored by the client but keep the HTTP write
path active, preventing WriteTimeout from firing on idle streams.

Also added:
- X-Accel-Buffering: no header to disable nginx/reverse-proxy buffering
- Client.WriteMu mutex to serialize concurrent writes between broadcast
  goroutines and the keepalive ticker
- Initial connection message now goes through the mutex too

Verified: all SSE tests pass. Dashboard banner should stay hidden
when connection is healthy.

Bump plugins to 3.5.7.
thebtf added a commit that referenced this pull request Apr 12, 2026
Backend:
- Migration 075: add type column (TEXT, default 'task') to issues table
- Issue model: Type field with validation (bug/feature/improvement/task)
- Store: CreateIssue validates type, UpdateIssueFields accepts type,
  ListIssuesEx filters by type
- MCP tool: type param in issues(action="create")
- REST: type in POST/PATCH body, GET query param

Dashboard:
- "New Issue" button + creation modal (title, body, type, priority, target_project)
- Type filter buttons (All/Bug/Feature/Improvement/Task)
- Type badge in issue list (colored: red/blue/green/gray)
- Type badge + edit in issue detail view

Hooks:
- formatIssuesBlock shows [TYPE] tag in session injection

Plugin v3.7.8.
Closes #31, #14.
thebtf added a commit that referenced this pull request Apr 12, 2026
* feat(issues): add type field (bug/feature/improvement/task) [T001-T008]

* feat(issues): add type field + operator create from dashboard (#31, #14)

Backend:
- Migration 075: add type column (TEXT, default 'task') to issues table
- Issue model: Type field with validation (bug/feature/improvement/task)
- Store: CreateIssue validates type, UpdateIssueFields accepts type,
  ListIssuesEx filters by type
- MCP tool: type param in issues(action="create")
- REST: type in POST/PATCH body, GET query param

Dashboard:
- "New Issue" button + creation modal (title, body, type, priority, target_project)
- Type filter buttons (All/Bug/Feature/Improvement/Task)
- Type badge in issue list (colored: red/blue/green/gray)
- Type badge + edit in issue detail view

Hooks:
- formatIssuesBlock shows [TYPE] tag in session injection

Plugin v3.7.8.
Closes #31, #14.

* fix(issues): address PR #145 review findings

- migrations.go: add DB-level CHECK constraint issues_type_check for
  type IN ('bug','feature','improvement','task') with proper rollback
- models.go: add not null to GORM tag for Type field to match migration
- handlers_issues.go: normalize type param with TrimSpace+ToLower in
  list, create, and update handlers
- api.ts: refactor createIssue to use postJson helper (removes
  duplicated timeout/abort/retry logic); require non-empty target_project
  and validate eagerly before HTTP call
- IssuesView.vue: pass target_project as string (not undefined) since
  createIssue now validates it directly

---------

Co-authored-by: Kirill Turanskiy <thebtf@users.noreply.github.com>
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