Skip to content

fix: keep pre-2.3.0 installs readable after the dev keys removal - #13800

Merged
HarshMN2345 merged 4 commits into
mainfrom
fix/devkeys-removal-upgrade
Sep 21, 2026
Merged

HarshMN2345 merged 4 commits into
mainfrom
fix/devkeys-removal-upgrade

Conversation

@HarshMN2345

Copy link
Copy Markdown
Member

What

Removing dev keys dropped the subQueryDevKeys filter, but existing installs still carry it in the stored projects collection metadata until the V25 migration runs. An unregistered filter makes decodeAttribute() 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 runs migrate.

Migration is not mandatory on upgrade (Install.php gates it on $isUpgrade && $migrate, which defaults to false and otherwise logs "Migration skipped"), so this is reachable through a normal upgrade.

Reproduced against a pre-migration console database:

BEFORE  Utopia\Database\Exception\NotFound:
        Filter "subQueryDevKeys" not found for attribute "devKeys"

AFTER   OK, read project '6a9fdac07a1aa7d2728b'
        devKeys => []

Changes

  • app/init/database/filters.php — register subQueryDevKeys as 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 a devKeys rule.
  • src/Appwrite/Migration/Migration.php — add '2.3.0' => 'V25'. The map stopped at 2.2.0, so an explicit migrate 2.3.0 failed with "No migration found for version".
  • src/Appwrite/Migration/Version/V22.php — drop the devKeys collection and projects.devKeys attribute creation. Both read from app/config/collections, which no longer defines them, so createCollection() could only hit an undefined index and throw. V25 deletes both anyway.

Notes

  • Whether to make migration mandatory on upgrade is a separate 2.3.0 release decision and is not changed here.
  • V25's own cleanup (deleteAttribute + deleteCollection) has not been exercised end-to-end on a populated install. Worth a 2.2.0 → main upgrade run before release.

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.
@greptile-apps

greptile-apps Bot commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

The PR appears safe to merge, with only the existing non-blocking concern that its upgrade compatibility behavior lacks observable regression coverage.

Fix All in Claude CodeFindings

  1. P2 Upgrade behavior lacks coverage ▶
Fix with agent prompt
### Issue 1
app/init/database/filters.php:159-166
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.

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!

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Summary

This PR preserves project readability for installations upgraded from before 2.3.0 that have not yet run V25.

  • Registers the removed subQueryDevKeys filter as a compatibility no-op.
  • Maps version 2.3.0 to V25 so explicit migration selection works.
  • Prevents V22 from recreating removed dev-key storage from configuration that no longer defines it.

Reviews (2) · Last reviewed commit: "Merge branch 'main' into fix/devkeys-rem..."

Comment on lines +159 to +166
Database::addFilter(
'subQueryDevKeys',
function (mixed $value) {
return;
},
function (mixed $value) {
return [];
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 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!

Fix in Claude Code Fix in Codex

@github-actions

github-actions Bot commented Sep 21, 2026 •

Copy link
Copy Markdown

✨ Benchmark results

Comparing main (before) → fix/devkeys-removal-upgrade (after).

Metric Before After Change
🚀 Requests/sec 201.24 192.08 ⚪ -4.6%
⏱️ Latency P50 86.64 ms 90.08 ms ⚪ +4%
⏱️ Latency P95 203.96 ms 209.71 ms ⚪ +2.8%
Per-scenario breakdown & investigation details

Metrics below reflect the current branch (after). Δ P95 compares against the base.

Scenario P50 (ms) P95 (ms) Requests RPS Δ P95 (ms)
API total 90.08 209.71 12,141 192.08 +5.75
Account 167.49 331.4 639 10.59 +25.01
TablesDB 88.28 168.66 6,603 107.38 +7.78
Storage 80.68 175.79 3,195 53.61 +5.53
Functions 122.3 256.33 1,704 29.3 +15.25

Top API waits (after)

API request Max wait (ms)
account.name.update 533.12
functions.variables.update 423.95
tablesdb.rows.create 422.27
tablesdb.rows.decrement 400.15
storage.files.create 385.48

@HarshMN2345
HarshMN2345 merged commit 5d2eda1 into main Sep 21, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants