Skip to content

Fix duplicate mock property and lint issues from email audit trail PR - #4495

Open
builder-io-integration[bot] wants to merge 8 commits into
mainfrom
ai_main_4a3db45f528a4e758630
Open

Fix duplicate mock property and lint issues from email audit trail PR#4495
builder-io-integration[bot] wants to merge 8 commits into
mainfrom
ai_main_4a3db45f528a4e758630

Conversation

@builder-io-integration

Copy link
Copy Markdown
Contributor

Follow-up to #4357 (already merged).

builderio-bot and others added 8 commits September 4, 2026 19:19
…a4e758630' into ai_main_4a3db45f528a4e758630

# Conflicts:
#	packages/core/src/email-catalog/log.ts
#	packages/core/src/email-catalog/schema.ts
#	packages/core/src/localization/default-messages.ts
#	packages/dispatch/src/components/transactional-email-send-log.tsx

@builder-io-integration builder-io-integration Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Builder reviewed your changes and found 1 potential issue 🟡

Review Details

Code Review Summary

PR #4495 completes the transactional-email audit trail from #4357: it adds additive log columns and indexes, captures provider request/response metadata with body and attachment redaction, tags Better Auth magic-link sends, exposes richer filters through list-email-log, and adds the Dispatch send-log UI. The implementation preserves organization/app scoping, distinguishes provider HTTP failures from pre-provider exceptions, bounds query sizes, and uses React-rendered text for logged values. The changeset correctly covers both affected packages.

Risk assessment: Standard, because this changes shared email delivery, persisted audit data, authorization-sensitive log access, and an authentication email path.

Key Findings

  • 🟡 MEDIUM — Offset pagination can duplicate or skip rows when new sends arrive between page requests, despite the code comment promising stable paging. A cursor/keyset boundary or fixed snapshot cutoff is needed for a live audit log.
  • The recipient/sender LIKE filters also do not escape % and _, so wildcard characters do not behave as the documented literal substring match; this is a lower-severity correctness issue.

The redaction strategy is a strong pattern: email bodies, magic-link tokens, and attachment bytes are omitted before persistence, while provider status/body remain available for diagnostics. Focused review agents found no additional confirmed authorization, migration, or UI correctness issues.

🧪 Browser testing: Will run after this review (PR touches UI code)

Comment on lines +250 to +253
sql: `SELECT ${LOG_COLUMNS} FROM email_log
WHERE ${where.join(" AND ")}
ORDER BY created_at DESC, id DESC
LIMIT ? OFFSET ?`,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Offset pagination is not stable while new sends arrive

The UI requests separate pages with OFFSET, so a new send inserted between page requests shifts every later row: the next page can duplicate a row already shown or skip a row. The id tie-breaker only stabilizes equal timestamps; use a cursor/keyset boundary based on the last (created_at, id) or a fixed snapshot cutoff for the paging session.

Additional Info
Found by 1 of 3 review agents; confirmed against the live-send paging flow.

Fix in Builder

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed. The offset-based pagination pattern flagged here (LIMIT ? OFFSET ? with created_at DESC, id DESC tie-break) is pre-existing — it was introduced by the already-merged #4357 and is unchanged by this PR, which is scoped only to the TS1117 duplicate-property fix in the log.spec.ts mock and oxfmt formatting. I also confirmed the same offset pattern is already live on main today (including in the newer, further-evolved implementation merged via #4496/#4504), so this isn't a regression this branch introduces. Agreed it's a real limitation for high-volume concurrent sends, but a keyset/cursor rework is a scope change for an admin log's pagination, not a lint fix — leaving it for a separate follow-up rather than bundling it here.

@steve8708

Copy link
Copy Markdown
Contributor

@builderio-bot look at the latest PR feedback and fix anything you agree with. Be skeptical. Reply on each comment thread whether you fixed it and why. Get CI green and keep the branch mergeable.

2 similar comments
@steve8708

Copy link
Copy Markdown
Contributor

@builderio-bot look at the latest PR feedback and fix anything you agree with. Be skeptical. Reply on each comment thread whether you fixed it and why. Get CI green and keep the branch mergeable.

@steve8708

Copy link
Copy Markdown
Contributor

@builderio-bot look at the latest PR feedback and fix anything you agree with. Be skeptical. Reply on each comment thread whether you fixed it and why. Get CI green and keep the branch mergeable.

@enzoames

enzoames commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

For some reason automation has pinged this PR 3 times, investigating...

@builder-io-integration

Copy link
Copy Markdown
Contributor Author

Confirmed clean — the merge was aborted successfully and HEAD is back at the original PR commit d0277a6. That reminder was stale, from the merge attempt I already resolved.

Here's the fuller picture after digging deeper:

The one thing this PR actually still fixes is real and still needed. I checked origin/main's log.spec.ts directly — it still has the duplicate ensureColumnExists property in the vi.mock block (lines 11 and 13), the exact TS1117 bug this PR claims to fix. So despite main having since merged more evolved versions of the underlying feature via #4496 and #4504, those PRs didn't carry this specific test-file fix forward. This PR's core contribution is not fully redundant.

But the branch itself is far too stale to reconcile safely. Doing the merge for real (not --no-commit dry run against just the overlapping files, but the actual full merge) surfaces conflicts across ~100+ files spanning packages/dispatch, packages/docs, packages/toolkit, scripts, templates, lockfiles, and changelogs — this branch is many days and dozens of PRs behind main, not just conflicting on the 7 email-catalog files I saw in the first attempt. Attempting to auto-resolve that is well outside a "small focused fix" and carries a real risk of silently reintroducing or dropping shipped code across unrelated areas.

Recommendation stands, sharpened: rather than reconciling this branch, someone should fix the still-live duplicate-property bug directly against current main in a fresh, tiny PR (it's a one-line deletion) and this stale branch should be closed. I don't have a clean, low-risk way to bring this specific branch current — it would mean re-merging the entire intervening history of main.

I'll leave the branch untouched rather than force a risky reconciliation, since this needs your call.



🟡 PR #4495 is far too stale to merge safely (conflicts span 100+ unrelated files, not just the 7 email-catalog ones) — the one still-valid fix it contains (duplicate ensureColumnExists mock property, still live on main) should be applied fresh in a new small PR and this one closed; awaiting your decision before taking any destructive action on the PR.


Edit in Builder  Preview

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants