Repository navigation
fix: keep pre-2.3.0 installs readable after the dev keys removal - #13800
Conversation
Removing dev keys dropped the filter, but installs that have not yet run the V25 migration still carry it on the projects collection metadata. An unregistered filter makes every project document fail to decode, so the whole API returns errors until the migration is run. Register the filter as a no-op so those installs keep serving until V25 deletes the attribute. The value is dropped from responses anyway, since the project model no longer has a devKeys rule.
The version map stopped at 2.2.0, so an explicit `migrate 2.3.0` failed with "No migration found for version" even though V25 is the migration that release needs.
V22 created the devKeys collection from app/config/collections, which no longer defines it, so createCollection() hit an undefined index and threw instead of migrating. The projects.devKeys attribute it created is gone from the config too, and V25 deletes both, so neither is worth creating.
|
| Database::addFilter( | ||
| 'subQueryDevKeys', | ||
| function (mixed $value) { | ||
| return; | ||
| }, | ||
| function (mixed $value) { | ||
| return []; | ||
| } |
There was a problem hiding this comment.
Upgrade behavior lacks coverage
This compatibility fix is not covered by an observable regression test. Add coverage that loads a project with legacy subQueryDevKeys metadata and confirms that it remains readable, as well as coverage that migrating version 2.3.0 selects and runs V25. Do not merely assert the filter registration or version-map entries, because that would mirror the implementation without proving that an actual upgrade works.
Prompt To Fix With AI
This is a comment left during a code review.
Path: app/init/database/filters.php
Line: 159-166
Comment:
**Upgrade behavior lacks coverage**
This compatibility fix is not covered by an observable regression test. Add coverage that loads a project with legacy `subQueryDevKeys` metadata and confirms that it remains readable, as well as coverage that migrating version 2.3.0 selects and runs V25. Do not merely assert the filter registration or version-map entries, because that would mirror the implementation without proving that an actual upgrade works.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
✨ Benchmark resultsComparing
Per-scenario breakdown & investigation detailsMetrics below reflect the current branch (after). Δ P95 compares against the base.
Top API waits (after)
|
What
Removing dev keys dropped the
subQueryDevKeysfilter, but existing installs still carry it in the storedprojectscollection metadata until the V25 migration runs. An unregistered filter makesdecodeAttribute()throw, so every project document fails to decode — and since the project is loaded in the HTTP init hook, the entire API goes down until someone runsmigrate.Migration is not mandatory on upgrade (
Install.phpgates it on$isUpgrade && $migrate, which defaults tofalseand otherwise logs "Migration skipped"), so this is reachable through a normal upgrade.Reproduced against a pre-migration console database:
Changes
app/init/database/filters.php— registersubQueryDevKeysas a no-op so pre-V25 installs keep serving until the migration deletes the attribute. The value cannot leak into responses:Response::output()builds from$model->getRules()and the project model no longer has adevKeysrule.src/Appwrite/Migration/Migration.php— add'2.3.0' => 'V25'. The map stopped at2.2.0, so an explicitmigrate 2.3.0failed with "No migration found for version".src/Appwrite/Migration/Version/V22.php— drop thedevKeyscollection andprojects.devKeysattribute creation. Both read fromapp/config/collections, which no longer defines them, socreateCollection()could only hit an undefined index and throw. V25 deletes both anyway.Notes
deleteAttribute+deleteCollection) has not been exercised end-to-end on a populated install. Worth a 2.2.0 → main upgrade run before release.