fix: handle NULL status values in migration 008 #578
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
Production deployment is failing with CrashLoopBackOff. Migration 008 fails with:
Root Cause
The migration extracts the
statusfield from an unexpected location in the data structure.Actual Data Structure (Before Migration)
In the current format,
statusis at the top level of the JSON, not nested in official metadata:{ "name": "com.example/server", "version": "1.0.0", "status": "active", ← STATUS IS HERE (top level) "_meta": { "io.modelcontextprotocol.registry/official": { "serverId": "uuid", "publishedAt": "2025-09-01T00:00:00Z", "isLatest": true // NO STATUS FIELD HERE } } }For 120 out of 765 servers, the status field is missing entirely:
{ "name": "com.biodnd/agent-ip", "version": "0.1.2", // ← NO STATUS FIELD AT ALL "_meta": { "io.modelcontextprotocol.registry/official": { "serverId": "uuid", "publishedAt": "2025-09-23T09:47:07Z", "isLatest": true // STILL NO STATUS FIELD HERE } } }Original Migration Logic
Result:
official_meta->>'status'returns NULL (field doesn't exist there)NOT NULLconstraint → failsFixed Migration Logic
Result:
NULLIF(rec.value->>'status', 'null')handles edge case of literal string "null"COALESCE(..., 'active')provides fallback when status is missingImpact Breakdown
645 servers with
"status": "active":120 servers with missing status field:
Example Servers with Missing Status
(First 9 discovered during investigation)
Testing
Verified against production data (765 total servers):
Impact
This unblocks production deployment. Once merged and released as v1.2.1, the migration will:
🤖 Generated with Claude Code