diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml index 03dfd2f..1389d9c 100644 --- a/.gitea/workflows/build.yaml +++ b/.gitea/workflows/build.yaml @@ -33,7 +33,7 @@ jobs: strategy: fail-fast: false matrix: - suite: [checks, tsan, ecs, postgres, deploy] + suite: [checks, tsan, ecs, postgres, deploy, client] steps: - name: Checkout uses: https://github.com/actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 diff --git a/CMakeLists.txt b/CMakeLists.txt index 2cb5fc7..8969541 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,6 +24,7 @@ option(EVO_ENABLE_TIDY "Run clang-tidy during compilation" OFF) option(EVO_BUILD_FUZZER "Build the Clang libFuzzer snapshot target" OFF) option(EVO_BUILD_ECS_EXPERIMENT "Build the isolated EnTT comparison (explicit preparation required)" OFF) option(EVO_BUILD_POSTGRES "Build the isolated Linux PostgreSQL persistence adapter" OFF) +option(EVO_BUILD_CLIENT_PROBE "Build the isolated M9.1 SDL dependency probe" OFF) set(EVO_SANITIZER "none" CACHE STRING "none, address (ASan/UBSan), or thread") set_property(CACHE EVO_SANITIZER PROPERTY STRINGS none address thread) include(cmake/ProjectOptions.cmake) @@ -90,6 +91,9 @@ target_link_libraries(evo_region_checkpoint PUBLIC evo::region_lease evo::proces evo_owned_target(evo_region_checkpoint) include(CTest) +if(EVO_BUILD_CLIENT_PROBE) + include(cmake/ClientProbe.cmake) +endif() if(EVO_BUILD_POSTGRES) if(NOT CMAKE_SYSTEM_NAME STREQUAL "Linux") message(FATAL_ERROR "The initial PostgreSQL adapter is qualified on Linux only") diff --git a/CMakePresets.json b/CMakePresets.json index 5e374fd..d62fef2 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -7,20 +7,23 @@ {"name": "release", "inherits": "base", "cacheVariables": {"CMAKE_BUILD_TYPE": "Release"}}, {"name": "analysis", "inherits": "debug", "cacheVariables": {"EVO_ENABLE_TIDY": "ON"}}, {"name": "asan", "inherits": "debug", "cacheVariables": {"EVO_SANITIZER": "address"}}, - {"name": "tsan", "inherits": "debug", "cacheVariables": {"EVO_SANITIZER": "thread"}} + {"name": "tsan", "inherits": "debug", "cacheVariables": {"EVO_SANITIZER": "thread"}}, + {"name": "client-probe", "inherits": "release", "cacheVariables": {"EVO_BUILD_CLIENT_PROBE": "ON"}} ], "buildPresets": [ {"name": "debug", "configurePreset": "debug"}, {"name": "release", "configurePreset": "release"}, {"name": "analysis", "configurePreset": "analysis"}, {"name": "asan", "configurePreset": "asan"}, - {"name": "tsan", "configurePreset": "tsan"} + {"name": "tsan", "configurePreset": "tsan"}, + {"name": "client-probe", "configurePreset": "client-probe", "targets": ["evo-client-probe"]} ], "testPresets": [ {"name": "debug", "configurePreset": "debug", "output": {"outputOnFailure": true}}, {"name": "release", "configurePreset": "release", "output": {"outputOnFailure": true}}, {"name": "analysis", "configurePreset": "analysis", "output": {"outputOnFailure": true}}, {"name": "asan", "configurePreset": "asan", "output": {"outputOnFailure": true}}, - {"name": "tsan", "configurePreset": "tsan", "output": {"outputOnFailure": true}} + {"name": "tsan", "configurePreset": "tsan", "output": {"outputOnFailure": true}}, + {"name": "client-probe", "configurePreset": "client-probe", "filter": {"include": {"label": "client"}}, "output": {"outputOnFailure": true}} ] } diff --git a/README.md b/README.md index af4dc3e..85bba85 100644 --- a/README.md +++ b/README.md @@ -163,3 +163,9 @@ for parameters, coverage and limitations. The shorter suite runs through CTest. See [PostgreSQL setup](docs/infrastructure/POSTGRESQL.md) for the optional Linux adapter, isolated integration checks and Kubernetes Secret/migration instructions. The default simulation build does not require PostgreSQL. + +## Native client dependency probe (M9.1) + +The optional SDL3 probe is separate from the headless targets. See +[client dependency preparation and checks](docs/engineering/CLIENT_DEPENDENCIES.md). +M9.2 will build the actual client platform/render boundary. diff --git a/cmake/ClientProbe.cmake b/cmake/ClientProbe.cmake new file mode 100644 index 0000000..06ab256 --- /dev/null +++ b/cmake/ClientProbe.cmake @@ -0,0 +1,36 @@ +include("${PROJECT_SOURCE_DIR}/tools/sdl3-pin.cmake") +set(sdl_source "${PROJECT_SOURCE_DIR}/build/external/sdl3/SDL3-${EVO_SDL_VERSION}") +if(NOT EXISTS "${sdl_source}/evo-verified.sha256") + message(FATAL_ERROR "Prepare SDL explicitly: cmake -P tools/prepare-sdl3.cmake") +endif() +file(STRINGS "${sdl_source}/evo-verified.sha256" verified) +if(NOT verified STREQUAL EVO_SDL_SHA256) + message(FATAL_ERROR "Prepared SDL does not match the reviewed source pin") +endif() +enable_language(C) +set(SDL_SHARED ON CACHE BOOL "" FORCE) +set(SDL_STATIC OFF CACHE BOOL "" FORCE) +set(SDL_TEST_LIBRARY OFF CACHE BOOL "" FORCE) +set(SDL_TESTS OFF CACHE BOOL "" FORCE) +set(SDL_EXAMPLES OFF CACHE BOOL "" FORCE) +set(SDL_INSTALL OFF CACHE BOOL "" FORCE) +foreach(feature AUDIO CAMERA JOYSTICK HAPTIC SENSOR GPU) + set(SDL_${feature} OFF CACHE BOOL "M9.1 scoped subset" FORCE) +endforeach() +add_subdirectory("${sdl_source}" "${PROJECT_BINARY_DIR}/sdl3" EXCLUDE_FROM_ALL SYSTEM) +add_executable(evo-client-probe experiments/client/main.cpp) +target_link_libraries(evo-client-probe PRIVATE SDL3::SDL3) +evo_owned_target(evo-client-probe) +if(WIN32) + add_custom_command(TARGET evo-client-probe POST_BUILD + COMMAND "${CMAKE_COMMAND}" -E copy_if_different + "$" "$" VERBATIM) +endif() +if(BUILD_TESTING) + add_test(NAME client-probe-software COMMAND evo-client-probe --renderer software) + set_tests_properties(client-probe-software PROPERTIES + ENVIRONMENT "SDL_VIDEO_DRIVER=dummy" TIMEOUT 20 LABELS "client") + add_test(NAME client-probe-invalid-driver COMMAND evo-client-probe --renderer evo-invalid) + set_tests_properties(client-probe-invalid-driver PROPERTIES + ENVIRONMENT "SDL_VIDEO_DRIVER=dummy" WILL_FAIL TRUE TIMEOUT 20 LABELS "client") +endif() diff --git a/deploy/docker/Dockerfile b/deploy/docker/Dockerfile index 4d38c69..fb63332 100644 --- a/deploy/docker/Dockerfile +++ b/deploy/docker/Dockerfile @@ -33,6 +33,18 @@ RUN cmake --preset tsan -DCMAKE_CXX_COMPILER=clang++-19 \ && cmake --build --preset tsan --parallel 2 CMD ["ctest", "--preset", "tsan", "--no-tests=error", "--timeout", "120"] +FROM ci-source AS ci-client +# X11 window + software regression; native GPU probes remain separate platform evidence. +RUN apt-get update && apt-get install -y --no-install-recommends \ + libx11-dev libxext-dev libxrandr-dev libxcursor-dev libxi-dev libxss-dev libxtst-dev xvfb xauth \ + && rm -rf /var/lib/apt/lists/* +RUN cmake -P tools/prepare-sdl3.cmake \ + && cmake --preset client-probe -DCMAKE_CXX_COMPILER=clang++-19 \ + -DEVO_ENABLE_TIDY=ON -DSDL_X11=ON -DSDL_WAYLAND=OFF \ + && cmake --build --preset client-probe --parallel 2 \ + && ctest --preset client-probe --no-tests=error \ + && xvfb-run -a env SDL_VIDEO_DRIVER=x11 ./build/client-probe/evo-client-probe --renderer software + FROM ci-source AS ci-ecs # Explicit experiment preparation; normal configure/runtime remains dependency-free. RUN cmake -P tools/prepare-entt.cmake \ diff --git a/docs/ROADMAP.md b/docs/ROADMAP.md index c98b05c..846c30d 100644 --- a/docs/ROADMAP.md +++ b/docs/ROADMAP.md @@ -389,6 +389,11 @@ JetStream is adopted only for a demonstrated delivery workload, not as lease aut ## M9 - Custom 2D engineering client +**M9.1 status (2026-10-01):** implemented and locally validated; scoped SDL3 +decision in ADR-0077, explicit pinned preparation, Windows native and Linux X11 +software probes. Evidence and platform limits are in engineering/VALIDATION.md. +The added Gitea client job awaits remote execution. Next gate: M9.2. + **Goal:** a native desktop cellular viewer/controller with input, camera, renderer, readable organism/environment views and a real development-server connection. It is an engineering client, not the M11 playable game or the M13 3D engine. diff --git a/docs/STATUS.md b/docs/STATUS.md index c46fc47..07ad444 100644 --- a/docs/STATUS.md +++ b/docs/STATUS.md @@ -1,5 +1,19 @@ # Project status and next steps +## Current gate — 2026-10-01 + +M9.1 supplies the opt-in native dependency probe and scoped SDL3 decision in +[ADR-0077](adr/0077-scoped-native-client-dependencies.md). SDL 3.4.16 is pinned by +archive hash; the headless build remains independent. Windows native backends and +Linux software/X11 validation are recorded in [VALIDATION.md](engineering/VALIDATION.md). +The new isolated Gitea client gate has not yet run remotely. + +Next: **M9.2**, the real native application lifecycle and immutable-view renderer +boundary, including resize/DPI/focus and failure handling. The probe is not a +playable client. No deployment or persistent-world state changed in M9.1. + +The sections below retain earlier milestone delivery history. + Updated 2026-09-27. The repository contains an engineering foundation and a deterministic headless proof. It does not yet contain cellular gameplay or a persistent simulation server. The founding vision remains unchanged. diff --git a/docs/adr/0003-dependencies.md b/docs/adr/0003-dependencies.md index 60e259d..c771ebe 100644 --- a/docs/adr/0003-dependencies.md +++ b/docs/adr/0003-dependencies.md @@ -2,7 +2,8 @@ ## Status -Dependency-free proof adopted; vcpkg manifest proposed at first dependency gate. +Dependency-free proof adopted; general package-manager comparison remains open. +ADR-0077 accepts a scoped explicit-source SDL dependency for M9 only. ## Context diff --git a/docs/adr/0077-scoped-native-client-dependencies.md b/docs/adr/0077-scoped-native-client-dependencies.md new file mode 100644 index 0000000..b2acd97 --- /dev/null +++ b/docs/adr/0077-scoped-native-client-dependencies.md @@ -0,0 +1,74 @@ +# ADR-0077: Scoped native 2D client dependencies + +## Status +Accepted for M9.1's isolated probe and M9 engineering client. No final 3D renderer, +audio, UI toolkit, physics engine or transport is selected here. + +## Context +M9 needs a native Windows/Linux window, input events and simple 2D primitives. +The headless libraries must configure, build and run without graphical dependencies. +M6 views already expose immutable value data; no SDL types belong in those APIs. + +## Decision +Use SDL **3.4.16**, zlib licensed, for window/events and `SDL_Renderer`. Build a +shared library from an explicitly prepared SHA-256-pinned upstream source archive. +`tools/sdl3-pin.cmake` is the machine-readable pin. Normal CMake configuration +never downloads it. The dependency and `evo-client-probe` are opt-in; only the +probe links SDL. M9.2 will introduce the actual platform/render boundary. + +Select SDL's small 2D abstraction rather than direct Vulkan for this scope. Retain +its platform renderer selection and allow the probe to explicitly request Vulkan, +Direct3D11 or software without silently substituting another backend. Disable +unused audio, camera, joystick, haptic, sensor and SDL_GPU subsystems. Keyboard and +mouse events remain. Audio and final UI are explicitly deferred. + +This is a scoped amendment to ADR-0003, following the explicit-source approach +already used for PostgreSQL: do not require adoption of a general package manager +for one self-contained client dependency. vcpkg/Conan measured comparison remains +open before a broader dependency graph. No claim is made that either was benchmarked. +Archive preparation can use an existing verified download for offline rebuilds. + +## Alternatives considered +| Option | Value | Cost / disposition | +|---|---|---| +| SDL3 + direct Vulkan | Explicit resource/synchronization control and future compute | Swapchain, shaders, pipeline and allocator work exceeds this 2D gate; defer to measured need / M13 | +| SDL3 + SDL_GPU | Portable explicit GPU API with shader pipelines | Shader build/distribution and more resource lifetime work; useful later, not required for basic views | +| SDL3 + SDL_Renderer | Window/events plus accelerated primitives and textures from one dependency | Less pipeline control; selected for scoped 2D client, not a permanent engine-wide abstraction | +| GLFW + Vulkan | Narrow window/input layer | Still needs the renderer work above and another dependency choice; no demonstrated M9 advantage | +| vcpkg manifest | Baselines/features and strong CMake/MSVC integration | Broader tool bootstrap/registry governance for one archive; remains a candidate | +| Conan lockfile | Profiles, binary packages and revision locks | Python/recipe/tool bootstrap and profile governance; remains a candidate | + +These are scope/maintenance comparisons, not measured performance rankings. +The probe records actual backend, SDL version and execution result; size/build +measurements and platform limits belong in the M9.1 validation record. + +## Benefits +One established C API with explicit return checks, uncomplicated RAII adapters and +small review surface for generated C++. No engine dependency and no changes to +simulation rules, formats or public headers. Software rendering permits CI pixel +checks without pretending to test a GPU driver. + +## Costs +Shared-library packaging and license retention; platform-specific SDL build options +and system video libraries. Main-thread event/render calls. A later renderer may +replace the private adapter rather than inherit an unsuitable 2D abstraction. + +## Risks +Backend-dependent pixels/performance, driver availability, DPI/event differences, +untrusted asset decoders and dependency updates. Synthetic event injection proves +queue plumbing only; actual keyboard/focus/DPI acceptance stays in M9.2/M9.3. +No user assets are decoded by this probe. Retain upstream third-party notices +alongside the SDL license for distribution; audit the enabled build at packaging. + +## Consequences and evidence +Preparation is explicit; missing sources fail with instructions. An ordinary +headless configure never evaluates SDL. Upgrades change version and hash together, +rerun platform probes and review upstream changes. Client rendering is approximate +presentation, never authoritative biological state. + +Primary sources checked 2026-10-01: +- [SDL 3.4.16 release](https://github.com/libsdl-org/SDL/releases/tag/release-3.4.16): stable bugfix release, active release maintenance. +- [SDL 2D API](https://wiki.libsdl.org/SDL3/CategoryRender): primitives/textures and main-thread requirement. +- [SDL GPU API](https://wiki.libsdl.org/SDL3/CategoryGPU): alternative explicit pipeline API. +- License/build/platform documentation is retained in the pinned source archive + (`LICENSE.txt`, `docs/README-cmake.md`, `docs/README-platforms.md`). diff --git a/docs/adr/README.md b/docs/adr/README.md index 83c2372..76a497a 100644 --- a/docs/adr/README.md +++ b/docs/adr/README.md @@ -87,3 +87,5 @@ design. No unadopted candidate is a link dependency of the proof. - [ADR-0074: World backup bundles and verified restore](0074-world-backup-and-restore.md) - accepted for M8.7 snapshot-consistent online bundles (dump + immutable objects + manifest), fail-closed audited restore on independent storage, isolated rebuild through clones; destination, encryption, schedule and WAL archiving pending. - [ADR-0075: World0 acknowledgment gate, host-loss recovery and promotion](0075-world0-acknowledgment-gate.md) - accepted for M8.8 ratified dev/stage RPO/RTO, World0 launch blocked (policy-enforced) until acknowledgements survive host loss in an independent failure domain, explicit-rewind in-place restore, barrier-based fencing of a superseded database, promotion only of stage-pinned digests. - [ADR-0076: Upgrade rehearsal on clones, version barrier in dev/stage, and node growth](0076-upgrade-and-growth.md) - accepted for M8.9 accelerated clone runs compared state-for-state before a build change, failed-migration recovery, guarded in-cluster barrier, stores/compute node labels with policy-checked placement. + +- [ADR-0077: Scoped native client dependencies](0077-scoped-native-client-dependencies.md) - SDL 3.4.16 window/events and 2D renderer for the opt-in M9.1 probe; no simulation dependency. diff --git a/docs/engineering/CLIENT_DEPENDENCIES.md b/docs/engineering/CLIENT_DEPENDENCIES.md new file mode 100644 index 0000000..fba6f21 --- /dev/null +++ b/docs/engineering/CLIENT_DEPENDENCIES.md @@ -0,0 +1,69 @@ +# M9.1 native client dependency probe + +Decision: [ADR-0077](../adr/0077-scoped-native-client-dependencies.md). This is an +isolated dependency evaluation, not `evo-client`, gameplay or the M9.2 renderer. +SDL 3.4.16 provides window/events and a thin 2D renderer. Direct Vulkan and SDL_GPU +remain alternatives if measured workloads outgrow it. Audio and player UI are deferred. + +## Reproduce + +In a C++23 developer shell with CMake 3.28+ and Ninja: + +```sh +cmake -P tools/prepare-sdl3.cmake +cmake --preset client-probe +cmake --build --preset client-probe --parallel 4 +ctest --preset client-probe --no-tests=error +./build/client-probe/evo-client-probe +./build/client-probe/evo-client-probe --renderer vulkan +``` + +Windows executables have `.exe`. CTest uses SDL's dummy window driver and software +renderer for deterministic rectangle/background pixel checks. The standalone run +uses the native video driver and reports the actual renderer. The window is hidden +and the process exits after one checked frame; no persistent desktop window is left. +An explicitly requested missing renderer must fail, not silently fall back. +Synthetic keyboard injection proves event plumbing, not physical input/focus behavior. + +Linux desktop builds require SDL's documented X11/Wayland development packages. +The `ci-client` Docker stage installs the X11 subset and runs a window probe under +Xvfb, in addition to dummy-driver CTests. It does not require a GPU or cluster. +For a CI host without these, explicitly add `-DSDL_UNIX_CONSOLE_BUILD=ON +-DSDL_X11=OFF -DSDL_WAYLAND=OFF`. That configuration proves software/offscreen +behavior only. Do not use it to claim Linux desktop-window qualification. + +Offline preparation from a previously downloaded archive: + +```sh +cmake -DSDL_ARCHIVE=/absolute/path/SDL3-3.4.16.tar.gz -P tools/prepare-sdl3.cmake +``` + +The script checks the archive before extraction. Sources go under ignored +`build/external/sdl3/`; configuration consumes only prepared sources and refuses +a missing/mismatched preparation marker. Treat that directory as an immutable +local dependency checkout; edits there invalidate qualification. Delete/reprepare +it explicitly for a clean rebuild. No network access occurs during configuration. + +## Ownership, licensing and updates + +- Machine-readable release URL/version/hash: `tools/sdl3-pin.cmake`. +- Owner: client/platform engineering. Upgrade by reviewing upstream release and + security changes, updating version/hash, preparing fresh sources and rerunning + Windows/Linux probes, analysis and package measurements. +- SDL's zlib notice is retained in `third_party/SDL3/LICENSE.txt`; the complete + upstream archive retains bundled component notices. No claim is made that SDL + license review licenses the game itself. Binary release packaging must retain + applicable third-party notices and audit enabled backend/system dependencies. +- Shared SDL is linked only by `evo-client-probe`; no SDL includes/link dependencies + enter `include/evo`, simulation, world, biology or server targets. It is disabled + by default. Windows copies SDL3.dll beside the probe; Linux uses the build RPATH. +- Size reports are build artifacts, not performance rankings. No representative + creature/terrain workload exists yet, so no renderer throughput claim is made. + +## Follow-up boundary + +M9.2 owns the real application lifecycle, immutable-view renderer interface, +resize/DPI/focus/device failures and resource limits. M9.3 owns camera/intentions. +M9.8 owns distributable packaging. Xvfb verifies the Linux X11 window path; real +desktop input, focus, DPI, Wayland and GPU qualification remain later gate work. +See VALIDATION.md for executed measurements and limitations. diff --git a/docs/engineering/VALIDATION.md b/docs/engineering/VALIDATION.md index c84fa0c..aee0614 100644 --- a/docs/engineering/VALIDATION.md +++ b/docs/engineering/VALIDATION.md @@ -3133,3 +3133,57 @@ as proof of rollback. layers deep and only the outer layer is tested. - Not run: a real network partition around COMMIT. The lost acknowledgement is an injected test mode (`EVO_RESTORE_TEST_INSTALL_ACK`). + +## M9.1 scoped native dependency probe — 2026-10-01 + +Decision: ADR-0077. SDL 3.4.16 shared window/events/2D renderer, explicitly +prepared from the official archive with SHA-256 validation. No simulation API, +world format, server image or deployed workload changed. + +Executed: + +- Windows x64 MSVC 19.44: fresh `client-probe` configure/build and 2/2 labeled + CTests passed. Native standalone probes reported `video=windows` with both + `renderer=direct3d11` (automatic) and explicitly requested `renderer=vulkan`; + synthetic key delivery and rectangle/background pixel readback passed. + Developer environment required explicit compiler and Windows SDK tool paths. +- WSL Ubuntu, GCC 14 Release: configured the same preset in + `build/client-probe-linux` with `SDL_X11=ON`, `SDL_WAYLAND=OFF`; build and 2/2 + client CTests passed. `xvfb-run -a env SDL_VIDEO_DRIVER=x11 + ./build/client-probe-linux/evo-client-probe --renderer software` passed. + X11 development dependencies are reproduced in Docker's `ci-client` stage. +- clang-tidy 19 standalone against `experiments/client/main.cpp`, C++23 and the + prepared SDL include directory: no owned-code diagnostics. Initial use of the + GCC compilation database failed on GCC module options; rerun used explicit + Clang arguments. Repository `format-check` passed. +- Clang 19 ASan/UBSan build of the owned probe, linked to the Release SDL shared + library: dummy video/software renderer passed. SDL itself was not instrumented. + **Additional X11 sanitizer run failed LeakSanitizer:** 50,016 bytes in 912 + allocations remained at exit; resolved SDL call sites included + `X11_InitKeyboard` and `X11_GetGlobalContentScale`, with underlying unloaded + library frames unresolved. This is not a proven application leak or a clean + native sanitizer result. Do not suppress or declare it fixed. M9.2 must reproduce + with symbolized native libraries and establish repeated window-lifecycle memory + behavior before desktop qualification. + Diagnostic rerun with `LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libX11.so.6` + passed with leak detection enabled. Keeping libX11 loaded changes the result, + suggesting library unload/static allocation reachability; it does not establish + that repeated native lifecycles are leak-free. No suppression was added. +- Headless Release, client disabled: configured/built `evo-sim`; seed 123456, + eight entities, 1,000 ticks and `--verify-replay` passed, hash `d61ad5bf0c928c76`. +- Offline cached archive preparation passed; deliberately invalid archive was + rejected with checksum mismatch before extraction. CI selector regression: + all 12 fixtures passed, including an SDL pin change selecting the client gate. +- Artifact sizes (not comparable performance measurements): Windows executable + 14,336 bytes + SDL3.dll 1,998,848; Linux X11 executable 17,624 bytes + shared SDL + 3,304,808. Build configurations/backend sets differ. No throughput or cold-build + benchmark claim is made. + +Limits: synthetic keyboard events only; hidden Windows window and virtual Linux +X11 display. No human visual inspection, real input/focus/DPI, Wayland or Linux +GPU qualification. A Linux offscreen GLES attempt failed because the environment +could not initialize OpenGL/GLES. No full headless CTest rerun, TSan, Docker build, +remote Gitea run or Kubernetes action was performed for this gate. The new client +CI job performs analysis, dummy pixel/error tests and an Xvfb window probe; +remote execution remains pending. M9.1 selects a scoped dependency, not a +production-ready renderer or packaged client. diff --git a/experiments/client/main.cpp b/experiments/client/main.cpp new file mode 100644 index 0000000..2ec8d5c --- /dev/null +++ b/experiments/client/main.cpp @@ -0,0 +1,86 @@ +// M9.1 dependency probe only. No simulation, application framework or network. +#include +#include +#include +#include +#include + +namespace { +struct SdlLifetime { + ~SdlLifetime() { + SDL_Quit(); + } +}; +int fail(const char* operation) { + std::fprintf(stderr, "%s: %s\n", operation, SDL_GetError()); + return 1; +} +} // namespace + +int main(int argc, char** argv) { + const char* driver = nullptr; + if (argc == 3 && std::string_view(argv[1]) == "--renderer") { + driver = argv[2]; + } else if (argc != 1) { + std::fputs("usage: evo-client-probe [--renderer NAME]\n", stderr); + return 2; + } + if (!SDL_Init(SDL_INIT_VIDEO)) + return fail("video init"); + const SdlLifetime lifetime; + const std::unique_ptr window{ + SDL_CreateWindow("Aeternalis M9.1 probe", 320, 240, SDL_WINDOW_HIDDEN), SDL_DestroyWindow}; + if (!window) + return fail("window"); + const std::unique_ptr renderer{ + SDL_CreateRenderer(window.get(), driver), SDL_DestroyRenderer}; + if (!renderer) + return fail("renderer"); + + // Synthetic keyboard event tests queue delivery; not real keyboard hardware. + SDL_Event sent{}; + sent.type = SDL_EVENT_KEY_DOWN; + sent.key.windowID = SDL_GetWindowID(window.get()); + sent.key.scancode = SDL_SCANCODE_SPACE; + sent.key.down = true; + if (!SDL_PushEvent(&sent)) + return fail("push event"); + bool received = false; + SDL_Event event{}; + for (int count = 0; count < 1024 && SDL_PollEvent(&event); ++count) { + if (event.type == SDL_EVENT_KEY_DOWN && event.key.windowID == sent.key.windowID && + event.key.scancode == SDL_SCANCODE_SPACE && event.key.down) + received = true; + } + if (!received) { + std::fputs("synthetic key event missing\n", stderr); + return 1; + } + const SDL_FRect box{0, 0, 32, 32}; + if (!SDL_SetRenderDrawColor(renderer.get(), 0, 0, 0, 255) || !SDL_RenderClear(renderer.get()) || + !SDL_SetRenderDrawColor(renderer.get(), 255, 0, 0, 255) || + !SDL_RenderFillRect(renderer.get(), &box)) + return fail("draw"); + const std::unique_ptr pixels{ + SDL_RenderReadPixels(renderer.get(), nullptr), SDL_DestroySurface}; + if (!pixels) + return fail("readback"); + Uint8 red{}, green{}, blue{}, alpha{}; + if (!SDL_ReadSurfacePixel(pixels.get(), 8, 8, &red, &green, &blue, &alpha)) + return fail("pixel"); + if (red != 255 || green != 0 || blue != 0 || alpha != 255) { + std::fputs("unexpected rectangle pixel\n", stderr); + return 1; + } + if (!SDL_ReadSurfacePixel(pixels.get(), 64, 64, &red, &green, &blue, &alpha)) + return fail("background pixel"); + if (red != 0 || green != 0 || blue != 0 || alpha != 255) { + std::fputs("unexpected background pixel\n", stderr); + return 1; + } + if (!SDL_RenderPresent(renderer.get())) + return fail("present"); + std::printf("SDL=%d video=%s renderer=%s event=ok pixels=ok\n", SDL_GetVersion(), + SDL_GetCurrentVideoDriver(), SDL_GetRendererName(renderer.get())); + return 0; +} diff --git a/third_party/SDL3/LICENSE.txt b/third_party/SDL3/LICENSE.txt new file mode 100644 index 0000000..e9adee4 --- /dev/null +++ b/third_party/SDL3/LICENSE.txt @@ -0,0 +1,18 @@ +Copyright (C) 1997-2026 Sam Lantinga + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. + diff --git a/third_party/SDL3/README.md b/third_party/SDL3/README.md new file mode 100644 index 0000000..0fe8497 --- /dev/null +++ b/third_party/SDL3/README.md @@ -0,0 +1,7 @@ +# SDL3 notice + +The isolated M9.1 probe uses SDL 3.4.16 from the verified upstream release archive +named in `tools/sdl3-pin.cmake`. `LICENSE.txt` is copied unchanged from that archive. +The full source archive also retains bundled component notices; preserve those +when redistributing source, and audit the enabled build's notices at packaging. +No SDL source or binary is vendored here. See ADR-0077 for scope and alternatives. diff --git a/tools/ci/ci-paths-check.sh b/tools/ci/ci-paths-check.sh index ed8bd4a..c767300 100644 --- a/tools/ci/ci-paths-check.sh +++ b/tools/ci/ci-paths-check.sh @@ -42,4 +42,9 @@ echo change >> tools/ci/dr-check.sh; git commit -qam dr-script script_base="$(git rev-parse HEAD~1)" expect "push: only dr-check.sh changed runs postgres" 0 CI_EVENT=push "CI_BEFORE=$script_base" -- postgres expect "push: only dr-check.sh changed skips image" 1 CI_EVENT=push "CI_BEFORE=$script_base" -- image +# Client dependency updates must select the isolated client gate. +mkdir -p tools +client_base="$(git rev-parse HEAD)" +echo pin > tools/sdl3-pin.cmake; git add .; git commit -qm client-pin +expect "push: SDL pin runs client" 0 CI_EVENT=push "CI_BEFORE=$client_base" -- client [ "$failures" = 0 ] && echo "ci path selection fixtures passed" || { echo "$failures fixture(s) failed"; exit 1; } diff --git a/tools/ci/ci-paths.sh b/tools/ci/ci-paths.sh index 314a66e..aa084af 100755 --- a/tools/ci/ci-paths.sh +++ b/tools/ci/ci-paths.sh @@ -33,6 +33,9 @@ common='\.gitea/workflows/|tools/ci/ci-paths\.sh' native='CMakeLists\.txt|CMakePresets\.json|cmake/|include/|src/|apps/' postgres_tools='migrations/|tools/prepare-postgres\.sh|tools/migrate-postgres\.sh|tools/backup/|tools/ci/postgres-check\.sh|tools/ci/backup-check\.sh|tools/ci/dr-check\.sh|tools/ci/upgrade-check\.sh' case "$suite" in + client) + pattern="$common|$native|experiments/client/|tools/prepare-sdl3\\.cmake|tools/sdl3-pin\\.cmake|deploy/docker/Dockerfile" + ;; checks|tsan|ecs) pattern="$common|$native|tests/|experiments/|tools/ci/linux-check\.sh|tools/ci/tsan-profile\.mjs|deploy/docker/Dockerfile" ;; diff --git a/tools/prepare-sdl3.cmake b/tools/prepare-sdl3.cmake new file mode 100644 index 0000000..3087acc --- /dev/null +++ b/tools/prepare-sdl3.cmake @@ -0,0 +1,22 @@ +cmake_minimum_required(VERSION 3.28) +include("${CMAKE_CURRENT_LIST_DIR}/sdl3-pin.cmake") +set(root "${CMAKE_CURRENT_LIST_DIR}/../build/external/sdl3") +file(MAKE_DIRECTORY "${root}") +if(NOT DEFINED SDL_ARCHIVE) + set(SDL_ARCHIVE "${root}/SDL3-${EVO_SDL_VERSION}.tar.gz") + if(NOT EXISTS "${SDL_ARCHIVE}") + file(DOWNLOAD "${EVO_SDL_URL}" "${SDL_ARCHIVE}" TLS_VERIFY ON + EXPECTED_HASH "SHA256=${EVO_SDL_SHA256}" STATUS result) + list(GET result 0 code) + if(NOT code EQUAL 0) + message(FATAL_ERROR "SDL download failed: ${result}") + endif() + endif() +endif() +file(SHA256 "${SDL_ARCHIVE}" actual) +if(NOT actual STREQUAL EVO_SDL_SHA256) + message(FATAL_ERROR "SDL archive checksum mismatch; refusing extraction") +endif() +file(ARCHIVE_EXTRACT INPUT "${SDL_ARCHIVE}" DESTINATION "${root}") +file(WRITE "${root}/SDL3-${EVO_SDL_VERSION}/evo-verified.sha256" "${actual}\n") +message(STATUS "Prepared SDL ${EVO_SDL_VERSION}; license: ${root}/SDL3-${EVO_SDL_VERSION}/LICENSE.txt") diff --git a/tools/sdl3-pin.cmake b/tools/sdl3-pin.cmake new file mode 100644 index 0000000..ee7e9ec --- /dev/null +++ b/tools/sdl3-pin.cmake @@ -0,0 +1,3 @@ +set(EVO_SDL_VERSION "3.4.16") +set(EVO_SDL_SHA256 "7322236cd12090c3eb40b9728be4d49c76f66ad17d04369584d4ecad5cf77c68") +set(EVO_SDL_URL "https://github.com/libsdl-org/SDL/releases/download/release-${EVO_SDL_VERSION}/SDL3-${EVO_SDL_VERSION}.tar.gz")