feat(forgejo): cache org teams in policy check#2775
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces caching for organization teams in the Gitea provider to prevent redundant API calls, extracting the logic into a new listOrgTeams helper method and adding a unit test to verify the caching behavior. However, a critical issue was identified in listOrgTeams where accessing resp.StatusCode before checking if err is nil or if resp is nil could lead to a nil pointer dereference panic.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
90909c7 to
4e2225f
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2775 +/- ##
==========================================
+ Coverage 60.09% 60.11% +0.01%
==========================================
Files 210 210
Lines 21135 21145 +10
==========================================
+ Hits 12701 12711 +10
Misses 7641 7641
Partials 793 793 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
4e2225f to
cf098f3
Compare
Cache ListOrgTeams API responses per organization to avoid redundant API calls when checking policy for the same org across multiple allowed teams evaluations. Signed-off-by: Akshay Pant <akpant@redhat.com>
cf098f3 to
10d7201
Compare
📝 Description of the Change
Cache ListOrgTeams API responses per organization to avoid redundant API calls when checking policy for the same org across multiple allowed teams evaluations.
🔗 Linked GitHub Issue
N/A
🧪 Testing Strategy
🤖 AI Assistance
AI assistance can be used for various tasks, such as code generation,
documentation, or testing.
Please indicate whether you have used AI assistance
for this PR and provide details if applicable.
Important
Slop will be simply rejected, if you are using AI assistance you need to make sure you
understand the code generated and that it meets the project's standards. you
need at least know how to run the code and deploy it (if needed). See
startpaac to make it easy
to deploy and test your code changes.
If the majority of the code in this PR was generated by an AI, please add a
Co-authored-bytrailer to your commit message.For example:
Co-authored-by: Claude noreply@anthropic.com
✅ Submitter Checklist
fix:,feat:) matches the "Type of Change" I selected above.make testandmake lintlocally to check for and fix anyissues. For an efficient workflow, I have considered installing
pre-commit and running
pre-commit installtoautomate these checks.