fix: novelty gate on diff re-propagation + greetings_max reachable from app
Re-propagation fired on every receipt, so a duplicate diff spawned a fresh round of sends with only sender-exclusion as a guard — no termination condition in a dense holder cluster, which is exactly what hot open-slot posts (registry, greeting-enabled bios) produce. Now: every storage apply reports whether it actually changed state, and apply_diff_ops returns only the ops that did. Nothing changed means no header rebuild and no outbound push at all; a mixed diff re-propagates a freshly built payload of only its novel ops rather than echoing what arrived. Gating is on state change, not message identity — a hash seen-set would break once coalescing lands, since no two pushes stay identical. Tombstones count as changes even when their target is absent, so a delete arriving before its comment still propagates. Found while implementing: AddCommentSlots appended unconditionally, so a re-delivered op grew the header forever AND looked novel forever — unbounded amplification on precisely the clusters this gate targets. Now idempotent on slot bytes. Review found a remotely-triggerable blocker in the first cut: absent-target tombstone placeholders were written with no expiry, and DeleteComment is authorized per-op rather than per-cardinality, so one keypair could mint unlimited valid deletes against any post a victim holds — permanent rows, relayed onward, and served in the rebuilt header. The registry post is universally held, making it network-wide unbounded growth. Fixed three ways: a 64-per-post placeholder cap, a bounded expiry so the existing sweep reclaims them, and exclusion from everything published (headers and the uniques announce). Also: RemoveReaction deliberately does NOT mirror the placeholder — it carries no timestamp and is unsigned, so a guessed-timestamp placeholder loses to a late AddReaction and the row key would be a free unbounded write vector. Rationale documented on the arm; signed RemoveReaction carrying the reaction timestamp is the named follow-up. set_greetings_max/get_greetings_max exposed as Tauri commands and wired next to the Accept-greetings consent control, clamped at the single read point every writer funnels through. 267 core tests (was 250); a3 12/12; c_topology 33/33. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LGiPD2cF75mnvneSCjdDC5
This commit is contained in:
parent
bbc17f8855
commit
8d29cb918e
6 changed files with 1598 additions and 296 deletions
|
|
@ -3450,10 +3450,15 @@ $('#profile-lightbox-btn').addEventListener('click', () => {
|
|||
</label>
|
||||
<input id="lb-registry-keywords" type="text" placeholder="Keywords, comma-separated (up to 8)" maxlength="280" style="width:100%;margin-bottom:0.25rem" />
|
||||
<div id="lb-registry-status" class="empty-hint" style="font-size:0.72rem;margin-bottom:0.5rem">Not listed</div>
|
||||
<label class="checkbox-label" style="margin:0.5rem 0;display:block;font-size:0.8rem">
|
||||
<label class="checkbox-label" style="margin:0.5rem 0 0.25rem;display:block;font-size:0.8rem">
|
||||
<input type="checkbox" id="lb-greetings-open" checked />
|
||||
Accept greetings (sealed hellos from people outside your circles)
|
||||
</label>
|
||||
<div style="display:flex;align-items:center;gap:0.5rem;margin-bottom:0.25rem">
|
||||
<label for="lb-greetings-max" style="font-size:0.8rem;color:#888;flex:1">Max live greetings</label>
|
||||
<input id="lb-greetings-max" type="number" min="1" max="64" placeholder="64" style="width:5rem" />
|
||||
</div>
|
||||
<div class="empty-hint" style="font-size:0.72rem;margin-bottom:0.5rem">Blank = the default of 64. The people holding your bio enforce this limit.</div>
|
||||
<div style="display:flex;gap:0.5rem;justify-content:center;margin-top:0.75rem">
|
||||
<button class="btn btn-primary btn-sm" id="lb-profile-save">Save</button>
|
||||
</div>
|
||||
|
|
@ -3474,7 +3479,12 @@ $('#profile-lightbox-btn').addEventListener('click', () => {
|
|||
// and auto-renew silently continuing.
|
||||
let _lbWasListed = false;
|
||||
const _lbSaveBtn = overlay.querySelector('#lb-profile-save');
|
||||
const _lbGreetMax = overlay.querySelector('#lb-greetings-max');
|
||||
_lbSaveBtn.disabled = true;
|
||||
// Disabled alongside Save: the prefill below assigns into this field, so
|
||||
// leaving it editable lets a fast typist have their value silently
|
||||
// overwritten when the async read lands.
|
||||
if (_lbGreetMax) _lbGreetMax.disabled = true;
|
||||
(async () => {
|
||||
try {
|
||||
const personaId = await getDefaultPersonaId();
|
||||
|
|
@ -3496,8 +3506,15 @@ $('#profile-lightbox-btn').addEventListener('click', () => {
|
|||
const greetCheck = overlay.querySelector('#lb-greetings-open');
|
||||
if (greetCheck) greetCheck.checked = !!open;
|
||||
} catch (_) {}
|
||||
try {
|
||||
// Ruling #6: author-declared greeting cap. Blank input =
|
||||
// unset = the holder default, so leave it empty on null.
|
||||
const max = await invoke('get_greetings_max', { postingIdHex: personaId });
|
||||
if (_lbGreetMax && max) _lbGreetMax.value = String(max);
|
||||
} catch (_) {}
|
||||
} finally {
|
||||
_lbSaveBtn.disabled = false;
|
||||
if (_lbGreetMax) _lbGreetMax.disabled = false;
|
||||
}
|
||||
})();
|
||||
_lbSaveBtn.addEventListener('click', async () => {
|
||||
|
|
@ -3516,6 +3533,25 @@ $('#profile-lightbox-btn').addEventListener('click', () => {
|
|||
throw new Error('could not resolve your persona — profile not saved, please try again');
|
||||
}
|
||||
await invoke('set_setting', { key: 'greetings_open.' + personaId, value: greetOpen ? '1' : '0' });
|
||||
// Ruling #6: the greeting cap ships inside the bio's SIGNED
|
||||
// OpenSlotDecl, so it only reaches holders on a republish.
|
||||
// Written the same way and for the same reason as the consent
|
||||
// flag above — before set_profile, so ONE republish carries
|
||||
// both. This is DELIBERATE, not an oversight: the
|
||||
// `set_greetings_max` Tauri command exists and republishes on
|
||||
// its own, which is right for CLI/API callers but would cost a
|
||||
// second republish here. Do not "fix" it into a direct call.
|
||||
// Blank/0 = unset = the holder default.
|
||||
const greetMaxRaw = _lbGreetMax.value.trim();
|
||||
const greetMaxNum = parseInt(greetMaxRaw, 10);
|
||||
// The 64 is presentational only — `node::greetings_max_setting`
|
||||
// owns the real clamp (to connection::MAX_GREETINGS_PER_BIO) for
|
||||
// every writer, and holders re-clamp again via
|
||||
// comment_ttl::open_slot_limit.
|
||||
const greetMax = (greetMaxRaw && Number.isFinite(greetMaxNum) && greetMaxNum > 0)
|
||||
? String(Math.min(greetMaxNum, 64))
|
||||
: '';
|
||||
await invoke('set_setting', { key: 'greetings_max.' + personaId, value: greetMax });
|
||||
await invoke('set_profile', { name, bio });
|
||||
const visible = overlay.querySelector('#lb-public-visible').checked;
|
||||
await invoke('set_public_visible', { visible });
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue