Skip to content
This repository was archived by the owner on Sep 11, 2025. It is now read-only.

Conversation

@mattjohnsonpint
Copy link
Contributor

Fixes #903

@mattjohnsonpint mattjohnsonpint requested review from a team and Copilot June 25, 2025 18:16
Copy link
Contributor

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 adds JSON validation for inference history entries to ensure only valid JSON is stored, adjusts database logging to mark certain errors as user-visible, and documents the change in the changelog.

  • Add gjson validation and error handling in getInferenceDataJson
  • Update logDbWarningOrError to include a user_visible flag on logged errors
  • Record the fix in CHANGELOG.md

Reviewed Changes

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

File Description
runtime/db/inferencehistory.go Renamed local variable, added gjson.ValidBytes check, and return error on invalid JSON
runtime/db/db.go Modified logger call to include user_visible metadata
CHANGELOG.md Added entry for v0.18.2 with JSON validation fix
Comments suppressed due to low confidence (2)

runtime/db/inferencehistory.go:181

  • Consider adding unit tests to cover both valid and invalid JSON inputs so the new validation logic is exercised and guarded against regressions.
	if !gjson.ValidBytes(result) {

runtime/db/inferencehistory.go:22

  • The code uses fmt.Errorf on line 182 but fmt is not imported; add import "fmt" to avoid a compilation error.
	"github.com/tidwall/gjson"

@mattjohnsonpint mattjohnsonpint enabled auto-merge (squash) June 25, 2025 18:20
@mattjohnsonpint mattjohnsonpint merged commit a2f2e3f into main Jun 25, 2025
33 checks passed
@mattjohnsonpint mattjohnsonpint deleted the mjp/jsonutf8 branch June 25, 2025 22:34
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Development

Successfully merging this pull request may close these issues.

ERROR: invalid byte sequence for encoding \"UTF8\": 0xf8 (SQLSTATE 22021)

3 participants