Changeset 88d7c8f in Klonkt for src/services/guardianship/gated.js
- Timestamp:
- 07/29/2026 07:15:16 AM (6 weeks ago)
- Branches:
- main
- Children:
- e27b8db
- Parents:
- 439f095
- File:
-
- 1 edited
-
src/services/guardianship/gated.js (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/services/guardianship/gated.js
r439f095 r88d7c8f 145 145 } 146 146 147 // ── The guardian-side copy (the missing leg of §5.6) ────────────── 148 // A proposal addressed to the ward's server reaches only the proposer and the 149 // ward. The other guardians never learn it exists, so a threshold of two can 150 // never be met and every proposal expires unanswered. The ward's server 151 // therefore FORWARDS it, exactly as it forwards a gated follow (§5.3): each 152 // guardian stores a copy it can answer, and the answer travels back to the 153 // ward, which tallies. 154 155 let _rs = null; 156 function rstmts() { 157 if (!_rs) { 158 _rs = { 159 ins: db.prepare(`INSERT INTO ap_gated_reviews (id, guardian_slug, ward_uri, ward_inbox, proposer, feature, value) 160 VALUES (?,?,?,?,?,?,?) 161 ON CONFLICT(guardian_slug, id) DO UPDATE SET value = excluded.value, ward_inbox = excluded.ward_inbox`), 162 get: db.prepare('SELECT * FROM ap_gated_reviews WHERE guardian_slug = ? AND id = ?'), 163 bySlug: db.prepare('SELECT * FROM ap_gated_reviews WHERE guardian_slug = ? ORDER BY created_at DESC'), 164 del: db.prepare('DELETE FROM ap_gated_reviews WHERE guardian_slug = ? AND id = ?'), 165 delAll: db.prepare('DELETE FROM ap_gated_reviews WHERE id = ?'), 166 }; 167 } 168 return _rs; 169 } 170 171 export function recordGatedReview(guardianSlug, r) { 172 rstmts().ins.run(r.id, guardianSlug, r.wardUri, r.wardInbox || null, r.proposer || null, r.feature, r.value ? 1 : 0); 173 return rstmts().get.get(guardianSlug, r.id); 174 } 175 export function getGatedReview(guardianSlug, id) { return rstmts().get.get(guardianSlug, id); } 176 export function listGatedReviews(guardianSlug) { return rstmts().bySlug.all(guardianSlug); } 177 export function removeGatedReview(guardianSlug, id) { rstmts().del.run(guardianSlug, id); } 178 /** Drop every guardian's copy once the decision has settled or lapsed. */ 179 export function clearGatedReviews(id) { rstmts().delAll.run(id); } 180 147 181 export function rememberGatedOffer(offerId, slug, feature, value) { 148 182 try { … … 160 194 tallyGatedSetting, thresholdFor, featureColumn, recordGatedVote, gatedProgress, GATED_WINDOW_MS, 161 195 parseGatedSetting, buildGatedOffer, rememberGatedOffer, recallGatedOffer, 196 recordGatedReview, getGatedReview, listGatedReviews, removeGatedReview, clearGatedReviews, 162 197 };
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)