fix(swarmtop): expose and render full peer identity/details from proc surfaces

This commit is contained in:
Raven Scott
2026-04-26 08:02:37 -04:00
parent 8c3d5f8795
commit 194fbd2c67
69 changed files with 13463 additions and 32 deletions
@@ -17,7 +17,17 @@ test('p2p suite commands include shared envelope helper in kernel bins', async (
'meshdrop',
'taskmesh',
'peernote',
'hypershell-board'
'hypershell-board',
'p2ping',
'dhtscan',
'dhttop',
'swarmdoctor',
'swarmmap',
'peerdiscover',
'p2ptrace',
'peerctl',
'routeview',
'holepunch-view'
]
for (const name of names) {
const src = await read(join(kernelBin, name))
@@ -32,7 +42,17 @@ test('p2p suite man pages exist', async (t) => {
'meshdrop',
'taskmesh',
'peernote',
'hypershell-board'
'hypershell-board',
'p2ping',
'dhtscan',
'dhttop',
'swarmdoctor',
'swarmmap',
'peerdiscover',
'p2ptrace',
'peerctl',
'routeview',
'holepunch-view'
]
for (const page of pages) {
const body = await read(join(coreutilsRoot, 'man/pages', page + '.json'))
@@ -0,0 +1,23 @@
import test from 'brittle'
import { readFile } from 'node:fs/promises'
import { dirname, join } from 'node:path'
import { fileURLToPath } from 'node:url'
const __dirname = dirname(fileURLToPath(import.meta.url))
const coreutilsRoot = join(__dirname, '..')
test('p2p suite reads peer_details proc for swarm snapshots', async (t) => {
const src = await readFile(join(coreutilsRoot, 'lib/p2p-suite.js'), 'utf8')
t.ok(src.includes('/proc/bare_os/peer_details.json'), 'reads peer details proc')
t.ok(src.includes('out.peers = merged.slice(0, 128)'), 'merges swarm + peer details rows')
})
test('swarmtop renders full public keys and endpoint details', async (t) => {
const src = await readFile(join(coreutilsRoot, 'src/swarmtop.js'), 'utf8')
t.ok(src.includes("lines.push(' pubkey: ' + key)"), 'shows full pubkey label')
t.ok(src.includes('endpoint='), 'shows endpoint details')
t.ok(
src.includes('? p.remotePublicKey') || src.includes('? p.remotePublicKey\n'),
'uses full remotePublicKey value in peer rows'
)
})