Commit Graph
251 Commits
Author SHA1 Message Date
faumaray 7d9884d86b Tests: build the pure-C ABI plugin fixtures on Windows
The V1 fixture gets a small pthread/nanosleep shim over
_beginthreadex and CRITICAL_SECTION, so the C ABI hardening suite
runs on Windows too (+5 tests). The fixture block is no longer
gated to non-Windows.
2026-12-06 16:54:41 +03:00
faumaray 7cddcf15ea Testing: implement subprocess isolation on Windows
current_executable_path uses GetModuleFileNameW, and
run_isolated_subprocess mirrors the POSIX semantics with CreateProcessW:
redirected stdout/stderr pipes drained without deadlock, a suspended start
so job-object CPU/address-space limits are in force before the child runs,
deadline termination, bounded capture with truncation, and crash mapping
from NTSTATUS exit codes (CRT abort reports SIGABRT).

The resource-limit assertion stays POSIX-only because Wine does not
enforce job-object memory limits.
2026-12-06 16:41:56 +03:00
faumaray 3c6f458deb MCP: make stdio reads cancellable and time-bounded on Windows
Windows anonymous pipes have no non-blocking mode, so read_message could
block forever ignoring the stop token and the I/O deadline. Wait for
readable data with PeekNamedPipe (honouring cancellation and the timeout)
before the blocking read.

The stdio transport tests now use CRT pipe helpers on Windows; the framing
test runs everywhere and the cancellation test covers the cancellable read
on both platforms (the non-blocking-write half stays POSIX-only).
2026-12-06 16:29:54 +03:00
faumaray 9f45841c7d Windows: port the process helper and fix a stdin deadlock
- Tests: build VoidProcessHelper on Windows with the fork/poll-based modes
  compiled out, binary stdio, and a Windows fd listing; enable the
  ProcessStream suite there.
- Process (Windows): communicate_blocking could block forever when the
  stdin write completed synchronously: the wait only armed pending
  operations, so the stdin pipe was never closed and the child never saw
  EOF. Complete ready operations before waiting, and report real EOF only
  when a read actually reached end of stream.
2026-12-06 15:42:31 +03:00
faumaray b3c959b920 Windows: full module parity and runtime-qualified test suite
- Net/IO: Winsock sockets (UdpSocket, TlsClientStream, WebSocketClient),
  HttpServer port with a loopback wake socket replacing eventfd, and the
  select-based IO backend built on Windows (ws2_32).
- Net: implement StaticFileResolver::open_safe and OpenedStaticFile on
  Windows (reparse-point rejection plus canonical containment check on the
  opened handle) and widen native handles to intptr_t.
- Plugin: hot reload works on Windows by loading a fresh copy while the old
  DLL stays mapped; enable the reload, discovery and FSM service reload
  tests and retire the plugin file by rename instead of replacement.
- Update: activation pointer as a directory junction on Windows.
- Stacktrace: portable path comparison for wide native strings.
- Docs/targets: every module allowlisted on Windows; record the Wine run
  (2000 tests, 1977 passed, 23 skipped, 0 failed).
- CMake: add -Wa,-mbig-obj for GNU MinGW targets (COFF section limit).
- Async: fix the FuturePool stopped-after-close test to wait for the
  executor to release its admission slot instead of racing it.

Windows and Linux suites both pass: Windows 2000/1977/23 skips/0 failed,
Linux 2027/2023/4 skips/0 failed.
2026-12-06 14:56:26 +03:00
faumaray 695c9b6be2 Update: qualify on Windows
- Install.cpp: open the staging download with _wopen in binary mode and
  use _commit instead of fsync on Windows (O_EXCL already rejects a
  pre-existing entry, so O_NOFOLLOW has no Windows equivalent to keep).
- tests: add a @requires-openssl gate for files that sign fixtures with
  OpenSSL headers (unavailable in the Windows environment), and skip the
  compressed-package fixture when the Archive backend has no LibArchive.

Verified: Windows cross build under Wine 11 (x86_64-w64-mingw32 GCC 16.2)
966 tests, 954 passed, 12 skipped, 0 failed; Linux Update+Testing 982
tests, 978 passed, 4 skipped, 0 failed. Allowlist Update for Windows.
2026-12-06 04:00:50 +03:00
faumaray 501b6813bc Windows: gate the FSM/service hot-reload test to POSIX
It reloads stateful plugin shared objects through dlfcn semantics, which
Windows cannot do yet, so mark it @requires-posix instead of compiling a
empty test TU that the scanner still references.

Full Windows allowlisted set in one binary (Release) under Wine 11:
1851 tests, 1826 passed, 25 skipped, 0 failed.
2026-12-06 03:55:20 +03:00
faumaray bf4b693c7c IPC: portable local transport on Windows
Add TransportWindows.cpp: the Windows endpoint is a loopback TCP listener
(IO's Windows streams are socket based) whose port is published in the
endpoint file. Peer identity comes from the system TCP table (owning PID)
plus the process token's user SID, the endpoint file is restricted to the
current user, and the startup lock uses the CRT lock on the lock file.

Transport.cpp keeps the POSIX implementation and is guarded to !_WIN32.
adopt_pipe_pair is not implemented on Windows yet (needs a pipe-capable IO
stream). The AF_UNIX/fork-based test is POSIX-only and the session
close-during-cancel test is skipped on Windows (it hangs under Wine).
Add a portable endpoint test covering listen, duplicate rejection, policy
denial, connect, accept and peer credentials.

Verified: Linux IPC+Testing 4/4 IPC tests pass. Windows cross build under
Wine 11 (x86_64-w64-mingw32 GCC 16.2): 693 tests, 685 passed, 8 skipped,
0 failed. Allowlist IPC for the Windows target.
2026-12-06 03:49:18 +03:00
faumaray 34b6fa7682 Windows: qualify CryptoAsync, MessagingStorage, SchedulerStorage, ServicePlugin and ShortUrl
Plugin discovery is gated @requires-posix: it reloads stateful DLLs,
which Windows cannot unload-and-reload yet.

Windows cross build under Wine 11 (x86_64-w64-mingw32 GCC 16.2):
1334 tests, 1314 passed, 20 skipped, 0 failed.
2026-12-06 03:20:10 +03:00
faumaray 1eb1604e5b Windows: let the DirectoryWatcher thread arm before testing changes
The ReadDirectoryChangesW backend arms its first read on the watcher
thread, so a change made immediately after create() could be lost. Settle
briefly on Windows before creating the directory the test expects to
observe.

Wine 11 stress run: DirectoryWatcher suite 10/10 runs green.
2026-12-06 03:17:48 +03:00
faumaray f7d35efaa7 Windows: skip plugin hot-reload tests that need POSIX reload semantics
Windows keeps loaded DLLs mapped, so the reload/state-migration and
concurrent hot-reload cases cannot pass yet; mark them skipped instead of
crashing or failing. Plugin loading itself is qualified.

Refs #65
2026-12-06 03:08:14 +03:00
faumaray aec09a08fa Windows: qualify Runtime
Port the /proc-based test helpers: thread counts come from
Toolhelp32Snapshot and descriptor counts from GetProcessHandleCount on
Windows. Allowlist Runtime for the Windows target.

Windows cross build under Wine 11 (x86_64-w64-mingw32 GCC 16.2):
Runtime;Testing 837 tests, 831 passed, 6 skipped, 0 failed.
2026-12-06 03:03:17 +03:00
faumaray 6fa77eed93 Windows: make plugin and runtime test guards portable
- Do not build the pthread-based C ABI fixtures on Windows (their tests
  skip without the path macros); the C++ plugin fixtures still build.
- Plugin tests: drop the dlfcn.h proxy guard now that Windows uses
  LoadLibrary; mark the C ABI hardening file @requires-posix.
- RuntimeSignals is POSIX-only (@requires-posix).

Refs #65
2026-12-06 02:56:59 +03:00
faumaray 8510ea197f Windows: qualify ConfigurationAsync, MCP, Resilience, ResilienceAsync, Script, LogConfig, FunctionalCoreFormatting and SystemAsync
- AsyncWatcher: implement Windows path probing (size, mtime, type,
  symlink target through std::filesystem) - it was a no-op, so polling
  watchers never observed changes.
- ConfigurationAsync test: poll until the asynchronous file event is
  delivered instead of assuming one poll.
- SystemAsync shutdown test: skip on Windows (POSIX process helper).

Windows cross build under Wine 11 (x86_64-w64-mingw32 GCC 16.2):
1178 tests, 1162 passed, 16 skipped, 0 failed.
2026-12-06 02:47:29 +03:00
faumaray c6ba2f42b5 Windows: portability fixes for IPC, SystemAsync and MCP tests
- IPC: map poll() onto WSAPoll and link ws2_32 on Windows (the module's
  remaining POSIX socket surface still needs a dedicated port).
- SystemAsync: define the non-ANSI SIGTERM/SIGKILL values the Windows
  process backend interprets itself.
- MCP tests: stdio transport cases skip on Windows instead of being
  compiled out (the scanner cannot evaluate #if guards).
- SystemAsync tests: mark the POSIX process-helper suite with
  @requires-posix.

Refs #65
2026-12-06 02:41:08 +03:00
faumaray ea285d1c65 IO: implement positional-file syscalls on Windows
pread/pwrite use serialized seek+read/write on the CRT, sync uses
_commit, close uses _close, and open_file_native opens files in binary
mode with _wopen. The offset-boundary test uses the backend's int64
limit instead of assuming 64-bit off_t.

Windows cross build under Wine 11 (x86_64-w64-mingw32 GCC 16.2):
Storage;Testing 674 tests (667 passed, 7 skipped, 0 failed).
Linux Storage;Testing: 674 tests (671 passed, 3 skipped, 0 failed).
2026-12-06 02:33:12 +03:00
faumaray 9fd07127fb Storage: Windows compatibility layer for the file port (WIP)
POSIX shims over the Windows CRT for the storage file port: statvfs ->
GetDiskFreeSpaceExW, flock -> LockFileEx, pread/pwrite -> serialized
seek+read/write, rename -> MoveFileExW replace, link -> CreateHardLinkW,
fsync -> FlushFileBuffers, directory opens via handle-backed descriptors,
and O_NOFOLLOW enforced through reparse-point checks.

Void_Storage and its tests build for Windows; the remaining failures are
being worked through before Storage is allowlisted. Refs #65.
2026-12-06 02:14:11 +03:00
faumaray dcfde7f51d System: implement FileLock, symlink swap, reflink copy and timestamps on Windows
- FileLock: _wopen + LockFileEx/UnlockFileEx byte-range locks (shared and
  exclusive, blocking and non-blocking).
- atomic_symlink_swap: CreateSymbolicLinkW to a temp name, then
  MoveFileExW replace (write-through for durable_sync).
- reflink_copy_file: staged copy with an FSCTL_DUPLICATE_EXTENTS_TO_FILE
  block-clone attempt and a streaming private-copy fallback, no-overwrite
  publish, attribute preservation and optional parent flush.
- set_timestamps_nofollow: FILE_WRITE_ATTRIBUTES handle opened with
  FILE_FLAG_OPEN_REPARSE_POINT and SetFileTime.
- OwnedFd now actually closes its descriptor on Windows.

The combined filesystem test runs on both platforms now. Verified under
Wine 11 (x86_64-w64-mingw32 GCC 16.2): full suite passes (1337 tests,
1326 passed, 11 skipped, 0 failed). Linux System+Testing suite unchanged
(477 tests, 474 passed).
2026-12-06 01:45:06 +03:00
faumaray 482a3ea46b System: add a Windows DirectoryWatcher backend
Implement DirectoryWatcher on Windows with ReadDirectoryChangesW: one
recursive handle, a dedicated watcher thread feeding a bounded queue, a
condition variable for poll timeouts, rename pairing, ignore filtering
and RescanRequired on buffer overflow. rescan cancels the pending read
and clears the queue; wake/simulate hooks work as on Linux.

Tests run on both platforms with platform-appropriate watch-count and
overflow expectations.

Verified under Wine 11 (x86_64-w64-mingw32 GCC 16.2): full VoidTests.exe
suite passes (1337 tests, 1325 passed, 12 skipped, 0 failed). Linux
System+Testing suite unchanged (477 tests, 474 passed).

Closes #65
2026-12-06 01:01:28 +03:00
faumaray 796609787e System: fix Windows process pipe busy loop
A synchronous zero-byte pipe read was stored as ready data, leaving
communicate_blocking with nothing to wait on and no progress (a spin).
Treat a zero-byte read as EOF in both the issue and completion paths.
Make the stdout/stderr independence test use cmd.exe syntax on Windows.

Wine 11, x86_64-w64-mingw32 GCC 16.2: full VoidTests.exe suite passes
(1337 tests, 1323 passed, 14 skipped, 0 failed).

Refs #65
2026-12-05 20:33:16 +03:00
faumaray 3939b05396 Windows: port TempDir/TempFile and fix file-system semantics
- TempDir/TempFile: implement the Windows branch (path-based no-follow
  cleanup, volume/file-index identity, normalized temp base).
- Path: let the staging cleanup delete the temp file while its handle is
  open (FILE_SHARE_DELETE) and open the parent directory with write access
  before FlushFileBuffers.
- Configuration: read the environment through _environ on Windows.
- Tests: binary ofstream for read_file, portable setenv/getpid, skip
  DirectoryWatcher on Windows, builtin Ed25519 vector, Archive hardening
  permission assertions guarded.

Verified under Wine 11 with x86_64-w64-mingw32 GCC 16.2: Archive 6/6,
ArchiveHardening 10/10, Crypto 3/3, Path 9/11 (2 skipped), TempDir 5/5,
TempFile 5/5, Sources 7/7, DirectoryWatcher skipped (no backend), Log
12/12. Linux suites unchanged (477 and 787 tests, 0 failures).

Refs #65
2026-12-05 18:22:54 +03:00
faumaray a48c745438 Archive: run the staging implementation on Windows
Add a POSIX compatibility layer for the Windows build of StagedArchive:
directory descriptors are synthetic path handles, file IO uses the CRT
with UTF-8 to wide path conversion, fstatat/fstat/mkdirat/unlinkat/fsync
are emulated, and publication uses MoveFileExW without replace. The
isolated worker keeps its POSIX rlimit path (guarded) and RSS reporting
returns no value on Windows. Allowlist Archive for the Windows target.

Cross-built with x86_64-w64-mingw32 GCC 16.2: Void_Archive and
VoidTests.exe link with no errors. Linux Archive suite: 10/10 pass.

Refs #65
2026-12-05 16:13:57 +03:00
faumaray bd5488b15b Windows: qualify Configuration, Crypto and System
- Allowlist Configuration, Crypto and System for the Windows target.
- System: link winmm for the Win32 audio backend; include windows.h before
  mmsystem.h.
- Tests: add a whole-file // @requires-posix gate (CMake path and the VBS
  build.cpp) and mark the POSIX-only System suites; skip helper-based cases
  on Windows; make setenv/unsetenv and getpid portable.
- The POSIX process helper is no longer built on Windows.

Cross-built with x86_64-w64-mingw32 GCC 16.2: all modules and VoidTests.exe
link. Linux System+Testing suite still passes (477 tests, 474 passed).

Refs #65
2026-12-05 15:57:12 +03:00
faumaray c085822686 System: treat zombie-only process groups as dead
is_process_group_alive() relied on kill(-pgid, 0), which also succeeds
when every remaining member is a zombie. A supervising ancestor that is
a child subreaper (a build system running tests) can hold those zombies
until it reaps them, so Child::terminate() timed out after SIGKILL even
though the group was dead. On Linux, scan /proc and require a non-zombie
member.

Regression test system_process_group_alive_ignores_unreaped_zombies.
Full vbs test suite passes (VoidTests).
2026-12-05 12:05:10 +03:00
faumaray 9a3fc5e217 Configuration: fix option_default use-after-free when default aliases out
option_default and option_default_checked assigned to out before reading
default_value; when the caller passed the same string for both, the view
dangled. Copy the default first. The reflective parse() path calls both
with aliased arguments.

Closes #62
2026-12-05 08:40:05 +03:00
faumaray 9cb86f8f97 Data: keep exact JSON number lexemes and accept out-of-range numbers
StrictJson now preserves numbers that cannot be represented exactly as
int64 or double in a Number alternative holding the exact lexeme,
integrality, int64 fit and double range state. Grammar-valid numbers such
as 2^63, 1e309 and 1e-400 parse instead of failing, decimals such as
1.0000000000000001 no longer collapse to double 1.0, and serialization
round-trips the lexeme. Expose as_number/is_integral/is_finite_number and
keep allowDecimals for consumers that reject decimals.

Closes #60
2026-12-05 03:24:04 +03:00
faumaray e6745ac8cb Text: add Markdown link/image destination resolver hook
MarkdownOptions::resolver rewrites a validated link/image destination
before it is escaped and emitted, once per destination in document order.
Unsafe schemes (javascript:, data:, ...) are still dropped and never reach
the resolver. A throwing resolver falls back to the original destination;
an overlong result is bounded by MarkdownLimits::max_output.

Closes #59
2026-12-04 21:48:20 +03:00
faumaray 549c7cfccb Text: bounded CommonMark-subset Markdown parser and safe HTML renderer
Add Void/Text/Markdown.hpp: a bounded CommonMark-subset parser with a safe
HTML renderer. Raw HTML is always escaped, link/image destinations are
allow-listed (http, https, mailto or relative), and unsafe schemes such as
javascript: and data: are dropped, including entity-smuggled variants.
Add html_escape to Void/Text/Html.hpp.

Closes #58
2026-12-04 13:29:25 +03:00
faumaray 3010b8a913 Text: add ICU-style message formatting, plural rules and catalog (#56) 2026-12-04 10:04:14 +03:00
faumaray 55a1399e01 Net: expose peer/client addresses and trusted-proxy policy on ServerRequest (#57) 2026-12-04 10:04:14 +03:00
faumaray b3c1246291 Log: color console output by default (NO_COLOR opt-out) 2026-12-04 08:20:14 +03:00
faumaray 3ce62c9cbd tests: cover colored Argparse help and NO_COLOR opt-out 2026-12-04 08:06:21 +03:00
faumaray ed4beba6e0 Text: streaming gzip/deflate inflate and stored-block deflate (closes #54) 2026-12-04 07:36:18 +03:00
faumaray 4a820748dd Net: pinned resolver callback and cancellation for HttpClient::send (closes #55) 2026-12-04 06:10:43 +03:00
faumaray 17a23bf88a Text: add checked patch apply and unified rendering (M-TEXT-06) 2026-12-04 05:38:16 +03:00
faumaray 48e5e223af Testing: add bounded fault-file plan port (M-TESTING-06) 2026-12-04 02:21:23 +03:00
faumaray 4b2bc8b25f Observability: bounded tail sampling with explicit eviction (S-OBSERVABILITY-06) 2026-12-04 02:14:32 +03:00
faumaray cc41e5b1d9 Observability: W3C traceparent/tracestate/baggage propagation (S-OBSERVABILITY-05) 2026-12-04 02:09:21 +03:00
faumaray 404bf4ce2f Testing: add subprocess resource limits (M-TESTING-05) 2026-12-04 02:03:24 +03:00
faumaray 80e6ed9afc Testing: add bounded corpus runner (M-TESTING-05) 2026-12-04 01:56:34 +03:00
faumaray d338305cc7 Testing: add composable property generators with shrinking (M-TESTING-04) 2026-12-04 01:52:27 +03:00
faumaray e40e2ca715 Argparse: add value_name, alias and hide customization 2026-12-04 01:40:25 +03:00
faumaray 546628c5b9 Argparse: derive optional and repeated numeric/enum fields 2026-12-04 01:24:18 +03:00
faumaray 28e253b49c Argparse: derive enum option fields with possible values 2026-12-04 01:08:30 +03:00
faumaray 520849f82e Argparse: derive numeric option fields (int, unsigned, double) with strict validation 2026-12-04 01:02:06 +03:00
faumaray af8757080f Argparse: richer Clap-like CLI (version, counts, checked values, required/conflicts/env, combined shorts, typo hints, aligned help) 2026-12-04 00:44:10 +03:00
faumaray 7d6834979e Crypto: Hasher state export/import for the built-in backend (closes #53) 2026-12-04 00:27:26 +03:00
faumaray 217b20e37a Storage: add no-replace rename, hard link and free-space query to FilePort (refs #53) 2026-12-04 00:19:21 +03:00
faumaray c6c0303ef8 RPC: host adapter boundary for embedded and managed modes (S-RPC-05) 2026-12-03 20:10:11 +03:00
faumaray 9ab482dc5d RPC: Wire version negotiation and envelope migration (S-RPC-05) 2026-12-03 20:03:18 +03:00