Skip to content

Data: preserve embedded email metadata evidence in dedupe decisions #1086

Description

@seonghobae

Current authority — 2026-09-18

Email identity/deduplication must keep sender-authored metadata separate from collection-time observation. An RFC 5322 Date fallback used for storage must never become strong duplicate evidence, filename dates remain weak display hints, and provider UIDL is collection identity rather than a replacement for Message-ID/source fingerprints.

Canonical safety contract

  • persisted/source vocabulary remains date_provenance = parsed | missing | invalid | unknown;
  • metadata auto-link requires genuine parsed Date plus complete sender/recipients/subject/body evidence;
  • incomplete metadata falls back to raw RFC822 bytes or deterministic canonical-source identity and does not create an automatic metadata link;
  • direct import without metadata-strong evidence returns deterministic dedupe_review_required behavior rather than a silent merge;
  • Message-ID equality remains an independent strong signal; missing direct-import Message-ID uses deterministic raw-source identity;
  • auto_link / review_required / distinct stay separate decision zones;
  • import, IMAP and POP3 use one provenance/dedupe boundary;
  • POP3 UIDL stays transport/collection identity and does not alter the message-provenance vocabulary;
  • migration lineage must converge to one Alembic head.

Canonical owner — #1195

Broad email identity/dedupe/POP3 collection owner is now exact #1195@630d5461d1eb8b59b392e4170dec66ce1edf034c, base #1623@509be4c1d9b6c7ba239a108656e2382681a85341, tree 5ae39dbe676ba3c84b647010182ec9eb0410ef35. It remains Draft/open/mergeable with 26 effective email provenance/dedupe/collection files.

The earlier provenance repairs are preserved in this lineage: zone-less/invalid/missing Date classification, complete-metadata gating, source-bound direct import, shared IMAP/POP3 persistence, deterministic Message-ID/source fallback, conservative auto_link/review_required/distinct decisions, and doctoring. Later POP3 work also fixes imported-count semantics, first-window starvation, per-message negative RETR continuation, and cross-poll starvation through durable owner-scoped UIDL progress (observed | retryable, nullable retry_after, never-attempted-before-due-retry scheduling).

The POP3 collection additions do not introduce a second dedupe vocabulary. Provider UIDL remains transport identity; raw reconstructed message bytes continue to feed the canonical source-provenance/dedupe boundary.

#1656 reconciliation — zero-delta provenance

All still-valid #1656 domain delta is either represented by #1195 or explicitly rejected with an invariant reason. #1656 is ordinary/non-force converged as exact 61920344e987f3405d4963168726be1274215e82 directly on #1195 and currently has 0 changed files / 0 additions / 0 deletions. Keep it Draft provenance until canonical successor evidence is complete; historical approval/checks do not transfer.

The proposed persisted message_id_evidence field remains rejected. Parser/input provenance plus deterministic source identity already covers the current decision consumers; a future persisted field requires a concrete invariant/consumer and a successor migration on the canonical lineage, not a sibling head.

Alembic ownership collision

Source reconciliation is not the same as migration integration. #1195 currently carries branch-local 0018_email_date_provenance → 0019_pop3_observed_uidl, while canonical workspace/database owner #1503 exact 9151c75568c582c8147cfee6757cd00a9b4d60b7 owns 0018_workspace_registry → 0019_email_read_state_repair → 0020_workspace_organization_binding → 0021_workspace_personal_owner_binding. Both descend from historical 0017, so independent merge would create parallel Alembic heads.

Required order is #1503 protected integration first, then ordinary/non-force adoption by #1195 and rechain/renumber of email/POP3 revisions behind the then-current protected head. Fresh and historical PostgreSQL upgrades must end with exactly one Alembic head.

Remaining acceptance gaps

The issue remains open because exact integrated evidence is incomplete:

Completion criteria

This is deterministic provenance/dedupe logic. It does not require a new LLM writer, model fallback, or parallel external owner.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: apiAPI, protocol, event, or external contractarea: ci-cdCI, GitHub Actions, checks, release, or supply chainbugSomething isn't workingpriority: highHigh-priority or P1 workstatus: triagedOpen issue has an organization taxonomy assignmenttype: bugDefect or incorrect behaviortype: featureNew or expanded product capability

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions