Skip to content

[pull] master from Ehco1996:master#316

Merged
pull[bot] merged 1 commit into
Kiterepo:masterfrom
Ehco1996:master
May 5, 2026
Merged

[pull] master from Ehco1996:master#316
pull[bot] merged 1 commit into
Kiterepo:masterfrom
Ehco1996:master

Conversation

@pull
Copy link
Copy Markdown

@pull pull Bot commented May 5, 2026

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

* ms: storage health + query latency + maintenance ops in Settings

Adds a self-contained, dependency-free observability layer over the
local SQLite metrics store, surfaced in the SPA's Settings page so
operators can see at a glance whether the store is healthy and act on
it without shelling into the box.

Backend (internal/cmgr/ms):
- stats.go: opStats{count,total,max,last} per op + Stats.Snapshot. The
  shared `track` helper instruments every public method via one-line
  defer; new ops register in Stats.all and the SPA picks them up.
- health.go: DBHealth aggregates file size, page/freelist counts, row
  counts, last rule write, and the stats snapshot. Maintenance ops
  (CleanupOlderThan, Vacuum, Truncate, ResetStats) return a unified
  MaintenanceResult with duration + before/after byte counts.
- ms.go: nodeRows/ruleRows atomic.Int64 caches keep Health() off the
  COUNT(*) hot path; reconciled via recountRows on startup, Vacuum,
  and Truncate. INSERT OR REPLACE may overcount briefly — bounded.
- Truncate requires confirm == "yes I am sure" exactly; a defaulted
  JSON field cannot wipe data.

cmgr: Cmgr interface gains DBHealth/DBCleanup/DBVacuum/DBTruncate/
DBResetStats, returning ErrMetricsDisabled when the store is not
configured.

Web (internal/web):
- 5 new routes under /api/v1/db/* (auth-gated via the existing api
  group middleware). dbMaintenanceErr maps cmgr/ms domain errors onto
  HTTP status uniformly.
- Settings.tsx grows Storage / Query Latency / Maintenance cards;
  Truncate uses prompt() with literal-match confirm; every op funnels
  through one runMaint helper for consistent loading/toast state.

Tests: round-trip, cleanup row-affected, truncate confirm strictness,
reset-stats — all green under -race.

* webui: tighten Settings layout and fix copy on plain-HTTP origins

Density / IA pass on /settings, plus the copy-button bug surfaced on
LAN (plain-HTTP) deployments where navigator.clipboard is undefined.

Layout
- Drop the standalone "theme" card — broken and already covered by the
  sidebar toggle, no need for a duplicate.
- Drop the "api surface" card — a hardcoded endpoint enumeration with
  no operator value; OpenAPI is the right home if we ever want it.
- Fold the "reload configuration" card into the runtime-configuration
  card's right slot. One button + one paragraph no longer steals a
  whole grid cell; the reload status pill renders inline.
- Group storage / query-latency / maintenance under a "database"
  section title; group the updates panel under "updates". Adds the
  vertical hierarchy that 11 sibling cards in a 2-col grid lacked.
- Maintenance card switches from md:grid-cols-3 to flex-wrap so the
  three actions hug the start instead of floating in unequal cells;
  status pill moves to the card-header right slot.
- Latency table drops the redundant "last" column and pins column
  widths via table-fixed + colgroup so the right edge no longer
  overflows the card on lg viewports.

UpdatesPanel
- Collapse "current build" + "check for updates" into a single card.
  Build DescList sits in the body; channel selector + Check button
  + nightly/stable pill move into the card-header right slot.
- Drop the in-panel h2 "updates" header — the new SectionTitle in
  Settings owns that label, and rendering it twice was redundant.
- "update progress" stays as a separate conditional card.

Copy bug
- New util/clipboard.ts wraps navigator.clipboard with the legacy
  document.execCommand fallback. Plain-HTTP origins (e.g. ehco on a
  LAN IP) are not secure contexts, so navigator.clipboard is
  undefined and the previous catch-and-ignore meant the button
  appeared dead. The fallback works in non-secure contexts and is
  the canonical pattern for this scenario.
- Settings calls copyText() instead of doing its own try/catch; the
  helper is generic enough for any future copy affordance.
@pull pull Bot locked and limited conversation to collaborators May 5, 2026
@pull pull Bot added the ⤵️ pull label May 5, 2026
@pull pull Bot merged commit 31fd219 into Kiterepo:master May 5, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant