Hide software license policies created through scan result policy
What does this MR do and why?
This MR hides the software license policies in the license compliance page that are created through scan_result_policy. It also updates the API to not return policies created through scan result policy.
This is a chained MR : !110967 (merged)
Context: !110967 (comment 1273055376)
DB Queries
Query 1
SELECT
"software_license_policies"."id" AS t0_r0,
"software_license_policies"."project_id" AS t0_r1,
"software_license_policies"."software_license_id" AS t0_r2,
"software_license_policies"."classification" AS t0_r3,
"software_license_policies"."created_at" AS t0_r4,
"software_license_policies"."updated_at" AS t0_r5,
"software_license_policies"."scan_result_policy_id" AS t0_r6,
"software_licenses"."id" AS t1_r0,
"software_licenses"."name" AS t1_r1,
"software_licenses"."spdx_identifier" AS t1_r2
FROM
"software_license_policies"
INNER JOIN
"software_licenses"
ON "software_licenses"."id" = "software_license_policies"."software_license_id"
WHERE
"software_license_policies"."scan_result_policy_id" IS NULL
AND "software_license_policies"."project_id" = 278964
Explain output: console.postgres.ai
Nested Loop (cost=0.56..64.89 rows=18 width=85) (actual time=13.901..13.949 rows=15 loops=1)
Buffers: shared hit=44 read=4
I/O Timings: read=13.801 write=0.000
-> Index Scan using idx_software_license_policies_unique_on_project_and_scan_policy on public.software_license_policies (cost=0.29..25.08 rows=18 width=40) (actual time=10.789..10.799 rows=15 loops=1)
Index Cond: ((software_license_policies.project_id = 278964) AND (software_license_policies.scan_result_policy_id IS NULL))
Buffers: shared read=3
I/O Timings: read=10.747 write=0.000
-> Index Scan using software_licenses_pkey on public.software_licenses (cost=0.28..2.21 rows=1 width=45) (actual time=0.208..0.208 rows=1 loops=15)
Index Cond: (software_licenses.id = software_license_policies.software_license_id)
Buffers: shared hit=44 read=1
I/O Timings: read=3.054 write=0.000
Time: 15.856 ms
- planning: 1.819 ms
- execution: 14.037 ms
- I/O read: 13.801 ms
- I/O write: 0.000 ms
Shared buffers:
- hits: 44 (~352.00 KiB) from the buffer pool
- reads: 4 (~32.00 KiB) from the OS file cache, including disk I/O
- dirtied: 0
- writes: 0
Query 2
SELECT
"software_license_policies".*
FROM
"software_license_policies"
WHERE
"software_license_policies"."project_id" = 278964
AND "software_license_policies"."scan_result_policy_id" IS NULL LIMIT 1000
Explain output: console.postgres.ai
Limit (cost=0.29..25.08 rows=18 width=40) (actual time=0.033..0.044 rows=15 loops=1)
Buffers: shared hit=3
I/O Timings: read=0.000 write=0.000
-> Index Scan using idx_software_license_policies_unique_on_project_and_scan_policy on public.software_license_policies (cost=0.29..25.08 rows=18 width=40) (actual time=0.031..0.040 rows=15 loops=1)
Index Cond: ((software_license_policies.project_id = 278964) AND (software_license_policies.scan_result_policy_id IS NULL))
Buffers: shared hit=3
I/O Timings: read=0.000 write=0.000
Time: 0.270 ms
- planning: 0.194 ms
- execution: 0.076 ms
- I/O read: 0.000 ms
- I/O write: 0.000 ms
Shared buffers:
- hits: 3 (~24.00 KiB) from the buffer pool
- reads: 0 from the OS file cache, including disk I/O
- dirtied: 0
- writes: 0
Screenshots or screen recordings
License policies list
Policy
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Sashi Kumar Kumaresan