source: Klonkt/src/services/guardianship/context.js@ ea138c0

main
Last change on this file since ea138c0 was 3d882bd, checked in by Bart <bart@…>, 5 weeks ago

FEP-633c §4.1: een kapotte guardian kost een kind niet de goede

Een "guardian" met eigen guardians is er geen (§1), en een escalatie daarheen
komt nergens aan: er is geen grand-guardian om naar door te vertakken. Klonkt
handhaafde dat nergens. De daemon doet het vanaf het begin, en dat verschil is
precies waar shaer-6d9 voor bestaat.

Nu zacht falen zoals §4.1 vraagt: dat ene doelwit valt af, de rest krijgt de
hulpvraag gewoon. Andersom zou één verkeerd geconfigureerd account van een
volwassene de noodroep van een kind helemaal laten mislukken.

Alleen bij een hulpvraag. Een gewoon direct bericht is geen escalatie, en een
ward mag een andere ward best iets sturen — daar stilletjes ontvangers uit
slopen zou een bug zijn met een spec-verwijzing eromheen.

Als ELKE guardian kapot is, is er niets om naar door te leveren. §4 dekt dat
niet, want §4.1 gaat ervan uit dat er anderen zijn. Dan komt de hulpvraag bij
niemand aan, en dat is het enige wat deze FEP juist moet voorkomen: dat faalt
dus luid in de log in plaats van een aflevering te melden die niet gebeurde.

carriesGuardians() staat nu in context.js, waar de rest van het vocabulaire ook
woont: §3 en §5.2 stellen dezelfde vraag en moeten hem hetzelfde lezen.

Co-Authored-By: Claude Opus 5 <claude@…>

  • Property mode set to 100644
File size: 1.9 KB
RevLine 
[6b5d7da]1/**
2 * Guardianship (FEP-633c "Guardians") — JSON-LD vocabulary.
3 *
4 * One source of truth for the shaer namespace and the terms Klonkt emits.
5 * ActivityPubService spreads SHAER_CONTEXT into its AP_CONTEXT term block, so
6 * every outgoing document declares the namespace and strict JSON-LD
7 * processors resolve the terms instead of dropping them.
8 */
9
10/** The term block merged into AP_CONTEXT. */
11export const SHAER_CONTEXT = {
12 // FEP-633c (Guardians): the shaer namespace. helpRequest marks a direct
13 // note as a ward's call for help (spec 5.2.1); ignorable by everyone else.
14 shaer: 'https://ns.klonkt.com/shaer#',
15};
16
17/** The Relationship value in the adoption Offer (FEP-633c §3), both forms. */
18export const GUARDIAN_RELATIONSHIP = 'https://ns.klonkt.com/shaer#Guardian';
19export const GUARDIAN_RELATIONSHIP_COMPACT = 'shaer:Guardian';
20
21/** True when an Offer's relationship names the guardian relation. */
22export function isGuardianRelationship(value) {
23 return value === GUARDIAN_RELATIONSHIP || value === GUARDIAN_RELATIONSHIP_COMPACT;
24}
25
[3d882bd]26/**
27 * True when an actor document carries `shaer:guardians` — i.e. it is a ward,
28 * and therefore not a valid guardian (§1). The one question §4 asks, in both
29 * places it asks it: before committing a guardianship (§4.2) and before
30 * delivering an escalation to one (§4.1).
31 *
32 * §2.1 allows the list as an array of URIs, a single URI, or a Collection, so
33 * all three are read here rather than in each caller.
34 */
35export function carriesGuardians(doc) {
36 const g = doc && doc['shaer:guardians'];
37 if (Array.isArray(g)) return g.length > 0;
38 if (typeof g === 'string') return g.length > 0;
39 if (g && typeof g === 'object') return Array.isArray(g.items) ? g.items.length > 0 : true;
40 return false;
41}
42
43export default { SHAER_CONTEXT, GUARDIAN_RELATIONSHIP, GUARDIAN_RELATIONSHIP_COMPACT, isGuardianRelationship, carriesGuardians };
Note: See TracBrowser for help on using the repository browser.