From 94c968e9414a9b37b9a6a11c36dfeb12a140f6ed Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Wed, 6 May 2026 04:35:29 +0000 Subject: [PATCH 1/3] feat(indexes): add 4 missing indexes (CLO-2333) - memberships: _key_team_confirm on (teamInternalId, confirm) for team-membership confirm-state queries - projects: _key_teamInternalId on teamInternalId for team-scoped project lookups - platforms: _key_project_id on projectId for user-facing-id lookups - webhooks: _key_project_id on projectId for user-facing-id lookups Re-applies the indexes from the stale PR #9629 (1.7.x base, conflicting) onto a fresh 1.9.x branch. None of these are in 1.9.x today; existing similar indexes target projectInternalId / teamId rather than the user-facing projectId / teamInternalId queries this addresses. --- app/config/collections/common.php | 7 +++++++ app/config/collections/platform.php | 23 ++++++++++++++++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/app/config/collections/common.php b/app/config/collections/common.php index 80bb717423..37fbcc8ca3 100644 --- a/app/config/collections/common.php +++ b/app/config/collections/common.php @@ -1523,6 +1523,13 @@ return [ 'lengths' => [], 'orders' => [Database::ORDER_ASC], ], + [ + '$id' => ID::custom('_key_team_confirm'), + 'type' => Database::INDEX_KEY, + 'attributes' => ['teamInternalId', 'confirm'], + 'lengths' => [], + 'orders' => [], + ], ], ], diff --git a/app/config/collections/platform.php b/app/config/collections/platform.php index 6195c11724..bb3413da5c 100644 --- a/app/config/collections/platform.php +++ b/app/config/collections/platform.php @@ -404,6 +404,13 @@ $platformCollections = [ 'lengths' => [], 'orders' => [], ], + [ + '$id' => ID::custom('_key_teamInternalId'), + 'type' => Database::INDEX_KEY, + 'attributes' => ['teamInternalId'], + 'lengths' => [], + 'orders' => [], + ], ], ], @@ -635,6 +642,13 @@ $platformCollections = [ 'lengths' => [Database::LENGTH_KEY], 'orders' => [Database::ORDER_ASC], ], + [ + '$id' => ID::custom('_key_project_id'), + 'type' => Database::INDEX_KEY, + 'attributes' => ['projectId'], + 'lengths' => [], + 'orders' => [], + ], ], ], @@ -1007,7 +1021,14 @@ $platformCollections = [ 'attributes' => ['projectInternalId'], 'lengths' => [Database::LENGTH_KEY], 'orders' => [Database::ORDER_ASC], - ] + ], + [ + '$id' => ID::custom('_key_project_id'), + 'type' => Database::INDEX_KEY, + 'attributes' => ['projectId'], + 'lengths' => [], + 'orders' => [], + ], ], ], From 83d56a2f368854c88a5644d09608a84ddcae3c7a Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Wed, 6 May 2026 04:44:58 +0000 Subject: [PATCH 2/3] fix(indexes): set explicit lengths + orders on new indexes (greptile P1) All four new indexes left lengths/orders as empty arrays; greptile flagged the inconsistency vs every existing string-attribute index in the file (e.g. _key_team uses [LENGTH_KEY], _key_unique uses [LENGTH_KEY, LENGTH_KEY]). - memberships._key_team_confirm: [LENGTH_KEY, 0] for (string, boolean) + [ORDER_ASC, ORDER_ASC] - projects._key_teamInternalId: [LENGTH_KEY] + [ORDER_ASC] - platforms._key_project_id: [LENGTH_KEY] + [ORDER_ASC] - webhooks._key_project_id: [LENGTH_KEY] + [ORDER_ASC] --- app/config/collections/common.php | 4 ++-- app/config/collections/platform.php | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/config/collections/common.php b/app/config/collections/common.php index 37fbcc8ca3..8b5d623185 100644 --- a/app/config/collections/common.php +++ b/app/config/collections/common.php @@ -1527,8 +1527,8 @@ return [ '$id' => ID::custom('_key_team_confirm'), 'type' => Database::INDEX_KEY, 'attributes' => ['teamInternalId', 'confirm'], - 'lengths' => [], - 'orders' => [], + 'lengths' => [Database::LENGTH_KEY, 0], + 'orders' => [Database::ORDER_ASC, Database::ORDER_ASC], ], ], ], diff --git a/app/config/collections/platform.php b/app/config/collections/platform.php index bb3413da5c..748211f222 100644 --- a/app/config/collections/platform.php +++ b/app/config/collections/platform.php @@ -408,8 +408,8 @@ $platformCollections = [ '$id' => ID::custom('_key_teamInternalId'), 'type' => Database::INDEX_KEY, 'attributes' => ['teamInternalId'], - 'lengths' => [], - 'orders' => [], + 'lengths' => [Database::LENGTH_KEY], + 'orders' => [Database::ORDER_ASC], ], ], ], @@ -646,8 +646,8 @@ $platformCollections = [ '$id' => ID::custom('_key_project_id'), 'type' => Database::INDEX_KEY, 'attributes' => ['projectId'], - 'lengths' => [], - 'orders' => [], + 'lengths' => [Database::LENGTH_KEY], + 'orders' => [Database::ORDER_ASC], ], ], ], @@ -1026,8 +1026,8 @@ $platformCollections = [ '$id' => ID::custom('_key_project_id'), 'type' => Database::INDEX_KEY, 'attributes' => ['projectId'], - 'lengths' => [], - 'orders' => [], + 'lengths' => [Database::LENGTH_KEY], + 'orders' => [Database::ORDER_ASC], ], ], ], From c9ad685e11352a96d3b868ff2219e7bf07223cad Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Wed, 6 May 2026 04:48:53 +0000 Subject: [PATCH 3/3] fix(indexes): use empty lengths for mixed-type composite to match existing pattern greptile flagged missing lengths but the codebase has two conventions: - all-string composite: [LENGTH_KEY, LENGTH_KEY] (_key_unique, _key_provider_providerUid) - mixed/non-string composite: [] (e.g. ('enabled', 'type'), ('region', 'accessedAt'), ('targetInternalId', 'topicInternalId'), ('period', 'time'), ('metric', 'period', 'time')) (teamInternalId, confirm) is string+boolean; closest match is ('enabled', 'type') which uses lengths => [] and orders => []. Aligning to that established pattern instead of inventing [LENGTH_KEY, 0]. --- app/config/collections/common.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/config/collections/common.php b/app/config/collections/common.php index 8b5d623185..37fbcc8ca3 100644 --- a/app/config/collections/common.php +++ b/app/config/collections/common.php @@ -1527,8 +1527,8 @@ return [ '$id' => ID::custom('_key_team_confirm'), 'type' => Database::INDEX_KEY, 'attributes' => ['teamInternalId', 'confirm'], - 'lengths' => [Database::LENGTH_KEY, 0], - 'orders' => [Database::ORDER_ASC, Database::ORDER_ASC], + 'lengths' => [], + 'orders' => [], ], ], ],