Repository navigation
refactor(addie): co-locate cross-cut CTAs in one registry (strangler-fig) - #3382
Merged
Merged
Conversation
The digest-newsletter pickNudge maintained its own parallel rule list, duplicating "Continue cert", "Find a WG", "Complete profile" with the suggested-prompts engine. Adding a new CTA meant editing two files in sync. Co-locate the catalog: cross-cut rules in prompt-rules.ts now have an optional `digest` facet alongside their `pull` fields. Each facet keeps its own `when` clause typed against the surface's native shape (MemberContext for pull, DigestEmailRecipient for digest) — we share the catalog, not the eligibility logic. Lossy adapters between the two shapes were the alternative; per-surface gates are honest. Three digest-only CTAs (become member, join Slack, contributor cert) live in a separate DIGEST_ONLY_NUDGES list since they have no pull-surface analog. Adding more lists like this is the migration path for future surfaces (push DM jobs, etc.). pickNudge becomes a 15-line wrapper. No behavior change — same 7 nudges, same priority order (1-6 + the dynamic cert text), same copy. 14 new digest-nudge tests covering each rule's eligibility, priority ordering between cross-cut and digest-only CTAs, dynamic cert text grammar. Also documents two invariants in .agents/playbook.md: - MemberContext fields must surface to both hydration and formatMemberContextForPrompt (the data-plane invariant from #3377) - Cross-surface CTAs co-locate in the registry; each surface keeps its own when clause Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Code review:
- Extract RuleWithDigest type alias instead of inline `r is typeof r &
{ digest: DigestNudgeFacet }` narrowing
- Deterministic secondary sort key on `id` so ordering doesn't rely
on V8's stable-sort guarantee implicitly
- New boundary test: zero-progress non-contributor must not receive
the cert nudge (locks in cert facet's `> 0 && < total` gate)
DX-expert:
- Boot-time assertion in prompt-rules.ts: any rule with function-
valued `prompt` must provide `matchClick`. Without it, click
telemetry silently zeros for the new rule. Catching at module load
is cheaper than discovering weeks later when CTR is empty.
- Playbook invariants now pair each rule with "what mistake this
prevents" + a code-pointer (canonical example) so future contributors
can pattern-match instead of inferring abstract intent.
Product expert: no blockers. The cert digest "Continue learning" vs
pull "Continue A1" copy mismatch is real but minor (different
surfaces, different attentional contexts). Defer.
140 unit tests total.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
`pickNudge` in `digest-nudge.ts` maintained its own parallel rule list with 7 priority-ordered CTAs. Three of them (cert continuation, find a WG, complete profile) duplicated logic in the suggested-prompts engine — adding a new CTA meant editing two files in sync, with drift risk on copy and eligibility.
What this changes
Documented invariants
Added to `.agents/playbook.md`:
Test plan
🤖 Generated with Claude Code