Repository navigation
feat(hosting): workers refuse replicas of DIP-0036 labelled sites (policy_refusal, refused count) - #497
Merged
Conversation
…licy_refusal) DIP-0036 step 4. A node with the hosting role and a [moderation] table (the one its gateway already uses) no longer holds copies of sites that have a file one of its labelers labelled with a `refuse` action. - Workers store blake3 chunks and labels name a file's SHA-256, so the worker puts each file back together from its local chunks, hashes it and asks the labelers' /query in batches (Gate::decide_hashes); with a scan token, small web files go to /scan first, as at the gateway. - A new copy is judged once its chunks are here and before it is held or announced (replicate -> policy_admit). Held copies are judged again every recheck_secs, since a label can arrive later; a refused one is let go the way a surplus copy is (announce first, delete after one holder TTL). - The node gossips what it refuses as HostingMsg::PolicyRefusal (`"t":"policy_refusal"`). To every node a refusing peer is then no holder of that version, no candidate for it (the next ranked node takes the copy) and so never challenged for it: a refusal is not a failed proof. - Owners see how many replicas refused and under which labeler and value, never which peers: /hosting/v1/sites (`refused`, `refused_by`), `hosting publish` (`refused:` line), the push report and hosting_push_status / `c0mpute chat push`. - `[moderation] refuse_replicas = false` keeps the policy to the gateway. Fails open, like the gateway gate. A refusal is lifted when its labels are retracted or expire. Not covered: striped sites (over 1 GiB), which a worker holds in groups and cannot put back into files; sites the node's own key owns or pays for. Refs #444 Co-Authored-By: Claude Fable 5.2 <[email protected]>
DIP-0036 gets a "Worker enforcement as built" section (subject, timing, the policy_refusal gossip shape, what owners see, lifting, fail open) and names what is left: striped sites, forfeiting accrued payout, the storage PUT. docs/hosting.md documents the operator config and behaviour; docs/chat-push-hosting.md and the hosting_push_status tool description document `refused` / `refused_by`. Refs #444 Co-Authored-By: Claude Fable 5.2 <[email protected]>
ThreatCrush Security Scan26 finding(s) HIGH/CRITICAL: 2 | MEDIUM: 20 | LOW: 4
Snippets are redacted; ThreatCrush never prints matched credential material. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
DIP-0036 step 4: a hosting worker refuses to hold replicas of labelled content, says so with
policy_refusalso the refusal is never a failed challenge, and owners see a count of refused replicas inhosting_push_status.Refs #444 (not "Closes": striped sites and payout forfeiture are left out, see below).
What it does
Worker (
c0mpute-core/src/hosting/policy.rs)[moderation]table andmoderation::Gate(one shared instance, one decision cache). No parallel mechanism./queryin batches of 50 (Gate::decide_hashes, new). With a scan token, up to 64 web files per site undermax_scan_bytesgo to/scanfirst, as at the gateway.replicateafter the chunks arrive and before the copy is held or announced. Refused: chunks deleted, typedPolicyRefusederror, no retry backoff, not fetched again.recheck_secs(file hashes are kept, the site is not re-read). A copy that became labelled is let go like a surplus copy: announce first, delete one holder TTL later.policy_refusal(wire)c0mpute/hosting/v1:{"t":"policy_refusal","refusals":[{site_id, manifest, labeler, val}]}, the sender's whole list (at most 128), repeated with every holding announcement, lapsing with the holder TTL.Refused count, end to end
ReplicaMap::refusal_tally->Hosting::refusals->GET /hosting/v1/sites(refused,refused_by).hosting publishprintsrefused: N (<val> by <labeler> xN, ...);chat connectparses it into the push report.apps/web/src/lib/chat/push.ts: two new nullable columns (refused,refused_by) added by an idempotentALTER TABLE;publicPush(sohosting_push_status,hosting_pushes, the REST routes) returnsrefusedandrefused_by: [{labeler, val, count}].c0mpute chat push hosting statusshows(N refused by policy).Config
[moderation] refuse_replicas(new, defaulttrue);falsekeeps the policy to the gateway.[moderation]labelers and the hosting role starts refusing replicas on upgrade. With no labelers (the default) nothing changes.Compatibility
receipt). They keep counting a refuser as a candidate, so on a mostly-old network a refused copy can take longer to be replaced.refused: the web shows0/[].LabelerClientgains a requiredquery_many.Not done
PUT-> 451 does not apply: hosted copies are pulled. The storage role's objectPUTis not gated.copies);/hosting/v1/siteshas the current one.Tests
moderation: batching, caching, shared cache with the gateway path, fail-open, stale refusal stands, retraction (2 new).hosting::replicas: refuser is no holder/candidate, tally, other-version refusal, TTL lapse, own refusal (2 new).hosting::policy: refusal validation, typed error, message size and tag (2 new).tests/hosting_moderation_e2e.rs: 4 hosts + publisher on loopback. Refusal at replicate, refusal of a held copy after a late label, replacement by the 4th node,/hosting/v1/sitesoutput, lifting on retraction (~65 s).c0mpute-cli:refused:line round trip, status line.push.test.ts: report stores and returns the count, drops malformed causes and anything naming a peer, old-node report.Run on vienna: the Rust tests above pass;
bun test src/lib/chat/push.test.ts20 pass;tsc --noEmitclean.DIP-0036 and
docs/hosting.md/docs/chat-push-hosting.mdupdated to describe what is built and what is left.🤖 Generated with Claude Code