Skip to content

Handle jsonl - #172

Merged
jgindin merged 2 commits into
mainfrom
handle-jsonl
Aug 21, 2026
Merged

Handle jsonl#172
jgindin merged 2 commits into
mainfrom
handle-jsonl

Conversation

@jgindin

@jgindin jgindin commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Description

Multi-Format Layout Parser (JSON, JSONL, Single-Object)

  • Enhances tryParseJsonArray in utils/json.ts to parse standard JSON arrays ([...]), single JSON objects ({...} → [obj]), and streaming JSON Lines ({...}\n{...}).
  • Updates RawFrame and ChatCleaner to use unified JSONL-tolerant parsing and layout snapshot validation.
  • Adds comprehensive unit tests covering single objects, multi-line JSONL streams, and malformed edge cases.

Pre-launch Checklist

  • I signed the [CLA].
  • I read the [Contributors Guide].
  • I read the [Style Guide].
  • I have added updates to the [CHANGELOG].
  • I updated/added relevant documentation.
  • My code changes (if any) have tests.
  • If my branch is on fork, I have verified that scripts/e2e_test.sh passes.

If you need help, consider asking for advice on the [discussion board].

@github-actions

github-actions Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

⚡ A2UI Composer PR Preview

Your automated preview is successfully live (commit e9cc060):
👉 Launch PR Preview

Note: This environment will be wiped automatically when the PR is merged or closed.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread shell/src/app/utils/json.ts Outdated
Comment thread shell/src/app/chat/a2ui-payload-parser/a2ui-payload-parser.ts Outdated
Comment thread shell/src/app/chat/a2ui-payload-parser/a2ui-payload-parser.ts Outdated
Comment thread shell/src/app/utils/json.spec.ts
@jgindin jgindin self-assigned this Aug 19, 2026
@jgindin
jgindin force-pushed the handle-jsonl branch 7 times, most recently from 2d52e14 to 76d15bb Compare August 21, 2026 18:02
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.
@jgindin
jgindin merged commit 42e0976 into main Aug 21, 2026
13 checks passed
@jgindin
jgindin deleted the handle-jsonl branch August 21, 2026 19:54
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.

2 participants