Skip to content

bug(store): migrate-copy rejects current-shaped catalog with legacy trigram FTS #2390

Closed

Description

@daandradec

Existing Issue Search

  • I searched existing issues and will add evidence to a canonical tracker when applicable.

The reporting coding agent performed this search on the reporter's behalf: all issue states, query catalog, 22 results (not truncated). Related reports are #2249, #2278 and #2344. Their documented predecessor shapes differ from this occurrence, so a matching canonical tracker was not established. Please consolidate if investigation establishes the same root cause and contract.

📝 Observed Consequence

The official 3.7.2 migrate-copy command refuses an existing Windows store currently served by 3.4.0. The original server was restored, but the current Gentle Shell memory companion cannot dispatch because that server returns HTTP 404 for /runtime-contract. The upgrade remains blocked without an established full-state-preserving recovery path.

🔄 Steps to Reproduce

  1. Use the affected existing Windows store, with schema version 1 and the catalog observations below. This report describes an actual occurrence, not a synthetic reproduction against current remote main.

  2. Stop clients and the server, disable automatic restart, and retain a full directory backup including WAL/SHM and configuration.

  3. With the verified official 3.7.2 Windows amd64 binary, run against a new absolute output path:

    engram migrate-copy --data-dir <SOURCE_DIR> --output-dir <NEW_OUTPUT_DIR> --confirm-quiescent --json
    
  4. Observe catalog rejection before a successful migration result. Preserve the incomplete output without promoting or reusing it.

✅ Expected Behavior

If this complete predecessor shape is supported, copy and migrate it while preserving all primary records, identities, counters, sync state and non-exported internal state. Otherwise, provide an official supported recovery path or clarify the unsupported boundary. A shared schema version or object count alone should not authorize migration.

❌ Actual Behavior

The command reports unsupported database catalog. No success result was accepted or promoted. The PowerShell wrapper surfaced NativeCommandError and exited 1; the native process exit code was not captured separately. All original file hashes matched the pre-migration manifest before restoring the old service.

Operating System

Windows

Release Version (Report Context)

3.7.2 (migration binary); 3.4.0 (last active server). Both are official release binaries. The installed 3.7.2 executable matched the checksum-verified official release archive.

Agent / Client

Other

📋 Relevant Logs

engram migrate-copy: unsupported database catalog; use a core supporting this store's exact shape; incomplete output retained at <NEW_OUTPUT_DIR>; do not use or promote it

💡 Additional Context

Client: Gentle Shell 4.8.0 / bundled runtime 1.5.2, Pi memory companion.

A separate fresh backup copy passed SQLite integrity_check. A complete raw name/type/owner/SQL comparison against an empty store initialized by the verified official 3.7.2 binary found 94 objects on both sides (32 tables, 54 indexes, 8 triggers, including SQLite internal objects) and six differing definitions:

Object Observed difference
observations_fts Existing tokenizer trigram; official reference trigram remove_diacritics 1
prompts_fts Existing tokenizer trigram; official reference trigram remove_diacritics 1
observations Column order and whitespace
sync_delete_tombstones Whitespace
sync_mutations Whitespace
sync_state Whitespace

The four ordinary-table differences were manually assessed as equivalent under the published 3.7.2 normalizer; the Go normalizer was not executed. The two virtual-table tokenizer differences remain. These are observations, not proof of the first violated invariant or exhaustive historical migration provenance.

The existing catalog includes org, idx_obs_org, session_finalizations, sync_chunk_delete_evidence and the lowercase-project indexes. Its sync_chunks header is unquoted. This differs from the complete historical profiles described in #2249 and #2278 and from the specifically qualified cases discussed in #2344.

Could a maintainer qualify this complete current-shaped/pre-diacritic-FTS predecessor and provide a bounded admission fix or supported recovery procedure? No original catalog was edited, no guard was bypassed, and export/import was not used. The full backup remains verified. No database, records, personal paths, instance identities or credentials are attached.

Activity

  1. added
    status:needs-review
    type:bug
    on Nov 15, 2026
  2. dnlrsls commented on Nov 22, 2026

    @dnlrsls
    Member

    On canonical main 33abd27, a disposable 94-object catalog with both plain trigram FTS definitions reproduces the same admission error, including with committed schema changes still in the WAL. The modern control migrates successfully, and each control with only one legacy FTS definition is still rejected.

    Could you share the complete catalog definitions from an existing scratch copy so we can check whether your catalog matches? This read-only query selects schema metadata only:

    SELECT type, name, tbl_name, sql
    FROM sqlite_schema
    ORDER BY type, name, tbl_name;

    Please share only the query results. Keep the SQLite file, sidecars, and data rows private. If any DDL includes paths, secrets, or personal information, please redact them and indicate which definitions you redacted, since that affects the comparison.

  3. added
    status:approved
    and removed
    status:needs-review
    on Nov 22, 2026
  4. self-assigned this
    on Nov 22, 2026
  5. dnlrsls commented on Nov 23, 2026

    @dnlrsls
    Member

    Closing as completed in main at dbbd08d78d8c8b94e37b1763fc8351f505b47690 for the reproduced complete catalog profile. The latest public release, v3.7.2, still has the original behavior. Merged correction · Verified main CI

    On Windows, the checksum-verified releases produced a disposable 3.4.0 → 3.7.2 → 3.4.0 store with 94 objects and the same six raw differences from the fresh v3.7.2 catalog. Official v3.7.2 rejected it. A build from current main migrated that fixture and a separate 3.7.2 → 3.4.0 fixture, preserving source file hashes and the observation sentinel while rebuilding both destination FTS indexes. The regression on main also passed with a checkpointed source and with committed WAL. The single-index downgrade, an extra index, and an altered trigger remain outside the admitted profile.

    The verification used generated stores. If a build containing #2440 still rejects the original store, the complete catalog metadata from a scratch copy would establish whether that store needs a separate profile.

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

Metadata

Metadata

Assignees

Labels

status:approvedtype:bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions