Skip to content

Reporting - #2934

Open
adelowo wants to merge 13 commits into
mainfrom
feat-ISS-3142
Open

adelowo wants to merge 13 commits into
mainfrom
feat-ISS-3142

Conversation

@adelowo

@adelowo adelowo commented Oct 24, 2026 •

Copy link
Copy Markdown
Member
  • reports have 3 level of visibility
    • organization ( any one in the org can read )
    • private ( only the creator and super admins can access )
    • restricted ( creator and any other org member added can access )
  • builds off how program and memberships + groups access works today
  • added membership tests to validate Program members can still access program even after access removal #2920 does not exists here
  • added query validation + variables against the actual parsed query the server exposes ( we don't have this in export )

@adelowo
adelowo marked this pull request as ready for review October 26, 2026 00:25
@adelowo
adelowo requested a review from a team as a code owner October 26, 2026 00:25
@github-actions github-actions Bot added the cli label Oct 26, 2026
@adelowo
adelowo enabled auto-merge (squash) October 26, 2026 12:25
@github-actions github-actions Bot removed the cli label Oct 26, 2026
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
13.5% Coverage on New Code (required ≥ 20%)
4.6% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@golanglemonade golanglemonade left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

initial comments, want to address these because they are schema related before I do a final review

entx.FieldSearchable(),
entgql.OrderField("name"),
),
field.Text("query").

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should probably have a validator that this is a valid graphql query because this could be created directly through the API.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see you did this in a hook. Any reason you did that over a validator?

Comment on lines +56 to +61
field.Enum("status").
GoType(enums.ReportStatus("")).
Default(enums.ReportStatusDraft.String()).
Annotations(
entgql.OrderField("STATUS"),
),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need status?


func (Report) Interceptors() []ent.Interceptor {
return []ent.Interceptor{
interceptors.FilterQueryResults[generated.Report](nil),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this needed here? Comment on the function:

// This is automatically added to all schemas using the ObjectOwnedMixin, so should not be added
// directly if that mixin is used

Comment on lines +117 to +122
// if this is being created via api or support user, there will be no "user", so
// automatically make it visibile org wide
if m.Op().Is(ent.OpCreate) && auth.IsUserlessContext(ctx) {
requestedVisibility = enums.ReportVisibilityOrganization
m.SetVisibility(requestedVisibility)
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels risky. I think we should probably reject instead with a error message that says you have to set that explicitly?

Comment thread fga/model/base/report.fga
@@ -0,0 +1,18 @@
module base

type report

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add some fga tests too?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants