Skip to content
This repository was archived by the owner on May 29, 2026. It is now read-only.
This repository was archived by the owner on May 29, 2026. It is now read-only.

Bug: MigrateToVersionedModel didn't actually drop pre-versioned Hello World app #69

Description

@rubenvdlinde

Symptom

Per spec C (`openbuilt-versioning-model`), the `MigrateToVersionedModel` repair step is supposed to green-field every existing virtual app on first upgrade: delete the per-app register, delete the Application row, log one line per deletion.

After running `occ maintenance:repair` on a fresh upgrade:

  • The hello-world Application row is STILL present in the openbuilt register
  • `GET /api/applications` returns hello-world as if nothing was migrated
  • No "Migrated-to-versioned-model: dropped Application 'hello-world'" log line found

The repair step's idempotency check ("short-circuit when schema is already in versioned shape") is likely too eager — it sees the new `ApplicationVersion` schema already imported and concludes "already migrated, nothing to do."

Repro

  1. Apply PRs [1/8] refactor: split Application + ApplicationVersion (ADR-002 foundation) #58[8/8] fix(tests): stabilise 11 PHPUnit failures + ProductionVersionGuardListener runtime bug #65
  2. `docker exec nextcloud php occ maintenance:repair && docker exec nextcloud php occ maintenance:mode --off`
  3. `curl -u admin:admin http://localhost:8080/index.php/apps/openbuilt/api/applications | jq '.[].slug'`
  4. See `"hello-world"` still present

Hypothesis

The idempotency check is keyed on the schema-register state (is `applicationVersion` schema imported?) but should be keyed on whether any pre-versioned Application rows still exist (Application rows that have a `manifest` field at top-level). The schema-register reimport happens BEFORE the migration step, so the check incorrectly concludes "already migrated" on the very first run.

Probable fix

Replace the schema-shape check with: "are there any Application rows whose `manifest` field is non-null at top-level (the pre-spec-C shape)?" If yes, run the migration; if no, no-op.

Spec ref: `openspec/changes/openbuilt-versioning-model/specs/green-field-migration/spec.md` (REQ-OBGFM-002).

Surfaced during morning visual smoke when expected empty state showed hello-world data.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions