Skip to content

Conversation

@lwnmengjing
Copy link
Member

fix: ensure non-empty results before returning from cache retrieval

Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

Fixes # (issue)

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Please also note any relevant details for your test configuration.

  • Test A
  • Test B

Test Configuration:

  • Firmware version:
  • Hardware:
  • Toolchain:
  • SDK:

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

fix: ensure non-empty results before returning from cache retrieval
@lwnmengjing lwnmengjing requested review from Copilot and mss-boot June 3, 2025 02:25
Copy link

Copilot AI left a comment

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 updates cache retrieval logic to only return results when non-empty, falling back otherwise.

  • service/app_config.go: added len(result) > 0 check before returning cached profile
  • apis/language.go: added len(keys) > 0 check before returning cached language response

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
service/app_config.go Only return cache result when non-empty
apis/language.go Only return cache response when keys slice is non-empty
Comments suppressed due to low confidence (1)

service/app_config.go:48

  • Consider adding a unit test to cover the case when err == nil but len(result) == 0, ensuring the fallback path is exercised.
if err == nil && len(result) > 0 {

@github-actions
Copy link

github-actions bot commented Jun 3, 2025

Field Coverage
total: 3.8%

…d microsoft/go-mssqldb

chore: update dependencies for aws-sdk-go-v2, spf13/cast, go-logr, and microsoft/go-mssqldb
@github-actions
Copy link

github-actions bot commented Jun 3, 2025

Field Coverage
total: 3.8%

@lwnmengjing lwnmengjing merged commit 925b899 into main Jun 3, 2025
1 check passed
@lwnmengjing lwnmengjing deleted the fix/cache-settings branch June 3, 2025 03:13
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