PRG-06: Idempotent merge bundle (from #339 #340)#371
PRG-06: Idempotent merge bundle (from #339 #340)#371nap-liu wants to merge 13 commits intodataelement:mainfrom
Conversation
…licate processing Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
When a user messages via DingTalk bot, fetch their corp profile (mobile, email) from the DingTalk API and pass it to channel_user_service. This enables matching against existing users who registered via web SSO or other channels, preventing duplicate user records for the same person. Also enrich existing matched users with mobile/email/name from the channel API so future cross-channel lookups succeed. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Thanks for the regrouped PR. The overall direction makes sense: avoiding DingTalk retransmit duplicates and ACK timeouts is useful. I do not think this is safe to merge as-is yet. A few issues need to be addressed first:
There is also a secondary operational concern: this adds a DingTalk user-detail API call, plus access-token retrieval, on every incoming message. That may need caching or rate-limit protection before production use. Could you update the PR to make dedup retry-safe and wire DingTalk |
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add `extra_ids` param to `resolve_channel_user` and refactor `_find_org_member` to accept a deduplicated `candidate_ids` list, enabling OR-matched lookups across staff_id and unionid for DingTalk. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Hoist `or_` import to module level (was inline inside _find_org_member). Add four tests that call _find_org_member with a _RecordingSession and assert the compiled WHERE clause contains the right column IN-clauses for dingtalk, feishu, wecom, and the empty-ids short-circuit path. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…paths Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
… to avoid IntegrityError Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ures are visible Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…nd wecom Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Thanks for the thorough review. Addressed all four concerns, plus one bonus bugfix discovered during local end-to-end testing. R1 — Retry-safe dedupReplaced the single-SETNX-on-entry approach with a
Redis is used when available (atomic cross-process); falls back to per-process memory with periodic GC. The Redis client is now injected via module-level R2 — Real
|
|
Closing this bundle per maintainer preference for focused single-concern PRs. The individual PRs remain open for review:
|
This regrouped PR combines the original changes from:\n- #339 context-window-dynamic\n- #340 dingtalk-dedup-ack\n\nScope: idempotent merge and duplicate-ack handling.