Repository navigation
Cleanup test output - #245
Conversation
Align @vitest/coverage-v8 version to 4.1.11 matching vitest. Enable silent: 'passed-only' in vitest configs across all workspaces. Suppress @a2ui/web_core outside-package sourcemap warnings and AnalogJS esbuildOptions deprecation warnings via Vite config and plugin hooks. Filter framework dev logs and mock negative-path console spies in tests.
Ensure vi.hoisted and vi.mock calls in monaco-editor, raw-frame, and settings specs reside at module top level and configure vitest angular plugin to avoid wrapping test modules in CommonJS closures.
There was a problem hiding this comment.
Code Review
This pull request refactors logging across the application by replacing direct console calls with a structured ErrorLogger service and updates Vitest configurations to suppress third-party framework warnings. While these changes improve log management, a critical issue was identified in catalog-management.ts where removing {allowSignalWrites: true} from an Angular effect will cause a runtime crash. Additionally, several refactored utility functions in cross-frame-validator.ts and query-parser.ts now require a logger parameter, which breaks backward compatibility; defaulting this parameter to console is recommended to preserve compatibility.
⚡ A2UI Composer PR PreviewYour automated preview is successfully live (commit
|
Replace raw console error and warning logging throughout shell components and services with ErrorLogger and TaggedLogger instances. Require TaggedLogger on CrossFrameValidator and QueryParser static methods to route diagnostic events through ErrorLogger. Refactor CatalogManagement to replace effect() with Angular resource, linkedSignal, and computed. Update test suites to spy on ErrorLogger instead of console methods.
336d8c7 to
feac7fb
Compare
…across the shell The rebased Gallery logs its load, dispatch, and copy failures through a tagged ErrorLogger instead of console, and its tests spy on ErrorLogger.
…across the shell The rebased Gallery logs its load, dispatch, and copy failures through a tagged ErrorLogger instead of console, and its tests spy on ErrorLogger.
a2ui-project#245 does a2ui-project#245 routes shell logging through ErrorLogger and makes CrossFrameValidator take a logger. The demo card, the demo frame dispatch, and the new message checks now pass theirs, and buildRendererUrl takes the caller's logger.
a2ui-project#245 does a2ui-project#245 routes shell logging through ErrorLogger and makes CrossFrameValidator take a logger. The demo card, the demo frame dispatch, and the new message checks now pass theirs, and buildRendererUrl takes the caller's logger.
a2ui-project#245 does a2ui-project#245 routes shell logging through ErrorLogger and makes CrossFrameValidator take a logger. The demo card, the demo frame dispatch, and the new message checks now pass theirs, and buildRendererUrl takes the caller's logger.
* feat(demos): add an interactive bento demo wall Browse live examples from the selected renderer in a responsive bento grid, then open one in Composer to edit its A2UI. Renderers serve their demos over the bridge (GET_DEMOS / getDemos, returning a name, description, and A2UI messages for each), mirroring GET_COMPONENT_USAGES, so the shell stays renderer-agnostic. - Angular, Lit, and React provide the same four shared showcases and 43 pinned catalog examples; shared JSON sources are validated before generating renderer modules. - Bundled adapters report when their first surface has rendered, so the wall reveals real content without a fixed measurement wait; older external adapters keep the measurement fallback, and a renderer that never finishes reports an error. - Sandboxed frames mount lazily with a cap, replies are filtered by source window, and wide previews are fitted without clipping. - Open in Composer loads the example through the shared-design route. * fix(bridge): coalesce SURFACE_RESIZE bursts and drop repeated reports The demo protocol's readiness reports (contentReady false, then true) add to the reports a renderer sends while its first surface settles. With React's layout passes that burst exceeded the host's feedback-loop cadence bound. The bridge now sends the first report of a burst at once, coalesces the rest into one trailing report per 16ms carrying the latest size, and drops a report identical to the last one sent. A readiness change still differs from the last report, so it is always delivered. The demo e2e now waits for the workspace preview to settle before editing an opened demo, and compares card row positions to within half a pixel instead of exactly. * refactor(demos): pass loggers through the validator and URL helpers, as #245 does #245 routes shell logging through ErrorLogger and makes CrossFrameValidator take a logger. The demo card, the demo frame dispatch, and the new message checks now pass theirs, and buildRendererUrl takes the caller's logger. * refactor(bridge): name the resize steps and pass sandbox options as one object Addresses review feedback on the bridge: - Rename flushSurfaceResize to sendSurfaceResize, and document the three steps a SURFACE_RESIZE report goes through (measure, coalesce, send) and what `force` is for. - Explain the 16ms coalescing window (one 60 Hz frame), why the measurement after every render isn't forced while the one after a reset is, and why renderers without the readiness hook still get measured. - Rename RendererConfig.whenSurfaceRendered to onInitialRender, and describe renderers without it instead of calling them "legacy". - A2uiSandboxConnection takes the AngularSandboxOptions object rather than four positional parameters, so argument order no longer matters. - Fix the type errors in the new bridge specs. * refactor(demos): share one generated demo list across the sample renderers Addresses review feedback on the sample demos: - The generator writes one samples/shared/demos/demos.json instead of three identical demos.ts modules, and the Angular, Lit, and React samples import it through samples/shared/demos/index.ts. - JSON carries no license header, so the generator no longer copies one out of bridge-message.ts; index.ts has an ordinary header that addlicense checks like any other file. - The README explains how the four hand-written showcase demos relate to the generated list: they lead it, followed by the 43 upstream basic-catalog examples. * refactor(demos): use enums for card state and rewrite the comments that were hard to follow DemoCardState and MeasurementPhase are enums now, and the template reads a hasError flag instead of comparing strings. Fields no longer carry their type in the name (stateSignal, cardHeightSignal, coordinatorSignal, mountedKeysSignal). Rewrote the demo catalog, card measurement and bento layout comments in plain terms: what the coordinator iframe is, what a height report is, which window or iframe each sentence means, and the bug the 32px floor guards against. * refactor(demos): use per-frame readiness from #252 for demo frames #252 tracks renderer readiness per guest window, which makes most of the HostCommunication additions this PR used to work around the global readiness flag unnecessary: - sendToFrame is removed. DemoCard sends its demo with sendRenderA2UI addressed to its own iframe; HostCommunication marks the frame ready before subscribers see its RENDERER_READY, so the payload is posted at once. DemosCatalog sends GET_DEMOS with sendMessage addressed to the coordinator, and only after the coordinator reported ready. A request sent earlier would now be held and posted on that handshake, in addition to the one the handshake sends. - messageStreamFor is removed. DemoCard subscribes to messageStream$ and already ignores envelopes from other windows. - unregisterSecondaryIframe is removed in favour of unregisterIframe, which also withdraws the frame's readiness and queued messages and never leaves the default target on an unregistered frame. - registerSecondaryIframe is replaced by registering with DefaultTarget.KEEP. Registering a frame otherwise makes it the default target: the frame that messages sent without a target go to. CatalogManagement answers every frame's RENDERER_READY with an untargeted GET_CATALOG, so with each card taking over as it mounted, the request would go to the newest card and be dropped when the next one registered, ending in the catalog watchdog error. KEEP leaves the coordinator as the default; everything else about the registration is unchanged. The origin-parsing helper this PR extracted is dropped too, so HostCommunication now differs from main only by DefaultTarget. * test(demos): drop try blocks and fixed waits from the demo tests - The Lit and Angular bootstrap tests register their cleanup with onTestFinished instead of try/finally. - The demos e2e init script only touches the Composer page's storage, so it no longer needs a try/catch for the renderer iframes. - The bridge's GET_DEMOS tests wait for the DEMOS reply with vi.waitFor instead of sleeping 10ms. - The demo wall spec's test IntersectionObserver queues the targets it observes and delivers them when the test asks, instead of on a 0ms timer. * fix(demos): show one Flight status card on the demo wall The wall showed two Flight cards: the "Flight status" showcase and the specification's own "Flight Status" basic-catalog example. The generator now drops a specification example when a showcase has the same name, ignoring case, so a showcase replaces the example it's modelled on. The wall has 46 demos instead of 47. * feat(demos): fill the demo wall's rows without empty cards The wall paired neighboring demos two to a row in reading order, which left cards mostly empty in two ways. A row is as tall as its taller card, so a short demo beside a tall one was stretched to the tall one's height: Interactive Button sat in a card three times its height beside Incremental's list, and four other rows did the same. Now, when a pair's shorter tile leaves a gap, the tiles that follow stack under it, in its column, while each brings the column closer to the tall tile's height, up to three tiles; the tall tile spans their rows. Sparse grid auto-placement puts each stacked card in the next row beside the tall one, so reading order and keyboard order are unchanged. A demo that overflowed the narrower half of a row took a full row, even when it fit the wider half, and so did the neighbor left without a partner: Live Invitation Builder and Task Card need a little more than the narrower half, and Movie Card and Music Player were left alone next to them, so all four filled the full width with demos far narrower. A demo now takes the wider half when it needs it, and a full row only when it needs more than that. DemoCard reports the narrowest card that shows its demo unscaled (minimumCardWidth, replacing needsWideLayout), and the wall reads its own width and gap from the resize observer it already has. A tile still left without a partner, before a demo that needs a full row or at the end of the wall, joins the row before it, three to a row, when that row is a plain pair and all three demos fit a third of it. Otherwise it takes a full row as before. A tile that hasn't been measured yet is paired as before and never stacked. On the Angular sample at 1440px, the emptiest card went from about 30% filled to about 60%, and the only demo on a full row is Task Card, whose content is wider than any card, as before. * fix(demos): stop a demo that is always wider than its frame from shrinking A card scales a demo that overflows its frame and widens the frame to the content width it recorded, so the demo fits. A demo that is always wider than its frame by the same amount then reported a wider width from the widened frame, and the card recorded that too: the sample Task Card is about 65px wider than any frame, and its recorded width grew from 1,347px to 1,919px in one session while its preview shrank. Once a frame is scaled, the card now records a wider width only while the demo converges: while its overflow shrinks, or repeats within 3px (widths are rounded up to whole pixels), up to 20 times in a row. React's invitation builder, which lays out wider in a wider frame, still settles, overflowing by 45, 34, 26 and so on down to 3px. Task Card is scaled once and stays put.
Description
Remove extraneous output that made reading the test output very difficult.
Pre-launch Checklist