Rask
Rask
v0.24.1-alpha.0.329
You're reading the Rask v0.24.1-alpha.0.329 guides. Updated .View source
All guides

Testing gaps

Where Rask's own test pyramid is thin, ranked by what a gap could cost, and the tests that would close each one. A maintainer's map, not a guide for apps (that is testing.md).

The rule every entry follows: a behaviour is proven once, at the lowest layer that can prove it. Unit is pure and in memory; integration is a real SQLite or provider database (TestDatabase), a TestServer host, or a generator driver; E2E is a browser or a real process. No test for a getter, for plumbing a generator test already proves, or for what EF Core or ASP.NET Core do on their own. A test asserted at two layers loses its higher copy. The coverage floor (Coverage and its floor) guards behaviour already proven; a test is never added to move a percentage.

Coverage per package

Measured by the coverage job of every CI run on the unit shards (line % / branch %, generated code excluded). The floor in scripts/coverage-baseline.json is the latest whole run's figure.

Measured by CI run 46820275122 (2026-12-02, the whole set), with the gaps marked Done below filled; the thinnest first. The first measurement (runs 46610086899 and 46595820324, before them) had Rask.Auth at 28.9 / 3.0 and Rask.Wasm at 75.2 / 70.6.

Package Line % Branch % Lines
Rask.Auth 40.6 36.4 197
Rask.Api.Generators 47.2 28.5 2385
Rask.Testing.Playwright 50.4 46.6 508
Rask.SqlServer 57.9 44.7 1399
Rask.TypeScript.Tasks 62.4 60.3 457
Rask.Postgres 63.4 53.2 582
Rask.Validation.FluentValidation 64.8 57.9 475
Rask.Auth.Client 69.3 65.5 231
Rask.Api 72.2 46.9 90
Rask.Wasm.Tasks 74.5 70.6 141
Rask.Api.Client 76.9 68.7 225
Rask.Spa.Hosting 77.1 61.3 646
Rask.Wasm 78.7 74.7 1763
Rask.Cache 80.5 68.2 447
Rask.SQLite.Snapshots 80.9 70.3 209
Rask.Dashboard 82.1 72.8 1813
Rask.Signaling 82.7 67.8 388
Rask.Outbox 83.5 67.7 708
Rask.Mail 83.5 67.1 625
Rask.Cqrs.Server 83.8 73.3 735
Rask.Tailwind.Tasks 84.9 81.7 557
Rask.Generators 85.0 67.4 11561
Rask.Cli 86.3 81.5 7394
Rask.Auth.Api 87.4 74.1 2515
Rask.Dom.Tasks 87.8 79.5 2711
Rask.Storage 87.8 79.0 2148
Rask.DevTools 88.0 76.4 2367
Rask.WebPush 88.4 78.9 696
Rask.Cqrs.Client 88.6 76.3 431
Rask.Data 89.0 76.4 11488
Rask.Web 89.1 73.4 422
Rask.Pdf 89.2 72.2 797
Rask.Cqrs 89.2 75.4 1487
Rask.SQLite.Browser 89.4 88.9 236
Rask.Generators.CodeFixes 89.9 69.2 2634
Rask.Query 90.0 80.1 1287
Rask.Testing 90.3 71.9 1362
Rask.SQLite 90.6 82.6 470
Rask.SQLite.Litestream 90.9 81.5 440
Rask.Wire 91.2 83.8 498
Rask.Server 91.4 81.5 6284
Rask.Jobs 92.0 85.2 2315
Rask.Xlsx 92.2 82.5 678
Rask.Core 93.1 85.4 15887
Rask.Batteries.Generators 93.2 76.0 12191
Rask.Logging 93.7 84.8 1075
Rask.SQLite.EntityFrameworkCore 95.0 80.5 1042
Rask.Ui 95.5 87.1 14087
Rask.Testing.Data 100.0 91.7 29

What each layer covers

Package Unit Integration E2E
Rask.Core (render, diff, routing, forms, values) most of Rask.Core.Tests (render, diff codec, routing, values) Rask.Core.Tests hosts, Rask.Server.Tests site, server, WASM journeys
Rask.Data (save, rules, tenancy, migrations) almost none: the suite runs on in-memory SQLite Rask.Data.Tests, Rask.SQLite.EntityFrameworkCore.Tests, Rask.SqlServer.Tests, Rask.Postgres.Tests Rask.Providers.E2E.Tests (SQL Server, PostgreSQL parity, release set)
Generators and analyzers Rask.Generators.Tests, Rask.Batteries.Generators.Tests, Rask.Api.Generators.Tests (driver, contains-assertions, compile checks; no snapshots) the generated code run for real in the data and server suites none
Rask.Server (live WS runtime, endpoints, auth wiring) small Rask.Server.Tests (TestServer, WebSocket frames), Rask.Server.HotReload.Tests Rask.Server.E2E.Tests
Rask.Wasm Rask.Wasm.Tests, Rask.Wasm.Invariant.Tests prerender runs in Rask.Wasm.Tests Rask.Wasm.E2E.Tests, site journeys
Rask.Ui Rask.Ui.Tests (179 component tests) live pages in Rask.Ui.Tests site journeys, Flux parity
Rask.Auth / Auth.Api / Auth.Client PasswordHasherTests, SecretTokenTests, Auth.Client.Tests Rask.Auth.Tests (TestServer: CSRF header, sessions, passkeys, recovery, tenants) Rask.Server.E2E.Tests, Rask.Wasm.E2E.Tests sign-in journeys
Rask.Cqrs (+ Server, Client) Rask.Cqrs.Tests Rask.Cqrs.Server.Tests (EndpointSecurityTests), Rask.Cqrs.Transport.Tests WASM journeys
Rask.Outbox / Rask.Jobs none Rask.Outbox.Tests, Rask.Jobs.Tests (SQLite) PostgresClaimTests, JobStopProviderTests
Rask.Cli (rask db, rask deploy) Rask.Cli.Tests (fake process runner, pinned argv) local backup/restore round trips on real SQLite Rask.Cli.E2E.Tests (deploy to a container host, release set)
Rask.Storage / WebPush value checks Rask.Storage.Tests, Rask.WebPush.Tests none

The gaps, by risk

Each line: the behaviour, where it lives, the layer that should prove it. Done names the commit that closed it.

1. Data integrity

  1. rask db restore deleted the live WAL before it checked the backup. A bad backup lost every write not yet checkpointed. src/Rask.Cli/Commands/DbCommand.Backup.cs. Integration. Done: the backup passes quick_check before anything is touched (StoredFilesBackupTests.A_backup_that_is_no_database_restores_nothing_and_keeps_the_live_wal).
  2. The remote restore moved the upload over /data/app.db with no integrity check, deleting the live WAL first. BuildRemoteReplaceArguments. Done: the host's script runs PRAGMA quick_check on the upload before it touches anything (StoredFilesBackupTests.An_upload_that_is_no_database_restores_nothing_on_the_host_and_keeps_its_wal, the host's script run on this machine). Still open: no previous copy of the database is kept.
  3. UpdateWhere could move rows to another tenant. src/Rask.Data/BulkSetWrite.cs. Integration. Done (TenancyTests.A_set_write_cannot_move_rows_to_another_tenant). Still open: a set write that points a foreign key at another tenant's row (ReferencedTenantCheck is not asked), and a test that the tenant filter scopes ExecuteUpdate/ExecuteDelete at all.
  4. rask deploy rollback after an exclusive (data-rewriting) migration started the old image on rewritten rows. Done: the deploy labels its container rask.rewrote, and a rollback refuses past it unless --accept-rewritten-data (DeployCommandTests.A_rollback_past_a_deploy_that_rewrote_the_rows_is_refused_before_anything_moves). Still open: a redeploy of the same image after a failed start finds nothing pending and carries no label.
  5. Data steps ran outside a transaction and outside the migration lock. Done: each migration's steps run in one Db.Transaction with their record, under EF Core's migration lock (DataStepTests.A_step_that_fails_half_way_writes_nothing_and_is_not_recorded, A_step_and_its_record_commit_together_so_it_runs_once).
  6. MomentsInUtc branches. A step written before the zone was recorded (id is null), a machine on UTC, a zone the machine does not know; SQLite's SqliteMoments.Convert leaving an unparseable value as it is, and parsing a value that carries Z or an offset as machine-local. Unit for the parser, integration for the step.
  7. Outbox claims on a server provider. Concurrent claims are proven on SQLite only; PostgreSQL and SQL Server double delivery are not. Provider E2E (Rask.Providers.E2E.Tests), beside PostgresClaimTests.
  8. The declared-rule pre-check under a retrying execution strategy runs outside the write's transaction (SaveTransaction.Open). Integration with a retrying SQLite strategy.
  9. A deploy cancelled mid-migration. The detached migrate container keeps running and the held old colour stays stopped. Unit on the fake runner: cancel during StreamUntilExitOrDeadlineAsync.
  10. Save path edges. AggregateSave.StageAsync when no row exists even ignoring filters; a save of a numbered-tenant root never nulling TenantId; an aggregate found in tenant A saved after Tenant.Use(B) through the detached save. Integration.

2. Security

  1. A cookie signed with the app's key but naming no session. AuthCookieEvents.ValidatePrincipal. Integration. Done (AuthEndpointTests.A_cookie_signed_with_the_apps_key_that_names_no_session_is_not_honoured). And its bearer twin, AuthBearerEvents.OnTokenValidated (AuthEndpointTests.A_bearer_token_signed_with_the_apps_key_that_names_no_session_is_refused).

  2. The policy evaluator fails closed when IAuthorizationService is not registered (AuthorizationPolicyEvaluator.Permits). Unit. Done (EndpointSecurityTests.A_policy_with_no_authorization_services_to_ask_is_an_error_never_a_pass).

  3. RASK109 for an [Authorize] handler called through base. — a call the interceptor cannot reach skips authorization; only the generic-method case was tested. Generator unit test. Done (HandlerAuthorizationGeneratorTests.A_call_through_base_to_a_method_with_authorize_is_reported_as_unchecked).

  4. File signatures beyond PDF (FileSignatures.Matches): the two-part WebP check, GIF 87a/89a, the zip family (.docx, .xlsx), OLE (.doc), content shorter than the signature. Unit. Done (Rask.Core.Tests/Values/FileSignaturesTests).

  5. /_rask/leave from another site. Mapped with antiforgery off; one explicit cross-site case in HttpTransportSecurityTests. Integration.

  6. ServerAuth, the Server host's IAuth (src/Rask.Auth/ServerAuth.cs, 117 of 125 lines unrun — the reason Rask.Auth measured 28.9%): proven only through browser journeys. Integration over the auth harness. Done (Rask.Auth.Tests/ServerAuthTests: a refused sign-in hands the host no principal, a passkey is never started for nobody, sign-out lets every battery let go first).

Checked and already proven, so not gaps: printing a guarded page (Rask.Pdf.Tests/Host/PdfFromTests: anonymous, missing role, admin), CQRS endpoint authorization (EndpointSecurityTests), WebSocket origin and frame limits (Rask.Server.Tests/Security), passkey replay and forged state (PasskeyFlowTests), Web Push SSRF and takeover (PushAbuseTests).

3. Generators and analyzers

  1. Diagnostics no test raised. RASK006, RASK016 and RASK018 — Done (ActionableDiagnosticMessageTests.RASK006_…, AmbiguousScopedAssetTests). And RASK202 (a type named like a lifecycle event).
  2. LifecycleEventGenerator had no generator-level test; it was exercised only at run time (Rask.Data.Tests/LifecycleEventTests). Done (Rask.Batteries.Generators.Tests/LifecycleEventGeneratorTests: the three events and RASK202).
  3. GatedMembersGenerator is covered only through OperationGeneratorTests.

4. Hosts

  1. PublishedAssetRepair (Rask.Wasm, re-syncs .br/.gz siblings and the endpoint manifest after prerender) had no test: a regression serves stale compressed pages. Unit over a temp publish folder. Done (Rask.Wasm.Tests/Hosting/PublishedAssetRepairTests), and it found a bug: a compressed variant listed before its page kept the shell's integrity.
  2. Wasm file streams (WasmFileBackend, WasmFileStream, WasmDownloadSink): only cancellation is tested. Unit.
  3. Off-thread hosting is proven only by E2E (OffThreadTests); its message routing is unit-testable.

Duplicates and tests to retire

Checked and kept: AggregateSaveTests' stale-copy and deleted-meanwhile tests against StaleRefusalTests' — the first prove the raw Save() (versioned and unversioned), the second the generated step entry with its rules and its sentence; the same refusal through two doors.

Candidates, to check one by one before deleting:

  • Rask.Server.E2E.Tests/KindChosenAfterRefusedSaveTests (now a journey): the diffs-not-a-page answer is proven frame by frame in Rask.Server.Tests/WebSockets/KindChosenAfterRefusedSaveFramesTests; only the form's own timer, which the frame test asks for by hand, is the browser's alone.
  • The three "cannot move to another tenant" variants in TenancyTests and NumberedTenantTests.A_row_cannot_be_moved_to_another_tenant_by_an_update: one theory.
  • JobShutdownGraceTests vs JobShutdownDrainTests (in-flight job finishes; nothing claimed after stop).
  • JobRetentionTests vs PruneTests.
  • Rask.Server.E2E.Tests/GuestPageTests: the "not signed in sees the page" and "redirect by address" cases are proven in Core.Tests/Authorization/GuestPageGuardTests and Wasm.Tests/Authentication/GuestPageTests.
  • Rask.Server.E2E.Tests/VirtualListTests and Rask.Wasm.E2E.Tests/VirtualListTests (five identical names): host parity on purpose; one shared parameterised suite rather than a deletion.
  • Rask.Cli.Tests/DbBackupTests.A_backup_taken_through_the_online_api_is_a_complete_readable_database calls SQLite's backup API directly, not Rask's: fold its WAL claim into the restore round trip.

Serial tests

29 collections set DisableParallelization; xUnit runs each alone after the parallel phase, so their whole time adds to the wall clock. The shared cause, and the change that frees each:

Cause Collections Change
RaskDiagnostics.Sink is one static Core ConsoleRedirect (~245 tests), Server DiagnosticsSink, HostEnvironment (~70), Ui AskedSearch (96), ChoiceOffers (43), Testing rask-global-diagnostics an AsyncLocal capture in front of the global sink (RaskDiagnostics.Capture()), used by CapturingDiagnostics; hosts started by a test flow the context (PreserveExecutionContext). Only the three Console.SetOut classes stay serial.
Db.Configure per RaskApp.Build Server RaskAppCollection (25 classes, ~195 tests) bind per request with Db.Use (already an AsyncLocal) instead of the process-wide Configure
JSInterop's static session and AppliedFrames Wasm WasmSession (46 classes, ~160 tests) carry them on the session in the non-browser build
LiveOptions.PathBase / MinifyScopedAssets / IsDevelopment statics Core and Server ScopedAssets (~240), the path-base collections a scoped override (AsyncLocal) behind the three properties
RaskDevToolsHook.Probe, RouteRegistry, RaskCulture.IsEnabled, RASK_PRERENDER_OUT DevTools (64), Core RouteRegistry (64), Culture (54), Wasm prerender (45) resolve per host, or an AsyncLocal override, the static only as the fallback

Real and staying serial: hot reload's MetadataUpdater, ThreadPool.SetMinThreads, the process culture, the allocation pins, ProcessWideDb (its subject is Db.Configure), ModelRegistry.

Confirm