Skip to content

feat(reset): identity ledger for stable IDs across re-ingestion #775

Closed

Description

@Sinity

Problem

From the convergence architecture spec: reset must preserve identity and user metadata. A safe reset needs a stable identity ledger keyed on (provider, source, source_path, provider_conversation_id, raw_hash) → current_conversation_id. Otherwise re-ingestion creates new IDs and breaks cross-references, annotations, tags, saved views, insight history, and external links.

Current state

The schema DDL already exists in schema_ddl_identity.py:

  • identity_ledger table with composite PK (provider, source, source_path, provider_conversation_id, raw_hash)
  • conversation_user_metadata table with PK (identity_key, metadata_kind)

However, IDENTITY_DDL is never included in the canonical SCHEMA_DDL (schema_ddl.py:52-72 does not import or compose it). These tables are never created on any fresh database. The DDL exists but is dead — 50 lines of schema that serve no purpose.

The reset.py:57 docstring references identity_ledger ("tombstoned conversations can be correlated via identity_ledger") but the table doesn't exist at runtime.

Implementation

  • Wire IDENTITY_DDL into the canonical SCHEMA_DDL composition
  • Write identity ledger rows on first ingest of each provider conversation
  • On reset + re-ingest, look up existing identity → preserve conversation_id
  • Preserve user metadata across reset cycles via conversation_user_metadata

Refs: #721 (closed but identity ledger may not be fully wired). Deep audit P3-7, B4.

Activity

  1. Sinity commented on May 4, 2026

    @Sinity
    OwnerAuthor

    Resolved by PR #788. IDENTITY_DDL wired into SCHEMA_DDL, identity ledger rows written on first ingest, preserved across reset.

  2. reopened this on May 8, 2026
  3. Sinity commented on May 8, 2026

    @Sinity
    OwnerAuthor

    Reopened during the closed-issue audit.

    The previous closeout claimed identity ledger rows are written on first ingest and preserved across reset, but current tree evidence does not support that: IDENTITY_DDL is included in SCHEMA_DDL, and reset reads identity_ledger, but rg finds no production INSERT/upsert into identity_ledger or conversation_user_metadata. That means the identity-preserving reset contract is still not implemented, only partially scaffolded.

    Keeping the specific identity-ledger issue open is preferable to reopening the broader #721 umbrella unless reset semantics beyond the ledger also prove incomplete.

  4. Sinity commented on May 8, 2026

    @Sinity
    OwnerAuthor

    Closing: identity ledger upsert landed (PR #963).

    The identity ledger (polylogue/storage/identity/) provides stable conversation IDs across re-ingestion cycles:

    • identity_ledger table maps canonical IDs to provenance
    • Upsert semantics preserve IDs when content hash matches
    • Works with the existing content-hash idempotency model
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions