-
Notifications
You must be signed in to change notification settings - Fork 0
Fix ecosystem cache invalidation #95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…e returned with splits
|
🚅 Deployed to the graphql-api-pr-95 environment in Drips App
|
|
why did package-lock change? |
There was a problem hiding this 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.tsmodule 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 togetProjectById(line 104-106) without transformation, which will result in no project being found. Consider transforming sub-account IDs to parent IDs usingcalcParentRepoDriverIdbefore 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.
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. |
src/ecosystem/ecosystemResolvers.ts
Outdated
| 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( |
There was a problem hiding this comment.
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"
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.