Skip to content

Add default response message type for v3 sparql#1794

Merged
n-h-diaz merged 4 commits intodatacommonsorg:masterfrom
n-h-diaz:n
Mar 3, 2026
Merged

Add default response message type for v3 sparql#1794
n-h-diaz merged 4 commits intodatacommonsorg:masterfrom
n-h-diaz:n

Conversation

@n-h-diaz
Copy link
Contributor

@n-h-diaz n-h-diaz commented Mar 3, 2026

There is nil dereference when fetching cached sparql response from redis, so this is setting the default message to UnmarshalTo (

if err := anyMsg.UnmarshalTo(response); err != nil {
)

image

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, 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 addresses a critical bug causing nil dereference errors when the system attempts to retrieve cached SPARQL v3 responses from Redis. By explicitly defining a default empty response object for SPARQL query types, the change prevents runtime crashes and enhances the robustness of the caching mechanism for SPARQL services.

Highlights

  • Bug Fix: Resolved a nil dereference error that occurred when fetching cached SPARQL v3 responses from Redis.
  • Feature Enhancement: Introduced a default response message type for SPARQL v3 queries to ensure proper initialization of cached responses.
Changelog
  • internal/server/redis/processor.go
    • Imported the pb package to access the QueryResponse type.
    • Added a new case in the newEmptyResponse function to return an empty pb.QueryResponse for dispatcher.TypeSparql.
    • Included error logging for unknown request types in newEmptyResponse.
  • internal/server/redis/processor_test.go
    • Imported the pb package for testing purposes.
    • Added a new test case to TestNewEmptyResponse to verify that dispatcher.TypeSparql correctly returns an empty pb.QueryResponse.
Activity
  • The pull request was opened by n-h-diaz.
  • No human activity (comments, reviews) has occurred yet.
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.

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.

@n-h-diaz n-h-diaz marked this pull request as ready for review March 3, 2026 22:29
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 correctly addresses a nil pointer dereference that occurs when fetching a cached sparql response. The fix involves handling the TypeSparql in newEmptyResponse to provide a default response message, and a corresponding test case has been added. My review includes a suggestion to make the default case in the switch statement more robust to prevent similar issues in the future.

@n-h-diaz n-h-diaz requested review from dhotchkiss and juliawu March 3, 2026 22:31
@juliawu
Copy link
Contributor

juliawu commented Mar 3, 2026

Thank you for the fix! Leaving approval to @dhotchkiss.

Copy link
Contributor

@dhotchkiss dhotchkiss left a comment

Choose a reason for hiding this comment

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

lgtm

(I miss the return / throw language of Java as opposed to the verbosity of (msg, err) but so it 'go'es)

@n-h-diaz n-h-diaz added this pull request to the merge queue Mar 3, 2026
Merged via the queue into datacommonsorg:master with commit 90fac6e Mar 3, 2026
5 checks passed
@n-h-diaz n-h-diaz deleted the n branch March 3, 2026 23:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants