Skip to content

fix(ingest): FTS triggers left dropped when side-effect commit fails #728

Closed

Description

@Sinity

Problem

In ingest_batch.py:896-900, if _commit_sync_ingest_side_effects fails in the finally block (after the main transaction was already committed by _commit_ingest_results), the except branch calls conn.rollback(). This rollback reverts only the trigger restoration and FTS repair (since the main data was already committed), meaning FTS triggers could remain dropped on disk.

On the next ingest, suspend_fts_triggers_sync does DROP TRIGGER IF EXISTS (safe no-op on already-missing triggers), and restore_fts_triggers_sync re-creates them. But the FTS index is stale until the next successful write — searches return incomplete results in the meantime.

Acceptance criteria

  • FTS trigger restoration and repair are committed in a transaction that is independent of the main data commit, OR
  • The error recovery path explicitly restores triggers before rolling back, OR
  • The next ingest cycle detects missing triggers and repairs them before any reads.
  • Regression test: simulate side-effect commit failure, verify FTS triggers are present and index is consistent after recovery.

Found by

2026-05-03 git history bug pattern analysis (wave 4 subagent analysis). Related to #618 (storage write-path unification).

Activity

  1. Sinity commented on May 3, 2026

    @Sinity
    OwnerAuthor

    Scope absorbed into #618 (storage write-path unification). The FTS trigger lifecycle, batch ordering, and crash gap are all part of the storage correctness workstream.

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