Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

modify ParseError to FromError for agent handler #2667

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

datelier
Copy link
Contributor

@datelier datelier commented Oct 2, 2024

Description

SSIA

Related Issue

Versions

  • Vald Version: v1.7.13
  • Go Version: v1.23.1
  • Rust Version: v1.81.0
  • Docker Version: v27.3.1
  • Kubernetes Version: v1.31.1
  • Helm Version: v3.16.1
  • NGT Version: v2.2.4
  • Faiss Version: v1.8.0

Checklist

Special notes for your reviewer

Summary by CodeRabbit

  • Bug Fixes
    • Improved error handling across multiple gRPC methods, enhancing clarity and consistency in error reporting.
    • Streamlined error parsing by adopting a direct approach to retrieve status information, reducing redundancy.
    • Enhanced logging mechanisms for better traceability of errors during operations.

These changes collectively improve the reliability and maintainability of error handling within the application.

Copy link
Contributor

coderabbitai bot commented Oct 2, 2024

Important

Review skipped

Ignore keyword(s) in the title.

⛔ Ignored keywords (3)
  • WIP
  • DO NOT MERGE
  • DNM

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

📝 Walkthrough
📝 Walkthrough
📝 Walkthrough
📝 Walkthrough
📝 Walkthrough
📝 Walkthrough
📝 Walkthrough

Walkthrough

The pull request introduces significant modifications to error handling across multiple methods in the grpc package. Key changes include the replacement of status.ParseError with status.FromError for more streamlined error reporting. This adjustment is applied to methods such as Insert, StreamInsert, MultiInsert, and others, ensuring that error messages and statuses are consistently recorded in tracing spans. The updates enhance the clarity and efficiency of error handling without altering the fundamental logic of the methods.

Changes

File Path Change Summary
pkg/agent/core/ngt/handler/grpc/insert.go Updated error handling in Insert, StreamInsert, and MultiInsert to use status.FromError.
pkg/agent/core/ngt/handler/grpc/linear_search.go Modified error handling in LinearSearch, LinearSearchByID, StreamLinearSearch, StreamLinearSearchByID, MultiLinearSearch, and MultiLinearSearchByID to utilize status.FromError.
pkg/agent/core/ngt/handler/grpc/object.go Enhanced error handling in StreamGetObject and StreamListObject with status.FromError.
pkg/agent/core/ngt/handler/grpc/remove.go Refined error handling in Remove, StreamRemove, MultiRemove, and RemoveByTimestamp using status.FromError.
pkg/agent/core/ngt/handler/grpc/search.go Improved error handling in Search, SearchByID, StreamSearch, StreamSearchByID, MultiSearch, and MultiSearchByID with status.FromError.
pkg/agent/core/ngt/handler/grpc/update.go Adjusted error handling in Update, StreamUpdate, MultiUpdate, and UpdateTimestamp to use status.FromError.
pkg/agent/core/ngt/handler/grpc/upsert.go Streamlined error handling in Upsert, StreamUpsert, and MultiUpsert with status.FromError.

Possibly related PRs

  • Bugfix NGT flush logic #2598: The changes in this PR involve error handling in the CreateIndex and CreateAndSaveIndex methods, which is related to the error handling improvements made in the main PR's Insert, StreamInsert, and MultiInsert methods, as both focus on enhancing error reporting and handling consistency within the grpc package.

Suggested labels

size/M

Suggested reviewers

  • kpango
  • vankichi

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@vdaas-ci
Copy link
Collaborator

vdaas-ci commented Oct 2, 2024

[CHATOPS:HELP] ChatOps commands.

  • 🙆‍♀️ /approve - approve
  • 🍱 /format - format codes and add licenses
  • /gen-test - generate test codes
  • 🏷️ /label - add labels
  • 🔚 2️⃣ 🔚 /label actions/e2e-deploy - run E2E deploy & integration test

Copy link

codecov bot commented Oct 2, 2024

Codecov Report

Attention: Patch coverage is 1.00000% with 99 lines in your changes missing coverage. Please review.

Project coverage is 24.03%. Comparing base (51283dc) to head (b55e795).
Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
pkg/agent/core/ngt/handler/grpc/linear_search.go 0.00% 30 Missing ⚠️
pkg/agent/core/ngt/handler/grpc/search.go 0.00% 30 Missing ⚠️
pkg/agent/core/ngt/handler/grpc/remove.go 0.00% 13 Missing ⚠️
pkg/agent/core/ngt/handler/grpc/upsert.go 0.00% 9 Missing ⚠️
pkg/agent/core/ngt/handler/grpc/object.go 0.00% 6 Missing ⚠️
pkg/agent/core/ngt/handler/grpc/update.go 0.00% 6 Missing ⚠️
pkg/agent/core/ngt/handler/grpc/insert.go 16.66% 4 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2667      +/-   ##
==========================================
- Coverage   24.29%   24.03%   -0.27%     
==========================================
  Files         537      539       +2     
  Lines       46950    47103     +153     
==========================================
- Hits        11408    11322      -86     
- Misses      34764    35012     +248     
+ Partials      778      769       -9     

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

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 21

🧹 Outside diff range and nitpick comments (7)
pkg/agent/core/ngt/handler/grpc/object.go (1)

Fix Typographical Errors and Address Method Inconsistencies

The shell script execution has confirmed the presence of st.Massage() in the StreamListObject method. This typo should be corrected to st.Message() to prevent potential runtime errors.

Additionally, the inconsistencies between the AI-generated summary and the actual changes in the StreamListObject method need to be clarified to ensure accurate documentation and understanding of the code.

  • File: pkg/agent/core/ngt/handler/grpc/object.go
    • Lines with Typos:
      • Line X: sspan.SetAttributes(trace.FromGRPCStatus(st.Code(), st.Massage())...)
      • Line Y: span.SetAttributes(trace.FromGRPCStatus(st.Code(), st.Massage())...)
🔗 Analysis chain

Line range hint 1-320: Overall improvements with minor issues and need for clarification

The changes in this file generally improve the error handling mechanism by using status.FromError instead of status.ParseError. This is a positive change that makes the code more idiomatic and efficient.

However, there are a few issues that need to be addressed:

  1. There are consistent typos where st.Massage() is used instead of st.Message(). This needs to be fixed throughout the file to prevent runtime errors.

  2. There's an inconsistency between the AI-generated summary and the visible changes in the StreamListObject method. The summary mentions changes that are not visible in the provided code.

To improve the overall quality and consistency of the codebase:

  1. Consider using a linter or IDE tool to catch typos like Massage vs Message across the entire codebase.
  2. Implement a code review checklist that includes verifying the consistency between code changes and summaries.
  3. Consider adding unit tests to verify the correct behavior of error handling in these methods.

To ensure all instances of the typo are corrected and to verify the changes in the StreamListObject method, you can run the following script:

This script will help identify any remaining instances of the typo and show the context around the StreamListObject method for verification.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check for remaining instances of st.Massage() and verify StreamListObject changes
echo "Checking for st.Massage() instances:"
rg "st\.Massage\(\)" pkg/agent/core/ngt/handler/grpc/object.go

echo "\nChecking for changes in StreamListObject method:"
rg -A 10 -B 10 "func \(s \*server\) StreamListObject" pkg/agent/core/ngt/handler/grpc/object.go

Length of output: 961

pkg/agent/core/ngt/handler/grpc/upsert.go (4)

155-158: Improved error handling in StreamUpsert method.

The changes simplify the error handling logic and fix a typo in the error message retrieval. These improvements enhance the clarity and efficiency of error handling.

Consider adding error checking for status.FromError:

-st, _ = status.FromError(err)
+st, ok := status.FromError(err)
+if !ok {
+    // Handle the case where err is not a gRPC status
+    st = status.New(codes.Unknown, err.Error())
+}

This ensures that even non-gRPC errors are properly handled and converted to a gRPC status.


174-177: Consistent error handling improvements in StreamUpsert method.

The changes maintain the improved error handling approach throughout the method, enhancing consistency and clarity.

As suggested earlier, consider adding error checking for status.FromError:

-st, _ = status.FromError(err)
+st, ok := status.FromError(err)
+if !ok {
+    // Handle the case where err is not a gRPC status
+    st = status.New(codes.Unknown, err.Error())
+}

This ensures consistent handling of both gRPC and non-gRPC errors.


321-324: Consistent error handling improvements in MultiUpsert method.

The changes align with the improvements made in the StreamUpsert method, maintaining a consistent error handling approach across different methods in the file.

For consistency with the previous suggestions, consider adding error checking for status.FromError:

-st, _ = status.FromError(err)
+st, ok := status.FromError(err)
+if !ok {
+    // Handle the case where err is not a gRPC status
+    st = status.New(codes.Unknown, err.Error())
+}

This ensures uniform handling of both gRPC and non-gRPC errors across all methods.


Line range hint 1-332: Overall improvement in error handling across the file.

The changes in this file consistently enhance the error handling mechanism in the StreamUpsert and MultiUpsert methods. By replacing status.ParseError with status.FromError and correcting the method name from st.Massage() to st.Message(), the code becomes more efficient and clearer.

These improvements contribute to better error reporting and potentially easier debugging. The suggested additions for error checking would further strengthen the robustness of the error handling.

Consider creating a helper function for error handling to ensure consistency across all methods and reduce code duplication. This function could encapsulate the error to status conversion, error checking, and span updates. For example:

func handleError(err error, span trace.Span) *status.Status {
    st, ok := status.FromError(err)
    if !ok {
        st = status.New(codes.Unknown, err.Error())
    }
    if span != nil {
        span.RecordError(err)
        span.SetAttributes(trace.FromGRPCStatus(st.Code(), st.Message())...)
        span.SetStatus(trace.StatusError, err.Error())
    }
    return st
}

This would simplify the error handling code in each method and ensure consistent behavior across the package.

pkg/agent/core/ngt/handler/grpc/search.go (1)

Line range hint 351-544: Overall improvement in error handling, but with recurring issues.

The changes consistently improve error handling across all search methods by using status.FromError(err). This is a good improvement that simplifies the error handling process. However, there are two recurring issues throughout the changes:

  1. A typo in the error message retrieval: st.Massage() should be st.Message().
  2. In the MultiSearch and MultiSearchByID methods, there's a variable name mismatch where err is used instead of errs.

Please address these issues consistently across all affected methods.

pkg/agent/core/ngt/handler/grpc/remove.go (1)

Line range hint 313-315: Incorrect mutex usage: Missing Unlock() call

In the if err != nil block within the RemoveByTimestamp method, the mutex emu is locked twice without an unlock. This will cause a deadlock because the mutex remains locked.

Apply this diff to fix the mutex usage:

if err != nil {
	emu.Lock()
	errs = errors.Join(errs, err)
-	emu.Lock()
+	emu.Unlock()
}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between d6b6c8c and b9cb6a2.

📒 Files selected for processing (7)
  • pkg/agent/core/ngt/handler/grpc/insert.go (2 hunks)
  • pkg/agent/core/ngt/handler/grpc/linear_search.go (8 hunks)
  • pkg/agent/core/ngt/handler/grpc/object.go (2 hunks)
  • pkg/agent/core/ngt/handler/grpc/remove.go (3 hunks)
  • pkg/agent/core/ngt/handler/grpc/search.go (8 hunks)
  • pkg/agent/core/ngt/handler/grpc/update.go (2 hunks)
  • pkg/agent/core/ngt/handler/grpc/upsert.go (3 hunks)
🧰 Additional context used
🪛 GitHub Check: grpc-stream
pkg/agent/core/ngt/handler/grpc/insert.go

[failure] 165-165:
undefined: st


[failure] 166-166:
undefined: st


[failure] 168-168:
undefined: st


[failure] 184-184:
undefined: st


[failure] 185-185:
undefined: st


[failure] 187-187:
undefined: st

pkg/agent/core/ngt/handler/grpc/linear_search.go

[failure] 347-347:
undefined: st


[failure] 348-348:
undefined: st


[failure] 350-350:
undefined: st

🪛 GitHub Check: grpc-sequential
pkg/agent/core/ngt/handler/grpc/insert.go

[failure] 165-165:
undefined: st


[failure] 166-166:
undefined: st


[failure] 168-168:
undefined: st


[failure] 184-184:
undefined: st


[failure] 185-185:
undefined: st


[failure] 187-187:
undefined: st

pkg/agent/core/ngt/handler/grpc/linear_search.go

[failure] 347-347:
undefined: st


[failure] 348-348:
undefined: st


[failure] 350-350:
undefined: st

🔇 Additional comments (4)
pkg/agent/core/ngt/handler/grpc/insert.go (1)

Line range hint 1-324: Overall changes improve error handling in StreamInsert function

The modifications in this file, particularly in the StreamInsert function, align with the PR objective of changing from ParseError to FromError. These changes simplify the error handling process and make it more consistent with the status package usage.

Key improvements:

  1. Simplified error handling by using status.FromError instead of status.ParseError.
  2. Consistent approach to setting span attributes and status.

The changes do not affect the public API or function signatures, maintaining backwards compatibility.

These changes look good overall, pending the fixes mentioned in the previous comments. The simplification of error handling should make the code more maintainable and consistent.

🧰 Tools
🪛 GitHub Check: grpc-stream

[failure] 165-165:
undefined: st


[failure] 166-166:
undefined: st


[failure] 168-168:
undefined: st

🪛 GitHub Check: grpc-sequential

[failure] 165-165:
undefined: st


[failure] 166-166:
undefined: st


[failure] 168-168:
undefined: st

pkg/agent/core/ngt/handler/grpc/linear_search.go (3)

Line range hint 1-542: Summary of Linear Search Handler Review

The changes in this file align with the PR objective of modifying ParseError to FromError for the agent handler. However, the implementation has introduced several recurring issues:

  1. Undefined st variables throughout the error handling sections.
  2. Consistent typos in st.Massage() method calls (should be st.Message()).
  3. Inconsistent use of span and sspan variables in some error handling contexts.

These issues appear systematically across multiple functions: StreamLinearSearch, StreamLinearSearchByID, MultiLinearSearch, and MultiLinearSearchByID.

To address these issues and improve the overall code quality:

  1. Implement a helper function for error handling to reduce code duplication and minimize errors.
  2. Conduct a thorough review of all error handling code in this file and related files.
  3. Implement unit tests specifically for error handling.
  4. Update your CI/CD pipeline to include static analysis tools for catching these issues automatically.
  5. Hold a team code review session to establish best practices for error handling and refactoring processes.

After making the suggested changes, please run the verification scripts provided in the individual comments to ensure all instances of these issues have been resolved.

This comprehensive approach will not only fix the current issues but also prevent similar problems in future refactoring efforts, leading to more maintainable and robust code.

🧰 Tools
🪛 GitHub Check: grpc-stream

[failure] 347-347:
undefined: st


[failure] 348-348:
undefined: st


[failure] 350-350:
undefined: st

🪛 GitHub Check: grpc-sequential

[failure] 347-347:
undefined: st


[failure] 348-348:
undefined: st


[failure] 350-350:
undefined: st


415-418: ⚠️ Potential issue

Address recurring issues and incorrect variable usage

This segment continues to show the same issues we've seen before, with an additional problem:

  1. The variable st is used before it's defined.
  2. There's a typo in st.Massage(). It should be st.Message().
  3. The variable sspan is used instead of span, which is likely incorrect in this context.

Please apply the following changes:

-		st, _ = status.FromError(err)
-		if st != nil && sspan != nil {
+		st, _ := status.FromError(err)
+		if st != nil && span != nil {
 			span.RecordError(err)
-			span.SetAttributes(trace.FromGRPCStatus(st.Code(), st.Massage())...)
+			span.SetAttributes(trace.FromGRPCStatus(st.Code(), st.Message())...)
 			span.SetStatus(trace.StatusError, err.Error())
 		}

To ensure all variable names are used correctly in error handling sections, please run the following script:

Please review the results and ensure that the correct span variable is used consistently in each context.

✅ Verification successful

Verification Successful: No Inconsistent 'span' or 'sspan' Usages Detected

The shell script did not find any occurrences of inconsistent usage of span or sspan in error handling sections of pkg/agent/core/ngt/handler/grpc/linear_search.go. This indicates that the previous issues related to variable usage have been addressed.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for inconsistent use of 'span' and 'sspan' variables in error handling
echo "Occurrences of 'span' in error handling:"
rg --type go --line-number 'span.*status\.FromError' pkg/agent/core/ngt/handler/grpc/linear_search.go

echo "\nOccurrences of 'sspan' in error handling:"
rg --type go --line-number 'sspan.*status\.FromError' pkg/agent/core/ngt/handler/grpc/linear_search.go

Length of output: 408


518-521: ⚠️ Potential issue

Final instance of systematic error handling issues

This segment in the MultiLinearSearchByID function shows the same issues we've seen throughout the file:

  1. The variable st is used before it's defined.
  2. There's a typo in st.Massage(). It should be st.Message().

Please apply the following changes:

-				st, _ = status.FromError(err)
-				if st != nil && sspan != nil {
+				st, _ := status.FromError(err)
+				if st != nil && sspan != nil {
 					sspan.RecordError(err)
-					sspan.SetAttributes(trace.FromGRPCStatus(st.Code(), st.Massage())...)
+					sspan.SetAttributes(trace.FromGRPCStatus(st.Code(), st.Message())...)
 					sspan.SetStatus(trace.StatusError, err.Error())
 				}

These recurring issues throughout the file indicate a systematic problem in the error handling refactoring process. To address this comprehensively:

  1. Implement the helper function for error handling as suggested in the previous comment.

  2. Conduct a thorough review of all error handling code in this file and related files to ensure consistency and correctness.

  3. Consider implementing unit tests specifically for error handling to catch these issues early in the development process.

  4. Set up or update your CI/CD pipeline to include static analysis tools that can catch these types of issues automatically.

  5. Conduct a team code review session to discuss these findings and establish best practices for error handling and refactoring processes.

By addressing these issues systematically, you can improve the overall quality and maintainability of your codebase, reducing the likelihood of similar problems in the future.

To ensure all instances have been addressed, please run the following final verification script:

This script will help ensure that all instances have been corrected and the new pattern is consistently applied throughout the file.

pkg/agent/core/ngt/handler/grpc/object.go Outdated Show resolved Hide resolved
pkg/agent/core/ngt/handler/grpc/object.go Outdated Show resolved Hide resolved
pkg/agent/core/ngt/handler/grpc/insert.go Outdated Show resolved Hide resolved
pkg/agent/core/ngt/handler/grpc/insert.go Outdated Show resolved Hide resolved
pkg/agent/core/ngt/handler/grpc/search.go Outdated Show resolved Hide resolved
pkg/agent/core/ngt/handler/grpc/remove.go Outdated Show resolved Hide resolved
pkg/agent/core/ngt/handler/grpc/remove.go Outdated Show resolved Hide resolved
pkg/agent/core/ngt/handler/grpc/remove.go Outdated Show resolved Hide resolved
pkg/agent/core/ngt/handler/grpc/update.go Outdated Show resolved Hide resolved
pkg/agent/core/ngt/handler/grpc/update.go Outdated Show resolved Hide resolved
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 14

🧹 Outside diff range and nitpick comments (4)
pkg/agent/core/ngt/handler/grpc/object.go (1)

154-157: Approve changes with a minor suggestion.

The updates to error handling in the StreamGetObject method are good improvements:

  1. Using status.FromError(err) simplifies the error parsing process.
  2. The typo fix from st.Massage() to st.Message() is correct.

However, there's a minor inconsistency in error variable naming.

Consider updating the error variable name for consistency:

-st, _ = status.FromError(err)
+st, _ := status.FromError(err)

This change applies to both occurrences (lines 154 and 173).

Also applies to: 173-176

pkg/agent/core/ngt/handler/grpc/upsert.go (2)

155-158: Improved error handling in StreamUpsert method.

The changes to error handling in the StreamUpsert method are good improvements:

  1. Replacing status.ParseError with status.FromError simplifies the error handling and is more idiomatic.
  2. Correcting st.Massage() to st.Message() fixes a critical typo that would have caused runtime errors.

These changes enhance the reliability and consistency of error handling in the method.

Consider using a consistent error checking pattern. For example, you could combine the nil checks for st and sspan:

if st != nil && sspan != nil {
    sspan.RecordError(err)
    sspan.SetAttributes(trace.FromGRPCStatus(st.Code(), st.Message())...)
    sspan.SetStatus(trace.StatusError, err.Error())
}

This pattern could be applied to both error handling blocks in the method for consistency.

Also applies to: 174-177


Line range hint 1-330: Overall improvement in error handling consistency.

The changes in this file focus on improving error handling in the StreamUpsert and MultiUpsert methods. These modifications enhance the consistency and correctness of error handling across the file. Key points:

  1. Consistent use of status.FromError instead of status.ParseError.
  2. Improved error message retrieval (with one remaining typo to be fixed).
  3. No changes to the core logic of the methods, maintaining existing functionality.

These changes contribute to better reliability and maintainability of the code.

Consider implementing a helper function for error handling to further improve consistency and reduce code duplication. This could encapsulate the common pattern of checking for nil status and span, recording errors, and setting attributes and status.

pkg/agent/core/ngt/handler/grpc/linear_search.go (1)

Remaining Issues Found in linear_search.go

The shell script execution revealed that there are still instances of st.Massage() and st, _ = status.FromError in the following lines:

  • st.Massage():

    • Line 350
    • Line 369
    • Line 399
    • Line 418
    • Line 459
    • Line 480
    • Line 521
    • Line 542
  • st, _ = status.FromError:

    • Line 347
    • Line 366
    • Line 396
    • Line 415
    • Line 456
    • Line 477
    • Line 518
    • Line 539

Please ensure that all instances are correctly refactored as suggested:

  • Replace st.Massage() with st.Message().
  • Update st, _ = status.FromError(err) to properly declare the variable, for example: st, ok := status.FromError(err).
🔗 Analysis chain

Line range hint 1-548: Overall code review summary

The changes in this file consistently replace ParseError with FromError, which aligns with the PR objective. However, there are recurring issues throughout the file that need to be addressed:

  1. The variable st is used without being properly declared.
  2. There's a typo in st.Massage(), which should be st.Message().

To fix these issues globally, you can use a find-and-replace operation across the entire file with the following pattern:

Find:

st, _ = status.FromError(err)
if st != nil && (s|ss)pan != nil {
	(s|ss)pan.RecordError(err)
	(s|ss)pan.SetAttributes(trace.FromGRPCStatus(st.Code(), st.Massage())...)
	(s|ss)pan.SetStatus(trace.StatusError, err.Error())
}

Replace with:

st, ok := status.FromError(err)
if ok && $1pan != nil {
	$1pan.RecordError(err)
	$1pan.SetAttributes(trace.FromGRPCStatus(st.Code(), st.Message())...)
	$1pan.SetStatus(trace.StatusError, err.Error())
}

This will correct all instances of the issue while maintaining the correct span variable name (span or sspan) in each context.

After making these changes, please run the following command to ensure all instances have been corrected:

If the command returns any results, please review those lines manually to ensure they've been properly updated.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check for any remaining instances of st.Massage() or undeclared st
grep -n 'st.Massage()' pkg/agent/core/ngt/handler/grpc/linear_search.go
grep -n 'st, _ = status.FromError' pkg/agent/core/ngt/handler/grpc/linear_search.go

Length of output: 1075

🧰 Tools
🪛 GitHub Check: grpc-stream

[failure] 347-347:
undefined: st


[failure] 348-348:
undefined: st


[failure] 350-350:
undefined: st

🪛 GitHub Check: grpc-sequential

[failure] 347-347:
undefined: st


[failure] 348-348:
undefined: st


[failure] 350-350:
undefined: st

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between d6b6c8c and b9cb6a2.

📒 Files selected for processing (7)
  • pkg/agent/core/ngt/handler/grpc/insert.go (2 hunks)
  • pkg/agent/core/ngt/handler/grpc/linear_search.go (8 hunks)
  • pkg/agent/core/ngt/handler/grpc/object.go (2 hunks)
  • pkg/agent/core/ngt/handler/grpc/remove.go (3 hunks)
  • pkg/agent/core/ngt/handler/grpc/search.go (8 hunks)
  • pkg/agent/core/ngt/handler/grpc/update.go (2 hunks)
  • pkg/agent/core/ngt/handler/grpc/upsert.go (3 hunks)
🧰 Additional context used
🪛 GitHub Check: grpc-stream
pkg/agent/core/ngt/handler/grpc/insert.go

[failure] 165-165:
undefined: st


[failure] 166-166:
undefined: st


[failure] 168-168:
undefined: st


[failure] 184-184:
undefined: st


[failure] 185-185:
undefined: st


[failure] 187-187:
undefined: st

pkg/agent/core/ngt/handler/grpc/linear_search.go

[failure] 347-347:
undefined: st


[failure] 348-348:
undefined: st


[failure] 350-350:
undefined: st

🪛 GitHub Check: grpc-sequential
pkg/agent/core/ngt/handler/grpc/insert.go

[failure] 165-165:
undefined: st


[failure] 166-166:
undefined: st


[failure] 168-168:
undefined: st


[failure] 184-184:
undefined: st


[failure] 185-185:
undefined: st


[failure] 187-187:
undefined: st

pkg/agent/core/ngt/handler/grpc/linear_search.go

[failure] 347-347:
undefined: st


[failure] 348-348:
undefined: st


[failure] 350-350:
undefined: st

🔇 Additional comments (9)
pkg/agent/core/ngt/handler/grpc/object.go (1)

Line range hint 1-300: Overall changes look good with minimal impact.

The changes in this file are focused on improving error handling in the StreamGetObject method. These modifications:

  1. Simplify the error parsing process.
  2. Fix a minor typo in the error message extraction.
  3. Maintain the existing functionality and error handling logic.

The changes are localized and do not affect the overall structure or functionality of the file. The improvements enhance the clarity and efficiency of error handling in the gRPC service method.

pkg/agent/core/ngt/handler/grpc/insert.go (1)

Line range hint 1-324: Overall assessment of changes

The modifications to replace ParseError with FromError in the StreamInsert method align with the PR objectives and improve error handling consistency. However, there are a couple of minor issues that need to be addressed:

  1. The undefined variable st in the StreamInsert method.
  2. A typo in the method name Massage() which should be Message().

Once these issues are resolved, the changes will effectively improve the error handling in the StreamInsert method. The MultiInsert method remains unchanged, which is appropriate as it doesn't use the ParseError function.

Please address the issues mentioned in the previous comment, and the changes will be ready for approval.

🧰 Tools
🪛 GitHub Check: grpc-stream

[failure] 165-165:
undefined: st


[failure] 166-166:
undefined: st


[failure] 168-168:
undefined: st

🪛 GitHub Check: grpc-sequential

[failure] 165-165:
undefined: st


[failure] 166-166:
undefined: st


[failure] 168-168:
undefined: st

pkg/agent/core/ngt/handler/grpc/remove.go (1)

Line range hint 1-399: Summary of changes and improvements

The changes in this file primarily focus on improving error handling by replacing status.ParseError with status.FromError. This is a good improvement as it directly retrieves the status from the error.

However, there's a consistent typo where st.Massage() is used instead of st.Message(). This typo should be fixed in all occurrences.

Overall, the changes maintain consistency in error handling across the methods and improve the code quality. Once the typo is fixed, these changes will be ready for approval.

pkg/agent/core/ngt/handler/grpc/search.go (6)

398-401: Typo: Replace Massage() with Message() in st.Massage()

The method st.Massage() in line 401 should be st.Message(). This typo has been noted previously and should be corrected here as well.

Apply this diff to fix the typo:

-    				sspan.SetAttributes(trace.FromGRPCStatus(st.Code(), st.Massage())...)
+    				sspan.SetAttributes(trace.FromGRPCStatus(st.Code(), st.Message())...)

417-420: Variable inconsistency and typo in method name

In line 418, sspan is used, but in line 420, span is referenced. Ensure consistent use of the span variable to avoid potential errors. Also, correct st.Massage() to st.Message() in line 420.

Apply this diff:

-    	if st != nil && sspan != nil {
+    	if st != nil && span != nil {
    		span.RecordError(err)
-    		span.SetAttributes(trace.FromGRPCStatus(st.Code(), st.Massage())...)
+    		span.SetAttributes(trace.FromGRPCStatus(st.Code(), st.Message())...)

458-461: Typo: Replace Massage() with Message() in st.Massage()

The typo st.Massage() appears again in line 461. Please correct it to st.Message().

Apply this diff:

-    				sspan.SetAttributes(trace.FromGRPCStatus(st.Code(), st.Massage())...)
+    				sspan.SetAttributes(trace.FromGRPCStatus(st.Code(), st.Message())...)

479-482: Variable inconsistency and typo in method name

In line 480, sspan is used, but span is referenced in line 482. Ensure consistent variable naming. Also, st.Massage() should be st.Message().

Apply this diff:

-    	if st != nil && sspan != nil {
+    	if st != nil && span != nil {
    		span.RecordError(err)
-    		span.SetAttributes(trace.FromGRPCStatus(st.Code(), st.Massage())...)
+    		span.SetAttributes(trace.FromGRPCStatus(st.Code(), st.Message())...)

520-523: Typo: Replace Massage() with Message() in st.Massage()

Once again, in line 523, st.Massage() should be st.Message(). Please correct this typo.

Apply this diff:

-    				sspan.SetAttributes(trace.FromGRPCStatus(st.Code(), st.Massage())...)
+    				sspan.SetAttributes(trace.FromGRPCStatus(st.Code(), st.Message())...)

541-544: Variable inconsistency and typo in method name

In line 542, sspan is used, but span is referenced in line 544. Please ensure consistent variable usage. Also, correct st.Massage() to st.Message().

Apply this diff:

-    	if st != nil && sspan != nil {
+    	if st != nil && span != nil {
    		span.RecordError(err)
-    		span.SetAttributes(trace.FromGRPCStatus(st.Code(), st.Massage())...)
+    		span.SetAttributes(trace.FromGRPCStatus(st.Code(), st.Message())...)

pkg/agent/core/ngt/handler/grpc/upsert.go Outdated Show resolved Hide resolved
pkg/agent/core/ngt/handler/grpc/insert.go Outdated Show resolved Hide resolved
pkg/agent/core/ngt/handler/grpc/remove.go Outdated Show resolved Hide resolved
pkg/agent/core/ngt/handler/grpc/remove.go Outdated Show resolved Hide resolved
pkg/agent/core/ngt/handler/grpc/linear_search.go Outdated Show resolved Hide resolved
pkg/agent/core/ngt/handler/grpc/linear_search.go Outdated Show resolved Hide resolved
pkg/agent/core/ngt/handler/grpc/update.go Outdated Show resolved Hide resolved
pkg/agent/core/ngt/handler/grpc/update.go Outdated Show resolved Hide resolved
pkg/agent/core/ngt/handler/grpc/search.go Outdated Show resolved Hide resolved
pkg/agent/core/ngt/handler/grpc/search.go Outdated Show resolved Hide resolved
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 24

🧹 Outside diff range and nitpick comments (2)
pkg/agent/core/ngt/handler/grpc/object.go (1)

Multiple Instances of status.ParseError and st.Massage() Detected

The verification revealed numerous remaining instances of status.ParseError across various files, indicating that the global replacement with status.FromError has not been fully completed. Additionally, the typo st.Massage() was found in multiple locations and should be corrected to st.Message().

Issues to Address:

  • Replace status.ParseError with status.FromError in the following files:

    • tests/e2e/operation/stream.go
    • tests/e2e/crud/crud_test.go
    • pkg/index/job/creation/service/indexer.go
    • pkg/index/job/save/service/indexer.go
    • internal/net/grpc/stream.go
    • (and others as listed in the script output)
  • Correct st.Massage() to st.Message() in the following files:

    • pkg/agent/core/ngt/handler/grpc/linear_search.go
    • pkg/agent/core/ngt/handler/grpc/object.go
    • pkg/agent/core/ngt/handler/grpc/update.go
    • pkg/agent/core/ngt/handler/grpc/search.go
    • pkg/agent/core/ngt/handler/grpc/upsert.go
    • pkg/agent/core/ngt/handler/grpc/insert.go
    • pkg/agent/core/ngt/handler/grpc/remove.go

Please ensure these changes are made consistently across the entire codebase to enhance error handling and maintain code integrity.

🔗 Analysis chain

Line range hint 1-300: Verify the global replacement of ParseError with FromError

The changes in this file consistently replace status.ParseError with status.FromError, which is a good improvement in error handling efficiency. However, the typo st.Massage() instead of st.Message() appears multiple times.

Please run the following script to check for any remaining instances of ParseError and to find any occurrences of the Massage typo:

After running this script, please review the results and ensure that:

  1. All instances of ParseError have been intentionally kept or replaced as needed.
  2. All instances of st.Massage() are corrected to st.Message().
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check for remaining instances of ParseError
echo "Checking for remaining instances of ParseError:"
rg --type go "status\.ParseError"

# Check for instances of the Massage typo
echo "Checking for instances of the Massage typo:"
rg --type go "st\.Massage\(\)"

Length of output: 32143

pkg/agent/core/ngt/handler/grpc/linear_search.go (1)

Issues Persist in Error Handling Code

The previously identified issues are still present in linear_search.go:

  1. Typo: st.Massage() should be st.Message().
  2. Variable Declaration: st is not properly declared with :=.
  3. Inconsistent Variable Names: sspan is used in some places where span should be used.

Please address all instances to ensure consistency and correctness in error handling across the entire file.

🔗 Analysis chain

Line range hint 1-548: Conduct a thorough review of error handling changes

The changes to use status.FromError instead of status.ParseError are good and align with best practices. However, there are consistent issues throughout the file that need to be addressed:

  1. Typo: st.Massage() should be st.Message().
  2. Variable declaration: st is not properly declared with :=.
  3. Inconsistent variable names: sspan is used in some places where span should be used.

To ensure all instances are corrected, please run the following script:

After making the corrections, please review the entire file to ensure consistency and correctness in error handling across all methods.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check for remaining instances of the typo and incorrect variable usage
echo "Checking for remaining issues..."
rg "st\.Massage\(\)" pkg/agent/core/ngt/handler/grpc/linear_search.go
rg "st, _ = status\.FromError" pkg/agent/core/ngt/handler/grpc/linear_search.go
rg "if st != nil && sspan != nil" pkg/agent/core/ngt/handler/grpc/linear_search.go

# If any of the above commands find matches, they will return a non-zero exit code
if [ $? -eq 0 ]; then
  echo "Issues found. Please review and correct all instances."
else
  echo "No remaining issues found. All instances appear to be corrected."
fi

Length of output: 1574

🧰 Tools
🪛 GitHub Check: grpc-stream

[failure] 347-347:
undefined: st


[failure] 348-348:
undefined: st


[failure] 350-350:
undefined: st

🪛 GitHub Check: grpc-sequential

[failure] 347-347:
undefined: st


[failure] 348-348:
undefined: st


[failure] 350-350:
undefined: st

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between d6b6c8c and b9cb6a2.

📒 Files selected for processing (7)
  • pkg/agent/core/ngt/handler/grpc/insert.go (2 hunks)
  • pkg/agent/core/ngt/handler/grpc/linear_search.go (8 hunks)
  • pkg/agent/core/ngt/handler/grpc/object.go (2 hunks)
  • pkg/agent/core/ngt/handler/grpc/remove.go (3 hunks)
  • pkg/agent/core/ngt/handler/grpc/search.go (8 hunks)
  • pkg/agent/core/ngt/handler/grpc/update.go (2 hunks)
  • pkg/agent/core/ngt/handler/grpc/upsert.go (3 hunks)
🧰 Additional context used
🪛 GitHub Check: grpc-stream
pkg/agent/core/ngt/handler/grpc/insert.go

[failure] 165-165:
undefined: st


[failure] 166-166:
undefined: st


[failure] 168-168:
undefined: st


[failure] 184-184:
undefined: st


[failure] 185-185:
undefined: st


[failure] 187-187:
undefined: st

pkg/agent/core/ngt/handler/grpc/linear_search.go

[failure] 347-347:
undefined: st


[failure] 348-348:
undefined: st


[failure] 350-350:
undefined: st

🪛 GitHub Check: grpc-sequential
pkg/agent/core/ngt/handler/grpc/insert.go

[failure] 165-165:
undefined: st


[failure] 166-166:
undefined: st


[failure] 168-168:
undefined: st


[failure] 184-184:
undefined: st


[failure] 185-185:
undefined: st


[failure] 187-187:
undefined: st

pkg/agent/core/ngt/handler/grpc/linear_search.go

[failure] 347-347:
undefined: st


[failure] 348-348:
undefined: st


[failure] 350-350:
undefined: st

🔇 Additional comments (3)
pkg/agent/core/ngt/handler/grpc/insert.go (1)

165-168: ⚠️ Potential issue

Fix undefined variable and update error handling logic

The changes to use status.FromError instead of status.ParseError simplify the error handling. However, there's a critical issue with an undefined variable st. This needs to be addressed to prevent runtime errors.

To fix this issue and improve the error handling, apply the following changes:

- st, _ = status.FromError(err)
- if st != nil && sspan != nil {
+ st, ok := status.FromError(err)
+ if ok && sspan != nil {
    sspan.RecordError(err)
-   sspan.SetAttributes(trace.FromGRPCStatus(st.Code(), st.Massage())...)
+   sspan.SetAttributes(trace.FromGRPCStatus(st.Code(), st.Message())...)
    sspan.SetStatus(trace.StatusError, err.Error())
  }

  // ... (similar changes in the second block)

- st, _ = status.FromError(err)
- if st != nil && span != nil {
+ st, ok := status.FromError(err)
+ if ok && span != nil {
    span.RecordError(err)
-   span.SetAttributes(trace.FromGRPCStatus(st.Code(), st.Massage())...)
+   span.SetAttributes(trace.FromGRPCStatus(st.Code(), st.Message())...)
    span.SetStatus(trace.StatusError, err.Error())
  }

These changes will:

  1. Properly declare and check the st variable.
  2. Use ok to check if the conversion was successful.
  3. Fix the typo in st.Massage() to st.Message().

After making these changes, please run the following command to ensure there are no remaining issues with undefined variables:

This command will help verify that the st variable is properly defined within the StreamInsert function.

Also applies to: 184-187

🧰 Tools
🪛 GitHub Check: grpc-stream

[failure] 165-165:
undefined: st


[failure] 166-166:
undefined: st


[failure] 168-168:
undefined: st

🪛 GitHub Check: grpc-sequential

[failure] 165-165:
undefined: st


[failure] 166-166:
undefined: st


[failure] 168-168:
undefined: st

pkg/agent/core/ngt/handler/grpc/update.go (2)

213-216: Potential nil pointer dereference of st

Similar to the issue in lines 194-197, st may be nil if status.FromError(err) cannot extract a *status.Status from err. Accessing st.Code() and st.Message() without checking can cause a nil pointer dereference.

Consider adding a nil check for st:

-st, _ = status.FromError(err)
+st, _ := status.FromError(err)
+if st != nil {
    span.RecordError(err)
-   span.SetAttributes(trace.FromGRPCStatus(st.Code(), st.Massage())...)
+   span.SetAttributes(trace.FromGRPCStatus(st.Code(), st.Message())...)
    span.SetStatus(trace.StatusError, err.Error())
+}

216-216: Typo in method name Massage

This is the same typo as previously mentioned. Replace Massage() with Message() to correct the method call.

Apply this diff to fix the typo:

-span.SetAttributes(trace.FromGRPCStatus(st.Code(), st.Massage())...)
+span.SetAttributes(trace.FromGRPCStatus(st.Code(), st.Message())...)

pkg/agent/core/ngt/handler/grpc/object.go Outdated Show resolved Hide resolved
pkg/agent/core/ngt/handler/grpc/object.go Outdated Show resolved Hide resolved
pkg/agent/core/ngt/handler/grpc/upsert.go Outdated Show resolved Hide resolved
pkg/agent/core/ngt/handler/grpc/upsert.go Outdated Show resolved Hide resolved
pkg/agent/core/ngt/handler/grpc/linear_search.go Outdated Show resolved Hide resolved
pkg/agent/core/ngt/handler/grpc/search.go Outdated Show resolved Hide resolved
pkg/agent/core/ngt/handler/grpc/search.go Outdated Show resolved Hide resolved
pkg/agent/core/ngt/handler/grpc/search.go Outdated Show resolved Hide resolved
pkg/agent/core/ngt/handler/grpc/search.go Outdated Show resolved Hide resolved
pkg/agent/core/ngt/handler/grpc/search.go Outdated Show resolved Hide resolved
Copy link

cloudflare-workers-and-pages bot commented Oct 2, 2024

Deploying vald with  Cloudflare Pages  Cloudflare Pages

Latest commit: b55e795
Status: ✅  Deploy successful!
Preview URL: https://d57090aa.vald.pages.dev
Branch Preview URL: https://refactor-pkg-fix-agent-handl.vald.pages.dev

View logs

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 7

🧹 Outside diff range and nitpick comments (2)
pkg/agent/core/ngt/handler/grpc/linear_search.go (2)

347-350: Approved changes with a minor suggestion.

The modifications in this segment improve error handling and fix previous issues:

  1. Using status.FromError(err) simplifies error parsing.
  2. Properly declaring st with := resolves the undefined variable issue.
  3. Correcting Massage() to Message() fixes the method name typo.

These changes enhance code correctness and readability.

Consider using a more descriptive variable name than st, such as errStatus, to improve code clarity:

-				st, _ := status.FromError(err)
-				if st != nil && sspan != nil {
+				errStatus, _ := status.FromError(err)
+				if errStatus != nil && sspan != nil {
 					sspan.RecordError(err)
-					sspan.SetAttributes(trace.FromGRPCStatus(st.Code(), st.Message())...)
+					sspan.SetAttributes(trace.FromGRPCStatus(errStatus.Code(), errStatus.Message())...)
 					sspan.SetStatus(trace.StatusError, err.Error())
 				}

Issues Identified in pkg/agent/core/ngt/handler/grpc/linear_search.go

The verification script has uncovered several issues that need to be addressed:

  1. Undefined sspan Variable:

    • Multiple instances where sspan is used without consistent definition or scope management.
  2. Incorrect Use of err Instead of errs:

    • Numerous occurrences of err.Error() suggest that err is being used in places where errs should be utilized.
  3. Use of st Variable:

    • The variable st is frequently used, which may lead to ambiguity and reduce code clarity. Consider using more descriptive names like status or errorStatus.

Category:

🔗 Analysis chain

Line range hint 1-546: Summary of changes and recommendations

The modifications throughout this file have consistently improved error handling and status reporting by:

  1. Replacing status.ParseError with status.FromError.
  2. Correcting the method name from Massage() to Message().
  3. Properly declaring status variables using :=.

However, several issues need to be addressed across the entire file:

  1. Resolve the undefined sspan variable by consistently using either span or sspan.
  2. Correct instances where err is used instead of errs.
  3. Use more descriptive variable names, e.g., errStatus instead of st.

To improve code maintainability and reduce the likelihood of similar issues in the future, consider implementing a helper function for error status setting and span updates, as suggested in the previous comment.

To ensure all instances of these issues are addressed, please run the following script:

This script will help identify any remaining instances of the issues discussed in the review.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
echo "Checking for potential issues:"
echo "1. Undefined sspan variable:"
rg --type go 'sspan' pkg/agent/core/ngt/handler/grpc/linear_search.go
echo "2. Incorrect use of err instead of errs:"
rg --type go 'err\.Error\(\)' pkg/agent/core/ngt/handler/grpc/linear_search.go
echo "3. Use of st variable:"
rg --type go '\bst\b' pkg/agent/core/ngt/handler/grpc/linear_search.go

Length of output: 4850

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between b9cb6a2 and 4d14221.

📒 Files selected for processing (7)
  • pkg/agent/core/ngt/handler/grpc/insert.go (2 hunks)
  • pkg/agent/core/ngt/handler/grpc/linear_search.go (8 hunks)
  • pkg/agent/core/ngt/handler/grpc/object.go (2 hunks)
  • pkg/agent/core/ngt/handler/grpc/remove.go (3 hunks)
  • pkg/agent/core/ngt/handler/grpc/search.go (8 hunks)
  • pkg/agent/core/ngt/handler/grpc/update.go (2 hunks)
  • pkg/agent/core/ngt/handler/grpc/upsert.go (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (6)
  • pkg/agent/core/ngt/handler/grpc/insert.go
  • pkg/agent/core/ngt/handler/grpc/object.go
  • pkg/agent/core/ngt/handler/grpc/remove.go
  • pkg/agent/core/ngt/handler/grpc/search.go
  • pkg/agent/core/ngt/handler/grpc/update.go
  • pkg/agent/core/ngt/handler/grpc/upsert.go
🧰 Additional context used
🪛 GitHub Check: grpc-sequential
pkg/agent/core/ngt/handler/grpc/linear_search.go

[failure] 367-367:
undefined: sspan


[failure] 416-416:
undefined: sspan


[failure] 477-477:
undefined: err


[failure] 478-478:
undefined: sspan


[failure] 479-479:
undefined: err


[failure] 539-539:
undefined: err


[failure] 540-540:
undefined: sspan


[failure] 541-541:
undefined: err

🪛 GitHub Check: grpc-stream
pkg/agent/core/ngt/handler/grpc/linear_search.go

[failure] 367-367:
undefined: sspan


[failure] 416-416:
undefined: sspan


[failure] 477-477:
undefined: err


[failure] 478-478:
undefined: sspan


[failure] 479-479:
undefined: err


[failure] 539-539:
undefined: err


[failure] 540-540:
undefined: sspan


[failure] 541-541:
undefined: err

pkg/agent/core/ngt/handler/grpc/linear_search.go Outdated Show resolved Hide resolved
pkg/agent/core/ngt/handler/grpc/linear_search.go Outdated Show resolved Hide resolved
pkg/agent/core/ngt/handler/grpc/linear_search.go Outdated Show resolved Hide resolved
pkg/agent/core/ngt/handler/grpc/linear_search.go Outdated Show resolved Hide resolved
coderabbitai[bot]
coderabbitai bot previously approved these changes Oct 2, 2024
@datelier datelier changed the title modify ParseError to FromError for agent handler [WIP] modify ParseError to FromError for agent handler Oct 2, 2024
@datelier datelier changed the title [WIP] modify ParseError to FromError for agent handler modify ParseError to FromError for agent handler Oct 3, 2024
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.

4 participants