diff --git a/src/applications/almanac/query/AlmanacBindingTransactionQuery.php b/src/applications/almanac/query/AlmanacBindingTransactionQuery.php
--- a/src/applications/almanac/query/AlmanacBindingTransactionQuery.php
+++ b/src/applications/almanac/query/AlmanacBindingTransactionQuery.php
@@ -7,4 +7,8 @@
     return new AlmanacBindingTransaction();
   }
 
+  public function getQueryApplicationClass() {
+    return PhabricatorAlmanacApplication::class;
+  }
+
 }
diff --git a/src/applications/almanac/query/AlmanacDeviceTransactionQuery.php b/src/applications/almanac/query/AlmanacDeviceTransactionQuery.php
--- a/src/applications/almanac/query/AlmanacDeviceTransactionQuery.php
+++ b/src/applications/almanac/query/AlmanacDeviceTransactionQuery.php
@@ -7,4 +7,8 @@
     return new AlmanacDeviceTransaction();
   }
 
+  public function getQueryApplicationClass() {
+    return PhabricatorAlmanacApplication::class;
+  }
+
 }
diff --git a/src/applications/almanac/query/AlmanacInterfaceTransactionQuery.php b/src/applications/almanac/query/AlmanacInterfaceTransactionQuery.php
--- a/src/applications/almanac/query/AlmanacInterfaceTransactionQuery.php
+++ b/src/applications/almanac/query/AlmanacInterfaceTransactionQuery.php
@@ -7,4 +7,8 @@
     return new AlmanacInterfaceTransaction();
   }
 
+  public function getQueryApplicationClass() {
+    return PhabricatorAlmanacApplication::class;
+  }
+
 }
diff --git a/src/applications/almanac/query/AlmanacNamespaceTransactionQuery.php b/src/applications/almanac/query/AlmanacNamespaceTransactionQuery.php
--- a/src/applications/almanac/query/AlmanacNamespaceTransactionQuery.php
+++ b/src/applications/almanac/query/AlmanacNamespaceTransactionQuery.php
@@ -7,4 +7,8 @@
     return new AlmanacNamespaceTransaction();
   }
 
+  public function getQueryApplicationClass() {
+    return PhabricatorAlmanacApplication::class;
+  }
+
 }
diff --git a/src/applications/almanac/query/AlmanacNetworkTransactionQuery.php b/src/applications/almanac/query/AlmanacNetworkTransactionQuery.php
--- a/src/applications/almanac/query/AlmanacNetworkTransactionQuery.php
+++ b/src/applications/almanac/query/AlmanacNetworkTransactionQuery.php
@@ -7,4 +7,8 @@
     return new AlmanacNetworkTransaction();
   }
 
+  public function getQueryApplicationClass() {
+    return PhabricatorAlmanacApplication::class;
+  }
+
 }
diff --git a/src/applications/almanac/query/AlmanacServiceTransactionQuery.php b/src/applications/almanac/query/AlmanacServiceTransactionQuery.php
--- a/src/applications/almanac/query/AlmanacServiceTransactionQuery.php
+++ b/src/applications/almanac/query/AlmanacServiceTransactionQuery.php
@@ -7,4 +7,8 @@
     return new AlmanacServiceTransaction();
   }
 
+  public function getQueryApplicationClass() {
+    return PhabricatorAlmanacApplication::class;
+  }
+
 }
diff --git a/src/applications/audit/query/PhabricatorAuditTransactionQuery.php b/src/applications/audit/query/PhabricatorAuditTransactionQuery.php
--- a/src/applications/audit/query/PhabricatorAuditTransactionQuery.php
+++ b/src/applications/audit/query/PhabricatorAuditTransactionQuery.php
@@ -7,4 +7,8 @@
     return new PhabricatorAuditTransaction();
   }
 
+  public function getQueryApplicationClass() {
+    return PhabricatorAuditApplication::class;
+  }
+
 }
diff --git a/src/applications/auth/query/PhabricatorAuthContactNumberTransactionQuery.php b/src/applications/auth/query/PhabricatorAuthContactNumberTransactionQuery.php
--- a/src/applications/auth/query/PhabricatorAuthContactNumberTransactionQuery.php
+++ b/src/applications/auth/query/PhabricatorAuthContactNumberTransactionQuery.php
@@ -7,4 +7,8 @@
     return new PhabricatorAuthContactNumberTransaction();
   }
 
+  public function getQueryApplicationClass() {
+    return PhabricatorAuthApplication::class;
+  }
+
 }
diff --git a/src/applications/auth/query/PhabricatorAuthFactorProviderTransactionQuery.php b/src/applications/auth/query/PhabricatorAuthFactorProviderTransactionQuery.php
--- a/src/applications/auth/query/PhabricatorAuthFactorProviderTransactionQuery.php
+++ b/src/applications/auth/query/PhabricatorAuthFactorProviderTransactionQuery.php
@@ -7,4 +7,8 @@
     return new PhabricatorAuthFactorProviderTransaction();
   }
 
+  public function getQueryApplicationClass() {
+    return PhabricatorAuthApplication::class;
+  }
+
 }
diff --git a/src/applications/auth/query/PhabricatorAuthMessageTransactionQuery.php b/src/applications/auth/query/PhabricatorAuthMessageTransactionQuery.php
--- a/src/applications/auth/query/PhabricatorAuthMessageTransactionQuery.php
+++ b/src/applications/auth/query/PhabricatorAuthMessageTransactionQuery.php
@@ -7,4 +7,8 @@
     return new PhabricatorAuthMessageTransaction();
   }
 
+  public function getQueryApplicationClass() {
+    return PhabricatorAuthApplication::class;
+  }
+
 }
diff --git a/src/applications/auth/query/PhabricatorAuthPasswordTransactionQuery.php b/src/applications/auth/query/PhabricatorAuthPasswordTransactionQuery.php
--- a/src/applications/auth/query/PhabricatorAuthPasswordTransactionQuery.php
+++ b/src/applications/auth/query/PhabricatorAuthPasswordTransactionQuery.php
@@ -7,4 +7,8 @@
     return new PhabricatorAuthPasswordTransaction();
   }
 
+  public function getQueryApplicationClass() {
+    return PhabricatorAuthApplication::class;
+  }
+
 }
diff --git a/src/applications/auth/query/PhabricatorAuthProviderConfigTransactionQuery.php b/src/applications/auth/query/PhabricatorAuthProviderConfigTransactionQuery.php
--- a/src/applications/auth/query/PhabricatorAuthProviderConfigTransactionQuery.php
+++ b/src/applications/auth/query/PhabricatorAuthProviderConfigTransactionQuery.php
@@ -7,4 +7,8 @@
     return new PhabricatorAuthProviderConfigTransaction();
   }
 
+  public function getQueryApplicationClass() {
+    return PhabricatorAuthApplication::class;
+  }
+
 }
diff --git a/src/applications/auth/query/PhabricatorAuthSSHKeyTransactionQuery.php b/src/applications/auth/query/PhabricatorAuthSSHKeyTransactionQuery.php
--- a/src/applications/auth/query/PhabricatorAuthSSHKeyTransactionQuery.php
+++ b/src/applications/auth/query/PhabricatorAuthSSHKeyTransactionQuery.php
@@ -7,4 +7,8 @@
     return new PhabricatorAuthSSHKeyTransaction();
   }
 
+  public function getQueryApplicationClass() {
+    return PhabricatorAuthApplication::class;
+  }
+
 }
diff --git a/src/applications/badges/query/PhabricatorBadgesTransactionQuery.php b/src/applications/badges/query/PhabricatorBadgesTransactionQuery.php
--- a/src/applications/badges/query/PhabricatorBadgesTransactionQuery.php
+++ b/src/applications/badges/query/PhabricatorBadgesTransactionQuery.php
@@ -7,4 +7,8 @@
     return new PhabricatorBadgesTransaction();
   }
 
+  public function getQueryApplicationClass() {
+    return PhabricatorBadgesApplication::class;
+  }
+
 }
diff --git a/src/applications/calendar/query/PhabricatorCalendarEventTransactionQuery.php b/src/applications/calendar/query/PhabricatorCalendarEventTransactionQuery.php
--- a/src/applications/calendar/query/PhabricatorCalendarEventTransactionQuery.php
+++ b/src/applications/calendar/query/PhabricatorCalendarEventTransactionQuery.php
@@ -7,4 +7,8 @@
     return new PhabricatorCalendarEventTransaction();
   }
 
+  public function getQueryApplicationClass() {
+    return PhabricatorCalendarApplication::class;
+  }
+
 }
diff --git a/src/applications/calendar/query/PhabricatorCalendarExportTransactionQuery.php b/src/applications/calendar/query/PhabricatorCalendarExportTransactionQuery.php
--- a/src/applications/calendar/query/PhabricatorCalendarExportTransactionQuery.php
+++ b/src/applications/calendar/query/PhabricatorCalendarExportTransactionQuery.php
@@ -7,4 +7,8 @@
     return new PhabricatorCalendarExportTransaction();
   }
 
+  public function getQueryApplicationClass() {
+    return PhabricatorCalendarApplication::class;
+  }
+
 }
diff --git a/src/applications/calendar/query/PhabricatorCalendarImportTransactionQuery.php b/src/applications/calendar/query/PhabricatorCalendarImportTransactionQuery.php
--- a/src/applications/calendar/query/PhabricatorCalendarImportTransactionQuery.php
+++ b/src/applications/calendar/query/PhabricatorCalendarImportTransactionQuery.php
@@ -7,4 +7,8 @@
     return new PhabricatorCalendarImportTransaction();
   }
 
+  public function getQueryApplicationClass() {
+    return PhabricatorCalendarApplication::class;
+  }
+
 }
diff --git a/src/applications/config/query/PhabricatorConfigTransactionQuery.php b/src/applications/config/query/PhabricatorConfigTransactionQuery.php
--- a/src/applications/config/query/PhabricatorConfigTransactionQuery.php
+++ b/src/applications/config/query/PhabricatorConfigTransactionQuery.php
@@ -7,4 +7,8 @@
     return new PhabricatorConfigTransaction();
   }
 
+  public function getQueryApplicationClass() {
+    return PhabricatorConfigApplication::class;
+  }
+
 }
diff --git a/src/applications/conpherence/query/ConpherenceTransactionQuery.php b/src/applications/conpherence/query/ConpherenceTransactionQuery.php
--- a/src/applications/conpherence/query/ConpherenceTransactionQuery.php
+++ b/src/applications/conpherence/query/ConpherenceTransactionQuery.php
@@ -7,4 +7,8 @@
     return new ConpherenceTransaction();
   }
 
+  public function getQueryApplicationClass() {
+    return PhabricatorConpherenceApplication::class;
+  }
+
 }
diff --git a/src/applications/countdown/query/PhabricatorCountdownTransactionQuery.php b/src/applications/countdown/query/PhabricatorCountdownTransactionQuery.php
--- a/src/applications/countdown/query/PhabricatorCountdownTransactionQuery.php
+++ b/src/applications/countdown/query/PhabricatorCountdownTransactionQuery.php
@@ -7,4 +7,8 @@
     return new PhabricatorCountdownTransaction();
   }
 
+  public function getQueryApplicationClass() {
+    return PhabricatorCountdownApplication::class;
+  }
+
 }
diff --git a/src/applications/dashboard/query/PhabricatorDashboardPanelTransactionQuery.php b/src/applications/dashboard/query/PhabricatorDashboardPanelTransactionQuery.php
--- a/src/applications/dashboard/query/PhabricatorDashboardPanelTransactionQuery.php
+++ b/src/applications/dashboard/query/PhabricatorDashboardPanelTransactionQuery.php
@@ -7,4 +7,8 @@
     return new PhabricatorDashboardPanelTransaction();
   }
 
+  public function getQueryApplicationClass() {
+    return PhabricatorDashboardApplication::class;
+  }
+
 }
diff --git a/src/applications/dashboard/query/PhabricatorDashboardPortalTransactionQuery.php b/src/applications/dashboard/query/PhabricatorDashboardPortalTransactionQuery.php
--- a/src/applications/dashboard/query/PhabricatorDashboardPortalTransactionQuery.php
+++ b/src/applications/dashboard/query/PhabricatorDashboardPortalTransactionQuery.php
@@ -7,4 +7,8 @@
     return new PhabricatorDashboardPortalTransaction();
   }
 
+  public function getQueryApplicationClass() {
+    return PhabricatorDashboardApplication::class;
+  }
+
 }
diff --git a/src/applications/dashboard/query/PhabricatorDashboardTransactionQuery.php b/src/applications/dashboard/query/PhabricatorDashboardTransactionQuery.php
--- a/src/applications/dashboard/query/PhabricatorDashboardTransactionQuery.php
+++ b/src/applications/dashboard/query/PhabricatorDashboardTransactionQuery.php
@@ -7,4 +7,8 @@
     return new PhabricatorDashboardTransaction();
   }
 
+  public function getQueryApplicationClass() {
+    return PhabricatorDashboardApplication::class;
+  }
+
 }
diff --git a/src/applications/differential/query/DifferentialDiffTransactionQuery.php b/src/applications/differential/query/DifferentialDiffTransactionQuery.php
--- a/src/applications/differential/query/DifferentialDiffTransactionQuery.php
+++ b/src/applications/differential/query/DifferentialDiffTransactionQuery.php
@@ -7,4 +7,8 @@
     return new DifferentialDiffTransaction();
   }
 
+  public function getQueryApplicationClass() {
+    return PhabricatorDifferentialApplication::class;
+  }
+
 }
diff --git a/src/applications/differential/query/DifferentialTransactionQuery.php b/src/applications/differential/query/DifferentialTransactionQuery.php
--- a/src/applications/differential/query/DifferentialTransactionQuery.php
+++ b/src/applications/differential/query/DifferentialTransactionQuery.php
@@ -7,4 +7,8 @@
     return new DifferentialTransaction();
   }
 
+  public function getQueryApplicationClass() {
+    return PhabricatorDifferentialApplication::class;
+  }
+
 }
diff --git a/src/applications/diviner/query/DivinerLiveBookTransactionQuery.php b/src/applications/diviner/query/DivinerLiveBookTransactionQuery.php
--- a/src/applications/diviner/query/DivinerLiveBookTransactionQuery.php
+++ b/src/applications/diviner/query/DivinerLiveBookTransactionQuery.php
@@ -7,4 +7,8 @@
     return new DivinerLiveBookTransaction();
   }
 
+  public function getQueryApplicationClass() {
+    return PhabricatorDivinerApplication::class;
+  }
+
 }
diff --git a/src/applications/drydock/query/DrydockBlueprintTransactionQuery.php b/src/applications/drydock/query/DrydockBlueprintTransactionQuery.php
--- a/src/applications/drydock/query/DrydockBlueprintTransactionQuery.php
+++ b/src/applications/drydock/query/DrydockBlueprintTransactionQuery.php
@@ -7,4 +7,8 @@
     return new DrydockBlueprintTransaction();
   }
 
+  public function getQueryApplicationClass() {
+    return PhabricatorDrydockApplication::class;
+  }
+
 }
diff --git a/src/applications/files/query/PhabricatorFileTransactionQuery.php b/src/applications/files/query/PhabricatorFileTransactionQuery.php
--- a/src/applications/files/query/PhabricatorFileTransactionQuery.php
+++ b/src/applications/files/query/PhabricatorFileTransactionQuery.php
@@ -7,4 +7,8 @@
     return new PhabricatorFileTransaction();
   }
 
+  public function getQueryApplicationClass() {
+    return PhabricatorFilesApplication::class;
+  }
+
 }
diff --git a/src/applications/fund/query/FundBackerTransactionQuery.php b/src/applications/fund/query/FundBackerTransactionQuery.php
--- a/src/applications/fund/query/FundBackerTransactionQuery.php
+++ b/src/applications/fund/query/FundBackerTransactionQuery.php
@@ -7,4 +7,8 @@
     return new FundBackerTransaction();
   }
 
+  public function getQueryApplicationClass() {
+    return PhabricatorFundApplication::class;
+  }
+
 }
diff --git a/src/applications/fund/query/FundInitiativeTransactionQuery.php b/src/applications/fund/query/FundInitiativeTransactionQuery.php
--- a/src/applications/fund/query/FundInitiativeTransactionQuery.php
+++ b/src/applications/fund/query/FundInitiativeTransactionQuery.php
@@ -7,4 +7,8 @@
     return new FundInitiativeTransaction();
   }
 
+  public function getQueryApplicationClass() {
+    return PhabricatorFundApplication::class;
+  }
+
 }
diff --git a/src/applications/harbormaster/query/HarbormasterBuildPlanTransactionQuery.php b/src/applications/harbormaster/query/HarbormasterBuildPlanTransactionQuery.php
--- a/src/applications/harbormaster/query/HarbormasterBuildPlanTransactionQuery.php
+++ b/src/applications/harbormaster/query/HarbormasterBuildPlanTransactionQuery.php
@@ -7,4 +7,8 @@
     return new HarbormasterBuildPlanTransaction();
   }
 
+  public function getQueryApplicationClass() {
+    return PhabricatorHarbormasterApplication::class;
+  }
+
 }
diff --git a/src/applications/harbormaster/query/HarbormasterBuildStepTransactionQuery.php b/src/applications/harbormaster/query/HarbormasterBuildStepTransactionQuery.php
--- a/src/applications/harbormaster/query/HarbormasterBuildStepTransactionQuery.php
+++ b/src/applications/harbormaster/query/HarbormasterBuildStepTransactionQuery.php
@@ -7,4 +7,8 @@
     return new HarbormasterBuildStepTransaction();
   }
 
+  public function getQueryApplicationClass() {
+    return PhabricatorHarbormasterApplication::class;
+  }
+
 }
diff --git a/src/applications/harbormaster/query/HarbormasterBuildTransactionQuery.php b/src/applications/harbormaster/query/HarbormasterBuildTransactionQuery.php
--- a/src/applications/harbormaster/query/HarbormasterBuildTransactionQuery.php
+++ b/src/applications/harbormaster/query/HarbormasterBuildTransactionQuery.php
@@ -7,4 +7,8 @@
     return new HarbormasterBuildTransaction();
   }
 
+  public function getQueryApplicationClass() {
+    return PhabricatorHarbormasterApplication::class;
+  }
+
 }
diff --git a/src/applications/harbormaster/query/HarbormasterBuildableTransactionQuery.php b/src/applications/harbormaster/query/HarbormasterBuildableTransactionQuery.php
--- a/src/applications/harbormaster/query/HarbormasterBuildableTransactionQuery.php
+++ b/src/applications/harbormaster/query/HarbormasterBuildableTransactionQuery.php
@@ -7,4 +7,8 @@
     return new HarbormasterBuildableTransaction();
   }
 
+  public function getQueryApplicationClass() {
+    return PhabricatorHarbormasterApplication::class;
+  }
+
 }
diff --git a/src/applications/herald/query/HeraldTransactionQuery.php b/src/applications/herald/query/HeraldTransactionQuery.php
--- a/src/applications/herald/query/HeraldTransactionQuery.php
+++ b/src/applications/herald/query/HeraldTransactionQuery.php
@@ -7,4 +7,8 @@
     return new HeraldRuleTransaction();
   }
 
+  public function getQueryApplicationClass() {
+    return PhabricatorHeraldApplication::class;
+  }
+
 }
diff --git a/src/applications/herald/query/HeraldWebhookTransactionQuery.php b/src/applications/herald/query/HeraldWebhookTransactionQuery.php
--- a/src/applications/herald/query/HeraldWebhookTransactionQuery.php
+++ b/src/applications/herald/query/HeraldWebhookTransactionQuery.php
@@ -7,4 +7,8 @@
     return new HeraldWebhookTransaction();
   }
 
+  public function getQueryApplicationClass() {
+    return PhabricatorHeraldApplication::class;
+  }
+
 }
diff --git a/src/applications/legalpad/query/LegalpadTransactionQuery.php b/src/applications/legalpad/query/LegalpadTransactionQuery.php
--- a/src/applications/legalpad/query/LegalpadTransactionQuery.php
+++ b/src/applications/legalpad/query/LegalpadTransactionQuery.php
@@ -7,4 +7,8 @@
     return new LegalpadTransaction();
   }
 
+  public function getQueryApplicationClass() {
+    return PhabricatorLegalpadApplication::class;
+  }
+
 }
diff --git a/src/applications/macro/query/PhabricatorMacroTransactionQuery.php b/src/applications/macro/query/PhabricatorMacroTransactionQuery.php
--- a/src/applications/macro/query/PhabricatorMacroTransactionQuery.php
+++ b/src/applications/macro/query/PhabricatorMacroTransactionQuery.php
@@ -7,4 +7,8 @@
     return new PhabricatorMacroTransaction();
   }
 
+  public function getQueryApplicationClass() {
+    return PhabricatorMacroApplication::class;
+  }
+
 }
diff --git a/src/applications/maniphest/query/ManiphestTransactionQuery.php b/src/applications/maniphest/query/ManiphestTransactionQuery.php
--- a/src/applications/maniphest/query/ManiphestTransactionQuery.php
+++ b/src/applications/maniphest/query/ManiphestTransactionQuery.php
@@ -7,4 +7,8 @@
     return new ManiphestTransaction();
   }
 
+  public function getQueryApplicationClass() {
+    return PhabricatorManiphestApplication::class;
+  }
+
 }
diff --git a/src/applications/meta/query/PhabricatorApplicationApplicationTransactionQuery.php b/src/applications/meta/query/PhabricatorApplicationApplicationTransactionQuery.php
--- a/src/applications/meta/query/PhabricatorApplicationApplicationTransactionQuery.php
+++ b/src/applications/meta/query/PhabricatorApplicationApplicationTransactionQuery.php
@@ -7,4 +7,11 @@
     return new PhabricatorApplicationApplicationTransaction();
   }
 
+  // NOTE: Although this belongs to the "Applications" application, trying
+  // to filter its results just leaves us recursing indefinitely. Users
+  // always have access to applications regardless of other policy settings
+  // anyway.
+  public function getQueryApplicationClass() {
+    return null;
+  }
 }
diff --git a/src/applications/metamta/query/PhabricatorMetaMTAApplicationEmailTransactionQuery.php b/src/applications/metamta/query/PhabricatorMetaMTAApplicationEmailTransactionQuery.php
--- a/src/applications/metamta/query/PhabricatorMetaMTAApplicationEmailTransactionQuery.php
+++ b/src/applications/metamta/query/PhabricatorMetaMTAApplicationEmailTransactionQuery.php
@@ -7,4 +7,8 @@
     return new PhabricatorMetaMTAApplicationEmailTransaction();
   }
 
+  public function getQueryApplicationClass() {
+    return PhabricatorMetaMTAApplication::class;
+  }
+
 }
diff --git a/src/applications/nuance/query/NuanceItemTransactionQuery.php b/src/applications/nuance/query/NuanceItemTransactionQuery.php
--- a/src/applications/nuance/query/NuanceItemTransactionQuery.php
+++ b/src/applications/nuance/query/NuanceItemTransactionQuery.php
@@ -7,4 +7,8 @@
     return new NuanceItemTransaction();
   }
 
+  public function getQueryApplicationClass() {
+    return PhabricatorNuanceApplication::class;
+  }
+
 }
diff --git a/src/applications/nuance/query/NuanceQueueTransactionQuery.php b/src/applications/nuance/query/NuanceQueueTransactionQuery.php
--- a/src/applications/nuance/query/NuanceQueueTransactionQuery.php
+++ b/src/applications/nuance/query/NuanceQueueTransactionQuery.php
@@ -7,4 +7,8 @@
     return new NuanceQueueTransaction();
   }
 
+  public function getQueryApplicationClass() {
+    return PhabricatorNuanceApplication::class;
+  }
+
 }
diff --git a/src/applications/nuance/query/NuanceSourceTransactionQuery.php b/src/applications/nuance/query/NuanceSourceTransactionQuery.php
--- a/src/applications/nuance/query/NuanceSourceTransactionQuery.php
+++ b/src/applications/nuance/query/NuanceSourceTransactionQuery.php
@@ -7,4 +7,8 @@
     return new NuanceSourceTransaction();
   }
 
+  public function getQueryApplicationClass() {
+    return PhabricatorNuanceApplication::class;
+  }
+
 }
diff --git a/src/applications/oauthserver/query/PhabricatorOAuthServerTransactionQuery.php b/src/applications/oauthserver/query/PhabricatorOAuthServerTransactionQuery.php
--- a/src/applications/oauthserver/query/PhabricatorOAuthServerTransactionQuery.php
+++ b/src/applications/oauthserver/query/PhabricatorOAuthServerTransactionQuery.php
@@ -7,4 +7,8 @@
     return new PhabricatorOAuthServerTransaction();
   }
 
+  public function getQueryApplicationClass() {
+    return PhabricatorOAuthServerApplication::class;
+  }
+
 }
diff --git a/src/applications/owners/query/PhabricatorOwnersPackageTransactionQuery.php b/src/applications/owners/query/PhabricatorOwnersPackageTransactionQuery.php
--- a/src/applications/owners/query/PhabricatorOwnersPackageTransactionQuery.php
+++ b/src/applications/owners/query/PhabricatorOwnersPackageTransactionQuery.php
@@ -7,4 +7,8 @@
     return new PhabricatorOwnersPackageTransaction();
   }
 
+  public function getQueryApplicationClass() {
+    return PhabricatorOwnersApplication::class;
+  }
+
 }
diff --git a/src/applications/packages/query/PhabricatorPackagesPackageTransactionQuery.php b/src/applications/packages/query/PhabricatorPackagesPackageTransactionQuery.php
--- a/src/applications/packages/query/PhabricatorPackagesPackageTransactionQuery.php
+++ b/src/applications/packages/query/PhabricatorPackagesPackageTransactionQuery.php
@@ -7,4 +7,8 @@
     return new PhabricatorPackagesPackageTransaction();
   }
 
+  public function getQueryApplicationClass() {
+    return PhabricatorPackagesApplication::class;
+  }
+
 }
diff --git a/src/applications/packages/query/PhabricatorPackagesPublisherTransactionQuery.php b/src/applications/packages/query/PhabricatorPackagesPublisherTransactionQuery.php
--- a/src/applications/packages/query/PhabricatorPackagesPublisherTransactionQuery.php
+++ b/src/applications/packages/query/PhabricatorPackagesPublisherTransactionQuery.php
@@ -7,4 +7,8 @@
     return new PhabricatorPackagesPublisherTransaction();
   }
 
+  public function getQueryApplicationClass() {
+    return PhabricatorPackagesApplication::class;
+  }
+
 }
diff --git a/src/applications/packages/query/PhabricatorPackagesVersionTransactionQuery.php b/src/applications/packages/query/PhabricatorPackagesVersionTransactionQuery.php
--- a/src/applications/packages/query/PhabricatorPackagesVersionTransactionQuery.php
+++ b/src/applications/packages/query/PhabricatorPackagesVersionTransactionQuery.php
@@ -7,4 +7,8 @@
     return new PhabricatorPackagesVersionTransaction();
   }
 
+  public function getQueryApplicationClass() {
+    return PhabricatorPackagesApplication::class;
+  }
+
 }
diff --git a/src/applications/passphrase/query/PassphraseCredentialTransactionQuery.php b/src/applications/passphrase/query/PassphraseCredentialTransactionQuery.php
--- a/src/applications/passphrase/query/PassphraseCredentialTransactionQuery.php
+++ b/src/applications/passphrase/query/PassphraseCredentialTransactionQuery.php
@@ -7,4 +7,8 @@
     return new PassphraseCredentialTransaction();
   }
 
+  public function getQueryApplicationClass() {
+    return PhabricatorPassphraseApplication::class;
+  }
+
 }
