Skip to content

feat(admin): trust and automation for operator console - #920

Merged
cameri merged 4 commits into
mainfrom
feat/admin-trust-automation-919
Oct 21, 2026
Merged

cameri merged 4 commits into
mainfrom
feat/admin-trust-automation-919

Conversation

@Ferryx349

Copy link
Copy Markdown
Collaborator

Description

This PR adds :-

  • Admin audit log (GET /admin/audit-log) and Trust UI
  • Webhook events: probe.failed / recovered, ssl.expiring, mirror.disconnected; optional HTTP HMAC
  • OpenTelemetry probe and mirror metrics
  • Diagnostics export and manual NIP-66 probe

Related Issue

Closes #919

Motivation and Context

How Has This Been Tested?

Screenshots (if appropriate):

Screen.Recording.2026-10-21.at.08.33.15.mov

Types of changes

  • Non-functional change (docs, style, minor refactor)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my code changes.
  • I added a changeset, or this is docs-only and I added an empty changeset.
  • All new and existing tests passed.

Add audit log API and Trust UI, signed webhook events for probe/mirror/SSL,
OpenTelemetry probe and mirror metrics, redacted diagnostics export, and
manual NIP-66 probe from the admin console.

Closes #919
@changeset-bot

changeset-bot Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: e572093

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
nostream Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coveralls

coveralls commented Oct 21, 2026 •

Copy link
Copy Markdown
Collaborator

Coverage Report for CI Build 39590902899

Coverage decreased (-0.4%) to 73.796%

Details

  • Coverage decreased (-0.4%) from the base build.
  • Patch coverage: 116 uncovered changes across 18 files (191 of 307 lines covered, 62.21%).
  • 2 coverage regressions across 1 file.

Uncovered Changes

Top 10 Files by Coverage Impact Changed Covered %
src/controllers/admin/post-admin-network-health-run-controller.ts 48 12 25.0%
src/utils/ops-trust-notifications.ts 70 46 65.71%
src/utils/admin-diagnostics-export.ts 23 12 52.17%
src/controllers/admin/get-admin-diagnostics-export-controller.ts 11 3 27.27%
src/controllers/admin/get-admin-audit-log-controller.ts 7 2 28.57%
src/app/static-mirroring-worker.ts 4 0 0.0%
src/factories/controllers/post-admin-network-health-run-controller-factory.ts 11 7 63.64%
src/telemetry/ops-metrics.ts 22 18 81.82%
src/utils/admin-audit-store.ts 25 21 84.0%
src/utils/admin-notifications-settings.ts 8 4 50.0%
Total (26 files) 307 191 62.21%

Coverage Regressions

2 previously-covered lines in 1 file lost coverage.

File Lines Losing Coverage Coverage
src/app/static-mirroring-worker.ts 2 0.0%

Coverage Stats

Coverage Status
Relevant Lines: 11554
Covered Lines: 8936
Line Coverage: 77.34%
Relevant Branches: 5997
Covered Branches: 4016
Branch Coverage: 66.97%
Branches in Coverage %: Yes
Coverage Strength: 779.68 hits per line

💛 - Coveralls

@greptile-apps

greptile-apps Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The changes since the previous review appear safe to merge.

Summary

Adds an admin Trust page, an audit log, diagnostics export, manual probes, signed webhooks, and probe and mirror metrics.

  • The Trust view shows recent admin actions and a redacted support bundle.
  • Operators can run NIP-66 probes from the network-health panel.
  • Operators can receive signed webhook alerts for probe, certificate, and mirror events.
  • Probe runs and mirror reconnects now add operations metrics.
  • Redis script calls reload and retry when Redis has lost a script.

Reviews (4) · Last reviewed commit: "fix(admin): skip audit Redis when cache ..." · Reviewed by Greptile

Comment thread src/utils/ops-trust-notifications.ts Resolved
Comment thread src/utils/ops-trust-notifications.ts Resolved
Comment thread resources/admin/assets/notifications.js Resolved
Comment thread resources/admin/assets/admin-trust.js Resolved
Comment thread resources/admin/assets/dashboard.js Resolved
Comment thread src/utils/ops-trust-notifications.ts Resolved
Wrap Redis dedupe in try/catch, enqueue before marking alerts sent, atomize
probe transitions, allow clearing webhook secrets, and fix Trust 401 handling.
Comment thread src/utils/ops-trust-notifications.ts Resolved
Reload cached script SHAs after Redis flushes scripts and isolate SSL
expiry notifications from probe eval failures.
greptile-apps[bot]
greptile-apps Bot previously approved these changes Oct 21, 2026
Avoid constructing an invalid Redis URL during admin login and settings
updates when REDIS_* env vars are unset (e.g. unit test CI).
@greptile-apps
greptile-apps Bot dismissed their stale review October 21, 2026 11:17

Dismissed because a newer commit was pushed; Greptile will re-review the current head.

@cameri
cameri merged commit abd4a1b into main Oct 21, 2026
14 of 17 checks passed
@cameri
cameri deleted the feat/admin-trust-automation-919 branch October 21, 2026 17:56
cameri added a commit that referenced this pull request Oct 31, 2026
…ts scripts (#1003)

Adds an integration scenario for #1002.

## What #1002 actually was

The relay answered `HTTP 200`, accepted websocket upgrades, and never
acknowledged another event after its Redis cache was restarted. The
cause is that the relay issues `EVALSHA`, and Lua scripts live in the
cache's memory, so every call after a restart answers `NOSCRIPT`.

**The production failure was an old image, not missing code.** The retry
landed on 2026-10-21 in #920 (`src/adapters/redis-adapter.ts`,
`isNoScriptError` + a `scriptLoad` retry). The relay that failed was
built 2026-09-03 from revision `3006eee3`, five minor releases behind
`latest` (3.8.0, built 2026-10-24).

So what was missing is proof, not a fix: the unit test stubs `evalSha`,
which cannot catch a retry that stops working through the workers — the
path that actually broke — and nothing exercised a real script cache.

## What this adds

`test/integration/features/redis-script-cache/` — one scenario that
publishes, runs `SCRIPT FLUSH` against the same Redis, and publishes
twice more. `SCRIPT FLUSH` is the whole of a restart as far as the relay
can tell, and it is deterministic: no container to restart, no reconnect
to wait for.

The `@script-cache` hook configures a message rate limit on purpose.
Both limiters return early when `rateLimits` is empty, so a scenario
without one would pass whether or not the fallback existed — the guard
that makes this test mean something.

## Verification

| run | state of the adapter | result |
|---|---|---|
|
[41221855127](https://github.com/cameri/nostream/actions/runs/41221855127)
| retry present | **Integration Tests: success** |
|
[41222446906](https://github.com/cameri/nostream/actions/runs/41222446906)
| retry removed (probe commit) | **Integration Tests: failure**, Unit
Tests: failure |
|
[41222894268](https://github.com/cameri/nostream/actions/runs/41222894268)
| retry restored | **Integration Tests: success** |

The middle row is the fail-before: the scenario goes red exactly when
the fallback goes away, and green when it returns. The probe commit was
dropped from the branch afterwards, so the diff here is the test and its
changeset only.

`cucumber-js --dry-run` over the full feature set reports 123 scenarios
with no undefined steps.

Refs #1002.
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.

[Admin Console] : trust & automation (audit, webhooks, OTel, diagnostics)

3 participants