Skip to content

Conversation

@mhgbrown
Copy link
Collaborator

@mhgbrown mhgbrown commented Nov 7, 2025

This PR fixes an issue where ecosystem and project support data was not being correctly aggregated when projects receive funds to their sub-accounts instead of their main accounts. The changes update the ecosystem resolver to detect and transform repo sub-account IDs to parent project IDs for proper lookups, update the project resolvers to query support data (splits and one-time donations) for both main and sub-accounts, add a new batch query method in SupportDataSource for efficiently querying multiple accounts, improve error handling in ProjectsDataSource to filter out errors and null values, and refactor duplicated support query logic into reusable helper functions in a new projectSupportHelpers module to improve code maintainability.

@railway-app
Copy link

railway-app bot commented Nov 7, 2025

🚅 Deployed to the graphql-api-pr-95 environment in Drips App

Service Status Web Updated (UTC)
GraphQL API ◻️ Removed (View Logs) Web Nov 13, 2025 at 11:36 am

@mhgbrown mhgbrown changed the title Mhgbrown/fix ecosystem cache invalidation Fix ecosystem cache invalidation Nov 7, 2025
@railway-app railway-app bot temporarily deployed to GraphQL API (Drips App / graphql-api-pr-95) November 7, 2025 13:34 Destroyed
@railway-app railway-app bot temporarily deployed to GraphQL API (Drips App / graphql-api-pr-95) November 11, 2025 09:50 Destroyed
@railway-app railway-app bot temporarily deployed to GraphQL API (Drips App / graphql-api-pr-95) November 11, 2025 09:53 Destroyed
@mhgbrown mhgbrown marked this pull request as ready for review November 11, 2025 09:55
@efstajas efstajas requested a review from Copilot November 11, 2025 12:42
@efstajas
Copy link
Contributor

why did package-lock change?

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes an issue where ecosystem and project support data was not being correctly aggregated when projects receive funds to their sub-accounts instead of their main accounts. The fix ensures that support queries check both main project accounts and their associated sub-accounts, and that ecosystem resolvers properly transform sub-account IDs to parent project IDs for data lookups.

Key Changes

  • Created reusable helper functions in a new projectSupportHelpers.ts module to centralize support query logic for both main and sub-accounts
  • Updated ecosystem resolver to detect and transform repo sub-account IDs to parent project IDs with deduplication
  • Added batch query method in SupportDataSource for efficiently querying multiple accounts

Reviewed Changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/project/projectSupportHelpers.ts New module with helper functions to query support data for projects including both main and sub-accounts
src/project/projectResolvers.ts Updated to accept sub-account IDs in projectById query and refactored support resolvers to use new helper functions
src/ecosystem/ecosystemResolvers.ts Enhanced to transform sub-account IDs to parent project IDs with deduplication for proper project data lookups
src/dataLoaders/SupportDataSource.ts Added batch query method for one-time donation support across multiple accounts
src/dataLoaders/ProjectsDataSource.ts Improved error handling to filter out errors and null values from DataLoader results
Comments suppressed due to low confidence (1)

src/project/projectResolvers.ts:107

  • When a sub-account ID is passed to projectById, it needs to be transformed to the parent project ID before querying the database. Projects are stored using their parent RepoDriverId, not sub-account IDs. The code currently accepts sub-account IDs (line 92) but passes them directly to getProjectById (line 104-106) without transformation, which will result in no project being found. Consider transforming sub-account IDs to parent IDs using calcParentRepoDriverId before the database query.
      // Accept both repo driver IDs and repo sub-account driver IDs
      if (!isRepoDriverId(id) && !isRepoSubAccountDriverId(id)) {
        return null;
      }

      if (chains?.length) {
        validateChainsQueryArg(chains);
      }

      const dbSchemasToQuery = (chains?.length ? chains : queryableChains).map(
        (chain) => chainToDbSchema[chain],
      );

      const dbProjects = await projectsDataSource.getProjectById(
        id,
        dbSchemasToQuery,
      );

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@railway-app railway-app bot temporarily deployed to GraphQL API (Drips App / graphql-api-pr-95) November 12, 2025 10:52 Destroyed
@railway-app railway-app bot temporarily deployed to GraphQL API (Drips App / graphql-api-pr-95) November 12, 2025 10:54 Destroyed
@mhgbrown
Copy link
Collaborator Author

why did package-lock change?

It was out of sync with the package.json or out of sync with the npm version that came with the docker specified node version I installed. I'll double check

@railway-app railway-app bot temporarily deployed to GraphQL API (Drips App / graphql-api-pr-95) November 12, 2025 10:59 Destroyed
@mhgbrown
Copy link
Collaborator Author

why did package-lock change?

It was out of sync with the package.json or out of sync with the npm version that came with the docker specified node version I installed. I'll double check

Not sure what I did there. Restored it.

const projectIds =
// Get parent project IDs - transform sub-account IDs to parent IDs
// Detect ID type instead of relying solely on splitsToRepoDriverSubAccount flag
const { calcParentRepoDriverId } = await import(
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we can import "normally"

@jtourkos jtourkos merged commit 7f376d0 into main Nov 13, 2025
3 checks passed
@railway-app railway-app bot temporarily deployed to Drips Multichain API (Drips App / mainnet) November 13, 2025 11:36 Inactive
@railway-app railway-app bot requested a deployment to GraphQL API (Drips App / wave-pr-24) November 13, 2025 11:36 Abandoned
@railway-app railway-app bot requested a deployment to GraphQL API (Drips App / wave-pr-25) November 13, 2025 11:36 Abandoned
@railway-app railway-app bot temporarily deployed to GraphQL API (Drips App / localtestnet) November 13, 2025 11:36 Inactive
@railway-app railway-app bot requested a deployment to GraphQL API (Drips App / app-pr-1707) November 13, 2025 11:36 Abandoned
@jtourkos jtourkos deleted the mhgbrown/fix-ecosystem-cache-invalidation branch November 13, 2025 11:36
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.

4 participants