Skip to content

[spark-compete] fix: guard json.loads in voice_judge.py - #327

Open
huzaifakhan98 wants to merge 1 commit into
vibeforge1111:masterfrom
huzaifakhan98:fix/guard-json-src-spark_character-voice_judge
Open

[spark-compete] fix: guard json.loads in voice_judge.py#327
huzaifakhan98 wants to merge 1 commit into
vibeforge1111:masterfrom
huzaifakhan98:fix/guard-json-src-spark_character-voice_judge

Conversation

@huzaifakhan98

@huzaifakhan98 huzaifakhan98 commented Jun 28, 2026

Copy link
Copy Markdown

Spark Compete Packet

{
  "schema": "spark-compete-hotfix-v1",
  "event": "spark-compete-first-event",
  "submission_mode": "public_repo_pr",
  "submission_target_url": "https://github.com/vibeforge1111/spark-character/pull/327",
  "team": {
    "name": "AKDAO",
    "members": [
      "huzaifakhan98",
      "friend_member_1",
      "friend_member_2"
    ],
    "llm_device_holder": "huzaifakhan98",
    "device_holder_github": "huzaifakhan98",
    "github_accounts": [
      "huzaifakhan98"
    ]
  },
  "target_repo": {
    "id": "vibeforge1111/spark-character",
    "source": "https://github.com/vibeforge1111/spark-character",
    "owner_surface": "character"
  },
  "issue": {
    "type": "bug",
    "severity": "medium",
    "title": "fix: guard json.loads in voice_judge.py",
    "actual_behavior": "Raw json.loads in src/spark_character/voice_judge.py is completely unguarded. If input JSON is corrupted or malformed, it raises an unhandled JSONDecodeError and crashes.",
    "expected_behavior": "The json.loads statement should be wrapped in try-except block throwing meaningful RuntimeErrors.",
    "repro_steps": [
      "1. Inject malformed JSON into input parsed by voice_judge.py.",
      "2. Run execution workflow.",
      "3. Observe unhandled JSONDecodeError traceback and crash."
    ],
    "affected_workflow": "JSON parsing in voice_judge.py"
  },
  "evidence": {
    "safe_links_only": true,
    "before_after_proof": "Wrapped raw json.loads in try-except in src/spark_character/voice_judge.py.",
    "links": [
      "https://github.com/vibeforge1111/spark-character"
    ],
    "forbidden": [
      "tokens",
      "raw logs",
      "private repo maps"
    ]
  },
  "proposed_fix": {
    "approach": "Wrap json.loads in try-except block catching (json.JSONDecodeError, OSError).",
    "files_expected": [
      "src/spark_character/voice_judge.py"
    ],
    "tests_or_smoke": "manual review"
  },
  "pr": {
    "branch": "fix/guard-json-src-spark_character-voice_judge",
    "title_prefix": "[spark-compete]",
    "author_github": "huzaifakhan98",
    "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/327"
  },
  "review_claim": {
    "impact_claim": "medium",
    "evidence_types": [
      "smoke_test"
    ],
    "duplicate_notes": "First automated fix for this JSON parsing crash.",
    "risk_notes": "Low risk try-except block addition.",
    "review_state_requested": "pr_review"
  }
}

Description

Wrapped unguarded json.loads in src/spark_character/voice_judge.py to catch JSONDecodeError and OSError, returning a clean RuntimeError instead of crashing the process.

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.

1 participant