Skip to content

fix(web/default): guard playground messages against legacy classic shape#4650

Open
feitianbubu wants to merge 1 commit intoQuantumNous:mainfrom
feitianbubu:pr/afe9c4c16cfe3b702008bfd7eedf30b46d21f810
Open

fix(web/default): guard playground messages against legacy classic shape#4650
feitianbubu wants to merge 1 commit intoQuantumNous:mainfrom
feitianbubu:pr/afe9c4c16cfe3b702008bfd7eedf30b46d21f810

Conversation

@feitianbubu
Copy link
Copy Markdown
Contributor

@feitianbubu feitianbubu commented May 6, 2026

⚠️ 提交说明 / PR Notice

修复新版UI, playground 获取playground_messages时
由于浏览器localstorage与旧版 结构不一致 导致报错问题

📸 运行证明 / Proof of Work

修复前:
image
image

修复后:
image

Summary by CodeRabbit

  • Bug Fixes
    • Improved reliability of stored messages by adding enhanced validation and data integrity checks to prevent crashes or errors from corrupted data.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 6, 2026

Walkthrough

The loadMessages function in the storage module is hardened to safely parse and validate stored messages. It now treats parsed values as unknown, verifies array validity, removes invalid data from storage, and persists sanitized results back to localStorage to prevent repeated sanitization.

Changes

Message Storage Hardening

Layer / File(s) Summary
Validation & Persistence Logic
web/default/src/features/playground/lib/storage.ts
loadMessages now parses stored values as unknown, validates they are arrays, removes invalid entries from storage, sanitizes via type casting, and persists the sanitized result if it differs from the parsed value.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 A hare hops through data with care,
Checking each message with vigilant stare,
No stray bits shall pass through my gate,
For validation and safety are truly first-rate!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title directly addresses the main change: hardening message parsing to handle legacy storage format inconsistencies in the playground feature.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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