Commit Graph
27 Commits
Author SHA1 Message Date
Raven Scott 8854365add Add core.status RPC, RPC invite diagnostics, and WebSocket stats refresh
- core.status handler and coreStatusRequest; diagnoseInviteIssuesAsync
  clears stale failed-invite flags when peers report canProvideInvite
- Admin invite diagnostics and Core stats UI: per-peer remote state,
  text status marks, recommendations aligned with invite.deliver RPC
- Extract stats-collector; push stats/health/status via subscribe-stats
  WebSocket; HTTP only on first Stats tab load
- Document core.status in PLUGIN_SDK; proxy registers onCoreStatus
2026-05-28 11:35:01 -04:00
Raven Scott 51ad117612 Fix: use newPass.base 2026-05-28 11:11:27 -04:00
Raven Scott 84199270b3 BREAKING: Native p2ns.core RPC — invite.deliver, remove legacy invite channel
Replace RPC-to-string adapters and processCoreRequestMessage (~470 lines) with
typed handlers in core-swarm-handlers.js. Autopass invite wire now uses
invite.deliver RPC only; p2ns.core-invite protomux channel is removed.

- Add core-rpc-contract.js (METHODS, INVITE_STATUS) and core-swarm-handlers.js
  with shared processInviteWire for deliver, relay, and pairing
- core-rpc.js: deliverInviteWire via invite.deliver; invite.request returns
  { status, reason, inviteId }; invite.ack carries optional inviteId
- p2ns.js: register native handlers; slim p2ns.core-request (lifecycle only);
  proactive invite ack tracks inviteId; fix missing invite.queued handler
- proxy-server: channel-manager + shared handlers (no p2ns.core-invite strings)
- Tests: core-swarm-handlers.test.js, core-invite-rpc-integration.js; extend test:core-rpc
- Docs: PLUGIN_SDK RPC table; consensus.removeDomain in longform/RESTAPI/glossary
2026-05-28 11:09:05 -04:00
Raven Scott ea9124c429 BREAKING EXPERIMENTAL: Holepunch-native hard migration (RPC core, shared storage, SDK v2)
BREAKING: All nodes must upgrade together. Legacy p2ns.core-request string
messages are rejected; invite/consensus control plane uses protomux-rpc
(invite.request, invite.ack, invite.relay*, consensus.*). Shared Corestore
namespaces are the default for plugin DBs and drives; USE_SHARED_CORESTORE_NAMESPACES=false
is debug-only. Admin plugin actions with params are validated before run.

EXPERIMENTAL: End-to-end RPC invite path reuses existing handlers via adapters;
invite wire still ships on the invite channel. Multi-peer invite/relay
integration tests are not in CI yet (core-rpc-smoke only).

SDK & channels:
- channel-rpc.js, sdk.channels.rpc (register/request/event)
- core-rpc.js for p2ns.core; action-params + plugin route validation
- sdk.db.getCore/reopen, sdk.state.getPeerChannelSnapshot,
  sdk.metrics.getHolepunchStats (schema v1)

Runtime:
- p2ns.js: RPC-first core invite/consensus; Hyperswarm firewall/reconnect
- channel-manager: required protomux-rpc per peer
- db-shared-namespace-migration; drive-manager shared namespaces
- proxy-server: invite.request RPC for joiners

Plugins: file.drop, global.profile, peer.directory, domain.consensus,
peer.visualize, example.plugin (RPC demo); peer.directory UI polish

Also: CI/smoke scripts, diagnostics hardening, plugin config schema validation,
admin action param modal, docs/RFCS, package-lock + engines.node >= 18
2026-05-28 10:51:19 -04:00
Raven Scott b000e34016 Updates 2026-05-27 20:15:25 -04:00
Raven Scott 05e388d525 Updates 2026-05-27 20:13:06 -04:00
Raven Scott 8849a432b3 Updates 2026-05-27 20:09:22 -04:00
Raven Scott 14a2373c4c Updates 2026-05-27 20:06:36 -04:00
Raven Scott 3d35f148c5 Updates 2026-05-27 20:03:25 -04:00
Raven Scott dbc6997219 Fixes 2026-05-27 19:59:45 -04:00
Raven Scott 229350e066 Bug fix 2026-05-27 19:53:48 -04:00
Raven Scott 54cbee254d Updates 2026-05-27 19:47:06 -04:00
Raven Scott c8334a8d63 Fix Atomic state 2026-05-27 19:44:05 -04:00
Raven Scott 3ece7abe9f Autopass updates 2026-05-27 19:41:21 -04:00
Raven Scott 022eeea263 fix: break circular dependency in domains.js
Move getInternalDomains import to lazy load inside addDomain function to resolve the circular dependency chain: plugin-handler → sdk → domains → plugin-handler.
2026-02-20 21:05:04 -05:00
Raven Scott 62ac5a4b50 ix: prevent corestore corruption during graceful shutdown
- Reorder shutdown sequence to close pairing operations before DNSPass
- Add proper tracking and cleanup of active Autopass.pair() operations
- Handle shared corestore conflicts between pairing ops and main DNSPass
- Ignore expected "store already closed" errors from pairing operations
- Consolidate all Autopass resource cleanup in PHASE 2.5

This fixes the "Corestore is closed" uncaught exceptions and corruption
that occurred when both pairing operations and DNSPass tried to close
the same shared corestore during shutdown.
2025-12-26 23:24:51 -05:00
Raven Scott be7bd5ee2b perf: parallelize holesail cleanup operations for 10x faster shutdown
Convert sequential cleanup loops to Promise.allSettled() across multiple files:
- includes/maintenance/cleanup.js: parallelize holesail connections, TLS/HTTP servers, and child process cleanup
- includes/core/domain_cleanup.js: parallelize multiple client cleanup within domain removal
- p2ns.js: parallelize child process and connection cleanup in main shutdown

Before: O(n) sequential execution (100-150s for 10 processes)
After: O(1) parallel execution (~10-15s for 10 processes)
2025-12-26 21:29:39 -05:00
Raven Scott eff22719ff cleanup/enhance cleanup 2025-12-26 18:02:21 -05:00
Raven Scott 4465e9aa62 update docs 2025-12-26 17:34:30 -05:00
Raven Scott 7a9889befe fix: Add strict ownership validation for claim modifications
Add comprehensive security checks to prevent unauthorized claim modifications
while preserving legitimate owner's ability to update their own claims.

- Add ownership verification before any pass.remove() operations
- Validate claimKey format: claim:domain:claimant
- Ensure claimant matches current user before allowing modifications
- Create safeRemoveClaim() helper with multi-layer validation
- Add security logging for audit trail
- Fail-safe error handling prevents unauthorized claim interference

Resolves critical data integrity issue where claims could be overwritten
by unauthorized peers, while maintaining proper claim management capabilities.
2025-12-26 17:09:16 -05:00
Raven Scott 0d23e296be ix: Prevent claim overwriting and improve domain removal safety
Fix critical bugs in domain claim management to ensure data integrity:

- Domain addition: Check for existing claims before adding to prevent duplicates
  - Update user's own claim if it exists instead of creating duplicates
  - Skip update if hash and SSL flag unchanged (idempotent)
  - Never touch other users' claims when updating own claim

- Domain removal: Add strict validation to prevent removing other users' claims
  - Only perform full cleanup (atomicDomainCleanup) when user is confirmed resolved claimant
  - Require consensus status 'resolved' AND resolvedClaimant matches localWriter
  - Improved logging to show which removal path is taken
  - Enhanced removeOwnClaimAndVotes with explicit vote key parsing

- Hash preferences cleanup: Fix module path resolution error
  - Correct require path from admin-backend/cache.js (../../core/core)
  - Add lazy require pattern with error handling to prevent crashes
  - Ensure cleanup runs after consensus updates and domain removals
2025-12-26 16:59:56 -05:00
Raven Scott 01acfb766c feat: Add P2P Domain Conflicts management
Implement comprehensive P2P domain conflict resolution allowing users to choose between local claim hashes and consensus-resolved hashes for domains where they have local claims but another claimant won consensus.

Key features:
- P2P Domain Conflicts UI tab in Local DNS section
- Hash preference toggle (local vs resolved) with automatic client restart
- Extended selector_cache.json to store hashPreferences alongside versionPreferences
- DNS cache invalidation for immediate preference application
- REST API endpoints for conflict detection and preference management
- Automatic Holesail client restart when hash preferences change
- Complete documentation updates across README, API docs, and glossary

Resolves conflicts between local claims and consensus resolution by giving users control over which hash their domain resolves to, with seamless client management ensuring immediate effect.
2025-12-26 16:36:19 -05:00
Raven Scott 480f99ae28 feat: allow partial domain removal and add conflict status
- Add partial domain removal functionality allowing users to remove their own claims and votes even when they're not the resolved claimant
- Add conflict status detection for domains where local peer has claim but another claimant won consensus
- Update UI to display conflict status with red badge
- Enhance API responses with detailed consensus information
- Update all documentation with new features

Changes:
- core/core.js: Add removeOwnClaimAndVotes() function for partial removal
- admin/routes/domains.js: Implement partial/full removal logic in /api/remove-domain
- admin/admin-backend/routes/domains.js: Same partial removal logic for backend routes
- plugins/sdk.js: Update removeDomain() to support partial removal
- admin/ui/config.js: Add conflict status badge and update postFetch
- admin/admin-frontend/ui/config.js: Add conflict status badge and fix status rendering
- admin/utils.js: Add conflict status to utility functions
- admin/admin-frontend/utils.js: Add conflict status to utility functions
- docs/CONSENSUS.md: Add conflict status to resolution states
- docs/README_LONGFORM.md: Add conflict status to consensus states
- docs/RESTAPI.md: Update /api/resolved-domains with new fields and examples
- docs/ARCHITECTURE.md: Document full vs partial removal modes
- docs/OPENAPI.yaml: Update Domain schema and add ConsensusState schema
2025-12-26 15:32:41 -05:00
Raven Scott ea1bcb569a fix: correct consensus vote counting to prevent duplicate voter inflation
- Modified getConsensusState() to track votes per voter and ensure each voter only counts once per domain
- Added logging to detect when voters have multiple votes for different claimants
- Prevents vote count inflation that could cause wrong claimants to win consensus
- Maintains most recent vote when duplicates are detected
2025-12-26 02:31:26 -05:00
Raven Scott eb5675adb2 fixes 2025-12-17 22:32:07 -05:00
Raven Scott 5f5ed3848e resolve circle dep 2025-12-17 21:49:54 -05:00
Raven Scott 742e27d3f7 reorg 2025-12-17 20:05:50 -05:00