Skip to content

Commit 5da2668

Browse files
luisleo526claude
andcommitted
integration: one detached-comment gate -- B-GATES' checked-in ceiling, now 0; B-DOCS' duplicate stage deleted
B-GATES added the ratchet (DETACHED_LINE_CEILING = 30 in scripts/measure_detached_comments.py, `--check-ceiling` against it, and a must-fail self-test: a fixture one detached line above the ceiling). B-DOCS, forked from the other side, zeroed the census and added its own preflight stage (`--check-ceiling --ceiling 0`) with its own `--ceiling` argument. The auto-merge kept both: two stages named `detached-comments` in ci_preflight.py and two `--check-ceiling` arguments, which argparse refuses. - B-GATES' mechanism and self-test stay; DETACHED_LINE_CEILING is 0. The self-test also requires a fixture exactly at the ceiling to pass, so a gate that refuses everything cannot pass it. - B-DOCS' duplicate stage and its `--ceiling` argument are deleted. - The census on the merged tree was 1, not 0: B-ENGINE's pivot doc block (5c3ec0dd) sits between ta.hpp's "--- pivot_point_levels (free function) ---" divider and its declaration, which left the divider detached behind a blank line. The blank line is deleted, as B-DOCS did for two sibling dividers; comment-only (strip_comments identical, 1ea16e46). `measure_detached_comments.py --check-ceiling`: 0/0 ... OK over the 83 files of the kernel compile closure; `--self-test`: 20 passed, 0 failed. - docs/ci.md says what the stage and its self-test hold instead of B-GATES' "after B-DOCS clears the census" instruction. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
1 parent d3cca9e commit 5da2668

4 files changed

Lines changed: 29 additions & 34 deletions

File tree

‎docs/ci.md‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,12 @@ release rows. Raise the constant when a row lands, and pass `--min-tests N` to
9393
override it for one run (the flag gates any profile; `kernel` and `release`
9494
have a default).
9595

96-
Preflight also runs the detached-comment census with a checked-in ceiling of
97-
30 lines. Its self-test adds one detached line above that ceiling and requires
98-
the gate to refuse it. After B-DOCS clears the census, set
99-
`DETACHED_LINE_CEILING = 0` in `scripts/measure_detached_comments.py`.
96+
Preflight also runs the detached-comment census of the kernel compile closure
97+
(`detached-comments`: `scripts/measure_detached_comments.py --check-ceiling`)
98+
against the checked-in `DETACHED_LINE_CEILING`, which is 0: R5 lane B-DOCS
99+
cleared the census, so one detached comment line fails the stage. Its self-test
100+
(`detached-comments-tests`) requires a fixture one detached line above the
101+
ceiling to be refused and one at the ceiling to pass.
100102

101103
Every compile of an `examples/native` source keeps `assert()` live: the
102104
`example_*` executables (`examples/native/CMakeLists.txt`) and the live

‎include/pineforge/ta.hpp‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1282,7 +1282,6 @@ class Dev {
12821282
};
12831283

12841284
// --- pivot_point_levels (free function) ---
1285-
12861285
// The 11 pivot levels [P, R1, S1, R2, S2, R3, S3, R4, S4, R5, S5] of one
12871286
// period's high, low and close, na for the levels a type does not define and
12881287
// all na for a missing input; an unknown name answers P alone. Traditional,

‎scripts/ci_preflight.py‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,6 @@ def check_commands(source: Path) -> list[tuple]:
117117
[sys.executable, str(source / 'scripts/check_pine_to_native_coverage.py')]),
118118
('doc-pine-coverage-tests',
119119
[sys.executable, str(source / 'scripts/test_check_pine_to_native_coverage.py')]),
120-
('detached-comments',
121-
[sys.executable, str(source / 'scripts/measure_detached_comments.py'),
122-
'--check-ceiling', '--ceiling', '0']),
123120
]
124121

125122

‎scripts/measure_detached_comments.py‎

