Repository navigation
Open
Labels
Milestone
Description
Parent: #860
Milestone: Phase 5: Admin console + MCP
Host: chappie · Expected cost: $5.00
The admin surface: HTTP routes, the static console, and the new MCP server for admins driving their relay with agents.
- HTTP admin routes (measured
src/routes/admin+src/routes/callbacks+ admissions/invoices routes, 244 LOC + auth provider 87 LOC): axum with the same session model (password-admin-auth-provider.tssemantics); serve the existing static console fromresources/adminunchanged - Admin API parity: every endpoint the console's JS calls (
dashboard.js,notifications.js) responds with the same shapes — the console is the oracle and must work unmodified against the Rust relay - MCP server for relay admins (
nostream-admincrate,rmcpSDK): tools for the agent-driven admin workflow:relay_status— uptime, worker health, connection count, version, NIP-11 doclist_events/get_event/delete_event— audited event-store inspection with kind/pubkey filtersuser_admin— admission, vanish, balance ops (mirrors the admin console's user actions)invoices_*— list/inspect payment invoicesreports_*— NIP-56 report triage: list, action (hide/allow), audit trailsettings_get/settings_set— the typed settings surface (schema-validated, same validation the TS admin enforces)maintenance_*— trigger retention/cleanup, read last-run stats- auth: the same admin credential model as the HTTP console; every tool call audit-logged to the delivery-log store
-
nostream-cliport (measured 3,216 LOC): the documentedpnpm run clisurface as a Rust subcommand set — help text, exit codes and the--all/--force/--older-than/--kindsclean-db semantics ported exactly (measured test rows in the CLI integration suite)
Acceptance: the unmodified TS-era admin console performs every action against the Rust relay; the MCP server answers tools/list with the tool set above and each tool passes an integration test against a running Rust relay; the CLI port passes the TS CLI integration tests re-expressed.
Estimate basis (2026-10-24): $5.00 - 3,216 LOC CLI port plus console parity plus seven MCP tool families - job 008's scale ($6.91) with the CLI as one extra build pass. Model and per-unit costs: .factory/estimates.md.
Activity
feat(services): port the services layer and the worker model (#866) (#…
chappie-daemon commentedon Nov 19, 2026
Recon finished — job
032-admin-console-parity(recon.md, 471 lines; 129 citations machine-verified againstf01cb5f3and a041fe34earchive).Relay::servetakes the listener and drops anything that is not a WebSocket upgrade; measured against the built daemon,GET /admin/,/admin/session,/healthz,/all return an empty reply. Noaxum/hyperserver dep exists.crates/nostream-adminis a 576-line Phase-1 stub: 39 of 41 filesNotImplemented,mount()unimplemented, no tests, andnostreamddoes not depend on it.resources/adminatf01cb5f3ships 3,346 JS lines in six files against the capture's 2,187 in two, and calls 26 endpoints across 28 of 30 registered routes; eleven of those postdate041fe34e(all of/ops/*,/audit-log,/diagnostics/export,/moderation/*,/network-health/run|history). Since the Rust process serves the base files, parity means those 26.041fe34eremains the semantic reference for the 18 capture-era routes.crates/nostream-admin/tests/integration test that derives the paths from the console's own JS (a 12-line extractor caught 23 of 24; the 24th is the:pubkey/reverifytemplate) and drives them against a live in-process server. LMDB needs no Postgres. Declared undecidable: literal headless-browser execution (no playwright/jsdom) and the/admin/metricspayload, which the capture assembles from a Prometheus endpoint Rust does not have.cargo test --workspace --all-features→ 84 targets, 1,352 passed, 0 failed, 6 ignored, 268 s cold; fmt and both clippy passes clean; warm clippy+build 87 s; disk at 84 %.Scope gate held: this job builds the HTTP routes + console parity only. The MCP server family (0 TS LOC, no
rmcpin the lock, no counterpart to inherit) and the CLI port (3,216 LOC in 28 files, 19 TS test files, Rustnostream-clicovers 3 commands) will be filed as their own issues with these measurements. Spec stage is running now.chappie-daemon commentedon Nov 19, 2026
Scope split, recorded. #867 bundles three families and they do not belong in one job. Slice 1 — the HTTP admin routes plus parity with the console the binary serves — is job
032-admin-console-parity, which carries this issue. The other two are filed with recon's measurements:rmcpin the lock, and no oracle to inherit: it must bring its owntools/listsnapshot and per-tool integration tests.pnpm run clisurface as Rust subcommands (family (c) of #867) #1184 — the 3,216-LOC / 28-file CLI port.nostream-clicoversconfig validate,importandmigrate pg-to-lmdb; 19 TS CLI specs are the inheritable oracle.Both are on Project 4 at
Todo, Phase 5. This issue keeps slice 1; when its PR merges intorewrite/main, it is closed by hand with the sha, becauseClosesis inert on a non-default base.chappie-daemon commentedon Nov 19, 2026
Spec written — job
032-admin-console-parity(spec.md, 330 lines). Slice 1 of #867 is now a buildable contract:Upgrade: websocketgoes to the relay, everything else to an axum router. A second port would change the console's URL and cookie path.SECRET,<expiresAt>.<hex>, bearer-then-cookie, scrypt hash withADMIN_PASSWORDoverride, the capture's cookie flags and TTL fallback.docs/rewrite/decisions/0013-admin-http-surface.md, including the four narrowings that keep this slice honest: the NIP-66 probe is [Rewrite P2] nostream-relay: wire handlers, strategies, rate limits #865's stub (409/502with its own messages),/moderation/statskeeps its shape with empty aggregates,/metricsstreams the capture's ownunavailablesnapshot, and NIP-98 is not an auth path here.[judged](the approver on the ADR; the operator in a browser, AC26).The red-team pass measured 18 fails-at-base and 8 declared guards, 0 unproven — and found 18 divergences, mostly criteria that could pass without the change (a
git statuscheck blind once committed, a grep that counts the struct line, filter-onlycargo testruns that exit 0 with zero tests). Those are being folded into one correction edit; the second pass is the last.Cost bracket set from the measurement, not the headline: $8.50 (≈4.0k TS LOC direct / 15,977-LOC closure against a 576-line stub crate and no HTTP server in the workspace), replacing #867's provisional $5.00 — recorded with its unit basis in the job record.
chappie-daemon commentedon Nov 19, 2026
Build READY — job
032-admin-console-parity(build.md; branchfactory/032-admin-console-parity, 5 commits at2456146).Upgrade: websocketgoes to the relay unchanged, everything else to an axum router. The relay's wire tests and the NIP-42 challenge still pass.cargo test -p nostream-admin --test console_parityderives the routes from the console's own JS (derived: 26 calls over 24 paths + 2 page + 7 assets,unserved: 0) and drives each against a live server;cargo test -p nostreamd --test admin_httpproves the one-port claim against the real binary.cargo test --workspace --all-features→ 94 targets, 1,503 passed, 0 failed, 6 ignored (base 84 / 1,352 / 0 / 6); fmt, both clippy passes and the release build exit 0.2456146— 502 artifacts, 26 build scripts, onebuild-finishedsuccess, 0 compiler-message records, 0 findings.value: nullin a settings PATCH was a 400 (needed path removal + validation against defaults), and the defaults filter droppedadmin.passwordHashwhen the defaults omitadmin.git diff f01cb5f3 -- resources/adminis empty). The operator's browser pass (AC26) remains the judged check nobody has run yet.Follow-ups unchanged: #1183 (MCP server), #1184 (CLI port).
chappie-daemon commentedon Nov 19, 2026
Review round 1 — code CHANGES, two findings; the other four lenses were held back by the gate.
The gate lens ran the full validation itself (
fmt, both clippy passes, 94 targets / 1,503 passed / 0 failed, release build, both oracle targets) and then inverted three of the new branches — the peek dispatch, the WebSocket arm, and the asset traversal guard — each going red where it should.What it found:
console_parity.rs:352asserted onlystatus < 500; deletingGET /admin/settingsfromroutes::mountstill returnedunserved: 0because the fallback answers404. The criterion (AC6) now requires each derived path's expected status class, and a deleted registration must produce a non-emptyunservedlist.nullsettings value answered200, where the capture refuses it as400 Validation failed(z.custom(v => v !== undefined)). Reachable from the console itself (dashboard.js:1126), and its test asserted only "not 400".Round 2 is running: both fixes, the dead
admin-key escape in the defaults filter, and the inversion backlog the gate could not reach (disabled-surface gate, session and scrypt, rate limits, the 415-not-on-login clause, the metrics cadence).chappie-daemon commentedon Nov 19, 2026
Review round 4 — security PASS, ux PASS, code PASS, architecture CHANGES, performance CHANGES.
Both blockers were real and neither was found by reading alone:
limits.rateLimiter.strategy(EWMA by default). Fixed on the operator's ruling: the sharedEwmaRateLimiterbehind theLimitertrait, the private store deleted, the strategy switch live, AC12 re-derived for EWMA. Refusal advancing the rate is EWMA parity — the capture's own Lua stores before the verdict — so the fixture pins that, and the finding's refused-hit rule is recorded as the sliding window's.POST /logout; the per-kind storage scans ran serially; scrypt blocked a runtime worker at 1,772 ms CPU per attempt. All four fixed and re-measured (audit: 34.5 s → 0.29 s over 2,000 appends; one open + one write per append).0644, so a local user can read admin actions and login addresses.unavailable::stores()until the store-wiring job lands — the ux lens measured it, and the spec's Out of scope already said it.Round 5 (five lenses, code gate) is confirming the fixes.
chappie-daemon commentedon Nov 19, 2026
Stage: needs-human (approve returned ESCALATE). Branch
factory/032-admin-console-parityatf20341c7, 11 commits, clean, pushed; every acceptance criterion is met under the approver's own runs (cargo fmt, both clippy passes, 95 targets / 1,509 passed / 0 failed / 6 ignored, oracle4 passed/unserved: 0, release build, andgit merge-treeagainst the movedrewrite/mainexits 0) except two that need a person:/admin/, signs in and walks the panels; its recordoperator-report.mddoes not exist yet.axum,hyper,hyper-util,scrypt).A browser pass was driven on the operator's behalf against a release
nostreamd(fixture password, one listener on :7401): login, wrong password, session landing, all six views at desktop width and five at phone width, plus the three storage-backed surfaces. The console renders; the three red surfaces are the documentedunavailable::stores()ones (NIP-05 "Internal Server Error", delivery log "Unable to load delivery log", storage counts 500) and the only console entries are the Grafana widget's own connection refusals and aborted/admin/metricsreconnects on view switch. The judgement of the rendering stays with the operator.Review notes that came out of the last round are their own issues: #1187 (audit mode, amended: the compaction re-creates
0644), #1188 (no bounded wait on the verification pool), #1189 (the shared limiter's cap can be spent), #1190 (the limiter fails open where the capture fails closed), #1191 (compaction is one mutex, not one process).feat(admin): serve the console's HTTP surface from the relay's one li…
chappie-daemon commentedon Nov 19, 2026
Slice 1 (HTTP admin routes + static console) merged: PR #1192 → merge commit
9a7c3181.factory/032-admin-console-parity, final headd29e4a78, 15 commits.console_parity4 passed (derived: 26 calls over 24 paths + 2 page + 7 assets,unserved: 0),admin_http2 passed, release build 0. CI: 12 checks green, 5 path-skipped, 0 failing.docs/rewrite/decisions/0014-admin-http-surface.md, D1–D17, with the relay-path adjudication in D10.factory-spansmeasured $6.05 across 28 subagent sessions (7.77M in / 1.64M out / 292.2M cache-read, 2,262 requests, 13.04h summed wall) against a $8.50 bracket — the regret line inruns.jsonlrecords why the bracket was high, and the subagent total excludes the orchestrator's own turns.pnpm run clisurface as Rust subcommands (family (c) of #867) #1184 (CLI port) remain this issue's open scope, with admin: the audit log is created 0644, so a local user can read the relay's admin history #1187–admin: the audit compaction is one mutex, not one process — pid-scope the staging file and state the 4,000-line bound #1191 as the review's follow-ups.chappie-daemon commentedon Nov 20, 2026
The Expected cost: $5.00 at the top of this issue is superseded, and this comment is the correction rather than an edit to the line so the original figure stays visible.
Three reasons, each measured:
9a7c3181) is spent and came in under its own bracket, but it was one of three families priced against that single figure.ReportRepositorysetter, anEventPurgeCountsreturn type).pnpm run clisurface as Rust subcommands (family (c) of #867) #1184) measured three times the headline on its own, before the scope cut that removeddevand its nine toolchain wrappers.The current numbers live in the private tracker, and every departure from this issue's figure is recorded on #860, which is where the board's plan adjustments are kept. This issue stays the umbrella for the three families; its headline should not be read as a budget.
feat(cli): port the pnpm run cli surface to Rust (#1203)