Handle jsonl - #172
Conversation
⚡ A2UI Composer PR PreviewYour automated preview is successfully live (commit
|
There was a problem hiding this comment.
Code Review
This pull request refactors the workspace by modularizing several services, including origin verification, payload parsing, error formatting, file ingestion, URL validation, and sharing. It also introduces base classes for selectors, adds event tracking directives, and removes the mock rules debug component. The review feedback focuses on hardening string processing utility methods (such as tryParseJsonArray, parseAndHealJsonLines, and attemptSyntaxHealing) with guard clauses to handle nullish or undefined inputs safely, as well as retaining fallback logic and tests for parsing single JSON objects to ensure backwards compatibility.
2d52e14 to
76d15bb
Compare
Update tryParseJsonArray in shell utils/json.ts to parse:
- Standard JSON arrays ([...])
- Single JSON objects ({...} -> [obj])
- JSON Lines ({...}\n{...} -> [obj1, obj2, ...])
Update RawFrame to use tryParseJsonArray when parsing layout JSON.
Update ChatCleaner to validate layout snapshots using isLayoutArray.
Add unit tests covering JSON Lines, single objects, and edge cases.
- Add nullish guard clause to tryParseJsonArray in shell utils/json.ts. - Add unit tests for null and undefined inputs across JSON and parser specs. - Verify single JSON object fallback parsing and JSON Lines support.
Description
Multi-Format Layout Parser (JSON, JSONL, Single-Object)
Pre-launch Checklist
If you need help, consider asking for advice on the [discussion board].