Skip to content

Conversation

@dmihalcik-virtru
Copy link
Member

Proposed Changes

  • mostly add nolints for deprecated things

Checklist

  • I have added or updated unit tests
  • I have added or updated integration tests (if appropriate)
  • I have added or updated documentation

Testing Instructions

mostly add nolints for deprecated things
@dmihalcik-virtru dmihalcik-virtru requested review from a team as code owners December 22, 2025 16:32
@github-actions github-actions bot added comp:db DB component comp:policy Policy Configuration ( attributes, subject mappings, resource mappings, kas registry) comp:sdk A software development kit, including library, for client applications and inter-service communicati comp:kas Key Access Server comp:authorization comp:examples comp:lib:ocrypto size/s labels Dec 22, 2025
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @dmihalcik-virtru, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request primarily addresses linter warnings throughout the project by strategically adding //nolint comments. This ensures that the codebase remains clean from static analysis warnings, especially for deprecated components that are necessary for compatibility or specific test cases. Additionally, it includes minor code quality enhancements such as optimizing string handling and updating the random number generation library.

Highlights

  • Linter Warning Suppression: Numerous //nolint:staticcheck directives have been added across the codebase, particularly in test files and example code, to suppress warnings related to the intentional use of deprecated functions, fields, or packages for backward compatibility or specific testing scenarios.
  • Performance Optimization: String concatenation operations in sdk/codegen/runner/generate.go and sdk/tdf.go have been refactored to utilize strings.Builder, improving performance and memory efficiency, especially in scenarios involving repeated string modifications within loops.
  • Random Number Generator Update: The math/rand package in sdk/internal/zipstream/crc32combine_test.go has been upgraded to the newer math/rand/v2 package, adopting its modern API for random number generation in tests.
  • Code Readability and Style: Minor adjustments include adding blank lines before deprecated comments for better formatting and adding specific nolint comments for clarity on why certain patterns (e.g., De Morgan's law simplification, nil checks) are used.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.


Old code whispers low, Linter flags, a gentle plea, Nolint stills the hum.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request primarily addresses linter warnings by adding nolint directives for deprecated code, which is justified for backward compatibility and in test/example code. It also includes valuable performance improvements by replacing string concatenation with strings.Builder and migrating to the math/rand/v2 package. The code has also been slightly reformatted in places to adhere to linter rules.

I've identified a couple of minor issues where nolint directives are used to suppress warnings that could be addressed by refactoring the code for better clarity and removing dead code. My comments provide more details on these specific cases.

Overall, these are good maintenance changes that improve the codebase.

Comment on lines +429 to 437
//nolint:staticcheck // SA4010: simplified test code, result intentionally unused
allBytes = append([]byte{}, bytes...) // Segment 0 goes first
for j := 1; j < segmentCount; j++ {
allBytes = append(allBytes, make([]byte, 0)...) // Placeholder
}
} else {
// This is simplified - in practice you'd need proper ordering
//nolint:staticcheck // SA4010: simplified test code, result intentionally unused
allBytes = append(allBytes, bytes...)
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

Instead of adding nolint directives to suppress the SA4010 warning, it would be better to remove the associated dead code. The allBytes variable is built up within this loop but is never used afterward, making this block of code and its associated comments confusing and unnecessary. Removing this logic would improve the test's clarity.

Comment on lines 195 to 196
//nolint:unparam // Return value is always false but kept for potential future use and consistency
func (suite *ChainContractTestSuite) handleConnectionErrors(t *testing.T, err error) bool {
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The unparam linter warning is being suppressed, but it points to a valid issue. The function handleConnectionErrors's boolean return value is effectively unused because t.Skipf terminates the test execution, making the return true statement unreachable. The function always returns false in all other paths. It would be cleaner to refactor this function to not return a boolean value and adjust the call site accordingly. This would make the code clearer and remove the need for a nolint directive.

@github-actions
Copy link
Contributor

Benchmark results, click to expand

Benchmark authorization.GetDecisions Results:

Metric Value
Approved Decision Requests 1000
Denied Decision Requests 0
Total Time 187.386353ms

Benchmark authorization.v2.GetMultiResourceDecision Results:

Metric Value
Approved Decision Requests 1000
Denied Decision Requests 0
Total Time 109.496217ms

Benchmark Statistics

Name № Requests Avg Duration Min Duration Max Duration

Bulk Benchmark Results

Metric Value
Total Decrypts 100
Successful Decrypts 100
Failed Decrypts 0
Total Time 369.517833ms
Throughput 270.62 requests/second

TDF3 Benchmark Results:

Metric Value
Total Requests 5000
Successful Requests 5000
Failed Requests 0
Concurrent Requests 50
Total Time 39.736599496s
Average Latency 395.996121ms
Throughput 125.83 requests/second

NANOTDF Benchmark Results:

Metric Value
Total Requests 5000
Successful Requests 5000
Failed Requests 0
Concurrent Requests 50
Total Time 28.072566051s
Average Latency 279.735928ms
Throughput 178.11 requests/second

@github-actions
Copy link
Contributor

jakedoublev
jakedoublev previously approved these changes Dec 22, 2025
@github-actions
Copy link
Contributor

Benchmark results, click to expand

Benchmark authorization.GetDecisions Results:

Metric Value
Approved Decision Requests 1000
Denied Decision Requests 0
Total Time 194.090583ms

Benchmark authorization.v2.GetMultiResourceDecision Results:

Metric Value
Approved Decision Requests 1000
Denied Decision Requests 0
Total Time 103.585829ms

Benchmark Statistics

Name № Requests Avg Duration Min Duration Max Duration

Bulk Benchmark Results

Metric Value
Total Decrypts 100
Successful Decrypts 100
Failed Decrypts 0
Total Time 374.870228ms
Throughput 266.76 requests/second

TDF3 Benchmark Results:

Metric Value
Total Requests 5000
Successful Requests 5000
Failed Requests 0
Concurrent Requests 50
Total Time 39.601718883s
Average Latency 393.693496ms
Throughput 126.26 requests/second

NANOTDF Benchmark Results:

Metric Value
Total Requests 5000
Successful Requests 5000
Failed Requests 0
Concurrent Requests 50
Total Time 27.799329913s
Average Latency 276.751957ms
Throughput 179.86 requests/second

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

Labels

comp:authorization comp:db DB component comp:examples comp:kas Key Access Server comp:lib:ocrypto comp:policy Policy Configuration ( attributes, subject mappings, resource mappings, kas registry) comp:sdk A software development kit, including library, for client applications and inter-service communicati size/s

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants