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
This commit is contained in:
Raven Scott
2025-12-26 15:32:41 -05:00
parent ea1bcb569a
commit 480f99ae28
13 changed files with 234 additions and 61 deletions
+49 -7
View File
@@ -72,11 +72,14 @@ The P2NS (Peer-to-Peer Name System) admin backend API, hosted at `https://p2ns.a
```
### 4. GET /api/resolved-domains
- **Description**: Retrieves a list of resolved domains with their hashes, local status, ownership, and available services.
- **Description**: Retrieves a list of resolved domains with their hashes, local status, ownership, consensus information, and available services.
- **Response**: JSON array of objects with:
- `domain` (string): Domain name
- `hash` (string): Holesail hash or `"internal"` for internal domains
- `isLocal` (boolean): Whether the local writer has a claim for this domain
- `isOwner` (boolean): Whether the local writer is the resolved claimant (owner) of this domain
- `consensusState` (object): Detailed consensus information including status, vote counts, quorum status, etc.
- `consensusStatus` (string): Simplified status that may include `"conflict"` for domains where local peer has a claim but another claimant won
- `services` (array): Array of service objects with `serviceName`, `key`, `port`, and `protocol` fields
- **Status Codes**:
- `200`: Success.
@@ -88,10 +91,25 @@ The P2NS (Peer-to-Peer Name System) admin backend API, hosted at `https://p2ns.a
```
```json
[
{
"domain": "example.tld",
"hash": "hs://s00084bf...",
{
"domain": "example.tld",
"hash": "hs://s00084bf...",
"isLocal": true,
"isOwner": true,
"consensusState": {
"status": "resolved",
"hash": "hs://s00084bf...",
"resolvedClaimant": "a6a6d7ebcc1df8f33410067bf96ad2cc30d5276516f758bb0f34195e914c451f",
"voteCounts": {
"a6a6d7ebcc1df8f33410067bf96ad2cc30d5276516f758bb0f34195e914c451f": 8
},
"activePeers": 5,
"quorumMet": true,
"minVotes": 2,
"totalVotes": 8,
"lastResolution": 1766780982538
},
"consensusStatus": "resolved",
"services": [
{
"serviceName": "web",
@@ -101,10 +119,34 @@ The P2NS (Peer-to-Peer Name System) admin backend API, hosted at `https://p2ns.a
}
]
},
{
"domain": "peer.directory",
"hash": "internal",
{
"domain": "bm.git",
"hash": "hs://s000f44fb5cfe3fa7f37e9070ea14975a8dbf1e2156689638bc92458118df7a4987b",
"isLocal": true,
"isOwner": false,
"consensusState": {
"status": "resolved",
"hash": "hs://s000f44fb5cfe3fa7f37e9070ea14975a8dbf1e2156689638bc92458118df7a4987b",
"resolvedClaimant": "acbb3b69ee810f4fbe54927a5742530e4cf76b7b462a4c37ddfe27ba5c3060b6",
"voteCounts": {
"a6a6d7ebcc1df8f33410067bf96ad2cc30d5276516f758bb0f34195e914c451f": 1,
"acbb3b69ee810f4fbe54927a5742530e4cf76b7b462a4c37ddfe27ba5c3060b6": 7
},
"activePeers": 5,
"quorumMet": true,
"minVotes": 2,
"totalVotes": 8,
"lastResolution": 1766780982538
},
"consensusStatus": "conflict",
"services": []
},
{
"domain": "peer.directory",
"hash": "internal",
"isLocal": true,
"isOwner": true,
"consensusStatus": "internal",
"services": []
}
]