diff --git a/AGENTS.md b/AGENTS.md index 59251a9b..f0c5ca59 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -8,7 +8,7 @@ WebFront is a C++23 header-only library for serving a browser UI from a C++ appl - C++ calls browser functions with `ui.jsFunction(name)(arguments...)`, which is fire-and-forget and ignores the result, or with `ui.jsFunction(name)(arguments...)`, which returns a `std::future`. Only the untyped C++ form is fire-and-forget. - `webFront.ready` resolves after the WebSocket handshake acknowledgement and rejects if the initial connection fails or closes. -WebFront also ships a standalone developer environment (`NativeApp::bootstrap("developer")`): a terminal whose `wf` commands (`init`, `install`, `restore`, `dev`, `build`, `check`, `test`, `run`, `exec`, `embed`) manage a project manifest and lock, compile TS/TSX, type-check, run Jasmine specs and generate the application's embedded provider, with no JavaScript runtime or package manager on the developer's machine. It is not a sandbox. See `docs/DEVELOPER_ENVIRONMENT.md`. +WebFront also ships a standalone developer environment (`NativeApp::bootstrap("developer")`): a terminal whose `wf` commands (`init`, `create`, `install`, `restore`, `run`, `exec`, `check`, `test`, `build`, `dev`, `preview`, `embed`, `list`, `help`) manage a project manifest and lock, compile TS/TSX, type-check, run Jasmine specs and generate the application's embedded provider, with no JavaScript runtime or package manager on the developer's machine. It is not a sandbox. See `docs/DEVELOPER_ENVIRONMENT.md`. The README introduces WebFront through the Game of Life walkthrough, demonstrating the developer bootstrap, reactive TypeScript UI and embedded distribution. The minimal `HelloWorld` example remains available under `examples/hello-world/`. Native modules and the bridge are covered by the Jasmine browser integration test. General DOM abstractions remain future work. Application coroutines use `webfront::Task` and `app.spawn(task)`/`ui.spawn(task)`; retain a `TaskHandle` to request individual cancellation. WebFront owns and drains these tasks. Spawn is callable from any thread while the application lives; a call rejected during shutdown returns a stopped handle. Destructors wait for outstanding operations; explicit shutdown reports a stalled join. Typed C++ sender calls support local cancellation; futures and JavaScript Promises do not expose cancellation. @@ -20,12 +20,12 @@ The README introduces WebFront through the Game of Life walkthrough, demonstrati - `include/webfront/system/`: layered virtual filesystems and the embedded web resources, a closed list guarded by the `MinimalCoreAssets` CTest case (normative list and 150 KiB decoded budget in ADR-016; changing it means amending the ADR and `test/cmake/CheckMinimalCoreAssets.cmake` together). - `include/webfront/frontend/`: system-browser, CEF, optional Windows WebView2 and macOS WKWebView frontend adapters. - `examples/`: only Hello World (`hello-world/`) and Game of Life (`life/`, with console, developer and embedded stages). -- `js/core/`: readable browser bridge, fallback and bootstrap loader compiled into `include/webfront/`, plus the embedding CMake modules; `js/developer/`: developer environment (its terminal and `wf`), the wf scripts that build it (`scripts/`), build and vendoring tools. The repository is itself a `wf` project (`js/developer/webfront.project.json` and its lock, selected with `--manifest-dir js/developer`): the environment builds itself, and its pure JavaScript specs (`test/developer/`) run with `wf test`. Production C++ remains header-only in `include/webfront/`. +- `js/core/`: readable browser bridge, fallback and bootstrap loader compiled into `include/webfront/`, plus the embedding CMake modules; `js/developer/`: developer environment (its terminal and `wf`), the wf scripts that build it (`scripts/`), build and publication tools. The repository is itself a `wf` project (`js/developer/webfront.project.json` and its lock, selected with `--manifest-dir js/developer`): the environment builds itself, and its pure JavaScript specs (`test/developer/`) run with `wf test`. Production C++ remains header-only in `include/webfront/`. - `test/fixtures/`, `test/web/fixtures/`: retained regression fixtures, not public example applications. - `test/unit/`: Catch2 unit tests; `test/web/`: real-browser integration (`suite/` is the WebFront project of the Jasmine specs, run by `webtest` through `wf test`); `test/driver/`: `webfront-wf`, the non-interactive `wf` driver for tests; `test/fuzz/`, `test/fixtures/`; `test/cmake/`: CMake test scripts and sub-projects. The `RepositoryLayout` CTest case pins the tracked root. - `cmake/`: build modules (frontends, CEF, CPM, compiler options); `.github/`: workflows, `.github/CONTRIBUTING.md`. - `docs/`: current reference guides, architecture decisions and `docs/CHANGELOG.md`. -- `docs/PROJECT_STATUS.md`: evidence-based status snapshot and known limitations. +- `docs/PROJECT_STATUS.md`: current supported paths, validation scope and known limitations; completed work belongs in the changelog and Git history. - `docs/adr/README.md`: architecture decision index, Git history, tradeoffs and implementation rules; read the relevant ADRs before changing their contracts. - `docs/DEVELOPER_ENVIRONMENT.md`: the reference of the developer environment (`wf` commands, manifest and lock, TypeScript and `wf check`, tests, limits, distribution); `docs/EMBEDDED_ASSETS.md`: the core's embedded resources and their regeneration. diff --git a/README.md b/README.md index c449c757..77512496 100644 --- a/README.md +++ b/README.md @@ -266,11 +266,12 @@ ctest --test-dir build --output-on-failure --parallel 4 Configuring with tests enabled downloads, and verifies against their SHA-512, the pinned bootstrap environment and the packages of the test registry; the embedded assets are generated and checked by CMake alone (the `webfront-embedded-assets` target regenerates them). Normal C++ builds use versioned headers. Browser tests require an enabled engine; Linux CEF tests use Xvfb. See [AGENTS.md](AGENTS.md) for contributor commands and [developer environment testing](docs/DEVELOPER_ENVIRONMENT.md#environment-distribution-and-offline-tests-maintainers). -CTest runs up to four tasks at a time; browser ports remain locked and embedded builds run serially. +CTest runs up to four tasks at a time; independent driver sessions use OS-assigned ports, while +shared projects and nested builds retain resource locks. See [test timings and parallelism](docs/TEST_PERFORMANCE.md) for measurements and constraints. `ctest -L fast` runs the unit tests in about a second; [test tiers](docs/TEST_TIERS.md) describes what CI runs on each pull request, weekly and before a merge into `master`. -CI runs one combined C++ / native-browser job per desktop platform on each code change. The Linux job also collects and prints GCC line coverage (no external upload). Linux Clang, sanitizers, fuzzing and CEF compatibility run weekly, on demand and on pull requests into `master`. Manual dispatch with `repeat_desktop_tests=true` also repeats each desktop CTest case three times for stability checks. Workflow concurrency cancels superseded runs; dependency and compiler caches avoid repeated work. Platform badges above identify the configured matrix; the CI badge reports its aggregate status. Execution times depend on cache state and runner availability. +CI runs one combined C++ / native-browser job per desktop platform on each code change. The Linux job also collects and prints GCC line coverage (no external upload). Linux Clang, sanitizers, fuzzing and CEF compatibility run weekly, on demand and on pull requests into `master`. Manual dispatch with `repeat_desktop_tests=true` also runs the complete desktop CTest suite three times, recreating its fixtures on each pass. Workflow concurrency cancels superseded runs; dependency and compiler caches avoid repeated work. Platform badges above identify the configured matrix; the CI badge reports its aggregate status. Execution times depend on cache state and runner availability. ## Contracts and limitations diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 22d7861b..188a724f 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -2,6 +2,22 @@ ## Unreleased +- The single-command test driver can set `--command-timeout` after browser/bootstrap startup, + within its unchanged overall `--timeout` deadline (#376). The watchdog regression deliberately + delays bootstrap beyond its command limit and requires the command's start marker before accepting + status 71; slow native browser startup can no longer satisfy the wrong timeout condition. + +- Repository cleanup (#376): consolidate the gzip benchmark and differential-validation commands + into [HTTP assets](HTTP_ASSETS.md#manual-benchmarks-and-differential-validation); remove + `GZIP_CACHE_MEASUREMENTS.md`, `GZIP_DECODER_MEASUREMENTS.md` and the one-off profiles under + `docs/test-performance/`. The last revision containing these reports is + [cce1927](https://github.com/ambroise-leclerc/WebFront/tree/cce1927ec952cb5d80b7bb130e9eaddbd1744885/docs); + new CI reports are workflow artifacts. + `PROJECT_STATUS.md` now describes supported paths, contracts and outstanding limitations; + completed migration/qualification records remain in Git and this changelog. Remove the unreferenced + Hello World and retired Signal Studio screenshots. Active build, test, publication and animation + generation tools, plus the measurement evidence cited by proposed ADRs, are retained. + - Tests are organized in tiers by CTest label: `fast` (unit tests, about one second), the standard tier and `portability` (the consumer project). CI runs the fast tier first, excludes `portability` from pull requests into `develop`, and runs the advanced tier (three suite repetitions, a portability matrix, sanitizers, fuzzers, CEF) weekly @@ -12,7 +28,14 @@ timings. Independent driver groups use OS-assigned ports; `WebFrontConfig::port = "0"` and `app.port()` expose this with TCPStdnet. Native `WebView2Options::visible` / `WKWebViewOptions::visible` default to true and allow quiet tests. Windows/macOS CI no longer wait for the Linux image, extended jobs use sccache, fuzzers have bounded concurrency, - and lcov verifies its fast JSON backend. See [TEST_PERFORMANCE](TEST_PERFORMANCE.md). + and lcov verifies its fast JSON backend. See [TEST_PERFORMANCE](TEST_PERFORMANCE.md). Local #388 measurements on Linux/GCC 16 + Release/WebKitGTK (two build workers, four CTest workers) went from 172.43 s at baseline + [da0297f](https://github.com/ambroise-leclerc/WebFront/commit/da0297ff235642ccbe665a78e42873da9cde9c98) + (365 cases/97 specs, one pass) to a 93.41 s median (378 cases/97 specs, three passes), a 45.8% + reduction. These are local observations on a busy shared workstation, not a cross-platform guarantee; + [measurement details](https://github.com/ambroise-leclerc/WebFront/blob/cce1927ec952cb5d80b7bb130e9eaddbd1744885/docs/TEST_PERFORMANCE.md#measurements) and + [raw profiles](https://github.com/ambroise-leclerc/WebFront/tree/cce1927ec952cb5d80b7bb130e9eaddbd1744885/docs/test-performance) + are preserved at cce1927. - Accepted stdnet connections enable `TCP_NODELAY`, including after WebSocket upgrade (#379). This removes the Nagle/delayed-ACK interaction that could delay a callback's return @@ -56,7 +79,7 @@ - Gzip identity fallback reuses a bounded validated-representation cache for GET and HEAD (#281). Cold decoding uses buffered bit reads and a small Huffman lookup (#282), with unchanged allocation behavior, strict stream validation and output budgets. Release benchmarks and - test-only zlib differential/sanitizer validation are recorded in `docs/GZIP_DECODER_MEASUREMENTS.md`. + test-only zlib differential/sanitizer validation are recorded in [HTTP asset validation](HTTP_ASSETS.md#manual-benchmarks-and-differential-validation). - `WebFrontLifeDeveloper` starts without argument on `./life-project` (created when missing, reused untouched otherwise) and the pinned environment; the explicit ` [ ]` form remains. At configuration, the diff --git a/docs/DEVELOPER_ENVIRONMENT.md b/docs/DEVELOPER_ENVIRONMENT.md index e79422a9..774fdb67 100644 --- a/docs/DEVELOPER_ENVIRONMENT.md +++ b/docs/DEVELOPER_ENVIRONMENT.md @@ -522,7 +522,7 @@ one `wf` command through `runNonInteractive`, prints its output and exits with i ```sh webfront-wf --project [--environment --integrity ] [--registry-dir ] \ - [--manifest-dir ] [--report ] [--timeout ] [--] [arguments...] + [--manifest-dir ] [--report ] [--timeout ] [--command-timeout ] [--] [arguments...] ``` - Without `--environment`, it uses the **bootstrap environment** provisioned at configure time. `cmake/WebFrontBootstrap.cmake` @@ -534,8 +534,11 @@ webfront-wf --project [--environment --integrity build/gzip-baseline/webfront/http/Gzip.hpp -git show d27e4fc:include/webfront/http/BuffersPolicy.hpp > build/gzip-baseline/webfront/http/BuffersPolicy.hpp -clang++ -std=c++23 -O3 -DNDEBUG -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE \ - -ftrivial-auto-var-init=pattern -Ibuild/gzip-baseline -Itest/unit \ - test/unit/GzipDecoderBenchmark.cpp -o build/gzip-before -clang++ -std=c++23 -O3 -DNDEBUG -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE \ - -ftrivial-auto-var-init=pattern -Iinclude test/unit/GzipDecoderBenchmark.cpp -o build/gzip-after -build/gzip-before build/gzip-corpus/*.gz -build/gzip-after build/gzip-corpus/*.gz -``` - -Use the same compiler for both; adapt the standard-library hardening macro on other platforms. -Repeat three times, alternating before/after order. Desktop background activity makes these -local observations noisy; compare the corpus as a whole rather than treating a small timing -difference as a guaranteed gain. - -## Differential and sanitizer validation - -`WEBFRONT_GZIP_DIFFERENTIAL=ON` opts into test-only zlib linkage. Production remains header-only -and does not depend on zlib. `GzipZlibDifferential` checks the neutral fixtures in ordinary CTest; -`gzip_differential ` also compares generated stored/fixed/dynamic/Huffman-only, -flush boundaries and size-boundary cases, exact budgets, sampled truncations/mutations, optional -headers, concatenation, CRC and trailing bytes. Comparisons require matching acceptance and -byte-for-byte content. The oracle explicitly loops over members and requires full consumption. - -Intentional differences from permissive gzip consumers: WebFront rejects all trailing padding, -including zeros, and dynamic declarations of 31/32 distance symbols. The zlib oracle normalizes -strict consumption; arbitrary-input differential fuzzing compares every WebFront-accepted stream -with zlib, while the generated supported corpus checks acceptance in both directions. Reserved -or otherwise unsupported declarations are covered by WebFront's malformed-input unit fixtures. - -```bash -cmake -S . -B build -DWEBFRONT_GZIP_DIFFERENTIAL=ON -cmake --build build --target gzip_differential --parallel 2 -build/test/unit/gzip_differential build/gzip-corpus -ctest --test-dir build --output-on-failure --parallel 4 -``` - -For Clang/compiler-rt sanitizer fuzzing, configure with `ENABLE_FUZZING=ON` and -`WEBFRONT_GZIP_DIFFERENTIAL=ON`. See [fuzzing](../test/fuzz/README.md) for commands. -The extended CI ASan/UBSan job runs the generated corpus and both gzip fuzzers; CodeScene -quality gates remain unchanged. The generated-corpus comparison step has a five-minute timeout. - -On this macOS host, Homebrew's ASan runtime stalled in its allocator initialization before main. -Validation instead used Apple Clang 21.0.0's ASan/UBSan runtime; libFuzzer came from Homebrew LLVM -21.1.8 because Apple does not ship its archive. Both fuzzers ran for 30 seconds with a 1 MiB output -cap, 65,536-byte maximum mutation size and a five-second per-input timeout. Standalone differential -validation used the 4 MiB output limit with the complete generated corpus. - -Local validation: 293 CEF-off CTest cases passed; 12,571 generated/fixture comparisons passed -under ASan/UBSan; bounded fuzzing completed 53,370 runs and differential fuzzing 44,065 runs -without a finding. The 264 bit-width/alignment combinations are covered by the unit tests. diff --git a/docs/HTTP_ASSETS.md b/docs/HTTP_ASSETS.md index 4c0e5f8f..bcabf21e 100644 --- a/docs/HTTP_ASSETS.md +++ b/docs/HTTP_ASSETS.md @@ -69,12 +69,8 @@ For the synchronous API, `RequestHandler::fallbackCacheStatistics()` exposes dec on the server context. The LRU lookup compares compressed bytes linearly across retained entries; gzip pass-through remains independent of this cost. Cold decoding uses bounded buffered bit reads and a 256-entry short-code Huffman lookup, with the canonical decoder for longer codes. -See [decoder measurements and differential validation](GZIP_DECODER_MEASUREMENTS.md) for the -Release comparison, allocation accounting and test-only zlib tools. Validation, budgets and -strict member/trailer boundaries are unchanged. - -See [gzip cache measurements](GZIP_CACHE_MEASUREMENTS.md) for cold/repeated GET and HEAD data -and the optional benchmark target. +Validation, budgets and strict member/trailer boundaries are unchanged. Optional +[manual benchmarks](#manual-benchmarks-and-differential-validation) measure codec/cache costs. ## Cold decoding, admission and shutdown (#283) @@ -151,7 +147,7 @@ queued jobs are stopped without decoding. `fallbackDecodeStatistics()` exposes a for jobs, response leases, charged bytes, decode attempts and whether a worker has been created. `Server::fallbackCacheStatistics()` combines I/O-context cache counters with worker decode attempts; read cache statistics on the I/O context. Buffered decoding reduces cold CPU work; see -[decoder measurements](GZIP_DECODER_MEASUREMENTS.md). +[manual benchmarks](#manual-benchmarks-and-differential-validation). ## Fallback budget @@ -176,3 +172,56 @@ using App = webfront::BasicWF