From 7b1032a2fdbbc074daf8da4fe41963ca186c0f30 Mon Sep 17 00:00:00 2001 From: R Date: Mon, 26 Oct 2026 11:41:58 -0400 Subject: [PATCH 1/3] lexical: AGENTS.md sends the reader to the superproject's coding guidelines The superproject's rules and design decisions moved to CODING-GUIDELINES.md, whose chapter 15 gives this library's decisions with their reasons; its AGENTS.md says how to work in the tree. Both are read before this file. --- AGENTS.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/AGENTS.md b/AGENTS.md index af247e4..0e7ffde 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1,6 +1,9 @@ # Working on lexical webcpp's rules apply here: read the superproject's +[CODING-GUIDELINES.md](../../CODING-GUIDELINES.md) +(), whose +chapter 15 gives lexical's design decisions with their reasons, and its [AGENTS.md](../../AGENTS.md) () first. This file holds only what is specific to lexical. From fc728d7e9a330f4c031bcd1dc5b23ba312622e8a Mon Sep 17 00:00:00 2001 From: R Date: Tue, 27 Oct 2026 16:21:56 -0400 Subject: [PATCH 2/3] lexical: writes each file of the Unicode cache through a partial file of its own Two generators that fill one cache at once, as the generated lane's tables and patterns do under b2 -j on a fresh CI runner, both downloaded a missing file and wrote it through the same .partial, so the second rename found nothing: lexical's lane failed on 'No such file or directory: ...DerivedCoreProperties.txt.partial'. Reproduced by calling write() from eight processes on one path: 1,220 of 1,600 writes failed before, none after. Each writer's partial file now has a name of its own, removed if the write fails, and the last rename wins with the same checked bytes. --- tools/generate_tables.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/tools/generate_tables.py b/tools/generate_tables.py index 03ee57d..c39fe23 100644 --- a/tools/generate_tables.py +++ b/tools/generate_tables.py @@ -43,6 +43,7 @@ import sys import textwrap import urllib.request +import uuid from collections.abc import Iterator, Sequence from pathlib import Path @@ -99,11 +100,17 @@ def pinned_files(pinned: Path) -> tuple[str, dict[str, dict[str, str]]]: def write(path: Path, data: bytes) -> None: - """Writes the data at the path through a sibling file, so that no reader sees half of it.""" + """Writes the data at the path through a sibling file of its own, so that no reader sees half + of it, and two writers of one path, such as two generators filling one cache at once, never + rename each other's file: the last to finish wins, with the same checked bytes.""" path.parent.mkdir(parents=True, exist_ok=True) - partial = path.with_name(path.name + '.partial') - partial.write_bytes(data) - partial.replace(path) + partial = path.with_name(f'{path.name}.{uuid.uuid4().hex}.partial') + try: + partial.write_bytes(data) + partial.replace(path) + except BaseException: + partial.unlink(missing_ok=True) + raise def checked(data: bytes, source: str, pinned: str) -> bytes: From 0eccb7d4c3225833ed221984ebe63d1883bc6ae8 Mon Sep 17 00:00:00 2001 From: R Date: Tue, 27 Oct 2026 16:21:56 -0400 Subject: [PATCH 3/3] lexical: the Python bytecode cache leaves the repository tools/__pycache__/generate_tables.cpython-314.pyc entered with the rename to lexical, and any run of a generator rewrote it. The cache is no longer tracked, and .gitignore keeps every __pycache__/ out, as the superproject's does. --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 6db4c4e..7883772 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ doc/html/ node_modules .node-modules/ +__pycache__/