Repository navigation
feat: add Project delivery synchronization - #10905
Conversation
There was a problem hiding this comment.
Hey - I've found 2 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path=".github/workflows/project-sync.yml" line_range="27-28" />
<code_context>
+
+# Every run reconciles the whole project; serialize snapshots, not just items.
+concurrency:
+ group: project-sync-${{ github.repository }}
+ cancel-in-progress: false
+
+jobs:
</code_context>
<issue_to_address>
**Closed items never reach the Project**
When overlapping event runs replace a pending run whose subject is an untracked item that has closed, the replacement run scans only its own event subject, and scheduled scans also omit untracked closed items, so the replaced item is never imported into the Project.
Ensure reconciliation discovers untracked closed items independently of the event subject, or otherwise guarantees every event subject is processed.
Also at `scripts/sync_github_project.py:442-456`.
</issue_to_address>
### Comment 2
<location path="scripts/sync_github_project.py" line_range="131-133" />
<code_context>
+ elif state == "CLOSED":
+ status = "Cancelled" if content.get("stateReason") == "NOT_PLANNED" else "Done"
+ elif "status:needs-verification" in content.get("labels", []):
+ status = "Needs verification"
+ elif "status:needs-info" in content.get("labels", []):
+ status = "Todo"
+ elif linked and all(pr["state"] == "MERGED" for pr in linked):
+ status = "Needs verification"
+ elif linked:
+ status = "In progress"
+ elif status not in STATUS_OPTIONS or status in {
+ "Done",
</code_context>
<issue_to_address>
**Reopened issues skip Todo**
When a terminal issue is reopened while it still has linked active or merged PRs, `decide` evaluates linked PRs before resetting terminal statuses, so a reopened issue previously marked Done, Cancelled, or Closed unmerged becomes In progress or Needs verification when it still has linked PRs. The Project status does not return to Todo as documented.
Apply the reopened-terminal reset before linked-PR status inference.
</issue_to_address>Sourcery assessment
Needs a human reviewer. 2 findings to address first, and a mistaken reconciliation can write incorrect Status, delivery progress, links, or release details that remain in the GitHub Project after this workflow is reverted. Those changes are bounded and can be corrected by rerunning a fixed sync or editing the fields; the workflow does not modify or delete source issues or pull requests.
Blocking findings: .github/workflows/project-sync.yml:28, scripts/sync_github_project.py:133
|
@sourcery-ai review |
There was a problem hiding this comment.
Hey - I've found 2 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path=".github/workflows/project-sync.yml" line_range="38" />
<code_context>
+ timeout-minutes: 30
+ steps:
+ - name: Validate manual branch
+ if: github.event_name == 'workflow_dispatch' && github.ref != format('refs/heads/{0}', github.event.repository.default_branch)
+ run: |
+ echo 'Manual sync must run from the default branch.'
</code_context>
<issue_to_address>
**Non-default dispatch can expose token**
When a repository writer dispatches the workflow from a branch containing a modified workflow file, the branch check is part of the workflow definition selected for `workflow_dispatch`, so a writer can dispatch a modified non-default-branch copy that removes the check and runs attacker-controlled steps with `ASTRBOT_PROJECT_TOKEN`; the Project credential is exposed.
Restrict the credential to a protected environment that only permits the default branch, and require that environment before any job can access the token.
</issue_to_address>
### Comment 2
<location path=".github/workflows/project-sync.yml" line_range="44" />
<code_context>
+ runs-on: ubuntu-latest
+ timeout-minutes: 5
+ steps:
+ - uses: actions/checkout@v7
+ with:
+ persist-credentials: false
</code_context>
<issue_to_address>
**Mutable actions can expose sync token**
When an upstream action tag is moved to or compromised with malicious code, the action references resolve mutable upstream tags before the token-bearing step. Compromised action code can replace the checked-out sync script, which then runs with `ASTRBOT_PROJECT_TOKEN` and can exfiltrate it.
Pin both actions to verified full commit SHAs and update them through reviewed SHA changes.
Also at `.github/workflows/project-sync.yml:54`.
</issue_to_address>Sourcery assessment
Needs a human reviewer. 2 findings to address first, and if the reconciliation logic is wrong, it can write incorrect status, implementation links, or release details to Project items. Those values persist after a revert, but a later sync can recalculate and repair them.
Blocking findings: .github/workflows/project-sync.yml:38, .github/workflows/project-sync.yml:44
|
@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="scripts/sync_github_project.py" line_range="49-50" />
<code_context>
+ for key in path:
+ data = (data or {}).get(key)
+ if not isinstance(data, dict):
+ raise RuntimeError("GitHub connection is inaccessible")
+ nodes.extend(node for node in data["nodes"] if node)
+ page = data["pageInfo"]
+ if not page["hasNextPage"]:
</code_context>
<issue_to_address>
**Error handling sits outside main**
When the new synchronization encounters inaccessible or stalled pages, ancestry errors, or GraphQL failures, when GitHub pages are inaccessible or stalled, ancestry checks fail, or GraphQL requests return errors, `connection`, `ancestor`, and `graphql` handle those cases outside `main`, contrary to the repository guidance.
Handle these edge cases and errors directly in the main function block instead of in helper functions.
Also at `scripts/sync_github_project.py:55-56`, `scripts/sync_github_project.py:159-160`, `scripts/sync_github_project.py:167-169`, `scripts/sync_github_project.py:309-312`, `scripts/sync_github_project.py:314-320`.
</issue_to_address>Sourcery assessment
Needs a human reviewer. If the reconciliation logic misclassifies an issue or release, it writes incorrect status and delivery values into the Project; reverting stops future writes but does not restore those values, though they can be corrected by a later sync or manual repair. The workflow also introduces a Project-write credential, so its default-branch and environment protections are part of the security boundary.
|
@sourcery-ai review |
|
@cubic-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. A defect in the reconciliation logic could write incorrect statuses, implementation links, or release details to Project items; those values outlive a revert, but a corrected full sync can recompute and repair them. The workflow also handles a Project-write token, so its trusted-branch and environment protections need to be configured as documented.
|
@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. A bad reconciliation can add Project items or store incorrect status, implementation links, or release details. Those changes persist in the Project, but a corrected run can recompute them; the workflow does not modify or delete the source Issues or PRs.
Summary
Verification
Live Project/API behavior still requires maintainer configuration and preview.
Summary by Sourcery
Add secure GitHub Project synchronization for issue and pull request lifecycle and delivery tracking.
New Features:
Enhancements:
CI:
Documentation:
Tests: