docs(website): the engagement engine as built (Phase 4a) #183
Reference in New Issue
Block a user
No description provided.
Delete Branch "docs/engagement-engine"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Companion to website#170. §6.0b's assignment for Phase 4 —
ENGAGEMENT.md's as-built andBACKEND_DESIGN.md's table inventory — plus the two corrections building it forced on this document's own design sections.ENGAGEMENT.mdsendingstate the ENUM already carried, which needs no open transaction and no version floor. Q4 gives the surface its own nav group.notis legal only inside anand, and contributes no ceiling of its own); dormancy three ways and whyaudience_segment_idhas no foreign key; the conditions grammar's two fail-closed properties; and whyemitdoes not await the engine.Two of this document's own design sections were wrong, and they are corrected in place rather than left to contradict the phase below them.
UNIQUE KEY uq_engo_dedupe (dedupe_key)— a dedupe key names the event, and one event is one row per (rule, user, channel). A global unique index would admit the first recipient's row and silently ignore every other one. Now scoped, with the reasoning in the DDL comment.INSERT … ON DUPLICATE KEY UPDATEguarded on the interval, in one statement" — that statement reads its answer out ofaffectedRows, and the mariadb connector's defaultfoundRows: truemakes a no-op update report 1 rather than 0. Every cooldown passes. §4.1 now describes the two-statement form and says why the obvious one does not work here.BACKEND_DESIGN.mdFive new tables in the schema inventory, each carrying the reasoning a reader would otherwise have to reconstruct from the DDL:
subject_keyis in the cooldown primary key (the four-decaying-houses case)engagement_sends.user_idisSET NULLrather thanCASCADE, and why the address is a hashSET NULLis wrong in the dangerous directionNo route-table changes: Phase 4a adds no routes.
🤖 Generated with Claude Code
Companion to website#170. Section 6.0b's assignment for Phase 4 - ENGAGEMENT.md's as-built and BACKEND_DESIGN.md's table inventory - plus the two corrections building it forced on this document's own design sections. ENGAGEMENT.md - Phase 4 is split 4a / 4b, with what each owes. - Section 7.1 Q2 and Q4 answered, so seven of eight are settled and only Q8 (android CI) is open. - The as-built: the gate order and why two of its placements are load-bearing, the segment rule the design never stated (not is legal only inside an and, and contributes no ceiling), dormancy three ways and why audience_segment_id has no foreign key, the conditions grammar's two fail-closed properties, and why emit does not await the engine. - Section 4.1's cooldown statement and section 4.2a's dedupe index are corrected in place, so the design sections stop teaching the two defects. BACKEND_DESIGN.md - Five new tables in the schema inventory, each with the reasoning a reader would otherwise have to reconstruct: why subject_key is in the primary key, why the dedupe index is scoped, why the send log survives an account deletion and is not a second address book, and why a rule points at a segment without a foreign key doing it. No route table changes - Phase 4a adds no routes. Co-Authored-By: Claude <noreply@anthropic.com>