apex-twin 1.0.1: check that the five version places agree

APEX_VERSION in src/apex.h is the only source of truth, and nothing compared it
with what users read. SECURITY.md claimed 0.23.x while the tree was at 0.30.0 for
seven releases.

tests/version_check.py now checks five places and names each disagreement:
man page .TH, README status line, top CHANGELOG heading, SECURITY supported line
(<major>.<minor>.x) and the Makefile tarball name (which must derive from
APEX_VERSION, not hardcode it). It runs first in tests/run.sh, has its own
make version-check target, and is the first step of make release-check.

Bump 1.0.0 -> 1.0.1 with all five updated. Red proof: leaving the man page at
1.0.0 fails with 'docs/apex-twin.1 .TH says 1.0.0, header says 1.0.1' and run.sh
stops before the suite.

Verified: make test (version check + gate audit + 334 checks), make analyze 0,
make release-check green through distcheck 1.0.1.
This commit is contained in:
lotherk committed 2026-11-21 09:56:45 +00:00
1 parent 2d7eb0304d
commit fa8f258fb9
7 files changed
+154 -7

No files matched your search

+11 -1
View File
@@ -8,7 +8,17 @@ fields, and state from an older version is read by a newer one.
There are no git tags. The hash next to a version is the commit that introduced
it; the current entry is the commit that adds this section.
## 1.0.0 — 2026-11-21 — this change
## 1.0.1 — 2026-11-21 — this change
- `tests/version_check.py` makes the five places that carry a version agree with
`APEX_VERSION`: the man page `.TH`, the README status line, the top CHANGELOG
heading, the SECURITY supported line and the Makefile tarball name. It runs
first in `tests/run.sh` and at the top of `make release-check`.
- Why: `SECURITY.md` claimed 0.23.x while the tree was at 0.30.0 for seven
releases, because nothing compared the two.
- No functional change. 45 tools, 334 checks, 340 fuzz cases.
## 1.0.0 — 2026-11-21 — 2d7eb03
First stable release. No functional change from 0.30.0: this version is the
version and the stability statement.
+5 -1
View File
@@ -39,6 +39,9 @@ test: apex-twin
gate-audit:
python3 tests/gate_audit.py
version-check:
python3 tests/version_check.py
asan: $(ASAN_BIN)
test-asan: $(ASAN_BIN)
@@ -173,6 +176,7 @@ distcheck: dist
# The full release gate, fail-fast. Takes several minutes and needs the network
# for the example.com checks; it is not part of `make test`.
release-check:
$(MAKE) version-check
$(MAKE) gate-audit
$(MAKE) test
$(MAKE) test-asan
@@ -200,4 +204,4 @@ clean:
rm -f *.gcov
rm -rf $(DISTNAME) $(DIST)
.PHONY: all test gate-audit asan test-asan fuzz fuzz-selftest fuzz-red fuzz-proxy fuzz-proxy-red fuzz-http fuzz-http-red coverage analyze dist distcheck release-check install clean
.PHONY: all test gate-audit version-check asan test-asan fuzz fuzz-selftest fuzz-red fuzz-proxy fuzz-proxy-red fuzz-http fuzz-http-red coverage analyze dist distcheck release-check install clean
+11 -2
View File
@@ -32,9 +32,10 @@ separate, explicitly armed switch.
```sh
make # apex-twin, ~239 kB static-ish binary, zero warnings under -Werror
make test # gate audit + 334 end-to-end checks, no mocks
make test # version check + gate audit + 334 end-to-end checks
make asan # apex-twin-asan with ASan + UBSan
make test-asan # the whole suite against the sanitizer binary
make version-check # the five places that carry a version must agree
make gate-audit # static audit: every target-taking tool calls the gate
make analyze # gcc -fanalyzer over every translation unit
make coverage # -O0 --coverage build, suite, per-file gcov report
@@ -452,6 +453,14 @@ and any ASan/UBSan report fails the run. A case also fails on a hang; 200/202/
`make fuzz-http-red` (`APEX_FUZZ_BUG_HTTP`, a heap overflow after a complete
head) is rejected 2/2 with the exact `apex-twin.c` UBSan line.
`make version-check` compares `APEX_VERSION` in `src/apex.h` with the man page
`.TH`, the README status line, the top `CHANGELOG.md` heading, the
`SECURITY.md` supported line and the Makefile tarball name. It runs first in
`tests/run.sh` and at the top of `make release-check`. It exists because
`SECURITY.md` said 0.23.x while the tree was at 0.30.0 for seven releases; leaving
the man page at the old version was seen failing the check with
`docs/apex-twin.1 .TH says 1.0.0, header says 1.0.1`.
`make gate-audit` is a static check of the one invariant: it parses every
`TOOLS_*[]` table and handler body (comments and strings stripped), and rejects
any tool whose schema names a `target` without calling
@@ -485,7 +494,7 @@ the copied scope reason is now bounded with a precision, not left to snprintf.
## Status
1.0.0. Built and run: 45 tools, 334 checks, 340 fuzz cases and 76.9% line
1.0.1. Built and run: 45 tools, 334 checks, 340 fuzz cases and 76.9% line
coverage. The loop closes: a probe captures the exchange as a pair, a finding
points at it, `finding_update` gives it a state, an asset records the host it
came from, `cors_check`/`cookie_audit`/`http_options` turn a web answer into a
+1 -1
View File
@@ -1,5 +1,5 @@
.\" apex-twin.1 - manual page for APEX TWIN
.TH APEX-TWIN 1 "2026-11-21" "apex-twin 1.0.0" "User Commands"
.TH APEX-TWIN 1 "2026-11-21" "apex-twin 1.0.1" "User Commands"
.SH NAME
apex-twin \- scope\-gated offensive\-security MCP server
.SH SYNOPSIS
+1 -1
View File
@@ -15,7 +15,7 @@
#include "mcp.h"
#define APEX_VERSION "1.0.0"
#define APEX_VERSION "1.0.1"
#define APEX_MAX_OUT (1u << 20)
#define APEX_PATH_MAX 512
#define APEX_PATH_FULL 1024
+3 -1
View File
@@ -1,5 +1,7 @@
#!/bin/sh
# The static gate audit runs first: it is the invariant the program exists for.
# Version consistency first (cheap, catches a drift before anything builds),
# then the static gate audit, then the suite.
dir=$(dirname "$0")
python3 "$dir/version_check.py" || exit 1
python3 "$dir/gate_audit.py" || exit 1
exec python3 "$dir/run.py"
+122
View File
@@ -0,0 +1,122 @@
#!/usr/bin/env python3
"""One version, five places.
APEX_VERSION in src/apex.h is the only source of truth. Everything a user or a
package reads has to agree with it: the man page .TH, the README status line,
the top CHANGELOG heading, the SECURITY supported line and the tarball name the
Makefile derives. Seven releases drifted because nothing checked; this does.
Exit 1 with a named failure per place that disagrees.
"""
import os
import re
import sys
HERE = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
def read(rel):
with open(os.path.join(HERE, rel), encoding="utf-8") as f:
return f.read()
def read_version():
m = re.search(r'^#define APEX_VERSION "([0-9]+\.[0-9]+\.[0-9]+)"',
read("src/apex.h"), re.M)
return m.group(1) if m else None
def check_man(version):
m = re.search(r'^\.TH\s+\S+\s+\d+\s+"[^"]*"\s+"apex-twin\s+([^"]+)"',
read("docs/apex-twin.1"), re.M)
if m is None:
return "docs/apex-twin.1 has no .TH with an apex-twin version"
if m.group(1) != version:
return "docs/apex-twin.1 .TH says %s, header says %s" % (m.group(1),
version)
return None
def check_readme(version):
body = read("README.md")
m = re.search(r"^## Status\s*$", body, re.M)
if m is None:
return "README.md has no ## Status section"
rest = body[m.end():].lstrip("\n")
if not rest.startswith(version + "."):
first = rest.splitlines()[0] if rest else "(empty)"
return "README.md status starts %r, expected %r" % (first[:40],
version + ".")
return None
def check_changelog(version):
m = re.search(r"^## ([0-9]+\.[0-9]+\.[0-9]+)", read("CHANGELOG.md"), re.M)
if m is None:
return "CHANGELOG.md has no version heading"
if m.group(1) != version:
return "CHANGELOG.md top heading is %s, header says %s" % (m.group(1),
version)
return None
def check_security(version):
body = read("SECURITY.md")
m = re.search(r"^## Supported versions\s*$", body, re.M)
if m is None:
return "SECURITY.md has no 'Supported versions' section"
tail = body[m.end():]
nxt = re.search(r"^## ", tail, re.M)
section = tail[:nxt.start()] if nxt else tail
major, minor, _ = version.split(".")
want = "%s.%s.x" % (major, minor)
if want not in section:
return "SECURITY.md supported line does not name %s" % want
return None
def check_makefile(version):
body = read("Makefile")
if "src/apex.h" not in body or "APEX_VERSION" not in body:
return "Makefile does not read APEX_VERSION from src/apex.h"
if re.search(r"apex-twin-[0-9]+\.[0-9]+\.[0-9]+\.tar\.gz", body):
return "Makefile hardcodes a versioned tarball name"
m = re.search(r"^DISTNAME\s*:=\s*apex-twin-\$\(VERSION\)\s*$", body, re.M)
if m is None:
return "Makefile DISTNAME is not apex-twin-$(VERSION)"
return None
CHECKS = (
("man page", check_man),
("README status", check_readme),
("CHANGELOG", check_changelog),
("SECURITY", check_security),
("Makefile", check_makefile),
)
def main():
version = read_version()
if version is None:
print("FAIL src/apex.h: no APEX_VERSION")
return 1
failures = []
for name, fn in CHECKS:
why = fn(version)
if why is None:
print("ok %-14s %s" % (name, version))
else:
print("FAIL %-14s %s" % (name, why))
failures.append(name)
if failures:
print("version-check: %d of %d places disagree with APEX_VERSION %s" %
(len(failures), len(CHECKS), version))
return 1
print("version-check: APEX_VERSION %s is consistent in %d places" %
(version, len(CHECKS)))
return 0
if __name__ == "__main__":
sys.exit(main())