supermemory icon indicating copy to clipboard operation
supermemory copied to clipboard

Self-hosted v0.0.5 upgrade skips profile_buckets migration; /v4/profile returns 500

Open skillet07 opened this issue 4 months ago • 1 comments

Summary

Upgrading an existing self-hosted server-v0.0.3 data dir to the official server-v0.0.5 Linux x64 binary leaves the space table without the new profile_buckets column. The server starts normally and existing document endpoints work, but both new profile endpoints return HTTP 500.

Environment

  • OS: Ubuntu Linux x86_64
  • Source store: working server-v0.0.3 encrypted local data dir
  • Target: official server-v0.0.5 Linux x64 release binary
  • Binary SHA-256: b2fccca3ff2b5607ce41028c759f375c4ecf5461adc9f3306f41c2757edaf375
  • Existing store: 1,218 documents; no embedding-plan.json before the upgrade
  • Reproduced on a copied data dir; the live store was not modified

Steps to reproduce

  1. Start with a populated self-hosted v0.0.3 encrypted local data dir.
  2. Make a copy of that data dir on the same machine.
  3. Start the official v0.0.5 binary against the copied data dir.
  4. Confirm the server starts and the existing API still works:
POST /v3/documents/list
→ 200 (1,218 documents)
  1. Call either new profile endpoint:
POST /v4/profile/buckets
Content-Type: application/json

{"containerTag":"<existing-container-tag>"}

or:

POST /v4/profile
Content-Type: application/json

{"containerTag":"<existing-container-tag>"}

Actual behavior

Both endpoints return HTTP 500.

The server log shows:

error: column "profile_buckets" does not exist
code: "42703"

Failed query: select "profile_buckets" from "space"
where ("space"."container_tag" = $1 and "space"."org_id" = $2)
limit $3

/v4/profile fails with the same missing-column error while selecting id, profile_buckets.

During startup, the migrator reports migration hash adoption instead of applying additive schema changes:

[migrate] Adopted 0000_spooky_hellion (schema already present; hash drift)
[migrate] Adopted 1 migration hash(es) without re-running SQL

The v0.0.5 embedding-plan migration does run: the populated store is locked to the legacy local Xenova/bge-base-en-v1.5 768d plan. The missing profile_buckets column is a separate schema migration problem.

Expected behavior

An in-place v0.0.3 → v0.0.5 upgrade should add every schema element required by the v0.0.5 API, including space.profile_buckets, or the server should fail startup with an actionable migration error.

The server should not report a healthy startup while newly advertised endpoints are guaranteed to fail.

Likely cause

The hash-drift/schema-adoption path appears to mark the consolidated migration as adopted after detecting that an older version of the schema already exists. That skips additive columns introduced after v0.0.3.

Suggested fix

  • Add a versioned/idempotent migration such as ALTER TABLE "space" ADD COLUMN IF NOT EXISTS "profile_buckets" ....
  • Do not treat partial table existence as equivalent to the complete current schema.
  • Add an upgrade integration test using a real v0.0.3 store fixture and exercise /v4/profile and /v4/profile/buckets, not only server startup and /v3/documents/list.

Impact

/v4/profile is one of the main features introduced in the recent self-hosted releases, but it is unusable after an apparently successful in-place upgrade. This is easy to miss because the server boots and legacy endpoints continue returning 200.

Related upgrade regression: supermemoryai/supermemory#1237 (API-key auth). This issue is distinct: localhost requests authenticate and legacy document APIs work; only the missing schema column breaks profile endpoints.

skillet07 avatar Jul 14 '26 06:07 skillet07

ENG-1056

linear-code[bot] avatar Jul 14 '26 06:07 linear-code[bot]