Skip to content

Conversation

@tstirrat15
Copy link
Contributor

Description

Getting close to done with linting things! This enables gocritic across the repo.

Changes

Will annotate.

Testing

Review. See that tests pass.

@tstirrat15 tstirrat15 requested a review from a team as a code owner October 31, 2025 21:16
@github-actions github-actions bot added area/cli Affects the command line area/datastore Affects the storage system area/tooling Affects the dev or user toolchain (e.g. tests, ci, build tools) labels Oct 31, 2025
@codecov
Copy link

codecov bot commented Oct 31, 2025

Codecov Report

❌ Patch coverage is 46.66667% with 16 lines in your changes missing coverage. Please review.
✅ Project coverage is 44.66%. Comparing base (684c598) to head (5db047d).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
pkg/query/simplify_caveat.go 0.00% 8 Missing ⚠️
pkg/query/arrow.go 0.00% 4 Missing ⚠️
internal/services/shared/schema.go 0.00% 3 Missing ⚠️
internal/graph/lookupresources3.go 0.00% 1 Missing ⚠️

❌ Your project check has failed because the head coverage (44.66%) is below the target coverage (75.00%). You can increase the head coverage or adjust the target coverage.

❗ There is a different number of reports uploaded between BASE (684c598) and HEAD (5db047d). Click for more details.

HEAD has 29 uploads less than BASE
Flag BASE (684c598) HEAD (5db047d)
54 25
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #2682       +/-   ##
===========================================
- Coverage   79.43%   44.66%   -34.77%     
===========================================
  Files         456      414       -42     
  Lines       47320    43897     -3423     
===========================================
- Hits        37586    19603    -17983     
- Misses       6971    22448    +15477     
+ Partials     2763     1846      -917     

☔ 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.

Copy link
Contributor Author

@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 -642 to -644
intFromString := func(s string) (int, error) {
return strconv.Atoi(s)
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the unlambda rule - basically don't wrap a function in a lambda if the lambda is exactly the same as the function.

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't like lambdas in general because they make reading stacktraces a pain in the behind

Comment on lines +191 to +192
switch {
case foundCount == 0:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Some if/elseif/else rewriting to cases

Comment on lines 1402 to 1403
cursor := (*index.dbCursor)
return dsIndexPrefix + index.chunkID + ":" + cursor.String(), nil
Copy link
Contributor Author

Choose a reason for hiding this comment

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

gocritic was complaining that you could get rid of the deref here, except that you can't because the compiler doesn't correctly recognize the interface. Separating the assignment fixes things.

Comment on lines 492 to 495
newArgs := append(args, strValue)
newArgs := make([]any, 0, len(args)+len(strValue))
newArgs = append(newArgs, args)
newArgs = append(newArgs, strValue)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think these are functionally equivalent, but gocritic doesn't like it when you use append and assign to a new slice, so this makes it more explicit.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This change is the problem. I'm not sure why it's semantically different.

datastore.WithRequestHedgingEnabled(false),
)
if err != nil {
log.Fatalf("unable to start memdb datastore: %s", err)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was complaining here that log.Fatalf prevents defer blocks from running. t.Fatalf should be equivalent and also work around that.

Comment on lines -409 to -411
asTuples := slicez.Map(testfixtures.StandardRelationships, func(item string) tuple.Relationship {
return tuple.MustParse(item)
})
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same unlambda thing here.

Copy link
Contributor Author

@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 comment

}

return dsIndexPrefix + index.chunkID + ":" + (*index.dbCursor).String(), nil
return dsIndexPrefix + index.chunkID + ":" + index.dbCursor.RelationshipReference.String(), nil
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not entirely sure how this deref worked previously - this both makes things a little clearer and also satisfies gocritic.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Except that it doesn't work 🤔

Copy link
Contributor

Choose a reason for hiding this comment

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

does this explain the broken tests or are you talking about something else?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought this was the test failure but it's not 🤔


checkedUpdate = true
} else {
// we wait for a checkpoint right after the update. Checkpoints could happen at any time off band.
Copy link
Contributor

Choose a reason for hiding this comment

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

the comment should be moved too

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

Labels

area/cli Affects the command line area/datastore Affects the storage system 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.

3 participants