Skip to content

Conversation

@barakmich
Copy link
Contributor

Description

Testing

References

@barakmich barakmich requested a review from a team as a code owner January 23, 2026 22:15
@github-actions github-actions bot added the area/tooling Affects the dev or user toolchain (e.g. tests, ci, build tools) label Jan 23, 2026
@codecov
Copy link

codecov bot commented Jan 23, 2026

Codecov Report

❌ Patch coverage is 89.11917% with 21 lines in your changes missing coverage. Please review.
✅ Project coverage is 74.43%. Comparing base (c89c449) to head (401e9a2).

Files with missing lines Patch % Lines
pkg/query/types.go 70.38% 7 Missing and 1 partial ⚠️
pkg/query/intersection.go 70.00% 4 Missing and 2 partials ⚠️
pkg/query/union.go 70.00% 4 Missing and 2 partials ⚠️
pkg/query/build_tree.go 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2849      +/-   ##
==========================================
+ Coverage   74.43%   74.43%   +0.01%     
==========================================
  Files         484      484              
  Lines       57444    57629     +185     
==========================================
+ Hits        42750    42889     +139     
- Misses      11701    11736      +35     
- Partials     2993     3004      +11     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

tstirrat15
tstirrat15 previously approved these changes Jan 23, 2026
Copy link
Contributor

@tstirrat15 tstirrat15 left a comment

Choose a reason for hiding this comment

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

See comments, otherwise LGTM

Comment on lines 349 to 350
// All subiterators should have the same resource type
return i.subIts[0].ResourceType()
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this enforced somewhere, implicitly or explicitly?

return []ObjectType{}
}

seen := make(map[string]bool)
Copy link
Contributor

Choose a reason for hiding this comment

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

Could also use mapz.Set here as well

tstirrat15
tstirrat15 previously approved these changes Jan 27, 2026
Copy link
Contributor

@tstirrat15 tstirrat15 left a comment

Choose a reason for hiding this comment

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

See comments

Comment on lines +358 to +368
// Validate that all subiterators have the same resource type
for idx, subIt := range i.subIts[1:] {
subType, err := subIt.ResourceType()
if err != nil {
return ObjectType{}, err
}
if firstType != subType {
return ObjectType{}, spiceerrors.MustBugf("intersection resource type mismatch: subiterator 0 has type %s, subiterator %d has type %s",
firstType.String(), idx+1, subType.String())
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this potentially expensive?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not terribly, no.

}

func (a *Arrow) ResourceType() (ObjectType, error) {
// Arrow's resources come from the left side
Copy link
Contributor

@miparnisari miparnisari Jan 28, 2026

Choose a reason for hiding this comment

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

i don't yet understand the reasoning behind this (why left and not right?) i suppose it will become apparent in a follow up PR where we use these functions

but in any case i'd move this to be a proper godoc of the function

Copy link
Contributor Author

Choose a reason for hiding this comment

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

definition user {}

definition group {
 relation member: user
}

definition document {
 relation group: group
 permission view = group->member
}

for view, then, the document is clearly the type of the resource -- it's also the type of the resource for the group relation (so this is the left side). Then the right side is the right side of member, which is user

var _ Iterator = &Self{}

func NewSelf(relation string) *Self {
func NewSelf(relation string, resourceType ObjectType) *Self {
Copy link
Contributor

Choose a reason for hiding this comment

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

i can't find a caller of this function where relation != resourceType.subrelation. Do you need that first parameter at all?

Copy link
Contributor

@tstirrat15 tstirrat15 left a comment

Choose a reason for hiding this comment

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

:shipit:

@barakmich barakmich added this pull request to the merge queue Jan 28, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jan 28, 2026
@barakmich barakmich added this pull request to the merge queue Jan 28, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jan 28, 2026
@barakmich barakmich added this pull request to the merge queue Jan 28, 2026
Merged via the queue into main with commit d4b1b63 Jan 29, 2026
44 of 45 checks passed
@barakmich barakmich deleted the barakmich/types_1 branch January 29, 2026 00:09
@github-actions github-actions bot locked and limited conversation to collaborators Jan 29, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area/tooling Affects the dev or user toolchain (e.g. tests, ci, build tools)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants