Skip to content

feat(gtd): add delegated contact API - #372

Draft
salmonumbrella wants to merge 3 commits into
maathimself:mainfrom
salmonumbrella:feat/gtd-delegation-api-plugin
Draft

feat(gtd): add delegated contact API#372
salmonumbrella wants to merge 3 commits into
maathimself:mainfrom
salmonumbrella:feat/gtd-delegation-api-plugin

Conversation

@salmonumbrella

Copy link
Copy Markdown
Contributor

Summary

Ports the backend half of delegated-contact GTD state from closed PR #343 onto the plugin boundary described in #368. A caller can now label one or more owned threads as Delegated and attach a durable contact snapshot without adding a GTD table, migration, or command-engine dependency.

This is a stacked draft. It is blocked by #371, which is blocked by #370. It currently includes both earlier commits; the diff collapses to this API layer as those PRs land.

Changes

  • Add POST /api/gtd/delegations for 1–100 unique, owned message IDs and an owned contact or null.
  • Store contactId, display name, primary email, and timestamps under messages.plugin_annotations.gtd.delegation on every live row in the thread.
  • Serialize work per account and thread so concurrent requests create at most one Delegated copy.
  • Reconcile non-UIDPLUS copies by syncing the destination once and taking a strict UID set difference. Ambiguous outcomes are reported without guessing.
  • Compensate annotation failures only when this request can identify the exact label copy it created. Pre-existing labels are never removed.
  • Inherit delegation snapshots onto newly synced rows and clear them only after the final Delegated copy disappears.
  • Include the contact snapshot in the plugin-owned row metadata response.

Testing

  • Backend: npm test — 1,157 tests passed across 66 files.
  • Backend: npm run lint and npm run lint:plugins.
  • Coverage includes ownership boundaries, duplicate IDs, thread grouping, contact clearing, exact compensation, pre-existing labels, concurrent calls, UIDPLUS and non-UIDPLUS reconciliation, ambiguous outcomes, route validation, annotation inheritance, and final-label cleanup.
  • RoboRev reviewed the final API commit with no issues found.

Blocked by #371.

Refs #343 and #368


Contributor License Agreement

By submitting this pull request I confirm that:

  • I have read and agree to the Contributor License Agreement.
  • My contribution is my own original work (or I have identified any
    third-party material and confirmed it is compatible with the CLA).
  • I have the right to submit this contribution under the terms of the CLA.

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