From 2084d5966ace3c7c4040decc7b75ad35a174e83c Mon Sep 17 00:00:00 2001 From: R Date: Wed, 14 Oct 2026 09:26:38 -0400 Subject: [PATCH 1/2] release: prepare webcpp 0.1.0 source distribution [skip ci] --- AGENTS.md | 14 ++- doc/releases/0.1.0.adoc | 13 +-- doc/releases/0.1.0.whats-new.md | 49 +++++++++ libs/config | 2 +- libs/document | 2 +- libs/idna | 2 +- libs/lexical | 2 +- libs/pratt | 2 +- libs/trystero | 2 +- libs/wasi | 2 +- libs/xactor | 2 +- libs/xstate | 2 +- site | 2 +- tools/release/release.py | 90 +++++++++++++---- tools/release/release_test.py | 172 +++++++++++++++++++++++++++++++- tools/report/pages.py | 2 +- tools/report/report_test.py | 2 +- tools/site/redirect_test.py | 4 +- tools/site/site.jam | 2 +- tools/site/site_test.py | 21 +++- 20 files changed, 334 insertions(+), 55 deletions(-) create mode 100644 doc/releases/0.1.0.whats-new.md diff --git a/AGENTS.md b/AGENTS.md index 49696986..1739d325 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -2510,7 +2510,10 @@ superproject's new `main`. `main` is the only branch. is, "from "), Updated Libraries (each library a section that includes its changelog's region, alphabetical), Removed Libraries (what went out, and what replaces it), Tools and build, Compilers tested (the - CI's lanes). The index page includes each, newest first. While a version + tested compiler lanes, a nonempty ordered unique subset of the CI's + canonical lane names). List only the compilers actually tested for this + release; a local-only release does not claim coverage of other CI lanes. + The index page includes each, newest first. While a version is in preparation its notes open with the paragraph "In preparation: ..." and include each library's `tag=unreleased`. @@ -2534,6 +2537,15 @@ targets, which run only when named: --init` runs first: a submodule of HEAD not checked out fails it by name (`git submodule update --init libs/`). +`dist` also bundles the tracked sources and upstream licences of the root +source submodules `site` and `third_party/libs/`, at their recorded +commits, with no dot files. Each must be checked out at that commit and +hold no uncommitted changes. It never initializes submodules. The unused +upstream nested submodules of `third_party/libs/nativejson-benchmark` are +omitted, as chapter 2 requires; its own sources, benchmark data and licence +are bundled. Every other unsupported root or nested submodule is refused +by name, so required sources are never silently omitted. + Nothing is released until the owner asks. Then: 1. In every library whose "Unreleased" holds lines, it becomes diff --git a/doc/releases/0.1.0.adoc b/doc/releases/0.1.0.adoc index 3cc46eb5..a24664fd 100644 --- a/doc/releases/0.1.0.adoc +++ b/doc/releases/0.1.0.adoc @@ -7,9 +7,6 @@ [#webcpp-0-1-0] = webcpp 0.1.0 -In preparation: no tag names this version yet, and its libraries' entries -are their changelogs' "Unreleased" sections. - [#webcpp-0-1-0-new-libraries] == New Libraries @@ -52,6 +49,8 @@ None. [#webcpp-0-1-0-tools-and-build] == Tools and build +* Fixed source distributions rejecting pinned site and third-party dependencies. +* Changed release checks to accept the tested compiler subset. * Added agent skills with validated metadata for common contributor workflows. * *Breaking change:* changed wasip2 programs to build with exceptions, as wasip3 does; whether a program uses them is its developer's choice. @@ -171,13 +170,5 @@ theirs, so a pinned third-party repository's own submodules are not fetched. [#webcpp-0-1-0-compilers-tested] == Compilers tested -* GCC 14 (container, no network) * GCC 15 -* Clang 18 (libstdc{plus}{plus}, container, no network) -* Clang 22 (libstdc{plus}{plus}) -* Apple Clang (macOS 15) -* MSVC 14.3 (Visual Studio 2022) -* MSVC 14.5 (Visual Studio 2026) * Emscripten 6.0.11 (node) -* wasm32-wasip2 (wasi-sdk 34, wasmtime 47.0.3) -* wasm32-wasip3 (wasi-sdk 34, wasmtime 47.0.3) diff --git a/doc/releases/0.1.0.whats-new.md b/doc/releases/0.1.0.whats-new.md new file mode 100644 index 00000000..ce812b03 --- /dev/null +++ b/doc/releases/0.1.0.whats-new.md @@ -0,0 +1,49 @@ +# webcpp 0.1.0 + +webcpp 0.1.0 is out. + +## New libraries + +- **config**: webcpp's configuration, which every library includes first: the target, exceptions and the version, from R. +- **document**: a header-only JSON document for C++20 that behaves as JavaScript does, exact in decimal, in one relocatable binary image, with a JavaScript module, from R. +- **idna**: a header-only library of internationalized domain names for C++20: Punycode, UTS 46 and IDNA2008 validity over Unicode 17.0.0 tables, from R. +- **lexical**: header-only validators of JSON Schema's string formats for C++20, allocating nothing, each also a Boost.URL grammar rule, from R. +- **pratt**: a header-only Pratt-parsing engine for C++20, with a decimal calculator built on it, from R. +- **trystero**: a port of Trystero 0.26.0, serverless WebRTC rooms wire-compatible with the original, for C++20, from R. +- **wasi**: a header-only HTTP handler for C++20 programs built as WebAssembly components, covering WASI 0.2 and WASI 0.3, from R. +- **xactor**: a header-only, deterministic actor system for C++20, from R. +- **xstate**: a header-only port of XState's state machines and actors for C++20, from R. + +## Highlights + +- **New libraries**: Nine C++20 libraries provide JSON, domain names, parsers, WebRTC rooms, WASI handlers and actor systems. +- **Security & reliability**: Trystero rooms share authenticated app connections while separate passwords remain isolated in distinct apps. +- **Developer experience**: Reproducible source packages include documentation, licenses and pinned source dependencies. + +## Tools and build + +- Fixed source distributions rejecting pinned site and third-party dependencies. +- Changed release checks to accept the tested compiler subset. +- Added agent skills with validated metadata for common contributor workflows. + +## Trystero migration + +Construct `webcpp::trystero::app` and call `app::join` instead of constructing a standalone +room with `room_config`. Put the immutable password in `app_config::password`; all rooms of +that app share it. Different passwords require separate apps and distinct peer IDs. The +Trystero JS 0.26.0 wire is unchanged. + +## Verification + +This release is prepared without CI at the owner's request. Local checks cover the collection's +ordinary tests and examples on Apple Clang 21 (macOS 27), Emscripten 6.0.11 and GCC 15.2. On +GCC, Trystero's core is tested; its native backend uses dependencies built with libc++ and is +validated with Clang. Trystero also passes ASan/UBSan, its protocol oracle, 27 native and 24 +browser interoperability scenarios against JS 0.26.0. Strict documentation and release-tool +checks pass. Windows, Linux container and WASI runtime lanes were not rerun for this release. + +The archive includes the complete built HTML documentation. The hosted site is updated by CI, +so this publication does not redeploy it. + +Release notes: `doc/releases/0.1.0.adoc` in the archive. Checksum: +`webcpp-0.1.0.tar.gz.txt`. diff --git a/libs/config b/libs/config index 2fad1626..ece3d0f7 160000 --- a/libs/config +++ b/libs/config @@ -1 +1 @@ -Subproject commit 2fad162629ef9f47e7b77ae975056224f33d32c2 +Subproject commit ece3d0f792fc4447676bc2a34f38001ef883886a diff --git a/libs/document b/libs/document index 3667adc8..94c60ad6 160000 --- a/libs/document +++ b/libs/document @@ -1 +1 @@ -Subproject commit 3667adc828dbcdc639272cc89ad12837b0a1d5e6 +Subproject commit 94c60ad623f12b000d710fc8b07484a00c44dc46 diff --git a/libs/idna b/libs/idna index bd8d0d5b..f298a3e5 160000 --- a/libs/idna +++ b/libs/idna @@ -1 +1 @@ -Subproject commit bd8d0d5b9a402d400fc3b884f4fc95303d8a73f5 +Subproject commit f298a3e5bb69ca5bcab9d83a5f661bba79fdc37b diff --git a/libs/lexical b/libs/lexical index 3ac79971..f9d25ff8 160000 --- a/libs/lexical +++ b/libs/lexical @@ -1 +1 @@ -Subproject commit 3ac79971fb92f759871fcc5d2ec0435e23bfa15a +Subproject commit f9d25ff8f6fe844a613ca0953a9bb9a4205aade0 diff --git a/libs/pratt b/libs/pratt index d78451bf..37595b11 160000 --- a/libs/pratt +++ b/libs/pratt @@ -1 +1 @@ -Subproject commit d78451bf273c1cd1f8d70349b701eae79c849e4e +Subproject commit 37595b111ce42364124e50f0c7920f3b1ab1b31f diff --git a/libs/trystero b/libs/trystero index 2e2dcd46..77fed8f0 160000 --- a/libs/trystero +++ b/libs/trystero @@ -1 +1 @@ -Subproject commit 2e2dcd465fbc13b77ff6dc9939bdea29a0f86af1 +Subproject commit 77fed8f0a46e2fb0d3c2c8e8f5ae90b79f4d3f12 diff --git a/libs/wasi b/libs/wasi index 6e3c5296..b936324d 160000 --- a/libs/wasi +++ b/libs/wasi @@ -1 +1 @@ -Subproject commit 6e3c52962e41ca5b3d788c60317974701f73541b +Subproject commit b936324dc4c2c1adeecdceedaa3dd17155e2b1cb diff --git a/libs/xactor b/libs/xactor index 50a43fb6..71013bf0 160000 --- a/libs/xactor +++ b/libs/xactor @@ -1 +1 @@ -Subproject commit 50a43fb6e39f17e334ca2f3af3abbe8eebb045cf +Subproject commit 71013bf0afb2facfb03f1b64cd023d25f5e436fc diff --git a/libs/xstate b/libs/xstate index 5299db2b..03c4c85f 160000 --- a/libs/xstate +++ b/libs/xstate @@ -1 +1 @@ -Subproject commit 5299db2b02d88d00b52396960e59bed77f1c5779 +Subproject commit 03c4c85f178fe4bcb2d3532d4d1dc4ecd9ea0dbc diff --git a/site b/site index 7a4c03f5..f1b4832a 160000 --- a/site +++ b/site @@ -1 +1 @@ -Subproject commit 7a4c03f50dcbc5983af2e7dc90115c06bae83756 +Subproject commit f1b4832adc6bf83a928c635b3417680986554d1f diff --git a/tools/release/release.py b/tools/release/release.py index 9df53ec5..318ccf50 100755 --- a/tools/release/release.py +++ b/tools/release/release.py @@ -25,8 +25,8 @@ - notes in preparation include a library's region other than tag=unreleased, or a changelog has the version's section already; frozen notes include a region other than tag=, an Unreleased holds lines, Compilers tested is None., or a tag webcpp- is not at HEAD; - Compilers tested lists other lanes than the CI's, tools/ci/matrix.py's LANES, as the notes - write them; + Compilers tested is not a nonempty ordered unique subset of tools/ci/matrix.py's LANES, + as the notes write them; - a library is no git checkout of its own, is no submodule at HEAD, is not checked out, or is checked out at another commit than the superproject records; - New Libraries or Removed Libraries is not exactly the libraries new or gone since the newest @@ -52,12 +52,14 @@ dist writes webcpp-.tar.gz into the directory --out names, and webcpp-.tar.gz.txt, its sha256sum line: the files the superproject's HEAD records and those each library's HEAD records, +and the pinned source submodules site and third_party/libs/, with their upstream licences, read from git's objects and never from the working tree, and the pages the doc build writes, doc/html/index.html for the index and for each library, all under webcpp-/, no path with a part that starts with a dot. It refuses, naming each fault, a change HEAD does not record (named alone, as check names it), a version other than version.hpp's, a library that is no checkout of its -own, not checked out, no submodule at HEAD or at another commit than HEAD records, a submodule other -than the libraries' own, libs/, a link whose target is not UTF-8, absolute, outside its +own, not checked out, no submodule at HEAD or at another commit than HEAD records, a source +submodule not checked out at its recorded commit or holding uncommitted changes, an unsupported +submodule, a link whose target is not UTF-8, absolute, outside its repository or a dot file, a page not built, and any other file under a doc/html. The archive is the same bytes from the same commits and pages wherever, whenever, by whomever and under whatever time zone, locale and umask it is written, with any CPython of 3.9 or later linked to zlib: its members @@ -68,7 +70,9 @@ them, is refused before anything is read. No tar or gzip program is run. The archive and its checksum are written to temporaries first, then each renamed over its file, the archive first: a fault while writing, or renaming the archive, leaves both files as they were; one renaming the -checksum leaves the new archive beside the old checksum, and says so. +checksum leaves the new archive beside the old checksum, and says so. The unused upstream nested +submodules of third_party/libs/nativejson-benchmark are omitted, never checked out; its own +tracked sources, benchmark data and licence are included. All other nested submodules are refused. Exit 0 when nothing is wrong; 1 with each fault on a line of its own, `: `; 2 on a usage error, when a file it reads is not there, cannot be read or is not UTF-8, when a path git @@ -301,7 +305,11 @@ def region_of(version: Version, notes: changelog.Notes) -> tuple[str, str]: def is_checkout(root: Path, library: str) -> bool: """Whether libs/ is a git checkout of its own, rather than a directory whose git commands would reach the superproject's.""" - directory = root / 'libs' / library + return repository_checkout(root / 'libs' / library) + + +def repository_checkout(directory: Path) -> bool: + """Whether directory is a Git checkout of its own, including an initialized submodule.""" completed = subprocess.run(['git', '-C', str(directory), 'rev-parse', '--show-toplevel'], capture_output=True, text=True, check=False) return completed.returncode == 0 and \ @@ -380,9 +388,11 @@ def state_findings(root: Path, version: Version, notes: changelog.Notes, if notes.compilers is None: if not notes.preparing: findings.append(f'{relative}: Compilers tested is None., and the version is frozen') - elif notes.compilers != lanes: + elif not notes.compilers or notes.compilers != [lane for lane in lanes + if lane in notes.compilers]: findings.append(f'{relative}: Compilers tested lists {", ".join(notes.compilers)}, and ' - f'the CI\'s lanes are {", ".join(lanes)}') + f'must list a nonempty ordered subset of the CI\'s lanes: ' + f'{", ".join(lanes)}') if not notes.preparing: tagged = subprocess.run(['git', '-C', str(root), 'rev-parse', '-q', '--verify', f'refs/tags/{version.tag}^{{commit}}'], capture_output=True, @@ -738,16 +748,18 @@ def check_deflate() -> None: "webcpp's archives are: run dist with a Python linked to zlib") -def blobs(directory: Path) -> tuple[list[tuple[str, str, str]], list[str]]: +def blobs(directory: Path, *paths: str) -> tuple[list[tuple[str, str, str]], dict[str, str]]: """The tree at HEAD of the repository directory: each blob's path, git mode and object, and - each gitlink's path. A path that is not UTF-8 is Broken, named.""" - listed = subprocess.run(['git', '-C', str(directory), 'ls-tree', '-r', '-z', 'HEAD'], + each gitlink's path and pinned commit, optionally limited to paths. A path that is not UTF-8 + is Broken, named.""" + listed = subprocess.run(['git', '-C', str(directory), 'ls-tree', '-r', '-z', 'HEAD', '--', + *paths], capture_output=True, check=False) if listed.returncode != 0: error = listed.stderr.decode(errors='replace').strip() raise Broken(f'git ls-tree in {directory}: {error}') found = [] - links = [] + links = {} for entry in listed.stdout.split(b'\0'): if not entry: continue @@ -760,7 +772,7 @@ def blobs(directory: Path) -> tuple[list[tuple[str, str, str]], list[str]]: if kind == 'blob': found.append((path, mode, name)) elif kind == 'commit': - links.append(path) + links[path] = name return found, links @@ -800,9 +812,33 @@ def pages(current: list[str]) -> list[str]: def repositories(root: Path, names: list[str]) -> list[tuple[str, Path]]: - """The superproject and the libraries names, each with the prefix of its paths in the - superproject.""" - return [('', root)] + [(f'libs/{name}/', root / 'libs' / name) for name in names] + """The superproject, libraries and checked-out source submodules, with their path prefixes. + dist validates every checkout and pin before reading any submodule's blobs.""" + return ([('', root)] + [(f'libs/{name}/', root / 'libs' / name) for name in names] + + [(f'{path}/', root / path) for path in source_submodules(root) + if repository_checkout(root / path)]) + + +def source_submodules(root: Path) -> dict[str, str]: + """Supported root source submodules and their pinned commits: site and direct dependencies + under third_party/libs. Other gitlinks must be refused, never silently omitted.""" + recorded = blobs(root, 'site', 'third_party/libs/')[1] + return {path: commit for path, commit in recorded.items() if not hidden(path) and + (path == 'site' or PurePosixPath(path).parent == PurePosixPath('third_party/libs'))} + + +def source_checkout_findings(root: Path, sources: dict[str, str]) -> list[str]: + """A source dependency must be checked out at the exact commit recorded by the root.""" + findings = [] + for path, recorded in sources.items(): + if not repository_checkout(root / path): + findings.append(f'{path} is not checked out: git submodule update --init {path}') + else: + checked_out = git(root / path, 'rev-parse', 'HEAD').strip() + if checked_out != recorded: + findings.append(f'{path} is at {checked_out}, and the superproject records ' + f'{recorded}') + return findings def utf8(data: bytes) -> bool: @@ -832,14 +868,18 @@ def link_refusal(path: str, target: bytes) -> str | None: def repository_refusals(root: Path, names: list[str]) -> list[str]: """What the superproject's tree and those of the libraries names hold that the archive cannot: - a submodule other than the libraries' own, libs/, which it does not archive; a link - that link_refusal refuses.""" + an unsupported root or nested submodule; a link that link_refusal refuses. Only the unused + nested dependencies of nativejson-benchmark are intentionally omitted (chapter 2).""" refusals = [] + sources = source_submodules(root) for base, directory in repositories(root, names): files, submodules = blobs(directory) for path in submodules: if not base and PurePosixPath(path).parent == PurePosixPath('libs'): continue + if (not base and path in sources) or base == \ + 'third_party/libs/nativejson-benchmark/': + continue owner = base.rstrip('/') or 'the superproject outside libs/' refusals.append(f'{base}{path} is a submodule of {owner}, which dist does not archive') links = [(path, name) for path, mode, name in files @@ -873,11 +913,19 @@ def dist_refusals(root: Path, version: Version) -> list[str]: superproject records; a submodule or a link the archive cannot hold; a page not built, or a file beside the pages.""" current = libraries(root) - uncommitted = uncommitted_findings(root, current) - if uncommitted: - return uncommitted + sources = source_submodules(root) + dirty = uncommitted_findings(root, current) + for path in sources: + if repository_checkout(root / path): + dirty += [f'{path}/{changed} is not committed: a tag carries only what HEAD ' + 'records' for changed in uncommitted(root / path)] + if dirty: + return sorted(dirty) refusals = version_findings(root, version) refusals += checkout_findings(root, current, gitlinks(root, 'HEAD')) + refusals += source_checkout_findings(root, sources) + if refusals: + return refusals refusals += repository_refusals(root, [name for name in current if is_checkout(root, name)]) refusals += page_refusals(root, current) return refusals diff --git a/tools/release/release_test.py b/tools/release/release_test.py index e6e12649..d0bf60a0 100755 --- a/tools/release/release_test.py +++ b/tools/release/release_test.py @@ -15,6 +15,7 @@ import gzip import hashlib import io +import json import os import re import shutil @@ -460,14 +461,19 @@ def test_compilers_tested_are_the_ci_lanes(directory: Path) -> None: assert release.check(tree.root, V010) == [] tree.commit_file('doc/releases/0.1.0.adoc', scratch.notes_text( '0.1.0', new=('alpha', 'beta', 'config'), compilers=lanes[1:])) - expect(release.check(tree.root, V010), 'Compilers tested lists') + assert release.check(tree.root, V010) == [] + for invalid in ((lanes[1], lanes[0]), (lanes[0], lanes[0]), ('Unknown compiler',)): + tree.commit_file('doc/releases/0.1.0.adoc', scratch.notes_text( + '0.1.0', new=('alpha', 'beta', 'config'), compilers=invalid)) + expect(release.check(tree.root, V010), 'Compilers tested lists') # The notes write a lane as changelog.notes_lane does, and the check compares through it: the # CI's own spelling, libstdc++, is no lane of the notes, which doc-check refuses in prose. tree.commit_file('doc/releases/0.1.0.adoc', scratch.notes_text( '0.1.0', new=('alpha', 'beta', 'config'), compilers=lanes).replace('{plus}', '+')) expect(release.check(tree.root, V010), 'Compilers tested lists GCC 14 (container, no ' - 'network), GCC 15, Clang 18 (libstdc++, container, no network), ', "and the CI's " - 'lanes are GCC 14 (container, no network), GCC 15, Clang 18 (libstdc{plus}{plus}, ' + 'network), GCC 15, Clang 18 (libstdc++, container, no network), ', + "must list a nonempty ordered subset of the CI's lanes: " + 'GCC 14 (container, no network), GCC 15, Clang 18 (libstdc{plus}{plus}, ' 'container, no network), ') @@ -504,6 +510,20 @@ def test_frozen_state(directory: Path) -> None: assert release.check(tree.root, V020) == [] +def test_frozen_notes_can_record_only_tested_compilers(directory: Path) -> None: + tree = scratch.make_tree(directory) + released(tree) + tree.change('alpha', 'include/webcpp/alpha.hpp', '// alpha, changed\n') + frozen(tree, ('GCC 15', 'Emscripten 6.0.11 (node)')) + completed = subprocess.run([sys.executable, str(Path(release.__file__)), 'check', '--root', + str(tree.root), '--version', '0.2.0'], + capture_output=True, text=True, check=False) + assert completed.returncode == 0, completed.stdout + completed.stderr + tree.commit_file('doc/releases/0.2.0.adoc', scratch.notes_text( + '0.2.0', preparing=False, updated=(('alpha', '0.2.0'),))) + expect(release.check(tree.root, V020), 'Compilers tested is None., and the version is frozen') + + def test_index_includes_every_version_newest_first(directory: Path) -> None: tree = scratch.make_tree(directory) released(tree) @@ -534,8 +554,9 @@ def test_the_tree_s_notes_name_the_ci_lanes(directory: Path) -> None: notes, faults = changelog.parse_notes(path.read_text(encoding='utf-8'), version.name) assert faults == [], faults if notes.compilers is not None: - assert notes.compilers == [changelog.notes_lane(lane.name) for lane in matrix.LANES], ( - notes.compilers) + lanes = [changelog.notes_lane(lane.name) for lane in matrix.LANES] + assert notes.compilers and notes.compilers == [lane for lane in lanes + if lane in notes.compilers], notes.compilers def test_whats_new_skeleton(directory: Path) -> None: @@ -1169,6 +1190,139 @@ def run_dist(root: Path, version: release.Version, out: Path) -> None: assert printed.getvalue() == f'{archive}\n{archive}.txt\n', printed.getvalue() +def source_submodule(tree: scratch.Tree, path: str, *, nested: bool = False) -> Path: + """Adds a local source submodule with its upstream licence and an optional unused gitlink. + No fixture fetches a nested submodule.""" + origin = tree.root.parent / ('origin-' + path.replace('/', '-')) + scratch.write(origin / 'LICENSE', 'Upstream licence\n') + scratch.write(origin / 'data/source.txt', f'{path}: pinned source\n') + scratch.write(origin / '.hidden', 'Not in the source archive\n') + if path == 'site': + scratch.write(origin / 'package.json', '{"name":"fixture-site"}\n') + elif path.endswith('JSON-Schema-Test-Suite'): + scratch.write(origin / 'tests/draft7/type.json', '[{"schema":{"type":"string"}}]\n') + elif path.endswith('nativejson-benchmark'): + scratch.write(origin / 'data/canada.json', '{"type":"FeatureCollection","features":[]}\n') + scratch.git(origin, 'init', '-q') + scratch.git(origin, 'add', '.') + scratch.git(origin, 'commit', '-q', '-m', 'The upstream sources') + if nested: + commit = scratch.git(origin, 'rev-parse', 'HEAD').strip() + scratch.git(origin, 'update-index', '--add', '--cacheinfo', + f'160000,{commit},unused/dependency') + scratch.git(origin, 'commit', '-q', '-m', 'An unused upstream dependency') + scratch.git(tree.root, 'submodule', 'add', '-q', str(origin), path) + scratch.git(tree.root, 'commit', '-q', '-m', f'{path}: recorded') + return tree.root / path + + +def dist_cli(root: Path, out: Path) -> subprocess.CompletedProcess[str]: + """Runs the user's release command in another process against a real Git checkout.""" + return subprocess.run([sys.executable, str(Path(release.__file__)), 'dist', '--root', + str(root), '--version', '0.1.0', '--out', str(out)], + capture_output=True, text=True, check=False) + + +def test_dist_bundles_pinned_source_submodules(directory: Path) -> None: + # Omitting a supported repository, its licence, or its pin must fail this CLI test. + tree = scratch.make_tree(directory) + paths = ('site', 'third_party/libs/JSON-Schema-Test-Suite', + 'third_party/libs/nativejson-benchmark') + for path in paths: + source_submodule(tree, path, nested=path.endswith('nativejson-benchmark')) + out = directory / 'out' + completed = dist_cli(tree.root, out) + assert completed.returncode == 0, (completed.stdout + completed.stderr) + first = (out / 'webcpp-0.1.0.tar.gz').read_bytes() + with tarfile.open(out / 'webcpp-0.1.0.tar.gz') as archive: + for path in paths: + prefix = f'webcpp-0.1.0/{path}/' + assert member_bytes(archive, archive.getmember(prefix + 'LICENSE')) == \ + b'Upstream licence\n' + assert member_bytes(archive, archive.getmember(prefix + 'data/source.txt')) == \ + f'{path}: pinned source\n'.encode() + assert prefix + '.hidden' not in archive.getnames() + assert not any('/unused/' in name for name in archive.getnames()) + archive.extractall(directory / 'extracted') + extracted = directory / 'extracted/webcpp-0.1.0' + assert json.loads((extracted / 'site/package.json').read_text()) == {'name': 'fixture-site'} + assert json.loads((extracted / paths[1] / 'tests/draft7/type.json').read_text()) == [ + {'schema': {'type': 'string'}}] + assert json.loads((extracted / paths[2] / 'data/canada.json').read_text()) == { + 'type': 'FeatureCollection', 'features': []} + other = directory / 'another place' + shutil.copytree(tree.root, other, symlinks=True) + completed = dist_cli(other, directory / 'out two') + assert completed.returncode == 0, (completed.stdout + completed.stderr) + assert (directory / 'out two/webcpp-0.1.0.tar.gz').read_bytes() == first + digest, name = (out / 'webcpp-0.1.0.tar.gz.txt').read_text().split() + assert (digest, name) == (hashlib.sha256(first).hexdigest(), 'webcpp-0.1.0.tar.gz') + + +def test_dist_refuses_source_submodules_not_as_recorded(directory: Path) -> None: + for number, path in enumerate(('site', 'third_party/libs/JSON-Schema-Test-Suite')): + case = directory / str(number) + case.mkdir() + tree = scratch.make_tree(case) + checkout = source_submodule(tree, path) + out = case / 'out' + scratch.git(checkout, 'commit', '-q', '--allow-empty', '-m', 'An unrecorded commit') + completed = dist_cli(tree.root, out) + output = completed.stdout + completed.stderr + assert completed.returncode == 1 and not out.exists(), completed + assert f'{path} is at ' in output and ', and the superproject records ' in output, output + scratch.git(checkout, 'reset', '--hard', 'HEAD~1') + for changed in ('tracked', 'staged', 'untracked'): + file = checkout / ('new.txt' if changed == 'untracked' else 'data/source.txt') + scratch.write(file, 'A change the pin does not record\n') + if changed == 'staged': + scratch.git(checkout, 'add', 'data/source.txt') + completed = dist_cli(tree.root, out) + output = completed.stdout + completed.stderr + assert completed.returncode == 1 and not out.exists(), completed + assert output.splitlines() == [ + f'dist: {path}/{file.relative_to(checkout)} is not committed: ' + 'a tag carries only what HEAD records'], output + scratch.git(checkout, 'reset', '--hard', 'HEAD') + if changed == 'untracked': + file.unlink() + shutil.rmtree(checkout) + checkout.mkdir() + completed = dist_cli(tree.root, out) + output = completed.stdout + completed.stderr + assert completed.returncode == 1 and not out.exists(), completed + assert f'{path} is not checked out: git submodule update --init {path}' in output, output + + +def test_dist_refuses_nested_source_submodules(directory: Path) -> None: + for number, path in enumerate(('site', 'third_party/libs/other')): + case = directory / str(number) + case.mkdir() + tree = scratch.make_tree(case) + source_submodule(tree, path, nested=True) + out = case / 'out' + completed = dist_cli(tree.root, out) + output = completed.stdout + completed.stderr + assert completed.returncode == 1 and not out.exists(), completed + assert f'{path}/unused/dependency is a submodule of {path}, which dist does not archive' \ + in output, output + + +def test_dist_names_source_paths_that_are_not_utf8(directory: Path) -> None: + tree = scratch.make_tree(directory) + commit = scratch.git(tree.library('alpha'), 'rev-parse', 'HEAD').strip().encode() + subprocess.run([*scratch.GIT, '-C', str(tree.root), 'update-index', '--add', '--cacheinfo', + b'160000,' + commit + b',third_party/libs/caf\xe9'], + capture_output=True, check=True) + scratch.git(tree.root, 'commit', '-q', '-m', 'A source path that is not UTF-8') + out = directory / 'out' + completed = dist_cli(tree.root, out) + assert completed.returncode == 2 and not out.exists(), completed + assert "the path b'third_party/libs/caf\\xe9' is not UTF-8" in completed.stderr, \ + completed.stderr + assert 'Traceback' not in completed.stderr, completed.stderr + + def test_dist_is_reproducible(directory: Path) -> None: tree = scratch.make_tree(directory) run_dist(tree.root, V010, directory / 'out one') @@ -1619,6 +1773,9 @@ def git_checkout(root: Path) -> None: scratch.write(root / 'doc/index.adoc', scratch.index_text(('0.1.0',))) scratch.write(root / 'doc/releases/0.1.0.adoc', scratch.notes_text('0.1.0', new=('config', 'demo'))) + # The real tree may already hold the owner's authored release body. This fixture tests + # creating its own skeleton, and must not inherit that body from the copied superproject. + (root / 'doc/releases/0.1.0.whats-new.md').unlink(missing_ok=True) scratch.git(root, 'init', '-q') scratch.git(root, 'add', '.') scratch.git(root, 'commit', '-q', '-m', 'The scratch superproject') @@ -1742,6 +1899,7 @@ def test_jamroot_without_config(root: Path) -> None: test_lines_out_of_form_are_named, test_compilers_tested_are_the_ci_lanes, test_frozen_state, + test_frozen_notes_can_record_only_tested_compilers, test_index_includes_every_version_newest_first, test_template_opens_a_version_that_checks, test_the_tree_s_notes_name_the_ci_lanes, @@ -1758,6 +1916,10 @@ def test_jamroot_without_config(root: Path) -> None: test_whats_new_section_ends_at_a_heading, test_whats_new_a_continuation_starts_no_markdown_block, test_whats_new_five_highlights_with_continuations_check_clean, + test_dist_bundles_pinned_source_submodules, + test_dist_refuses_source_submodules_not_as_recorded, + test_dist_refuses_nested_source_submodules, + test_dist_names_source_paths_that_are_not_utf8, test_dist_is_reproducible, test_dist_leaves_out_dot_files_and_what_git_does_not_track, test_dist_refuses_a_dirty_tree_and_missing_pages, diff --git a/tools/report/pages.py b/tools/report/pages.py index 1b19b876..62c3f8d6 100644 --- a/tools/report/pages.py +++ b/tools/report/pages.py @@ -39,7 +39,7 @@ OUTSIDE = 'outside failure' # The longest title the site's valid-html accepts on a page of the report: html-validate's -# long-title, which site/.htmlvalidate.json leaves at its default. +# long-title, which site/htmlvalidate.json leaves at its default. LONGEST_TITLE = 70 # html-validate's directive, before a matrix inside its .scroll: no-redundant-role is off from diff --git a/tools/report/report_test.py b/tools/report/report_test.py index 4fc8b4fa..7262a89f 100644 --- a/tools/report/report_test.py +++ b/tools/report/report_test.py @@ -66,7 +66,7 @@ EM_DASH = chr(0x2014) # The longest title html-validate's long-title accepts, as the site's valid-html runs it on every -# page of the report (site/.htmlvalidate.json). +# page of the report (site/htmlvalidate.json). LONGEST_TITLE = 70 diff --git a/tools/site/redirect_test.py b/tools/site/redirect_test.py index ebc97840..9de2d9ae 100755 --- a/tools/site/redirect_test.py +++ b/tools/site/redirect_test.py @@ -12,7 +12,7 @@ root; and --to without https://, or a --prefix that is not a path between slashes, fails and writes nothing. The script's target(location) is cut from each page between its markers and run with node on objects shaped like window.location. Both pages are valid HTML by the rules the -site's own pages are checked with, site/.htmlvalidate.json, run with the site's html-validate, +site's own pages are checked with, site/htmlvalidate.json, run with the site's html-validate, installed as b2 installs it (tools/node/install.py); without the site checked out at site/ there is no html-validate to run, which that case says, and passes. Run with the names of some cases to run only those.""" @@ -131,7 +131,7 @@ def test_both_pages_are_valid_html(root: Path) -> None: assert install.returncode == 0, (install.returncode, install.stdout, install.stderr) out = written(root) result = subprocess.run([str(SITE / 'node_modules/.bin/html-validate'), - '--config', str(SITE / '.htmlvalidate.json'), + '--config', str(SITE / 'htmlvalidate.json'), *(str(out / name) for name in PAGES)], capture_output=True, text=True, check=False, timeout=120, env={**os.environ, 'FORCE_COLOR': '0'}) diff --git a/tools/site/site.jam b/tools/site/site.jam index 5541baf6..951f6430 100644 --- a/tools/site/site.jam +++ b/tools/site/site.jam @@ -28,7 +28,7 @@ # The site's Jamfile declares context.json, what its pages are rendered with, # with write-context below, pages, which renders them, test, which runs the # site's own tests, and valid-html, which checks every page of bin/site/ is -# valid HTML, html-validate against .htmlvalidate.json. +# valid HTML, html-validate against htmlvalidate.json. # # b2 site builds the docs with b2 doc, in the layout of the site (doc.jam), # unless -sWEBCPP_SITE_DOCS= names pages built already, a superproject's diff --git a/tools/site/site_test.py b/tools/site/site_test.py index 3247bf8a..e6829120 100755 --- a/tools/site/site_test.py +++ b/tools/site/site_test.py @@ -330,6 +330,22 @@ def test_the_release_channel_needs_its_version(scratch: Path) -> None: assert not (root / 'bin/site').exists() +def test_release_sources_build_the_site_without_dotfiles(scratch: Path) -> None: + # dist excludes every tracked path with a dot-prefixed component. The site's HTML + # validation must remain runnable from those sources, with dependencies installed normally. + root = superproject(scratch) + files = subprocess.run(['git', 'ls-files', '-z', '--', 'site'], cwd=root, + capture_output=True, text=True, check=True).stdout.split('\0') + for name in filter(None, files): + if any(part.startswith('.') for part in Path(name).parts): + (root / name).unlink() + docs = docs_fixture(scratch, root) + result = b2(root, '-a', 'site', f'-sWEBCPP_SITE_DOCS={docs}') + assert result.returncode == 0, (result.returncode, result.stdout[-6000:], result.stderr[-3000:]) + assert (root / 'bin/site/index.html').is_file() + assert (root / 'bin/site/docs/index.html').is_file() + + def test_valid_html_fails_the_build_naming_the_file(scratch: Path) -> None: # /webcpp/site//valid-html (site/Jamfile), b2 site's last step, runs html-validate over every # page of bin/site/: a page that is not valid HTML fails the build, naming the file and the @@ -364,7 +380,7 @@ def test_valid_html_fails_the_build_naming_the_file(scratch: Path) -> None: def test_valid_html_allows_trailing_whitespace_inside_a_librarys_pre(scratch: Path) -> None: - # The relaxed pass (.htmlvalidate.docs.json), for docs/ and libs/ alone, turns + # The relaxed pass (htmlvalidate.docs.json), for docs/ and libs/ alone, turns # no-trailing-whitespace off: a listing of a library's guide may show it as content. root = superproject(scratch) docs = docs_fixture(scratch, root) @@ -378,7 +394,7 @@ def test_valid_html_allows_trailing_whitespace_inside_a_librarys_pre(scratch: Pa def test_valid_html_still_fails_on_the_sites_own_trailing_whitespace(scratch: Path) -> None: - # The strict pass (.htmlvalidate.json), for every page outside docs/ and libs/, keeps + # The strict pass (htmlvalidate.json), for every page outside docs/ and libs/, keeps # no-trailing-whitespace on: the site's own pages are React's, which writes no such line on # its own, so one that holds any is a fault of the page's text, never formatting to allow. root = superproject(scratch) @@ -440,6 +456,7 @@ def test_a_channel_is_preview_or_release(scratch: Path) -> None: test_the_release_is_indexed_with_its_sitemap, test_a_failed_build_leaves_the_previous_bin_site_or_none, test_a_server_on_bin_site_answers_every_request_of_a_rebuild, + test_release_sources_build_the_site_without_dotfiles, test_valid_html_fails_the_build_naming_the_file, test_valid_html_allows_trailing_whitespace_inside_a_librarys_pre, test_valid_html_still_fails_on_the_sites_own_trailing_whitespace, From 3468418459241762621ab8e82f89d19a49244368 Mon Sep 17 00:00:00 2001 From: R Date: Wed, 14 Oct 2026 09:27:57 -0400 Subject: [PATCH 2/2] release: clarify the upstream JS password limitation [skip ci] --- doc/releases/0.1.0.whats-new.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/releases/0.1.0.whats-new.md b/doc/releases/0.1.0.whats-new.md index ce812b03..5a1b82a6 100644 --- a/doc/releases/0.1.0.whats-new.md +++ b/doc/releases/0.1.0.whats-new.md @@ -31,7 +31,8 @@ webcpp 0.1.0 is out. Construct `webcpp::trystero::app` and call `app::join` instead of constructing a standalone room with `room_config`. Put the immutable password in `app_config::password`; all rooms of that app share it. Different passwords require separate apps and distinct peer IDs. The -Trystero JS 0.26.0 wire is unchanged. +Trystero JS 0.26.0 wire is unchanged. A remote JS page mixing room passwords retains the +upstream one-way-handshake limitation. ## Verification