Skip to content

Epic 5 UI - #170

Merged
jgindin merged 7 commits into
mainfrom
epic-5-ui
Aug 21, 2026
Merged

Epic 5 UI#170
jgindin merged 7 commits into
mainfrom
epic-5-ui

Conversation

@jgindin

@jgindin jgindin commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Description

Fifth and final in a series of refactorings to clean up the A2UI Composer code.

UI Shell Encapsulation, CDK Share Service & Telemetry Directives

  • Introduces the declarative TrackEventDirective ([a2uiTrackEvent]) using modern Angular signal-based input() bindings.
  • Extracts ShareService backed by @angular/cdk/clipboard for robust clipboard operations.
  • Extracts FileIngestionService to decouple browser FileReader operations from UI components (ChatPanel).
  • Strips monolithic clipboard logic and normalizes component inputs and template bindings.

NOTE No e2e tests had to be changed.

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.

@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 A2UI Composer shell by modularizing several core features, including extracting payload parsing and syntax healing into a2ui-payload-parser, error formatting into ChatErrorFormatterService, file ingestion into FileIngestionService, and sharing capabilities into ShareService. It also introduces a base AbstractSelector for settings selectors, delegates startup state to StartupConfigStateService, and adds services for safe URL validation and screenshot capture. Feedback on these changes highlights several critical regressions and improvements: same-window messages should be allowed in preview-bridge.ts to avoid runtime regressions; the single JSON object fallback in a2ui-payload-parser.ts must be removed to comply with repository rules, while a nullish input guard should be added and the missing rules/mock* property filtering restored; the earlyMessageBuffer cleanup in host-communication.ts should be preserved to prevent memory leaks; and the gallery component should use @angular/cdk/clipboard for robust clipboard operations.

Comment thread bridge/src/preview-bridge.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.ts
Comment thread shell/src/app/chat/a2ui-payload-parser/a2ui-payload-parser.ts Outdated
Comment thread shell/src/app/shell/host-communication/host-communication.ts
Comment thread shell/src/app/gallery/gallery.ts Outdated
@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 c538c41):
👉 Launch PR Preview

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

@suyangw-g suyangw-g 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.

Summary & Stack Bookkeeping

Stacked on #169. Note the clipboard API change + telemetry implications and the intended gallery-copy tracking semantics. Inherited blockers from #166-#169 (sanitize filter, cleanPayload, prompt content, empty-payload guard, iframe unregistration) remain open on this branch — fixing them downstack and rebasing is cleaner than patching at the top.

Key Points

  1. Share Service: Don't downgrade the share path to synchronous CDK copy; restore async navigator.clipboard with CDK fallback for KB-scale URLs.
  2. Gallery Copy Telemetry: Restore success-conditioned copy telemetry rather than firing unconditionally on click via the directive.
  3. Change Detection: Restore ChangeDetectionStrategy.OnPush on Gallery and OriginConfirmationDialog.
  4. Preview Teardown (#169 fix): Restore registerIframe(ref?.nativeElement || null) so detached iframes are unregistered.
  5. Test Coverage: Backfill share tests lost during extraction, delegation tests, and directive error/param handling.
  6. Cleanups: Minor error message fix in ShareService and documentation for TrackEventDirective pre-click param evaluation.

Comment thread shell/src/app/shell/share/share.service.ts Outdated
Comment thread shell/src/app/gallery/gallery.ts
Comment thread shell/src/app/gallery/gallery.ng.html Outdated
Comment thread shell/src/app/gallery/gallery.ts
Comment thread shell/src/app/preview/rendered/rendered-frame.ts Outdated
Comment thread shell/src/app/shell/share/share.service.spec.ts
Comment thread shell/src/app/shell/share/share.service.ts Outdated
Comment thread shell/src/app/usage-tracking/track-event.directive.ts
@jgindin
jgindin force-pushed the epic-5-ui branch 2 times, most recently from 98c928d to 0eddfbc Compare August 21, 2026 17:14
…ngestion

- Implement TrackEventDirective applying declarative tracking boundaries natively.
- Construct FileIngestionService strictly leveraging @angular/cdk/clipboard utilities.
- Construct ShareService cleanly encapsulating clipboard interactions.
- Sweep all active standalone UI components throughout the app, converting default ChangeDetection behavior to ChangeDetectionStrategy.OnPush.
- Strip FileReader native accesses from ChatPanel into the FileIngestionService.
- Swap template tracking to the directive.
- Rip out the legacy shareDesign() bloated component implementation comprehensively.
- Delete deprecated inner test asserts and old inline code.
- Clear earlyMessageBuffer when unregistering iframe in
  HostCommunication.
- Inject CDK Clipboard service in Gallery for copying A2UI payloads.
- Update unit test suites to verify buffer clearing and CDK Clipboard
  mocking.
- Track gallery copy usage conditionally on successful clipboard copy
- Backfill comprehensive test suites for ShareService and TrackEventDirective
- Add composer shell share button delegation test
- Replace Angular CDK Clipboard with navigator.clipboard.writeText
- Update ShareService specs to mock native clipboard writeText
- Restore 'Shareable link copied to clipboard' format with KB size
- Update unit test assertions in share service spec
@jgindin
jgindin merged commit f06249f into main Aug 21, 2026
13 checks passed
@jgindin
jgindin deleted the epic-5-ui branch August 21, 2026 17:46
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.

3 participants