Repository navigation
perf: speed up full Project reconciliation - #10935
Conversation
There was a problem hiding this comment.
Hey - I've reviewed your changes and they look great!
Sourcery assessment
Needs a human reviewer. If the containment query classifies a commit against the wrong release tag, reconciliation could write an incorrect delivery value to a Project item. That value is persisted, but it can be corrected by rerunning reconciliation or reverting the change.
|
@sourcery-ai review |
|
Follow-up fix in 80e7a2f: |
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="tests/test_project_events.py" line_range="265" />
<code_context>
+ result["projectItems"][0]["fieldValues"], [first_value, second_value]
+ )
+ self.assertEqual(graphql.call_count, 2)
+ self.assertEqual(graphql.call_args_list[1].args[1]["cursor"], "CURSOR")
+
def test_apply_failure_reports_confirmed_unknown_and_unattempted(self):
</code_context>
<issue_to_address>
**Wrong item IDs go undetected**
When the pagination request uses an ID other than the Project item’s ID, when `read_subject` requests the next field-values page using the wrong item ID, `test_subject_paginates_nested_project_field_values` still passes: its mocked GraphQL response ignores the request, and line 265 checks only the cursor.
Assert that the second GraphQL call passes `id="ITEM"` (and, if needed, that its query requests `ProjectV2Item.fieldValues`).
</issue_to_address>Sourcery assessment
Needs a human reviewer. 1 finding to address first, and if the tag-containment calculation is wrong, reconciliation could write an incorrect release or delivery status into Project fields; those values persist after a revert but can be corrected by fixing the code and rerunning reconciliation. The added pagination can also change which field values bounded sync sees, but its effects are likewise repairable Project data.
Blocking findings: tests/test_project_events.py:265
|
@sourcery-ai review |
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="tests/test_project_delivery.py" line_range="243" />
<code_context>
+ with (
+ patch.object(sync, "ancestor", return_value=True),
+ patch.object(sync, "tag_names", return_value={"v1"}),
+ patch.object(sync, "tags_containing", side_effect=[{"v1"}, set()]),
):
desired = sync.delivery(issue, {}, prs, releases, "c" * 40)
</code_context>
<issue_to_address>
**Commit mock is order-sensitive**
When set iteration visits the `b` commit first and delivery is broken to check only the first commit, `test_multiple_implementations_need_all_commits_in_release` assigns `tags_containing` results by call order, but `delivery` iterates an `integrated` set; if the `b` commit is visited first, a broken implementation that checks only that commit gets an empty set and passes the no-release assertions at `tests/test_project_delivery.py:246-247`.
Return containment results based on the commit argument and assert both commit OIDs were checked.
</issue_to_address>Sourcery assessment
Needs a human reviewer. 1 finding to address first, and if the new tag-containment calculation misclassifies a release, reconciliation could write an incorrect release or delivery status to a Project item. Those values are bounded and can be corrected by rerunning reconciliation; reverting alone would not undo an already-written value.
Blocking findings: tests/test_project_delivery.py:243
|
@sourcery-ai review |
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="tests/test_project_events.py" line_range="268" />
<code_context>
+ self.assertEqual(graphql.call_args_list[1].args[1]["cursor"], "CURSOR")
+ self.assertEqual(graphql.call_args_list[1].args[1]["id"], "ITEM")
+ self.assertIn("ProjectV2Item", graphql.call_args_list[1].args[0])
+ self.assertIn("fieldValues", graphql.call_args_list[1].args[0])
+
def test_apply_failure_reports_confirmed_unknown_and_unattempted(self):
</code_context>
<issue_to_address>
**Cursor use goes unchecked**
When the nested query omits the cursor from its `fieldValues` connection, a nested field-values query that selects `fieldValues` but does not use `after:$cursor` still satisfies `test_subject_paginates_nested_project_field_values`: line 268 checks only a substring, while the mocked second response supplies the next page regardless of the query, so broken pagination passes the test.
Assert that the query binds `$cursor` to the nested `fieldValues` connection's `after` argument.
</issue_to_address>Sourcery assessment
Needs a human reviewer. 1 finding to address first, and if the new tag-containment check or paginated field reads produce the wrong delivery result, reconciliation could write an incorrect release or status value to a Project item. Reverting stops future writes, but the value already written remains until a later reconciliation corrects it.
Blocking findings: tests/test_project_events.py:268
|
@sourcery-ai review |
There was a problem hiding this comment.
Hey - I've reviewed your changes and they look great!
Sourcery assessment
Needs a human reviewer. If the tag-containment check picks the wrong release, reconciliation could write an incorrect delivery status or release value to a Project item. Reverting the code would not undo that stored value, but a corrected reconciliation can repair it.
|
Added diagnostic tracing in fe19b7d. Full scans already log phase/page and candidate progress; release ancestry now logs start/complete, commit prefix, tag count, and elapsed seconds to stderr. Added regression coverage for the diagnostic output. No sync semantics changed. Local suites: 15 entry, 27 delivery, 8 event tests; Ruff and Actionlint pass. |
Summary
git merge-basesubprocess loops with cachedgit tag --containsancestry sets, retaining earliest published stable-release selection and failing closed if an expected release tag was not fetched.Verification
This follows the Project sync implementation merged in #10905. No live Project write performed.
Summary by Sourcery
Speed up full Project reconciliation with cached Git ancestry checks, safer release verification, and improved scan progress visibility.
Bug Fixes:
Enhancements:
Documentation:
Tests: