feature: lighten ProjectView by surfacing PR state and allow pinning refs forever #50

Merged
Gilles merged 1 commit from feat/lighten-closed-pr-display into master 2026-10-30 14:51:10 +00:00
Owner

Summary

  • apps.reports.pr_state: caches a PR's open/closed state read from Forgejo; the webhook now writes "closed" immediately on the close event, so the display reacts without waiting on cleanup_pr()'s own retention delay (which is untouched).
  • ReportListUploadView annotates each PR-scoped report with pr_state ("open"/"closed"/"unknown"), one Forgejo lookup per distinct PR number in the response, not per report row.
  • New PinnedRef model: marks a (project, ref_kind, ref_value) as kept forever (e.g. a release build), exempting it from cleanup_pr's PR deletion and prune_history's per-ref retention count, including reports uploaded to it afterwards.
  • New endpoints: GET/POST/DELETE .../refs/{ref_kind}/{ref_value}/pin/ and GET .../pinned-refs/ (both permission-gated like every other mutating project action).

Frontend changes (ProjectView collapsing closed PRs, RefDetailView pin toggle) are in a companion PR on argus/frontend.

Closes #49

Test plan

  • pytest (278/278)
  • pylint apps config (10/10)
  • bandit -r apps config -x '/migrations/,/tests.py,/test_*.py' (0 issues)
  • autopep8 --diff --exit-code clean
  • makemigrations --check clean

🤖 Generated with Claude Code

https://claude.ai/code/session_014HiJrn6J6vhyFfC2qyY4uh

## Summary - apps.reports.pr_state: caches a PR's open/closed state read from Forgejo; the webhook now writes "closed" immediately on the close event, so the display reacts without waiting on cleanup_pr()'s own retention delay (which is untouched). - ReportListUploadView annotates each PR-scoped report with pr_state ("open"/"closed"/"unknown"), one Forgejo lookup per distinct PR number in the response, not per report row. - New PinnedRef model: marks a (project, ref_kind, ref_value) as kept forever (e.g. a release build), exempting it from cleanup_pr's PR deletion and prune_history's per-ref retention count, including reports uploaded to it afterwards. - New endpoints: GET/POST/DELETE .../refs/{ref_kind}/{ref_value}/pin/ and GET .../pinned-refs/ (both permission-gated like every other mutating project action). Frontend changes (ProjectView collapsing closed PRs, RefDetailView pin toggle) are in a companion PR on argus/frontend. Closes #49 ## Test plan - [x] pytest (278/278) - [x] pylint apps config (10/10) - [x] bandit -r apps config -x '*/migrations/*,*/tests.py,*/test_*.py' (0 issues) - [x] autopep8 --diff --exit-code clean - [x] makemigrations --check clean 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_014HiJrn6J6vhyFfC2qyY4uh
feat: lighten ProjectView by surfacing PR state and allow pinning refs forever
All checks were successful
ci / test (pull_request) Successful in 3m38s
ci / e2e (pull_request) Has been skipped
ci / docker (pull_request) Has been skipped
ci / deploy (pull_request) Has been skipped
93c3f18030
Closed PR reports stayed visible in ProjectView until cleanup_pr()'s own
retention delay deleted them, cluttering the listing. Adds apps.reports.pr_state
(cached Forgejo lookup, set directly from the webhook on close) so the frontend
can collapse closed PRs without changing the deletion delay itself.

Also adds a PinnedRef model + pin/unpin endpoints so a ref (e.g. a release
build) can be exempted from cleanup_pr/prune_history entirely, independent of
any report_type.

Closes #49

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014HiJrn6J6vhyFfC2qyY4uh
Author
Owner
<!-- argus-link-bot:argus/backend --> 📊 [Rapports Argus pour cette PR](https://reports.stationmyr.net/argus/backend/pr/50)
Gilles merged commit a289fa5617 into master 2026-10-30 14:51:10 +00:00
Gilles deleted branch feat/lighten-closed-pr-display 2026-10-30 14:51:10 +00:00
Gilles changed title from feat: lighten ProjectView by surfacing PR state and allow pinning refs forever to feature: lighten ProjectView by surfacing PR state and allow pinning refs forever 2026-10-30 14:54:39 +00:00
Sign in to join this conversation.
No description provided.