Skip to content

Feat | Reworked InfiniFrame.Tools.Pack into InfinIFrame.SingleFile - #402

Open
AnnaSasDev wants to merge 50 commits into
corefrom
test-coverage
Open

Feat | Reworked InfiniFrame.Tools.Pack into InfinIFrame.SingleFile#402
AnnaSasDev wants to merge 50 commits into
corefrom
test-coverage

Conversation

@AnnaSasDev

Copy link
Copy Markdown
Member

No description provided.

@AnnaSasDev AnnaSasDev linked an issue Aug 14, 2026 that may be closed by this pull request
2 tasks
Add many new unit tests for BlazorWebView and InfiniFrame components (C#) and a TypeScript setupGuard test. Include generated LCOV coverage file and update vitest config to enforce coverage thresholds. Update .gitignore to exclude coverage report output. Adjust test project files: add TUnit.Mocks package where needed and remove some Using entries from Directory.Build.props. Extend MockFactory with additional mock creators for new tests. These changes improve test coverage and add missing test scaffolding.
Large test suite additions and improvements across JS/TS and C# tests. Key changes:
- Added many Vitest tests (AllFeatures, Lifecycle feature, and numerous NativeInterop, HostMessaging, customElements, blazor patches, WindowChrome, utils tests).
- Introduced resetNativeInteropBridgeState() and adjusted normalizeEnvelope typing/behavior in NativeInteropBridge.
- Added ArgumentNullException guard in InfiniFrameHttpHandler constructor.
- Relaxed Vitest coverage thresholds and adjusted include/exclude patterns.
- Updated TUnit package versions.
- Adjusted multiple C# tests: assertions, timeouts, and message recording behavior (thread-safe message capture).
These changes primarily improve test coverage and robustness.
This change adds a reusable coverage workflow that collects TypeScript and C# coverage, writes badge JSON, and pushes updates to the coverage/badges branch on core pushes. Test workflows now support an enable_coverage flag and upload Cobertura artifacts for aggregation, and the README includes the generated coverage badges.
Remove the monolithic AllFeatures.test.ts and add individual feature test files under Window/Features with a shared _testHelpers.ts (messaging mock & setup). Add/expand tests: Browser/Debugging/Decorations/FilePicker/Invoke/JavaScript/Lifecycle/Monitors/Notifications/PageNavigation/Position/Size/State/WebMessaging. Improve InfiniFrame, InfiniFrameHostMessaging and customElements tests (additional edge cases and error handling). Extend WindowChrome tests with pointer event (drag/resize) scenarios. These changes improve test granularity, isolation, and robustness.
@AnnaSasDev AnnaSasDev self-assigned this Aug 14, 2026
macOS native diagnostics: include the fatal signal number in the message and print a symbolized backtrace via backtrace_symbols (freeing the symbols and fflush'ing stderr) instead of using backtrace_symbols_fd.

Lifecycle disposal: when the window hasn't reached TeardownComplete, release native callback/milestone roots and perform best-effort native handle release and mark-disposed calls inside try/catch blocks to avoid leaks or runtime aborts during shutdown; retain the early return to skip normal cleanup path.
Environment.Exit() does not fully prevent .NET 10's runtime teardown
from calling abort() on macOS during GC finalization. Replace it with
a POSIX _exit() call which unconditionally terminates the process,
bypassing the managed finalizer thread and CLR shutdown sequence
entirely. The existing drain loop already handles native window
cleanup before exit.
The GC finalizer thread on .NET 10 can deliver SIGABRT (via runtime
abort()) after the managed test host has finished all tests but before
it reaches _exit().  The existing SIGABRT handler re-raises with
SIG_DFL, killing the process with exit code 134 even though every
test passed.

Add a managed-side exit code flag (InfiniFrameNative_SetManagedExitCode)
that the native SIGABRT handler checks.  When set, the handler calls
_exit(code) directly instead of re-raising, so the process terminates
with the correct exit code.  The flag is set immediately after the
test task completes, before the drain loop where the abort typically
occurs.
The native library built by CI may not yet contain the
InfiniFrameNative_SetManagedExitCode export (e.g. when the test
assemblies run against a pre-built binary from a prior CI run).
The unhandled EntryPointNotFoundException was crashing ALL test
assemblies on every framework (net8.0, net9.0, net10.0), making
the regression worse than the original net10.0-only SIGABRT.
The drain loop + Environment.Exit added in this PR were intended to
fix a net10.0 SIGABRT but actually caused it.  The drain loop keeps
the process alive after tests complete, giving the .NET 10 GC
finalizer a window to trigger abort() on the finalizer thread.

The original core code ('return await testTask') exits cleanly when
Main returns — the runtime handles its own teardown.  Reverting to
that pattern removes the crash window entirely.

Also reverts the SetManagedExitCode native flag and PosixExit P/Invoke
which were attempts to intercept the abort at the signal-handler level.
.NET 10 calls abort() during its CLR shutdown sequence on macOS,
producing exit code 134 (SIGABRT) even when all tests pass.
Calling POSIX _exit() terminates the process immediately before
Main returns, so the CLR never starts the shutdown sequence that
triggers the abort.

The test results have already been reported by MTP at this point,
so skipping managed finalization is safe.
.NET 10's CLR calls abort() during GC finalization on macOS, causing
app.RunAsync() to return 1 even when every test passes and results
are already written to disk.  Calling _exit(0) terminates the process
immediately, bypassing the CLR shutdown sequence entirely.
AnnaSasDev and others added 5 commits August 16, 2026 18:09
Adds a broad set of unit tests across BlazorWebView, NativeBridge, Shared, and framework projects, along with InternalsVisibleTo entries to enable test access. Also fixes the shared coverage workflow to aggregate TypeScript and C# coverage correctly without double-counting nested totals, and updates drag/drop tests to assert interactions via mock verification.
Add an optional pr_number input and pull-requests permission to CI workflows; post or update a single coverage comment on the specified PR with TypeScript/C# coverage, delta and trend indicators. Pass pr_number from ci-testing.yml to shared-coverage.yml. Also refactor ExitCodes unit tests to assign ExitCodes.* to a local variable before asserting (clarifies Arrange/Act/Assert).
@github-actions

Copy link
Copy Markdown
Contributor

📊 Code Coverage Report

Language Coverage Delta Trend
TypeScript 93.6% 0% ➡️ unchanged
C# 8.1% 0% ➡️ unchanged

github-actions Bot and others added 4 commits August 16, 2026 18:21
Move pure logic into InfiniFrame.Shared.Utilities (AssetPathResolver, ColorUtility, CustomSchemeResponseValidator, EndpointStatusResolver, MenuItemTreeHelper, MonitorOverlapCalculator, PositionCalculations, SizeCalculations, TimeoutParser, PublishValidationHelpers). Update callers to use these helpers (StaticAssetSchemeHandler, decorations/menu/position/size features, CommandLine, PublishService, MsBuild resolver) and consolidate timeout/PE validation logic. Add comprehensive unit tests for the new utilities and adjust code to preserve behavior while improving testability.
Introduce InfiniFrame.SingleFile packaging: new tooling and MSBuild targets for two-pass single-file publish (embed wwwroot, native libs, framework). Add PackModeFileProvider to serve embedded "publish.*" resources and fallback to physical wwwroot. Extend StaticWebAssetsRuntimeFileProvider to load manifests from embedded resources and accept an embedded assembly; ManifestCandidate now carries a ResourceStream. Move CLI to infiniframe-singlefile (Program.cs) and add InfiniFrame.SingleFile.targets/project; remove older InfiniFrame.Pack targets and pack scripts. Improve bootstrap/runtime detection and safe native extraction. Update examples Directory.Build.targets accordingly.
@AnnaSasDev AnnaSasDev changed the title Testing | Enhanced testing coverage Feat | Reworked InfiniFrame.Tools.Pack into InfinIFrame.SingleFile Aug 17, 2026
This change adds single-file automation test projects for the vanilla and MudBlazor examples, along with shared CDP/Playwright startup utilities to launch packed executables and validate runtime behavior. It also updates example project files to publish artifacts in a stable build path and fixes single-file example packaging metadata for the MudBlazor sample.
Replace the pack-tool E2E action with a SingleFile publish action (dotnet publish -t:InfiniFrameSingleFile) and copy the publish output. Update workflows to the new example path (examples/SingleFileExe/...).

Also: fix StaticWebAssetsRuntimeFileProvider lambda and directory traversal logic; simplify GetFallbackContentType call; add missing ProjectReference to InfiniFrame.Shared; small Program/Process and lifecycle try/catch/formatting changes; update SetTrustAllOrigins usage. Numerous test fixes and cleanups (concrete types, AddSingleton overloads, CancelAsync, using/dispose, consts, callbacks) to satisfy compilation and style.
Attach the native menu bar after the webview is created and enable lookup by menu-item ID. Call AttachMenuBar() after Show(), implement AttachMenuBar() to reparent existing children into a GtkBox when needed, and call it from SetMenuBarJson when the webview exists. Store each item's ID via g_object_set_data for lookup and simplify FindMenuItemWidget to search by that stored ID. Update SetMenuItemEnabled/Visible to use the new lookup. Add a no-op AttachMenuBar on macOS and expose AttachMenuBar in the shared header.
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.

Feature | Better code Coverage

1 participant