You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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."
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.
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 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
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.