[Task]: Improvements for custom policy usage related logic
Open
Nobody has claimed this yet.
Area/Platform-API
Aspect/Other
Type/Task
- Dominant language
- Go
- Stars
- 71
- Forks
- 111
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 110
Description
Please select the area the issue is related to
Platform API
Please select the aspect the issue is related to
Aspect/Other (Anything else which does not match above categories)
Description
Address improvements:
- We should remove the conditional around reconcilePolicyUsages and always maintain policy usage for LLM providers, consistent with how we handle APIs. Not storing these usages was the original bug, so keeping the reconciliation unconditional ensures consistent behavior.
- The current insert loop executes one tx.Exec per policy UUID, resulting in N database round-trips within the transaction. Since the policy UUIDs are already deduplicated upfront, this could be optimized into a single multi-row INSERT to reduce transaction overhead.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Find reconcilePolicyUsages and the transaction insert loop in the Platform API code, then inspect how policy UUIDs are deduplicated and how API usages are handled. Make reconciliation unconditional for LLM providers and replace the per-UUID inserts with one multi-row insert; the relevant existing tests should confirm both behaviors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- api, backend-api-design
- Issue type
- Refactor
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 65/100