Lines changed: 23 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
measure_detached_comments.py # census, per file
3131
measure_detached_comments.py --blocks # every detached block's span
3232
measure_detached_comments.py --json
33-
measure_detached_comments.py --check-ceiling [--ceiling N]
33+
measure_detached_comments.py --check-ceiling # fail above DETACHED_LINE_CEILING
3434
measure_detached_comments.py --self-test # the classifier's own pins
3535
measure_detached_comments.py FILE [FILE...] # an explicit population
3636
"""
@@ -45,8 +45,10 @@
4545
from pathlib import Path
4646

4747
ROOT = Path(__file__).resolve().parents[1]
48-
# B-DOCS lowers this to zero after removing the remaining detached comments.
49-
DETACHED_LINE_CEILING = 30
48+
# The checked-in ceiling --check-ceiling holds the census to (R5 lane B-GATES'
49+
# ratchet). R5 lane B-DOCS cleared the census, so it is zero: one detached
50+
# line anywhere in the kernel compile closure fails the preflight stage.
51+
DETACHED_LINE_CEILING = 0
5052
KERNEL_SOURCE_BLOCK = re.compile(
5153
r"set\(PINEFORGE_KERNEL_SOURCES\s*(.*?)\)", re.DOTALL)
5254
INCLUDE = re.compile(r'^\s*#\s*include\s*(?:"([^"]+)"|<([^>]+)>)')
@@ -266,24 +268,27 @@ def self_test() -> int:
266268
failures += 1
267269
print(f" {status} {name}"
268270
+ ("" if got == want else f"\n want {want} got {got}"))
269-
# One additional detached line above today's ceiling must turn the CLI red.
270-
fixture = (["int a;"] + ["// detached"] * (DETACHED_LINE_CEILING + 1)
271-
+ ["", "// attached", "int b;"])
272-
with tempfile.TemporaryDirectory(prefix="pineforge-detached-test-") as directory:
273-
path = Path(directory) / "one-extra.cpp"
274-
path.write_text("\n".join(fixture) + "\n")
275-
result = subprocess.run([sys.executable, __file__, '--check-ceiling',
276-
str(path)], capture_output=True, text=True,
277-
check=False)
278-
if (result.returncode != 1
279-
or f"{DETACHED_LINE_CEILING + 1}/{DETACHED_LINE_CEILING}"
280-
not in result.stdout):
271+
# One additional detached line above today's ceiling must turn the CLI red,
272+
# and a population exactly at the ceiling must not.
273+
for detached, want_rc, name in (
274+
(DETACHED_LINE_CEILING + 1, 1, "ceiling + one detached line is refused"),
275+
(DETACHED_LINE_CEILING, 0, "a population at the ceiling passes")):
276+
fixture = (["int a;"] + ["// detached"] * detached
277+
+ ["", "// attached", "int b;"])
278+
with tempfile.TemporaryDirectory(prefix="pineforge-detached-test-") as directory:
279+
path = Path(directory) / "fixture.cpp"
280+
path.write_text("\n".join(fixture) + "\n")
281+
result = subprocess.run([sys.executable, __file__, '--check-ceiling',
282+
str(path)], capture_output=True, text=True,
283+
check=False)
284+
if (result.returncode != want_rc
285+
or f"{detached}/{DETACHED_LINE_CEILING}" not in result.stdout):
281286
failures += 1
282-
print(" FAIL ceiling + one detached line: "
287+
print(f" FAIL {name}: "
283288
f"exit {result.returncode}, output {result.stdout.strip()!r}")
284289
else:
285-
print(" ok ceiling + one detached line is refused")
286-
print(f"measure_detached_comments self-test: {len(SELF_TESTS) + 1 - failures}"
290+
print(f" ok {name}")
291+
print(f"measure_detached_comments self-test: {len(SELF_TESTS) + 2 - failures}"
287292
f" passed, {failures} failed")
288293
return 1 if failures else 0
289294

@@ -299,10 +304,6 @@ def main() -> int:
299304
parser.add_argument("--blocks", action="store_true",
300305
help="print every detached block's line span")
301306
parser.add_argument("--json", action="store_true")
302-
parser.add_argument("--check-ceiling", action="store_true",
303-
help="fail when the detached-line census exceeds the ceiling")
304-
parser.add_argument("--ceiling", type=int, default=0,
305-
help="detached-line ceiling for --check-ceiling (default 0)")
306307
parser.add_argument("--self-test", action="store_true")
307308
parser.add_argument("--check-ceiling", action="store_true",
308309
help="fail when TOTAL exceeds the checked-in ceiling")
@@ -311,10 +312,6 @@ def main() -> int:
311312
return self_test()
312313
paths = [path.resolve() for path in args.paths] or kernel_closure(ROOT)
313314
rows = measure(paths)
314-
observed = sum(row["lines"] for row in rows)
315-
if args.check_ceiling:
316-
print(f"detached comment ceiling={args.ceiling}, observed={observed}")
317-
return 1 if observed > args.ceiling else 0
318315
if args.json:
319316
print(json.dumps({"files": rows,
320317
"total": sum(row["lines"] for row in rows)},

0 commit comments

Comments
 (0)