feature: sync issue links via webhook, poll as fallback, detect spec codes in bodies #28
No reviewers
Labels
No labels
breaking
bug
ci
dependencies
documentation
feature
security
skip-changelog
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
thierryade/backend!28
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/issue-link-webhook-sync"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #27.
Second slice of the Forgejo issue <-> spec link feature, on top of thierryade/backend#26 (now merged).
ForgejoRepoWebhookmodel (one per repo,events=["issues"]), registered lazily byapps.specs.forgejo.ensure_webhookwhen aProject.default_repois set/changed or a link targets an unseen repo; deregistered (remove_webhook_if_unused) once the last link on a repo is removed.POST /api/webhooks/forgejo/issues/<repo_full_name>/: verifies the delivery's HMAC signature against the repo's own secret, then (B1) syncscached_state/cached_titleon every existing link to that issue, and (B2) on anopened/editeddelivery, detects a spec code typed on its ownSpec: CODE/Thierryade: CODEline -- creates adetected_in_bodylink for a new match, drops one whose code disappeared (never a manual/issue_buttonlink).apps.specs.tasks.poll_stale_issue_links(Celery beat, every 15 min): re-fetches every stale (repo, issue) pair, same B1/B2 rules -- the polling fallback for a missed/never-registered webhook.apps.specs.tasks.sync_confirmation_comment: posts (or edits in place) a confirmation comment on the issue, pointing back at the spec in Thierryade -- queued on link creation or acached_statechange.THIERRYADE_BASE_URLsetting +CELERY_BEAT_SCHEDULE(nodjango-celery-beat-- incompatible with this project's Django pin -- so Celery's own file-based scheduler, a newthierryade-beatservice). Also wiresFORGEJO_API_TOKEN_FILEintodeploy/docker-compose.yml/README, missed in PR 1.Test plan
manage.py test-- 197/197 passing (35 new)pylint apps config-- 10.00/10autopep8 --diffcleanbandit -r apps config-- 0 issuesensure_webhook/sync_confirmation_commentin a couple of PR 1 tests this PR wired into the same paths, which would otherwise have hit the livegit.stationmyr.netinstanceUnverified against the real Forgejo instance: the webhook registration payload shape and the signature header name (
X-Gitea-SignaturevsX-Forgejo-Signature) follow Gitea/Forgejo's documented convention, not confirmed end-to-end yet -- worth a real smoke test once deployed.🤖 Generated with Claude Code
https://claude.ai/code/session_014HiJrn6J6vhyFfC2qyY4uh
📊 Rapports Argus pour cette PR