This commit is contained in:
Raven Scott
2026-05-20 20:19:20 -04:00
parent 040f1d05ea
commit d70060ec4e
365 changed files with 23547 additions and 431 deletions
@@ -6,3 +6,6 @@
## v0.2.0
- Production-grade docs, validation, and expanded tests.
## v0.3.0
- Wave 6: presence-tier API tables, architecture wire section, validation test.
+18 -3
View File
@@ -18,15 +18,30 @@ const mod = new HyperP2PContradictionGraph(opts)
## Methods
See [`index.js`](../index.js) for the full method list. Core operations implement **opposing claims contradiction lattice**.
| Method | Returns | Notes |
|--------|---------|-------|
| `claim(...)` | See source | — |
| `close(...)` | See source | — |
| `conflictSet(...)` | See source | — |
| `contradicts(...)` | See source | — |
| `merge(...)` | See source | — |
| `ready(...)` | See source | — |
| `toJSON(...)` | See source | — |
## Events
The instance extends `EventEmitter`. Common events: `closed`, plus module-specific events documented in source.
| Event | Description |
|-------|-------------|
| `claim` | Module-specific |
| `closed` | Module-specific |
## Metrics
Call `getStats()` when implemented for counters (Wave 6 network modules always expose stats).
## P2P
When `topic` is set, `ready()` joins Hyperswarm and opens Protomux channel `contradiction-graph/v1` via [`_shared/p2p-bare.js`](../_shared/p2p-bare.js).
When `topic` is set, `ready()` joins Hyperswarm and opens Protomux `contradiction-graph/v1` via [`_shared/p2p-bare.js`](../_shared/p2p-bare.js).
## Testing
@@ -1,10 +1,22 @@
# Architecture: hyper-p2p-contradiction-graph
Opposing claims contradiction lattice for Bare/Pear P2P overlays.
```mermaid
flowchart LR
flowchart TB
App[Application] --> Mod[HyperP2PContradictionGraph]
Mod --> P2P[Protomux contradiction-graph/v1]
P2P --> Swarm[Hyperswarm]
Mod --> Mux[Protomux contradiction-graph/v1]
Mux --> Swarm[Hyperswarm topic]
```
Local state lives in memory maps/arrays; gossip merges remote updates when `topic` is configured.
## Wire messages (gossip)
JSON envelopes via `gossipSend` when connected. Message `type` fields are module-specific; see `index.js` `onmessage` handler.
## Composition (Wave 6)
See [`../_shared/WAVE6_NETWORK_STACK.md`](../_shared/WAVE6_NETWORK_STACK.md) for pairing with network-stack modules.
## State
In-memory maps/arrays; merged from remote gossip when `topic` is configured.
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "hyper-p2p-contradiction-graph",
"version": "0.2.0",
"version": "0.3.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "hyper-p2p-contradiction-graph",
"version": "0.2.0",
"version": "0.3.0",
"license": "Apache-2.0",
"dependencies": {
"b4a": "^1.6.7",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "hyper-p2p-contradiction-graph",
"version": "0.2.0",
"version": "0.3.0",
"description": "Opposing claims contradiction lattice for Bare/Pear P2P.",
"main": "index.js",
"type": "commonjs",
@@ -25,3 +25,22 @@ test('hyper-p2p-contradiction-graph: close without leak', async (t) => {
await m.close()
t.pass()
})
test('hyper-p2p-contradiction-graph: validation rejects invalid input', async (t) => {
const m = new HyperP2PContradictionGraph()
try {
if (typeof m.addNeighbor === 'function') m.addNeighbor(null)
else if (typeof m.buildCircuit === 'function') m.buildCircuit([])
else if (typeof m.grant === 'function') m.grant(null, -1)
else if (typeof m.enqueue === 'function') m.enqueue('bad', null)
else if (typeof m.reportSample === 'function') m.reportSample(null, -1, -1)
else if (typeof m.fanout === 'function') m.fanout(null, 0)
else if (typeof m.probe === 'function') m.probe(null)
else if (typeof m.resolve === 'function') m.resolve(null)
else if (typeof m.acquire === 'function') m.acquire(null)
else throw new Error('no validation hook')
t.fail('expected throw')
} catch (err) {
t.ok(err instanceof Error)
}
await m.close()
})