diff --git a/src/applications/paste/query/PhabricatorPasteTransactionQuery.php b/src/applications/paste/query/PhabricatorPasteTransactionQuery.php
--- a/src/applications/paste/query/PhabricatorPasteTransactionQuery.php
+++ b/src/applications/paste/query/PhabricatorPasteTransactionQuery.php
@@ -7,4 +7,8 @@
     return new PhabricatorPasteTransaction();
   }
 
+  public function getQueryApplicationClass() {
+    return PhabricatorPasteApplication::class;
+  }
+
 }
diff --git a/src/applications/people/query/PhabricatorPeopleTransactionQuery.php b/src/applications/people/query/PhabricatorPeopleTransactionQuery.php
--- a/src/applications/people/query/PhabricatorPeopleTransactionQuery.php
+++ b/src/applications/people/query/PhabricatorPeopleTransactionQuery.php
@@ -7,4 +7,8 @@
     return new PhabricatorUserTransaction();
   }
 
+  public function getQueryApplicationClass() {
+    return PhabricatorPeopleApplication::class;
+  }
+
 }
diff --git a/src/applications/phame/query/PhameBlogTransactionQuery.php b/src/applications/phame/query/PhameBlogTransactionQuery.php
--- a/src/applications/phame/query/PhameBlogTransactionQuery.php
+++ b/src/applications/phame/query/PhameBlogTransactionQuery.php
@@ -7,4 +7,8 @@
     return new PhameBlogTransaction();
   }
 
+  public function getQueryApplicationClass() {
+    return PhabricatorPhameApplication::class;
+  }
+
 }
diff --git a/src/applications/phame/query/PhamePostTransactionQuery.php b/src/applications/phame/query/PhamePostTransactionQuery.php
--- a/src/applications/phame/query/PhamePostTransactionQuery.php
+++ b/src/applications/phame/query/PhamePostTransactionQuery.php
@@ -7,4 +7,8 @@
     return new PhamePostTransaction();
   }
 
+  public function getQueryApplicationClass() {
+    return PhabricatorPhameApplication::class;
+  }
+
 }
diff --git a/src/applications/phlux/query/PhluxTransactionQuery.php b/src/applications/phlux/query/PhluxTransactionQuery.php
--- a/src/applications/phlux/query/PhluxTransactionQuery.php
+++ b/src/applications/phlux/query/PhluxTransactionQuery.php
@@ -7,4 +7,8 @@
     return new PhluxTransaction();
   }
 
+  public function getQueryApplicationClass() {
+    return PhabricatorPhluxApplication::class;
+  }
+
 }
diff --git a/src/applications/pholio/query/PholioTransactionQuery.php b/src/applications/pholio/query/PholioTransactionQuery.php
--- a/src/applications/pholio/query/PholioTransactionQuery.php
+++ b/src/applications/pholio/query/PholioTransactionQuery.php
@@ -7,4 +7,8 @@
     return new PholioTransaction();
   }
 
+  public function getQueryApplicationClass() {
+    return PhabricatorPholioApplication::class;
+  }
+
 }
diff --git a/src/applications/phortune/query/PhortuneAccountEmailTransactionQuery.php b/src/applications/phortune/query/PhortuneAccountEmailTransactionQuery.php
--- a/src/applications/phortune/query/PhortuneAccountEmailTransactionQuery.php
+++ b/src/applications/phortune/query/PhortuneAccountEmailTransactionQuery.php
@@ -7,4 +7,8 @@
     return new PhortuneAccountEmailTransaction();
   }
 
+  public function getQueryApplicationClass() {
+    return PhabricatorPhortuneApplication::class;
+  }
+
 }
diff --git a/src/applications/phortune/query/PhortuneAccountTransactionQuery.php b/src/applications/phortune/query/PhortuneAccountTransactionQuery.php
--- a/src/applications/phortune/query/PhortuneAccountTransactionQuery.php
+++ b/src/applications/phortune/query/PhortuneAccountTransactionQuery.php
@@ -7,4 +7,8 @@
     return new PhortuneAccountTransaction();
   }
 
+  public function getQueryApplicationClass() {
+    return PhabricatorPhortuneApplication::class;
+  }
+
 }
diff --git a/src/applications/phortune/query/PhortuneCartTransactionQuery.php b/src/applications/phortune/query/PhortuneCartTransactionQuery.php
--- a/src/applications/phortune/query/PhortuneCartTransactionQuery.php
+++ b/src/applications/phortune/query/PhortuneCartTransactionQuery.php
@@ -7,4 +7,8 @@
     return new PhortuneCartTransaction();
   }
 
+  public function getQueryApplicationClass() {
+    return PhabricatorPhortuneApplication::class;
+  }
+
 }
diff --git a/src/applications/phortune/query/PhortuneMerchantTransactionQuery.php b/src/applications/phortune/query/PhortuneMerchantTransactionQuery.php
--- a/src/applications/phortune/query/PhortuneMerchantTransactionQuery.php
+++ b/src/applications/phortune/query/PhortuneMerchantTransactionQuery.php
@@ -7,4 +7,8 @@
     return new PhortuneMerchantTransaction();
   }
 
+  public function getQueryApplicationClass() {
+    return PhabricatorPhortuneApplication::class;
+  }
+
 }
diff --git a/src/applications/phortune/query/PhortunePaymentMethodTransactionQuery.php b/src/applications/phortune/query/PhortunePaymentMethodTransactionQuery.php
--- a/src/applications/phortune/query/PhortunePaymentMethodTransactionQuery.php
+++ b/src/applications/phortune/query/PhortunePaymentMethodTransactionQuery.php
@@ -7,4 +7,8 @@
     return new PhortunePaymentMethodTransaction();
   }
 
+  public function getQueryApplicationClass() {
+    return PhabricatorPhortuneApplication::class;
+  }
+
 }
diff --git a/src/applications/phortune/query/PhortunePaymentProviderConfigTransactionQuery.php b/src/applications/phortune/query/PhortunePaymentProviderConfigTransactionQuery.php
--- a/src/applications/phortune/query/PhortunePaymentProviderConfigTransactionQuery.php
+++ b/src/applications/phortune/query/PhortunePaymentProviderConfigTransactionQuery.php
@@ -7,4 +7,8 @@
     return new PhortunePaymentProviderConfigTransaction();
   }
 
+  public function getQueryApplicationClass() {
+    return PhabricatorPhortuneApplication::class;
+  }
+
 }
diff --git a/src/applications/phortune/query/PhortuneSubscriptionTransactionQuery.php b/src/applications/phortune/query/PhortuneSubscriptionTransactionQuery.php
--- a/src/applications/phortune/query/PhortuneSubscriptionTransactionQuery.php
+++ b/src/applications/phortune/query/PhortuneSubscriptionTransactionQuery.php
@@ -7,4 +7,8 @@
     return new PhortuneSubscriptionTransaction();
   }
 
+  public function getQueryApplicationClass() {
+    return PhabricatorPhortuneApplication::class;
+  }
+
 }
diff --git a/src/applications/phriction/query/PhrictionTransactionQuery.php b/src/applications/phriction/query/PhrictionTransactionQuery.php
--- a/src/applications/phriction/query/PhrictionTransactionQuery.php
+++ b/src/applications/phriction/query/PhrictionTransactionQuery.php
@@ -7,4 +7,8 @@
     return new PhrictionTransaction();
   }
 
+  public function getQueryApplicationClass() {
+    return PhabricatorPhrictionApplication::class;
+  }
+
 }
diff --git a/src/applications/phurl/query/PhabricatorPhurlURLTransactionQuery.php b/src/applications/phurl/query/PhabricatorPhurlURLTransactionQuery.php
--- a/src/applications/phurl/query/PhabricatorPhurlURLTransactionQuery.php
+++ b/src/applications/phurl/query/PhabricatorPhurlURLTransactionQuery.php
@@ -7,4 +7,8 @@
     return new PhabricatorPhurlURLTransaction();
   }
 
+  public function getQueryApplicationClass() {
+    return PhabricatorPhurlApplication::class;
+  }
+
 }
diff --git a/src/applications/ponder/query/PonderAnswerTransactionQuery.php b/src/applications/ponder/query/PonderAnswerTransactionQuery.php
--- a/src/applications/ponder/query/PonderAnswerTransactionQuery.php
+++ b/src/applications/ponder/query/PonderAnswerTransactionQuery.php
@@ -7,4 +7,8 @@
     return new PonderAnswerTransaction();
   }
 
+  public function getQueryApplicationClass() {
+    return PhabricatorPonderApplication::class;
+  }
+
 }
diff --git a/src/applications/ponder/query/PonderQuestionTransactionQuery.php b/src/applications/ponder/query/PonderQuestionTransactionQuery.php
--- a/src/applications/ponder/query/PonderQuestionTransactionQuery.php
+++ b/src/applications/ponder/query/PonderQuestionTransactionQuery.php
@@ -7,4 +7,8 @@
     return new PonderQuestionTransaction();
   }
 
+  public function getQueryApplicationClass() {
+    return PhabricatorPonderApplication::class;
+  }
+
 }
diff --git a/src/applications/project/query/PhabricatorProjectColumnTransactionQuery.php b/src/applications/project/query/PhabricatorProjectColumnTransactionQuery.php
--- a/src/applications/project/query/PhabricatorProjectColumnTransactionQuery.php
+++ b/src/applications/project/query/PhabricatorProjectColumnTransactionQuery.php
@@ -7,4 +7,8 @@
     return new PhabricatorProjectColumnTransaction();
   }
 
+  public function getQueryApplicationClass() {
+    return PhabricatorProjectApplication::class;
+  }
+
 }
diff --git a/src/applications/project/query/PhabricatorProjectTransactionQuery.php b/src/applications/project/query/PhabricatorProjectTransactionQuery.php
--- a/src/applications/project/query/PhabricatorProjectTransactionQuery.php
+++ b/src/applications/project/query/PhabricatorProjectTransactionQuery.php
@@ -7,4 +7,8 @@
     return new PhabricatorProjectTransaction();
   }
 
+  public function getQueryApplicationClass() {
+    return PhabricatorProjectApplication::class;
+  }
+
 }
diff --git a/src/applications/project/query/PhabricatorProjectTriggerTransactionQuery.php b/src/applications/project/query/PhabricatorProjectTriggerTransactionQuery.php
--- a/src/applications/project/query/PhabricatorProjectTriggerTransactionQuery.php
+++ b/src/applications/project/query/PhabricatorProjectTriggerTransactionQuery.php
@@ -7,4 +7,8 @@
     return new PhabricatorProjectTriggerTransaction();
   }
 
+  public function getQueryApplicationClass() {
+    return PhabricatorProjectApplication::class;
+  }
+
 }
diff --git a/src/applications/repository/query/PhabricatorRepositoryIdentityTransactionQuery.php b/src/applications/repository/query/PhabricatorRepositoryIdentityTransactionQuery.php
--- a/src/applications/repository/query/PhabricatorRepositoryIdentityTransactionQuery.php
+++ b/src/applications/repository/query/PhabricatorRepositoryIdentityTransactionQuery.php
@@ -7,4 +7,8 @@
     return new PhabricatorRepositoryIdentityTransaction();
   }
 
+  public function getQueryApplicationClass() {
+    return PhabricatorDiffusionApplication::class;
+  }
+
 }
diff --git a/src/applications/repository/query/PhabricatorRepositoryTransactionQuery.php b/src/applications/repository/query/PhabricatorRepositoryTransactionQuery.php
--- a/src/applications/repository/query/PhabricatorRepositoryTransactionQuery.php
+++ b/src/applications/repository/query/PhabricatorRepositoryTransactionQuery.php
@@ -7,4 +7,8 @@
     return new PhabricatorRepositoryTransaction();
   }
 
+  public function getQueryApplicationClass() {
+    return PhabricatorDiffusionApplication::class;
+  }
+
 }
diff --git a/src/applications/repository/query/PhabricatorRepositoryURITransactionQuery.php b/src/applications/repository/query/PhabricatorRepositoryURITransactionQuery.php
--- a/src/applications/repository/query/PhabricatorRepositoryURITransactionQuery.php
+++ b/src/applications/repository/query/PhabricatorRepositoryURITransactionQuery.php
@@ -7,4 +7,8 @@
     return new PhabricatorRepositoryURITransaction();
   }
 
+  public function getQueryApplicationClass() {
+    return PhabricatorDiffusionApplication::class;
+  }
+
 }
diff --git a/src/applications/search/query/PhabricatorProfileMenuItemConfigurationTransactionQuery.php b/src/applications/search/query/PhabricatorProfileMenuItemConfigurationTransactionQuery.php
--- a/src/applications/search/query/PhabricatorProfileMenuItemConfigurationTransactionQuery.php
+++ b/src/applications/search/query/PhabricatorProfileMenuItemConfigurationTransactionQuery.php
@@ -7,4 +7,8 @@
     return new PhabricatorProfileMenuItemConfigurationTransaction();
   }
 
+  public function getQueryApplicationClass() {
+    return PhabricatorSearchApplication::class;
+  }
+
 }
diff --git a/src/applications/settings/query/PhabricatorUserPreferencesTransactionQuery.php b/src/applications/settings/query/PhabricatorUserPreferencesTransactionQuery.php
--- a/src/applications/settings/query/PhabricatorUserPreferencesTransactionQuery.php
+++ b/src/applications/settings/query/PhabricatorUserPreferencesTransactionQuery.php
@@ -7,4 +7,8 @@
     return new PhabricatorUserPreferencesTransaction();
   }
 
+  public function getQueryApplicationClass() {
+    return PhabricatorSettingsApplication::class;
+  }
+
 }
diff --git a/src/applications/slowvote/query/PhabricatorSlowvoteTransactionQuery.php b/src/applications/slowvote/query/PhabricatorSlowvoteTransactionQuery.php
--- a/src/applications/slowvote/query/PhabricatorSlowvoteTransactionQuery.php
+++ b/src/applications/slowvote/query/PhabricatorSlowvoteTransactionQuery.php
@@ -7,4 +7,8 @@
     return new PhabricatorSlowvoteTransaction();
   }
 
+  public function getQueryApplicationClass() {
+    return PhabricatorSlowvoteApplication::class;
+  }
+
 }
diff --git a/src/applications/spaces/query/PhabricatorSpacesNamespaceTransactionQuery.php b/src/applications/spaces/query/PhabricatorSpacesNamespaceTransactionQuery.php
--- a/src/applications/spaces/query/PhabricatorSpacesNamespaceTransactionQuery.php
+++ b/src/applications/spaces/query/PhabricatorSpacesNamespaceTransactionQuery.php
@@ -7,4 +7,8 @@
     return new PhabricatorSpacesNamespaceTransaction();
   }
 
+  public function getQueryApplicationClass() {
+    return PhabricatorSpacesApplication::class;
+  }
+
 }
diff --git a/src/applications/transactions/query/PhabricatorApplicationTransactionQuery.php b/src/applications/transactions/query/PhabricatorApplicationTransactionQuery.php
--- a/src/applications/transactions/query/PhabricatorApplicationTransactionQuery.php
+++ b/src/applications/transactions/query/PhabricatorApplicationTransactionQuery.php
@@ -292,8 +292,14 @@
     return parent::shouldGroupQueryResultRows();
   }
 
+  /**
+   * Get name of class of application queried by the query.
+   *
+   * To be overwritten by child classes when applicable.
+   *
+   * @return  string|null Application class name
+   */
   public function getQueryApplicationClass() {
-    // TODO: Sort this out?
     return null;
   }
 
diff --git a/src/applications/transactions/query/PhabricatorEditEngineConfigurationTransactionQuery.php b/src/applications/transactions/query/PhabricatorEditEngineConfigurationTransactionQuery.php
--- a/src/applications/transactions/query/PhabricatorEditEngineConfigurationTransactionQuery.php
+++ b/src/applications/transactions/query/PhabricatorEditEngineConfigurationTransactionQuery.php
@@ -7,4 +7,8 @@
     return new PhabricatorEditEngineConfigurationTransaction();
   }
 
+  public function getQueryApplicationClass() {
+    return PhabricatorTransactionsApplication::class;
+  }
+
 }
diff --git a/src/infrastructure/daemon/workers/query/PhabricatorWorkerBulkJobTransactionQuery.php b/src/infrastructure/daemon/workers/query/PhabricatorWorkerBulkJobTransactionQuery.php
--- a/src/infrastructure/daemon/workers/query/PhabricatorWorkerBulkJobTransactionQuery.php
+++ b/src/infrastructure/daemon/workers/query/PhabricatorWorkerBulkJobTransactionQuery.php
@@ -7,4 +7,8 @@
     return new PhabricatorWorkerBulkJobTransaction();
   }
 
+  public function getQueryApplicationClass() {
+    return PhabricatorDaemonsApplication::class;
+  }
+
 }