Repository navigation
refactor(core): Enhance error redaction and factory initialization - #813
Merged
Merged
Conversation
- Improves `redactErrorText` to preserve plain exception class names by restricting redaction to tokens containing digits. - Updates OpenAI compatible model factories to pass settings context when initializing telemetry listeners. - Provides more specific telemetry provider keys based on model templates where applicable. BREAKING CHANGE: The `redactErrorText` function now uses a more precise regex, ensuring that exception class names are preserved during error reporting, as redaction is only applied to opaque tokens containing digits.
There was a problem hiding this comment.
🟡 Changes recommended
The change still exposes digitless secrets or opaque identifiers and breaks template-specific provider reporting because its key format is incompatible with existing telemetry consumers.
2 open issues
What changed in this PR
This pull request refines error redaction and makes OpenAI-compatible telemetry initialization aware of provider settings and model templates.
Changes:
- Updates error-text redaction and adds regression coverage for exception class names.
- Passes provider settings into telemetry listener creation.
- Adds template-specific telemetry provider keys.
| File | Description |
|---|---|
| shared-jvm/src/test/kotlin/io/askimo/core/util/TextUtilsTest.kt | Adds regression tests covering preservation of exception class names during error redaction. |
| shared-jvm/src/main/kotlin/io/askimo/core/util/TextUtils.kt | Updates bare-token error redaction behavior. |
| shared-jvm/src/main/kotlin/io/askimo/core/providers/openaicompatible/OpenAiCompatibleModelFactory.kt | Adds template-aware telemetry provider keys and passes provider settings to listeners. |
| shared-jvm/src/main/kotlin/io/askimo/core/providers/openaicompatible/OpenAiCompatibleChatModelFactory.kt | Extends telemetry listener initialization to receive provider settings. |
Review effort: Lite
| .replace(Regex("""(?:[A-Za-z]:\\|/)[\w./\\-]{3,}"""), "[path]") | ||
| .replace(Regex("""\b[A-Za-z0-9_-]{16,}\b"""), "[id]") | ||
| // Bare opaque tokens are redacted, except PascalCase ...Exception/...Error names. | ||
| .replace(Regex("""\b(?!(?:[A-Z][A-Za-z]+(?:Exception|Error))\b)[A-Za-z0-9_-]{16,}\b"""), "[id]") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
Related Issue(s)
redactErrorTextto preserve plain exception class names by restricting redaction to tokens containing digits.Type of Change
What Changed & Why
How to Test
./gradlew testScreenshots / Recordings (if applicable)
Checklist
main./gradlew spotlessApplyand./gradlew detektlocally./gradlew testand all tests passgit commit -sAdditional Notes