EXPERIMENTAL: replace KV-scan consensus with Autobase sidecar engine

Cut over domain resolution to an Autobase apply-based sidecar fed by
claim/vote dual-writes from dnsPass. Remove the legacy full-KV scan
getConsensusState path and wire all reads through consensus-view.

- Add consensus-resolver, consensus-events, consensus-apply,
  consensus-autobase, and consensus-view modules
- Dual-append consensus events on claim/vote dnsPassAdd/Remove
- Bootstrap sidecar from existing KV entries; persist
  consensusAutobaseKey in network manifest
- Expose sidecar health via GET /api/consensus/status and metrics
- Add consensus-resolver and consensus-apply unit tests
- Expand RFC 0001 to Implemented; update CONSENSUS.md

Rollback: deploy prior release; KV data unchanged, sidecar rebuilds on
next startup.
This commit is contained in:
Raven Scott
2026-05-30 23:49:48 -04:00
parent 3a8daefc30
commit d230fb3360
19 changed files with 1867 additions and 890 deletions
@@ -10,6 +10,25 @@ async function handleConsensusRoutes(req, res) {
const method = req.method;
const url = new URL(req.url, `https://${req.headers.host}`);
// GET /api/consensus/status - Sidecar health
if (method === 'GET' && urlPath === '/api/consensus/status') {
try {
trackRequest('/api/consensus/status', true);
const { getConsensusStatus } = require('../../../core/consensus-autobase');
const status = getConsensusStatus();
res.writeHead(200, { 'Content-Type': 'application/json' });
res.end(JSON.stringify(status));
return true;
} catch (err) {
logError('Consensus', `Failed to get consensus status: ${err.message}`);
trackRequest('/api/consensus/status', false);
const errorResponse = createErrorResponse(err, 500);
res.writeHead(errorResponse.statusCode, errorResponse.headers);
res.end(errorResponse.body);
return true;
}
}
// GET /api/consensus/metrics - Get consensus metrics
// Check this BEFORE the domain route to avoid matching "metrics" as a domain
if (method === 'GET' && urlPath === '/api/consensus/metrics') {