Ignore:
Timestamp:
07/24/2026 07:44:15 PM (7 weeks ago)
Author:
Robin Genis <roboburr@…>
Branches:
main
Children:
b5924eb
Parents:
c26cc18
Message:

Guardianship Fase 0+1: de echte multi-party handshake (FEP-633c §3)

De eerste versie committeerde na één accept. Nu de spec: geen enkele partij
maakt een voogdij alleen, en een nieuwe guardian erbij kan niet zonder
toestemming van de bestaande. Daemon als blauwdruk, zodat Klonkt en de
test-daemon exact hetzelfde gedragen en de Shaer-clients één contract lezen.

Fase 0 (datamodel): ap_guardian_offers (per lokale partij een kopie van de
handshake, PK slug+offer_id) + ap_guardian_offer_accepts (de accept-tally).
ap_guardianships houdt alleen nog de GECOMMITTE relaties.

Fase 1 (state-machine): offers.js is een getrouwe port van de daemon-Handshake
(accepts over ward+candidate+existing; ready = ward && candidate && (geen
existing OF >=1 existing); een Reject voidt). handshake.js orchestreert het
gedistribueerd: de kandidaat adresseert de Offer aan ward + alle bestaande
guardians (§3.1.1); elke Accept wordt aan alle andere partijen gebroadcast, dus
elke instance-kopie convergeert; zodra een kopie compleet is committeert die
lokaal (ward schrijft shaer:guardians, guardian schrijft z'n ward), met de
kandidaat-inbox als handle (§6). Volgorde-onafhankelijk.

Ook: §1 wederzijdse uitsluiting (een ward is nooit ook guardian in het
actor-doc), de queues vullen nu de echte accept-tally (needsMyAccept/
readyToCommit/acceptedBy/existingGuardians), en de PWA + Berichten beantwoorden
via de C2S Accept/Reject-pijplijn per offer-id. De co-guardian ziet een
mede-voogdij-aanvraag met accepteer/weiger in de PWA.

Changed files:
src/config/database.js

  • tabellen ap_guardian_offers + ap_guardian_offer_accepts

src/services/guardianship/offers.js (NEW)

  • de handshake-state-machine (daemon-port), per-instance in SQLite

src/services/guardianship/relations.js

  • alleen commit-writers + actor-props (§1 uitsluiting)

src/services/guardianship/handshake.js

  • gedistribueerde multi-party C2S/S2S orchestratie

src/services/guardianship/queues.js

  • offers-queue uit de state-machine

src/services/guardianship/index.js

  • exports bijgewerkt

src/services/ActivityPubService.js

  • wire localSlug + fetchActor; inbound-routing naar alle lokale partijen

src/routes/guardian.js

  • dashboard toont offers met tally; POST /guardian/offer (accept/reject)

src/routes/posts.js

  • Berichten toont ward-offers uit de state-machine; accept via offer-id

src/views/pages/messages.ejs, src/assets/js/guardian.js, src/assets/css/guardian.css

  • offer-kaarten per state (mijn aanvraag / mede-voogdij / wachten)

src/services/i18n.js

  • accept/reject/complete/coguard + co-guardian push (nl/en/de)

test/guardianship.test.js

  • multi-party: eerste guardian, co-approval bestaande guardian, reject voidt, ward-mag-niet-guarden, vaste initiator

remarks: Fase 2 (follow-gating), 3 (hasGuardians + Not-a-Teapot), 4 (Undo/
emancipatie) volgen. 164 tests groen.

-robo
Co-Authored-By: Claude Opus 4.8 <noreply@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/services/guardianship/index.js

    rc26cc18 r780a7c6  
    44 * Klonkt's kid-safety feature as one cohesive unit:
    55 *  - context.js:   the shaer JSON-LD namespace + Relationship vocabulary
    6  *  - relations.js: ward ↔ guardian relations (ap_guardianships) + actor props
     6 *  - offers.js:    the multi-party handshake state (a port of the Shaer daemon)
     7 *  - relations.js: the COMMITTED ward ↔ guardian relations + actor props
    78 *  - handshake.js: the adoption Offer/Accept/Reject over C2S and S2S
    89 *  - queues.js:    the owner-only dashboard collections (offers/follows/wards)
     
    1011 *  - delivery.js:  the direct-note leg a ward's call-for-help rides
    1112 *
    12  * The shared blocklist (Shaer's "in Orbit") intentionally lives NEXT TO this
    13  * module in BlocklistService: Klonkt's own Block tab uses it too.
    14  *
    15  * ActivityPubService wires the AP helpers in once (wireDelivery/wireHandshake)
    16  * and delegates; nothing here imports ActivityPubService back.
     13 * The shared blocklist (Shaer's "in Orbit") lives NEXT TO this module in
     14 * BlocklistService. ActivityPubService wires the AP helpers in once and
     15 * delegates; nothing here imports ActivityPubService back.
    1716 */
    1817export { SHAER_CONTEXT, GUARDIAN_RELATIONSHIP, GUARDIAN_RELATIONSHIP_COMPACT, isGuardianRelationship } from './context.js';
     
    2120export { wireHandshake, handleOutbox as handleGuardianshipOutbox, handleInbox as handleGuardianshipInbox, parseRelationship } from './handshake.js';
    2221export { offersCollection, followsCollection, wardsCollection } from './queues.js';
     22export { listForParty as listOffersForParty, getOffer, findOfferAnywhere } from './offers.js';
    2323export {
    24   listGuardians, listWards, listOffers, isGuardian, getRelation, findByOfferId,
    25   recordOffer, acceptRelation, removeRelation, actorProps as guardianshipActorProps,
     24  listGuardians, listWards, isGuardian, getRelation, removeRelation,
     25  actorProps as guardianshipActorProps,
    2626} from './relations.js';
Note: See TracChangeset for help on using the changeset viewer.