Skip to content

Code suggestions with AddOns

What does this MR do and why?

As per Make Code Suggestions only available in Project... (#417422 - closed) we are making code suggestions available only in projects with code-suggestions add-on purchased.

We are checking whether the project should have access to code suggestions via purchased add-ons, and returning 404 (Not found), if not. In addition, we're introducing caching logic (with expiration time of 1 hour) to prevent unnecessary DB queries.

Query plans for the new scopes:

Scope Query Recommendation Postgres.ai
.active SELECT "subscription_add_on_purchases".* FROM "subscription_add_on_purchases" WHERE (expires_on >= '2023-07-17') Looks good Details
.for_code_suggestions SELECT "subscription_add_ons"."id" FROM "subscription_add_ons" WHERE "subscription_add_ons"."name" = 1 Looks good Details
.for_project SELECT "projects".* FROM "projects" WHERE "projects"."id" = 77 LIMIT 1 Looks good Details
.for_project SELECT "subscription_add_on_purchases".* FROM "subscription_add_on_purchases" WHERE "subscription_add_on_purchases"."namespace_id" = 22 Looks good Details

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Relates to #417422 (closed)

Edited by Bojan Marjanovic

Merge request reports