Skip to content

feat(health): expose SQLite backup acknowledgment as a Prometheus gauge - #3444

Closed
bohdansolovie wants to merge 1 commit into
JSONbored:mainfrom
bohdansolovie:feat/health-backup-acknowledged-metric-2089
Closed

feat(health): expose SQLite backup acknowledgment as a Prometheus gauge#3444
bohdansolovie wants to merge 1 commit into
JSONbored:mainfrom
bohdansolovie:feat/health-backup-acknowledged-metric-2089

Conversation

@bohdansolovie

Copy link
Copy Markdown
Contributor

Fixes #2089

Summary

  • Add backupAcknowledgedGaugeValue() in health.ts — returns 1 when Postgres is in use or backup is acknowledged, 0 when the boot SQLite backup advisory would fire
  • Register gittensory_backup_acknowledged gauge at server boot (mirrors existing sqliteBackupAdvisory inputs)
  • Add metric metadata in metrics.ts
  • Unit tests for all three input combinations

Test plan

  • backupAcknowledgedGaugeValue unit tests in selfhost-health.test.ts
  • CI validate-code

Made with Cursor

…ge (JSONbored#2089)

Add backupAcknowledgedGaugeValue and register gittensory_backup_acknowledged at boot alongside the existing advisory.

Co-authored-by: Cursor <cursoragent@cursor.com>
@bohdansolovie
bohdansolovie requested a review from JSONbored as a code owner July 5, 2026 07:14
@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@codecov

codecov Bot commented Jul 5, 2026

Copy link
Copy Markdown

⚠️ JUnit XML file not found

The CLI was unable to find any JUnit XML files to upload.
For more help, visit our troubleshooting guide.

@loopover-orb loopover-orb Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jul 5, 2026
@loopover-orb

loopover-orb Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Caution

🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥

🛑 Gittensory review result - fixes required

Review updated: 2026-07-05 07:16:05 UTC

4 files · 1 AI reviewer · no blockers · readiness 80/100 · CI failing · blocked

🛑 Suggested Action - Fix Blockers

  • Touches a guarded path — held for manual review: This PR changes guardrail-protected path(s): src/selfhost/health.ts (matched src/selfhost/**), src/selfhost/metrics.ts (matched src/selfhost/**).

Review summary
This change cleanly exposes the existing SQLite backup advisory state as a Prometheus gauge and reuses the same input object as the boot warning, so the metric cannot drift from the warning logic at the call site. The helper in health.ts delegates to sqliteBackupAdvisory, which keeps the Postgres and acknowledged-backup semantics aligned with the existing source of truth. I do not see a reachable correctness defect in the visible diff.

Nits — 5 non-blocking
  • nit: test/unit/selfhost-health.test.ts:211 covers the three meaningful states, but a table-driven test including `{ usingSqlite: false, backupAcknowledged: true }` would make the ignored-acknowledgment Postgres case explicit.
  • nit: src/server.ts:690 registers the gauge through the full advisory helper path, which is correct, but there is no visible metrics rendering assertion that `gittensory_backup_acknowledged` emits with HELP/TYPE metadata.
  • test/unit/selfhost-health.test.ts:211: convert the helper test to a table so all boolean combinations are documented without adding much noise.
  • src/selfhost/metrics.ts:52: add or extend a metrics render test to assert the new gauge metadata is emitted when the gauge is registered.
  • Touches a guarded path — held for manual review — A maintainer must review and merge this change.

CI checks failing

  • validate
  • validate-code
Signal Result Evidence
Code review ✅ No blockers 1 reviewer
Linked issue ✅ Linked #2089
Related work ✅ No active overlap found No same-issue or scoped active PR overlap found.
Change scope ✅ 20/20 Low review scope from cached public metadata (1 linked issue).
Validation posture ❌ 5/25 Preflight is holding this PR: the review lane is unavailable, so it is not ready for automated review.
Contributor workload ✅ 10/10 Author activity: 267 registered-repo PR(s), 167 merged, 9 issue(s).
Contributor context ✅ Confirmed Gittensor contributor bohdansolovie; Gittensor profile; 267 PR(s), 9 issue(s).
Gate result ⚠️ Not blocking Advisory; not blocking this PR.
Review context
  • Author: bohdansolovie
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository registration is not available in the local Gittensory cache.
  • Public profile languages: not available
  • Official Gittensor activity: 267 PR(s), 9 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Await review-lane availability.
  • Refresh registry data or choose a registered active repo.
Signal definitions
  • Related work = same linked issue, overlapping active PRs, or title/path similarity.
  • Change scope = cached public metadata such as size labels, draft state, and review-burden hints.
  • Validation posture = whether the PR provides enough public validation/test evidence for maintainer review.
  • Contributor workload = public contributor activity and cleanup pressure, not a repo-wide quality failure.
  • Contributor context = public GitHub/Gittensor identity context; non-Gittensor status is not a blocker.

🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed


💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →.

Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers.

  • Re-run Gittensory review

@loopover-orb

loopover-orb Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Gittensory is closing this pull request on the maintainer's behalf (CI is failing (validate, validate-code)). This is an automated maintenance action — to pursue this change, please open a new pull request with the issues resolved. Closed PRs may be analyzed later to improve review accuracy, but they are not automatically reopened or re-reviewed.

@loopover-orb loopover-orb Bot closed this Jul 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(health): count boot-time SQLite backup advisory as a metric, not just a log line

1 participant