Repository navigation
fix(github_graphql): extract only new raw rows for PRs, issues, deployments and releases - #9443
Open
shaynhornik wants to merge 1 commit into
Open
shaynhornik wants to merge 1 commit into
shaynhornik wants to merge 1 commit into
Conversation
…yments and releases Extract Pull Requests, Extract Issues, Extract Deployments and Extract Releases used api.NewApiExtractor, which extracts every raw row of the scope again on every run. They now use api.NewStatefulApiExtractor, so an incremental run reads only the raw rows added since the previous one. The label patterns of the scope config are part of the subtask config, so a change extracts everything again. The labels of a pull request, and the labels and assignees of an issue, are replaced when it is extracted again. Closes apache#9442 Generated-by: Claude Code (Claude Fable 5.2) Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
3 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to #9427. Four more extractors of github_graphql were built with
api.NewApiExtractor, which extracts every raw row of the scope again on every run:Extract Pull Requests,Extract Issues,Extract DeploymentsandExtract Releases. Their collectors are already stateful, so the raw tables only grow by what changed, but the extraction time grew with the whole history (#9442).They now use
api.NewStatefulApiExtractor, so an incremental run reads only the raw rows added since the previous run. The field mapping is unchanged.Pull requests and issues follow the REST extractors in
plugins/github/tasks:SubtaskConfig(prType,prComponent; the sixissue*patterns), so a change extracts everything again.Reviews, reviewers and pull request commits are not deleted. They are upserted as before, and the REST plugin does not delete them either.
When every row is still extracted:
Extract Usersis left as it is: its collector is not stateful and rewrites its raw table on every run.Does this close any open issues?
Closes #9442
Tests
New e2e tests in
plugins/github_graphql/e2e/extractor_incremental_test.go, one per extractor. Each builds its raw rows in the test and runs the subtask with its state kept:updated_at(pull requests, issues, deployments) or is not restored after being deleted (releases, whoseupdated_atcolumn holds the release's own date).Against the old extractors all four tests fail. Removing a child-row delete or the
SubtaskConfigfails the matching assertion.Run locally:
go test ./plugins/github_graphql/e2e/...on MySQL 8.4 and PostgreSQL 18.7, and the new tests 6 times on each.go test ./plugins/github_graphql/tasks/...go vetandgolangci-lintv2.15.0 on the plugin.Not run: the full unit and e2e suites, and a real collection against GitHub.
Other Information
runExtractJobsin the existing job test now calls the shared helperrunSubtaskKeepingState.Generated-by: Claude Code (Claude Fable 5.2). I reviewed and tested the change.
🤖 Generated with Claude Code