Skip to content

Epic 4 bridge - #169

Open
jgindin wants to merge 12 commits into
mainfrom
epic-4-bridge
Open

Epic 4 bridge#169
jgindin wants to merge 12 commits into
mainfrom
epic-4-bridge

Conversation

@jgindin

@jgindin jgindin commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Description

Fourth in a series of refactorings intended to clean up the A2UI Composer code.

Storage Consolidation & Host Communication Decoupling

  • Unifies IndexedDB storage handling across catalogs and secure credentials through a shared AbstractIdbStorage base class.
  • Replaces static html2canvas imports with dynamic, deferred loading inside ScreenshotCaptureService to reduce initial bundle size.
  • Decouples monolithic cross-frame postMessage listeners in HostCommunication into modular message routing handlers.
  • Cleans up legacy storage keys and un-deferred communication layout code.

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].

jgindin added 12 commits August 18, 2026 12:17
Create SafeUrlValidatorService for http/https validation.
Create DomainOriginVerificationService for strict iframe networking validation.
Wire bypassSecurityTrustResourceUrl inside rendered-frame.ts through the rigorous URL validator.
Swap the check in preview-bridge.ts for the strict origin verification.
Fix LLM concurrency in ChatCoordinator submitPrompt.
Fix Monaco model.dispose() in a2ui-composer-monaco-editor.
Inject takeUntilDestroyed in api-key-selector.ts and renderer-selector.ts.
Delete debug/mock-rules/ entirely.
Rip out console.error patch hacks from ChatCoordinator.
Delete obsolete storage key ACTIVE_DRAFT.
…ks into decoupled targets accurately abandoning monolithic arrays globally
…mentations and un-deferred webrtc layout code gracefully

@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 chat panel and startup resolution architecture by extracting payload parsing, error formatting, system prompt generation, and environment context into dedicated services. It also introduces a shared AbstractSelector base class for settings selectors, adds safe URL validation for the renderer, and removes the MockRules component. The review feedback highlights a critical security vulnerability in the origin verification service where query-parameter origins are trusted blindly. Additionally, a regression was identified in the payload sanitization logic that fails to strip rules and mock* properties, along with suggestions to harden utility methods against nullish inputs and replace a deprecated substr() call in the Monaco editor wrapper.

Comment thread bridge/src/domain-origin-verification.ts
Comment thread shell/src/app/chat/a2ui-payload-parser/a2ui-payload-parser.ts
Comment thread shell/src/app/chat/a2ui-payload-parser/a2ui-payload-parser.spec.ts
Comment on lines +93 to +94
export function attemptSyntaxHealing(line: string): unknown | null {
let patched = line.trim();

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.

medium

Following the general rules for string processing utility methods, we should harden attemptSyntaxHealing with a guard clause to safely handle nullish or undefined inputs by returning a safe default (null), preventing potential runtime crashes. Please also ensure corresponding unit tests are added to verify resilience against nullish values.

Suggested change
export function attemptSyntaxHealing(line: string): unknown | null {
let patched = line.trim();
export function attemptSyntaxHealing(line: string | null | undefined): unknown | null {
if (!line) {
return null;
}
let patched = line.trim();
References
  1. Harden string processing utility methods with guard clauses to safely handle nullish or undefined inputs by returning safe defaults, and ensure corresponding unit tests are added to verify resilience against nullish values.

Comment on lines +31 to +32
export function parseAndHealJsonLines(content: string): ParseResult {
let wasHealed = false;

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.

medium

Following the general rules for string processing utility methods, we should harden parseAndHealJsonLines with a guard clause to safely handle nullish or undefined inputs by returning a safe default (empty blocks), preventing potential runtime crashes. Please also ensure corresponding unit tests are added to verify resilience against nullish values.

Suggested change
export function parseAndHealJsonLines(content: string): ParseResult {
let wasHealed = false;
export function parseAndHealJsonLines(content: string | null | undefined): ParseResult {
if (!content) {
return {blocks: [], wasHealed: false};
}
let wasHealed = false;
References
  1. Harden string processing utility methods with guard clauses to safely handle nullish or undefined inputs by returning safe defaults, and ensure corresponding unit tests are added to verify resilience against nullish values.

Comment thread shell/src/app/shared/monaco-editor/monaco-editor.ts
@github-actions

Copy link
Copy Markdown
Contributor

⚡ A2UI Composer PR Preview

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

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

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