Skip to content

Disable cache in debug#1316

Merged
iceljc merged 2 commits intoSciSharp:masterfrom
iceljc:master
Mar 27, 2026
Merged

Disable cache in debug#1316
iceljc merged 2 commits intoSciSharp:masterfrom
iceljc:master

Conversation

@iceljc
Copy link
Copy Markdown
Collaborator

@iceljc iceljc commented Mar 27, 2026

No description provided.

@iceljc iceljc merged commit f577a05 into SciSharp:master Mar 27, 2026
0 of 4 checks passed
@qodo-code-review
Copy link
Copy Markdown
Contributor

Review Summary by Qodo

Disable cache in debug mode and code cleanup

✨ Enhancement 📦 Other

Grey Divider

Walkthroughs

Description
• Disable caching in DEBUG mode for knowledge base configs • Reorganize method placement in MembaseGraphDb class • Remove unused imports from plugin files 
Diagram
flowchart LR A["Cache Attribute"] -->|Conditional Compilation| B["#if !DEBUG"] B -->|Wraps SharpCache| C["Knowledge Config Methods"] D["MembaseGraphDb"] -->|Refactor| E["Move BuildRetryPolicy"] E -->|To End| F["After ExecuteQueryAsync"] G["Unused Imports"] -->|Remove| H["DemoRuleGraph & MembaseSettings"] 
Loading

Grey Divider

File Changes

1. src/Infrastructure/BotSharp.Core/Repository/FileRepository/FileRepository.KnowledgeBase.cs ✨ Enhancement +3/-1

Conditionally disable cache in debug builds

• Wrap [SharpCache(10)] attribute with #if !DEBUG preprocessor directive • Disable caching for GetKnowledgeCollectionConfig method in debug builds • Fix indentation of #endregion comment 

src/Infrastructure/BotSharp.Core/Repository/FileRepository/FileRepository.KnowledgeBase.cs


2. src/Plugins/BotSharp.Plugin.Membase/GraphDb/MembaseGraphDb.cs Miscellaneous +26/-25

Reorganize BuildRetryPolicy method placement

• Move BuildRetryPolicy() method from beginning to end of class • Reorganize method placement for better code structure • No functional changes to retry policy logic 

src/Plugins/BotSharp.Plugin.Membase/GraphDb/MembaseGraphDb.cs


3. src/Plugins/BotSharp.Plugin.Membase/Services/DemoRuleGraph.cs Code cleanup +0/-4

Remove unused namespace imports

• Remove unused imports: BotSharp.Abstraction.Graph • Remove unused imports: BotSharp.Abstraction.Graph.Models • Remove unused imports: Microsoft.Extensions.Logging • Remove unused imports: System.Text.Json 

src/Plugins/BotSharp.Plugin.Membase/Services/DemoRuleGraph.cs


View more (2)
4. src/Plugins/BotSharp.Plugin.Membase/Settings/MembaseSettings.cs Code cleanup +0/-2

Remove unused Graph Models import

• Remove unused import: BotSharp.Abstraction.Graph.Models • Remove blank line after removed import 

src/Plugins/BotSharp.Plugin.Membase/Settings/MembaseSettings.cs


5. src/Plugins/BotSharp.Plugin.MongoStorage/Repository/MongoRepository.KnowledgeBase.cs ✨ Enhancement +2/-0

Conditionally disable cache in debug builds

• Wrap [SharpCache(10)] attribute with #if !DEBUG preprocessor directive • Disable caching for GetKnowledgeCollectionConfig method in debug builds • Consistent with FileRepository implementation 

src/Plugins/BotSharp.Plugin.MongoStorage/Repository/MongoRepository.KnowledgeBase.cs


Grey Divider

Qodo Logo

@qodo-code-review
Copy link
Copy Markdown
Contributor

qodo-code-review bot commented Mar 27, 2026

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (1) 📎 Requirement gaps (0) 📐 Spec deviations (0)

Grey Divider


Action required

1. Logs raw ex.Message 📘 Rule violation ⛨ Security
Description
The retry logger records the raw exception message (ex.Message), which may include sensitive user/provider content or internal configuration details depending on the thrown exception. This violates the requirement to avoid logging sensitive content and to keep logs minimal/structured. 
Code

src/Plugins/BotSharp.Plugin.Membase/GraphDb/MembaseGraphDb.cs[R84-87]

+ _logger.LogWarning(ex, + "CypherQueryAsync retry {RetryAttempt}/{MaxRetries} after {Delay}s. Exception: {Message}", + retryAttempt, RetryCount, timespan.TotalSeconds, ex.Message); + });
Evidence
PR Compliance ID 3 requires avoiding sensitive content and internal configuration in logs; the newly-added retry log explicitly includes ex.Message, which is unbounded/unstructured content originating from exception text. 

src/Plugins/BotSharp.Plugin.Membase/GraphDb/MembaseGraphDb.cs[84-87]
Best Practice: Learned patterns

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution ## Issue description The retry log includes `ex.Message`, which may contain sensitive user/provider payloads or internal configuration details. ## Issue Context Compliance requires logs to exclude sensitive content and avoid exposing internal configuration values; logs should prefer minimal, structured metadata. ## Fix Focus Areas - src/Plugins/BotSharp.Plugin.Membase/GraphDb/MembaseGraphDb.cs[84-87] 

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Qodo Logo

Comment on lines +84 to +87
_logger.LogWarning(ex,
"CypherQueryAsync retry {RetryAttempt}/{MaxRetries} after {Delay}s. Exception: {Message}",
retryAttempt, RetryCount, timespan.TotalSeconds, ex.Message);
});
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Action required

1. Logs raw ex.message 📘 Rule violation ⛨ Security

The retry logger records the raw exception message (ex.Message), which may include sensitive user/provider content or internal configuration details depending on the thrown exception. This violates the requirement to avoid logging sensitive content and to keep logs minimal/structured. 
Agent Prompt
## Issue description The retry log includes `ex.Message`, which may contain sensitive user/provider payloads or internal configuration details. ## Issue Context Compliance requires logs to exclude sensitive content and avoid exposing internal configuration values; logs should prefer minimal, structured metadata. ## Fix Focus Areas - src/Plugins/BotSharp.Plugin.Membase/GraphDb/MembaseGraphDb.cs[84-87] 

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

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

Labels

None yet

1 participant