Skip to content

Remove duplicate email import Realtime owner - #519

Merged
bizzybee90 merged 1 commit into
mainfrom
codex/own-email-import-realtime-at-app-scope-20260813
Aug 13, 2026
Merged

Remove duplicate email import Realtime owner#519
bizzybee90 merged 1 commit into
mainfrom
codex/own-email-import-realtime-at-app-scope-20260813

Conversation

@bizzybee90

@bizzybee90 bizzybee90 commented Aug 13, 2026

Copy link
Copy Markdown
Owner

Purpose

Remove the duplicate route-level email-import Realtime owner revealed by governed proof run 31693861981. The existing app-scope workspace invalidation channel already subscribes to both email-import tables and invalidates the shared status query.

Included scope

  • Keep useEmailImportStatus query-only.
  • Retain useWorkspaceLiveInvalidation as the single persistent, workspace-filtered Realtime owner.
  • Remove the now-unnecessary channel registry, removal retry state, and post-leave timing workaround.
  • Update the product-proof Realtime policy to require only the authoritative workspace topic.
  • Pin exact ownership, table filters, query invalidation, and absence of a duplicate channel in tests.

Explicit exclusions

  • No query, display, authentication, RLS, schema, credential, provider, timeout, retry, route, or staging mutation change.
  • No Realtime join-limit widening and no acceptance relaxation.
  • No production deployment.

Architecture placement

Current owner / directory: existing app-scope workspace invalidation under src/hooks/useWorkspaceLiveInvalidation.ts; status reads remain under src/hooks/useEmailImportStatus.tsx.

Dependencies and duplicate-system check: removes a duplicate subsystem and reuses the established persistent workspace invalidation owner.

Security and tenancy impact

  • Authentication / authorization: unchanged.
  • Tenant isolation: preserved exact workspace_id=eq.<workspace> filters on both backing tables.
  • Service-role impact: none.
  • Provider / webhook impact: none.
  • Secrets impact: none.

Data impact

  • Schema / migration / RLS / grant impact: none.
  • Backfill, retention, or rollback: none; code rollback only.

Verification

  • Behavioural tests: hook ownership 8/8; network policy and live recorder 444/444.
  • Static checks: scoped ESLint, TypeScript --noEmit, Node syntax, and diff checks passed.
  • Security review: zero findings; no raw data, credential, mutation, or acceptance path added.
  • Environment caveat: the repository-wide local run used a stale shared dependency tree and produced unrelated missing-package/UI fixture failures; hosted locked-dependency quality is authoritative.
  • CI / security review: every fresh exact-head protected gate and CodeRabbit approval mandatory.

Governed evidence

Predecessor proof 31693861981 on exact main ad8d6ae3275962d2e0e1c5fda14004fcbcfd64b3 failed closed at tenant-A Reviews desktop with exact sanitized diagnostic live_realtime_join_limit_exceeded, topic class email-import-status, prior state leave-pending. Cleanup, postflight, and independent recovery passed; writer/readback were skipped and zero proof artifacts were published.

Release safety

  • Deployment scope: private no-index preview only after protected exact-head merge.
  • Monitoring / stop conditions: stop on any gate failure, non-exact source, changed topic/filter, cleanup/recovery failure, or any different governed-proof blocker.
  • Rollback or containment: revert the single merge commit; predecessor source is ad8d6ae3275962d2e0e1c5fda14004fcbcfd64b3, manifest 5817ed58921bd91525deacba9f7ee3fb8dad1f60cf0b3866e6c575848af133a4.

Documentation and generated files

  • Docs / diagrams / ADR updates: none; this removes duplicate implementation and does not change architecture direction.
  • Generated-file or lockfile justification: none.

Completion check

  • Starts from current origin/main.
  • No valuable work remains only in a dirty worktree, stash, or local-only branch.
  • Source branch will be retired under the branch policy after merge.
  • Any PR-size or branch-retention exception is documented below, or neither applies.

Policy exceptions (leave blank when none apply)

PR-size exception rationale: none; five files with a net deletion of duplicate lifecycle machinery.

Retained branch reason / owner / review date / maximum retention date:

Summary by CodeRabbit

  • Bug Fixes
    • Improved real-time updates for email import status through shared workspace updates.
    • Prevented duplicate or unnecessary real-time connections for email import status.
    • Ensured email-related updates are reliably reflected across Home and Reviews views.
    • Improved cleanup of real-time subscriptions when leaving a view.

@bizzybee90
bizzybee90 deployed to release-status-ledger-writer August 13, 2026 11:55 — with GitHub Actions Active
@coderabbitai

coderabbitai Bot commented Aug 13, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: ef6f1b07-c559-4dca-a2b6-81a0b39cd958

📥 Commits

Reviewing files that changed from the base of the PR and between ad8d6ae and 814482a.

📒 Files selected for processing (5)
  • scripts/product-proof-network-policy.mjs
  • scripts/product-proof-network-policy.test.mjs
  • src/hooks/__tests__/useEmailImportStatus.test.tsx
  • src/hooks/__tests__/useWorkspaceLiveInvalidation.test.tsx
  • src/hooks/useEmailImportStatus.tsx

📝 Walkthrough

Walkthrough

The change removes email-import Realtime channel management from useEmailImportStatus and assigns table subscriptions and query invalidation to useWorkspaceLiveInvalidation. Network policy tests now require the shared workspace topic across desktop and mobile views.

Changes

Email import realtime ownership

Layer / File(s) Summary
Centralize email import invalidation
src/hooks/useEmailImportStatus.tsx, src/hooks/__tests__/useWorkspaceLiveInvalidation.test.tsx, src/hooks/__tests__/useEmailImportStatus.test.tsx
useEmailImportStatus now performs query-only status retrieval. useWorkspaceLiveInvalidation subscribes to both email-related tables, debounces status-query invalidation, and removes its channel on unmount. Tests cover channel ownership and lifecycle behavior.
Update realtime policy coverage
scripts/product-proof-network-policy.mjs, scripts/product-proof-network-policy.test.mjs
The dedicated email-import status topic is removed. Desktop and mobile home and reviews policies require both tables on the shared workspace invalidation topic.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Mergeability Score: ⚪ Minimal · up to 81448

This PR removes a duplicate email-import Realtime owner while preserving the existing workspace-scoped invalidation path and tenant filters; no actionable merge-blocking risk remains after normal checks and review.

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely identifies removal of the duplicate email import Realtime owner.
Description check ✅ Passed The description covers the required sections, scope, architecture, impact, verification, release safety, and completion checks.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/own-email-import-realtime-at-app-scope-20260813

Comment @coderabbitai help to get the list of available commands.

@coderabbitai
coderabbitai Bot deployed to release-status-ledger-writer August 13, 2026 11:57 Active
@bizzybee90
bizzybee90 merged commit 054b0d7 into main Aug 13, 2026
11 checks passed
@bizzybee90
bizzybee90 deleted the codex/own-email-import-realtime-at-app-scope-20260813 branch August 13, 2026 12:22
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.

1 participant