[spark-compete] fix(character): handle malformed JSON in voice_judge _load_corpus - #124
Open
ifeoluwaaj wants to merge 2 commits into
Open
[spark-compete] fix(character): handle malformed JSON in voice_judge _load_corpus#124ifeoluwaaj wants to merge 2 commits into
ifeoluwaaj wants to merge 2 commits into
Conversation
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.
{ "schema": "spark-compete-hotfix-v1", "event": "hotfix.submitted", "submission_mode": "pull_request", "submission_target_url": "https://github.com/vibeforge1111/spark-character/pull/54", "team": { "name": "Sequence", "members": [ "ifesn", "micc9ee", "londitshabalala", "ifeoluwaaj" ], "device_holder_github": "ifeoluwaaj", "device_holder_llm": "ifesn" }, "target_repo": "vibeforge1111/spark-character", "issue": { "type": "bug", "severity": "MEDIUM", "description": "handle malformed JSON in voice_judge _load_corpus", "title": "Unhandled JSONDecodeError in voice_judge _load_corpus crashes scoring pipeline", "actual_behavior": "_load_corpus crashes with unhandled JSONDecodeError if corpus files are malformed", "expected_behavior": "Should return empty list and let scoring continue gracefully", "repro_steps": [ "Create a malformed JSON corpus file", "Call score_distinctiveness", "Observe unhandled crash" ], "affected_workflow": "T2 distinctiveness scoring pipeline", "category": "reliability" }, "evidence": { "safe_links_only": true, "before_after_proof": "BEFORE: malformed corpus crashes entire scoring pipeline. AFTER: returns empty list gracefully", "links": [ "https://github.com/vibeforge1111/spark-character/pull/54" ], "forbidden": [ "pdf", "zip", "exe", "unknown downloads", "shortened links", "archives", "binaries", "tokens", "browser cookies", "wallet material", "raw logs", "raw conversations", "raw memory", "raw patches", "private repo maps", "private scoring details" ], "type": "code_review", "files": [] }, "proposed_fix": { "approach": "Added try/except around json.loads to return empty list on parse failure", "files_expected": [ "src/spark_character/voice_judge.py (+4 lines: try/except wrapper)" ], "tests_or_smoke": "PYTHONPATH=src python3 -c \"import ast; ast.parse(open('src/spark_character/voice_judge.py').read()); print('Syntax OK')\"", "summary": "Applied fix", "files_changed": [] }, "pr": { "branch": "fix/voice-judge-json-parse", "title_prefix": "[spark-compete]", "author_github": "ifeoluwaaj", "body_must_include": [ "packet", "team", "pr_author", "repo", "actual_behavior", "expected_behavior", "repro_steps", "before_after_proof", "tests_or_smoke", "duplicate_notes", "risk_notes", "review_claim" ], "url": "https://github.com/vibeforge1111/spark-character/pull/54" }, "review_claim": { "impact_claim": "medium", "evidence_types": [ "smoke_test" ], "duplicate_notes": "PR #37 was closed without merge. No existing open PR for this bug.", "risk_notes": "Returns empty list on parse failure, safe default for scoring", "review_state_requested": "pr_review", "duplicate": false, "security_safe": true, "public_safe": true } }Team: Sequence
Bug Summary
What:
_load_corpusinvoice_judge.pycrashes with unhandledJSONDecodeErrorif the golden or foil corpus files are malformed.Actual behavior: Any malformed corpus file crashes the entire T2 distinctiveness scoring pipeline with an unhandled exception.
Expected behavior: Should return an empty list and let scoring continue gracefully.
Repro steps:
score_distinctivenessorscore_distinctiveness_asyncJSONDecodeErrorcrashRoot Cause
In
src/spark_character/voice_judge.py, line 52,json.loadsis called without error handling:Fix
Added try/except to return empty list on parse failure:
Before (The Bug)
After (The Fix)
Files Changed
src/spark_character/voice_judge.py— Added try/except in_load_corpus(+4/-1 lines)Duplicate Notes
No known duplicate PRs.
Risk Notes
Minimal risk.