From 2f83c16b2f3ac20f7e408de7bffff970bbbc8f67 Mon Sep 17 00:00:00 2001 From: bong-water-water-bong <277547417+bong-water-water-bong@users.noreply.github.com> Date: Wed, 11 Nov 2026 04:52:04 -0400 Subject: [PATCH] tools/ci: the /tmp ratchet also guards /dev/shm, which is the other RAM path the directive names (engine#2027) The directive this ratchet exists for says "never `/tmp` **or `/dev/shm`**", and the merged pattern guards one of the two: a reader -- and the next lane writing a benchmark scratch file -- sees a green check and concludes the RAM paths are handled. `/dev/shm` is the same failure mode with a worse ceiling: it is capped (half of RAM by default), always RAM, and never reclaimable to disk. So it is one alternation in the existing pattern, with the anchor unchanged: the lookbehind is about the character before the leading slash, so `/var/dev/shm/x` stays out for exactly the reason `/var/tmp/x` does. Measured before writing it: **zero `/dev/shm` sites on main** (`git grep -l 'dev/shm'` outside third_party), so this lands as a pure guard with no baseline lines -- today's 44 baselined sites are all `/tmp` and none of them is touched. Verified: * `--self-test` ok, including two new arms: a `/dev/shm/buf.bin` literal is a site, and `/var/dev/shm/not_ours.bin` is not (a fixture file, scanned, then unlinked so the baseline round-trip arms stay undisturbed) * `--check --root ` rc=0, "44 baselined site(s), none new, none stale" Not done here, deliberately: the 44 baseline lines still carry no per-entry reason. The file's header already says it once ("each is a real test whose runner was never added" -- no, for this file: a site that predates the ratchet), and 44 reasons would be 44 sentences saying that; the set baseline plus the stale-line report is what keeps it honest, which is the same argument `add_test_gaps.txt` established. --- tools/ci/tmp_path_check.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/tools/ci/tmp_path_check.py b/tools/ci/tmp_path_check.py index ef8ab4fc7..f7f6d6cbf 100644 --- a/tools/ci/tmp_path_check.py +++ b/tools/ci/tmp_path_check.py @@ -46,7 +46,12 @@ # anchor is "not the tail of another path": `(?`, `=`, a quote or nothing at all. A trailing quote # is included when present so the baseline names the literal as a reader finds it. -LITERAL = re.compile(r"""(? None: check(all('"' not in s and "'" not in s for s in bare.get("tools/bare.sh", [])), "and the bare form is recorded without a quote it never had") + # engine#2027 review: `/dev/shm` is the other RAM path the directive names, so it is the same site rule -- and + # the anchor has to keep `/var/dev/shm` out for the same reason it keeps `/var/tmp` out. + (root / "npu" / "forward" / "shm.cpp").write_text( + 'void h() { open("/dev/shm/buf.bin"); }\nconst char* o2 = "/var/dev/shm/not_ours.bin";\n', + encoding="utf-8", + ) + shm = scan(root) + check(shm.get("npu/forward/shm.cpp") == ["/dev/shm/buf.bin"], + "a /dev/shm literal is a site too, and /var/dev/shm is not") + (root / "npu" / "forward" / "shm.cpp").unlink() + # The ratchet: a new site fails, a stale baseline line fails, and an unchanged tree passes. write_baseline(root / "tools" / "ci" / "tmp_paths.txt", found) base = read_baseline(root / "tools" / "ci" / "tmp_paths.txt")