Repository navigation
feat(gitea): add per-project issue synchronization modes - #1899
gabrielrinaldi wants to merge 4 commits into
Conversation
PR Summary by QodoAdd per-project Gitea issue synchronization modes
AI Description
Diagram
High-Level Assessment
Files changed (99)
|
Code Review by Qodo
1.
|
|
Addressed the five Qodo findings in 8d7e885:
The request-coordination change also preserves best-effort label behavior: a provider label failure does not prevent the independent close/reopen or backlink operation, while a refused write still stops subsequent mutations. Added regression coverage and updated the setup guide and generated OpenAPI reference. Verification:
No production configuration changes or deployment. Disposable verification services and scripts were removed. |
8d7e885 to
c8bf547
Compare
b251dc6 to
ccf0f50
Compare
ccf0f50 to
e32c166
Compare
|
Hello there! Your pull request was automatically converted to a draft. Since October 5, 2026, contributors who have not been vouched for must link their pull requests to an open issue in this repository labeled Please open a bug report or feature request first, then wait for a maintainer to approve the scope and add the label. If an approved issue already exists, link it in your pull request description with Read more: https://github.com/usekaneo/kaneo?tab=contributing-ov-file#contribution-eligibility |
Code Review by Qodo
1.
|
| await publishEvent("integration.sync_rules_changed", { | ||
| projectId, | ||
| integrationId: integration.id, | ||
| existingLinksOnly: true, | ||
| }); |
There was a problem hiding this comment.
4. New two-way connections no longer export existing tasks 🐞 Bug ≡ Correctness
The create route now always publishes integration.sync_rules_changed with `existingLinksOnly: true, so reconcileProjectSync` only processes tasks that already have a Gitea issue link, even when the new connection is in sync mode. Previously (and still for GitHub and GitLab) connecting a repository exported every eligible unlinked task; first-time Gitea users in the default two-way mode now get no issues created for their existing backlog.
Agent Prompt
## Issue description
The Gitea create route always publishes `integration.sync_rules_changed` with `existingLinksOnly: true`, so a brand-new two-way connection never exports existing eligible tasks. That is a regression from previous Gitea behaviour and differs from GitHub/GitLab.
## Fix Focus Areas
- apps/api/src/gitea-integration/index.ts[251-272]
- apps/api/src/gitea-integration/controllers/create-gitea-integration.ts[141-150]
## Recommended Fix
Have `createGiteaIntegration` return whether this is a new connection (or a new target) in `sync` mode. Set `existingLinksOnly: true` only when the mode is not `sync`, or when only credentials changed on the same target in the same mode. Otherwise omit the flag so a fresh two-way connection exports eligible tasks as before.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| const links = await database.query.externalLinkTable.findMany({ | ||
| where: and( | ||
| eq(externalLinkTable.integrationId, integrationId), | ||
| eq(externalLinkTable.resourceType, "issue"), | ||
| ), | ||
| }); | ||
| for (const link of links) { |
There was a problem hiding this comment.
5. Changing the mode on large projects briefly blocks syncing 🐞 Bug ➹ Performance
retireGiteaIssueEdits loads every issue link for the integration and, for each one, runs up to five sequential updateExternalLink savepoint transactions with per-link FOR UPDATE locks. All of this happens inside the settings transaction that holds the integration row FOR UPDATE. For projects with thousands of linked issues, a mode change keeps webhooks and outbound fences for that integration waiting until the loop finishes.
Agent Prompt
## Issue description
A mode change iterates every issue link with several sequential updates while holding the integration lock.
## Fix Focus Areas
- apps/api/src/plugins/gitea/services/retire-issue-edits.ts[17-69]
## Recommended Fix
Restrict the query to links whose metadata contains `deferredIssueEdit` or pending/uncertain outbound intents (for example with a LIKE/JSONB filter, as `replayClaimedIssueEdits` does). Merge the per-field `retireOutboundIntents` calls into a single `updateExternalLink` per link.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
What changed?
This is a proposal PR. I recently installed Kaneo and I love it. Also, kudos for having Gitea support!
I would like more control over issue synchronization with Gitea, since I don't want every Kaneo task duplicated as a Gitea issue or to maintain the source of truth in two places.
This adds three issue synchronization modes:
writing issue changes back to Gitea.
connection.
Branch, push, and pull-request linking and workflow automation remain available in all three modes. Changing modes preserves existing tasks and links and doesn't automatically export existing tasks.
Related issue
None.
How did you check it?
I used AI to help with the implementation, since TypeScript isn't a language I work with every day. I have reviewed the diff and tested the changes.
Verification included:
Non-English locales retain English placeholders, following the contribution guidelines.
Fixes #1985