Skip to content

Gracefully handle nil returns in generic CacheResult#44

Merged
rekby merged 1 commit into
masterfrom
codex/analyze-code-and-suggest-interface-improvements
Oct 24, 2025
Merged

Gracefully handle nil returns in generic CacheResult#44
rekby merged 1 commit into
masterfrom
codex/analyze-code-and-suggest-interface-improvements

Conversation

@rekby

@rekby rekby commented Oct 24, 2025

Copy link
Copy Markdown
Owner

Summary

  • ensure the generic CacheResult helper returns the zero value when the cached payload is nil
  • add a regression test that verifies nil results stay cached and deserialize to typed nil values

Testing

  • go test ./...

@rekby rekby requested a review from Copilot October 24, 2025 20:41
@github-actions

Copy link
Copy Markdown

API Changes

summary

Base version: v0.7.0 (latest)
Suggested version: v0.7.1

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes a nil pointer dereference issue in the generic CacheResult helper function. When a cached fixture returns nil, the function now properly returns the zero value of the generic type instead of panicking during type assertion.

  • Added nil check before type assertion in CacheResult
  • Returns zero value of generic type when cached result is nil
  • Added regression test verifying nil results are cached and deserialize correctly

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
env_generic_sugar.go Added nil check to return zero value before type assertion
env_generic_sugar_test.go Added test case verifying nil results cache properly and return typed nil values

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@rekby rekby merged commit 03ac35e into master Oct 24, 2025
9 checks passed
@rekby rekby deleted the codex/analyze-code-and-suggest-interface-improvements branch October 24, 2025 20:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants