Skip to content

Commit 163abf5

Browse files
luisleo526claude
andcommitted
Add generated CLI coverage for map pair limits
Add an end-to-end regression for the map pair limit: a committed, generated strategy library driven through the ordinary run_json command line in seven cases (finite boundary and refusal, omitted and explicit zero limit with two pair counts each, and a negative option), with an oracle that recomputes what to expect from the inputs. The row is slow-labelled, registered from its tests/cr150.d lane file with its library in the owning fence, guarded for sanitizer and coverage builds, and pinned (89 to 90) in the explicit slow-row policy. docs/ci.md: the slow-label bound paragraph and the slow-label inventory paragraph, introduced by 69cddc9 (#679), now state the size of the pinned set (90 names, including test_cr559_map_capacity_cli) instead of the retired 43 + 28 = 71 breakdown. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
1 parent 755e665 commit 163abf5

12 files changed

Lines changed: 1443 additions & 15 deletions

‎docs/ci.md‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -280,9 +280,9 @@ those names is partitioned. Without `--ctest-shard`, the summary gains no
280280
registry-name or exclusion-name fields; the default exclusion still adds
281281
selected discovery and strict `ctest-exclusion` checks.
282282

283-
**Slow-label bound, 2026-10-24:** `PINNED_SLOW_TEST_ROWS` in
284-
`scripts/ci_verify.py` pins all 71 source-labelled names: 43 from the
285-
`PINEFORGE_PR_SLOW_TESTS` loop and 28 direct CMake `LABELS` assignments; the four report slices replace one direct name (+3), and the report and command-after covers remain outside the slow set.
283+
**Slow-label bound, 2026-11-08:** `PINNED_SLOW_TEST_ROWS` in
284+
`scripts/ci_verify.py` pins 90 slow-test names, including
285+
`test_cr559_map_capacity_cli`.
286286
Every name listed by `ctest -N -L slow` must belong to that set; conditional
287287
registration may omit names. An unpinned name fails `ctest-exclusion` on
288288
plain and 1/1 runs, or `ctest-shard-discovery` for multiple shards, with the
@@ -1426,11 +1426,11 @@ fewer of the 43 than Release does. `live-sanitizers`, `live-tsan` and the
14261426
parity subset keep their existing selections.
14271427

14281428
**The slow-label inventory also includes rows with direct labels:**
1429-
The timing list contains 43 names, and 28 additional names are pinned for
1430-
direct `LABELS` assignments in `tests/CMakeLists.txt` and
1431-
`tests/cr150.d/*.cmake`, making 71 distinct pinned slow names.
1432-
`PINNED_SLOW_TEST_ROWS` bounds the discovered exclusion by those names,
1433-
independent of the registered count; each profile may register a subset.
1429+
`PINNED_SLOW_TEST_ROWS` explicitly pins 90 distinct slow names across
1430+
`tests/CMakeLists.txt` and `tests/cr150.d/*.cmake`, including the directly
1431+
labelled `test_cr559_map_capacity_cli` row. It bounds the discovered exclusion
1432+
by those names, independent of the registered count; each profile may register
1433+
a subset.
14341434

14351435
The verifier's own self-test is split by TestCase class. A class is FAST only
14361436
when its measured total in the serial run log is under 5 s and its passing

‎scripts/ci_verify.py‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1017,8 +1017,11 @@ def permitted_exclusion_skips(pinned: frozenset[str], host_platform: str) -> fro
10171017
'test_p2_a5_string_1m',
10181018
'test_p2_a5_map_1m',
10191019
'test_p2_a5_map_prepared_1m',
1020-
# tests/cr150.d/cr559-map-capacity.cmake:23.
1020+
# tests/cr150.d/cr559-map-capacity.cmake:30.
10211021
'test_cr559_map_capacity_resident',
1022+
# tests/cr150.d/cr559-map-capacity.cmake:25 (its library target is in the
1023+
# tests/CMakeLists.txt fence); measured 5615.44 s in the ended pair proof.
1024+
'test_cr559_map_capacity_cli',
10221025
# tests/cr150.d/p2cx-a5arr.cmake:5.
10231026
'test_array_growth_1m',
10241027
# tests/cr150.d/report-trade-retirement.cmake and report-trade-reference.cmake:

‎scripts/test_ci_preflight.py‎

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5570,12 +5570,18 @@ def test_documented_slow_row_counts_match_literal_population(self):
55705570
r'in `tests/CMakeLists.txt`: (\d+)$', text, re.MULTILINE)
55715571
self.assertEqual([int(first or second) for first, second in counts],
55725572
[len(EXPECTED_PR_SLOW_ROWS)] * 2)
5573+
# expectation corrected: 71 -> 90, because docs/ci.md now states the
5574+
# size of the pinned set (89 names, 90 with test_cr559_map_capacity_cli)
5575+
# instead of the retired 43 + 28 = 71 breakdown, which had fallen
5576+
# behind the pin.
55735577
inventory = re.findall(
5574-
r'pins all (\d+) source-labelled names: (\d+) from the\n'
5575-
r'`PINEFORGE_PR_SLOW_TESTS` loop and (\d+) direct CMake', text)
5576-
self.assertEqual(inventory, [('71', '43', '28')])
5577-
self.assertIn('The timing list contains 43 names, and 28 additional names', text)
5578-
self.assertIn('making 71 distinct pinned slow names.', text)
5578+
r'`scripts/ci_verify\.py` pins (\d+) slow-test names, including\n'
5579+
r'`test_cr559_map_capacity_cli`\.', text)
5580+
self.assertEqual(inventory, ['90'])
5581+
self.assertIn(
5582+
'`PINNED_SLOW_TEST_ROWS` explicitly pins 90 distinct slow names across\n'
5583+
'`tests/CMakeLists.txt` and `tests/cr150.d/*.cmake`, including the directly\n'
5584+
'labelled `test_cr559_map_capacity_cli` row.', text)
55795585

55805586
def test_documented_slow_rows_refuse_same_size_wrong_slice(self):
55815587
text = (ROOT / 'docs/ci.md').read_text()

‎scripts/test_ci_verify.py‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4490,7 +4490,9 @@ def test_the_table_is_the_floor_and_profiles_outside_it_keep_their_own(self):
44904490
{name for name in ci_verify.PINNED_SLOW_TEST_ROWS
44914491
if name.startswith('test_native_command_after')},
44924492
{f'test_native_command_after_slice_{index}' for index in range(1, 9)})
4493-
self.assertEqual(len(ci_verify.PINNED_SLOW_TEST_ROWS), 89)
4493+
# expectation corrected: 89 -> 90, because test_cr559_map_capacity_cli
4494+
# joins the explicit slow-label policy.
4495+
self.assertEqual(len(ci_verify.PINNED_SLOW_TEST_ROWS), 90)
44944496
self.assertEqual(LIVE_SANITIZERS_MIN_TESTS, 21)
44954497
for name, (full, pinned) in ci_verify.PRIVATE_FIXTURE_PROFILE_FLOORS.items():
44964498
with self.subTest(profile=name):

‎tests/CMakeLists.txt‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8429,6 +8429,20 @@ if(UNIX)
84298429
else()
84308430
target_link_options(test_cr559_map_capacity_run PRIVATE "-Wl,--export-dynamic")
84318431
endif()
8432+
if(NOT PINEFORGE_ENABLE_SANITIZERS AND NOT PINEFORGE_ENABLE_COVERAGE)
8433+
# The genuine generated.cpp fixture is committed; a missing file
8434+
# is a configure error.
8435+
add_library(cr559_cli_pair SHARED
8436+
fixtures/cr559_cli_pair/generated.cpp)
8437+
target_link_libraries(cr559_cli_pair PRIVATE pineforge)
8438+
if(APPLE)
8439+
target_link_options(cr559_cli_pair PRIVATE
8440+
"-Wl,-force_load,$<TARGET_FILE:pineforge>")
8441+
else()
8442+
target_link_options(cr559_cli_pair PRIVATE
8443+
"-Wl,--whole-archive" "$<TARGET_FILE:pineforge>" "-Wl,--no-whole-archive")
8444+
endif()
8445+
endif()
84328446
endif()
84338447
endif()
84348448
# --- CR-150 cr559-map-capacity end ---

‎tests/cr150.d/cr559-map-capacity.cmake‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@ if(UNIX)
1717
pineforge_add_unit_test(test_cr559_map_capacity_run)
1818
list(APPEND TEST_SOURCES test_cr559_map_capacity_calc_on_fill)
1919
pineforge_add_unit_test(test_cr559_map_capacity_calc_on_fill)
20+
if(NOT PINEFORGE_ENABLE_SANITIZERS AND NOT PINEFORGE_ENABLE_COVERAGE)
21+
add_test(NAME test_cr559_map_capacity_cli
22+
COMMAND bash "${PROJECT_SOURCE_DIR}/tests/cr559_cli_pair.sh"
23+
"${PROJECT_SOURCE_DIR}" "$<TARGET_FILE:cr559_cli_pair>"
24+
"${CMAKE_CURRENT_BINARY_DIR}/cr559-cli-pair")
25+
set_tests_properties(test_cr559_map_capacity_cli PROPERTIES LABELS slow)
26+
endif()
2027
endif()
2128
# One million real pairs, including all reads, is deliberately in the full
2229
# verification population; there is no timeout or expected-failure marker.

‎tests/cr559_cli_pair.sh‎

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/usr/bin/env bash
2+
# Ordinary CTest entrypoint. Executables stay literal; Python only reads data.
3+
set -euo pipefail
4+
source_root=$1
5+
module=$2
6+
out=$3
7+
mkdir -p "$out"
8+
if test -e "$out/collection.json"; then
9+
printf 'CR559 CLI: collection already exists: %s; use a fresh output directory to preserve prior artifacts.\n' "$out/collection.json" >&2
10+
exit 1
11+
fi
12+
if ! test -s "$module"; then
13+
printf 'CR559 CLI: generated module is missing or empty: %s; build target cr559_cli_pair before running this test.\n' "$module" >&2
14+
exit 1
15+
fi
16+
set -x
17+
python3 -B "$source_root/tests/test_cr559_map_capacity_cli.py" prepare --out "$out"
18+
19+
# Boundary and refusal are finite-policy controls, run before unlimited cases.
20+
if python3 -B "$source_root/docker/run_json.py" --so "$module" --ohlcv "$out/feed.csv" --profile unjailed --input-tf 1 --script-tf 1 --inputs '{"Pairs":"50000","Salt":"7"}' --limit-map-pairs 50000 >"$out/finite_boundary.stdout" 2>"$out/finite_boundary.stderr"; then rc=0; else rc=$?; fi
21+
printf '%s\n' "$rc" >"$out/finite_boundary.exit"
22+
if python3 -B "$source_root/docker/run_json.py" --so "$module" --ohlcv "$out/feed.csv" --profile unjailed --input-tf 1 --script-tf 1 --inputs '{"Pairs":"50001","Salt":"7"}' --limit-map-pairs 50000 >"$out/finite_refusal.stdout" 2>"$out/finite_refusal.stderr"; then rc=0; else rc=$?; fi
23+
printf '%s\n' "$rc" >"$out/finite_refusal.exit"
24+
if python3 -B "$source_root/docker/run_json.py" --so "$module" --ohlcv "$out/feed.csv" --profile unjailed --input-tf 1 --script-tf 1 --inputs '{"Pairs":"50003","Salt":"11"}' >"$out/omitted_a.stdout" 2>"$out/omitted_a.stderr"; then rc=0; else rc=$?; fi
25+
printf '%s\n' "$rc" >"$out/omitted_a.exit"
26+
if python3 -B "$source_root/docker/run_json.py" --so "$module" --ohlcv "$out/feed.csv" --profile unjailed --input-tf 1 --script-tf 1 --inputs '{"Pairs":"50003","Salt":"11"}' --limit-map-pairs 0 >"$out/zero_a.stdout" 2>"$out/zero_a.stderr"; then rc=0; else rc=$?; fi
27+
printf '%s\n' "$rc" >"$out/zero_a.exit"
28+
if python3 -B "$source_root/docker/run_json.py" --so "$module" --ohlcv "$out/feed.csv" --profile unjailed --input-tf 1 --script-tf 1 --inputs '{"Pairs":"50009","Salt":"23"}' >"$out/omitted_b.stdout" 2>"$out/omitted_b.stderr"; then rc=0; else rc=$?; fi
29+
printf '%s\n' "$rc" >"$out/omitted_b.exit"
30+
if python3 -B "$source_root/docker/run_json.py" --so "$module" --ohlcv "$out/feed.csv" --profile unjailed --input-tf 1 --script-tf 1 --inputs '{"Pairs":"50009","Salt":"23"}' --limit-map-pairs 0 >"$out/zero_b.stdout" 2>"$out/zero_b.stderr"; then rc=0; else rc=$?; fi
31+
printf '%s\n' "$rc" >"$out/zero_b.exit"
32+
if python3 -B "$source_root/docker/run_json.py" --so "$module" --ohlcv "$out/feed.csv" --profile unjailed --inputs '{"Pairs":"50003","Salt":"11"}' --limit-map-pairs -1 >"$out/negative_option.stdout" 2>"$out/negative_option.stderr"; then rc=0; else rc=$?; fi
33+
printf '%s\n' "$rc" >"$out/negative_option.exit"
34+
python3 -B "$source_root/tests/test_cr559_map_capacity_cli.py" check --out "$out"

‎tests/cr559_cli_pair_generate.py‎

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
"""Worker-only driver of the real gate/glue.py transpile_json interface."""
2+
3+
import argparse
4+
import hashlib
5+
import json
6+
from pathlib import Path
7+
import sys
8+
9+
10+
def sha(path):
11+
return hashlib.sha256(path.read_bytes()).hexdigest()
12+
13+
14+
def main():
15+
parser = argparse.ArgumentParser(description=__doc__)
16+
parser.add_argument("--codegen", type=Path, required=True)
17+
parser.add_argument("--fixture", type=Path, required=True)
18+
parser.add_argument("--artifacts", type=Path, required=True)
19+
args = parser.parse_args()
20+
codegen = args.codegen.resolve()
21+
sys.path.insert(0, str(codegen))
22+
from gate import glue
23+
import pineforge_codegen
24+
if (Path(glue.__file__).resolve() != codegen / "gate/glue.py" or
25+
Path(pineforge_codegen.__file__).resolve() !=
26+
codegen / "pineforge_codegen/__init__.py"):
27+
raise RuntimeError("generator import escaped the declared archive")
28+
source = args.fixture / "probe.pine"
29+
raw = glue.transpile_json(source.read_text(encoding="utf-8"))
30+
(args.artifacts / "generation-response.json").write_text(raw, encoding="utf-8")
31+
print(raw, flush=True)
32+
response = json.loads(raw)
33+
(args.artifacts / "generation-diagnostics.json").write_text(
34+
json.dumps(response.get("diagnostics"), indent=2) + "\n", encoding="utf-8")
35+
if response.get("ok") is not True or not response.get("cpp", "").strip():
36+
raise RuntimeError("real transpile_json did not return a translation unit")
37+
if any(item.get("severity") == "error" for item in response["diagnostics"]):
38+
raise RuntimeError("real generation returned error diagnostics")
39+
generated = args.fixture / "generated.cpp"
40+
# Only the generator response is allowed to populate this reserved file.
41+
generated.write_text(response["cpp"], encoding="utf-8")
42+
(args.artifacts / "generation.json").write_text(json.dumps({
43+
"interface": "gate/glue.py:transpile_json",
44+
"generator_argv": sys.argv, "python_executable": sys.executable,
45+
"python_version": sys.version, "codegen_version": (codegen / "VERSION").read_text().strip(),
46+
"glue_sha256": sha(codegen / "gate/glue.py"),
47+
"codegen_init_sha256": sha(codegen / "pineforge_codegen/__init__.py"),
48+
"pine_sha256": sha(source), "generated_cpp_sha256": sha(generated),
49+
"response_sha256": sha(args.artifacts / "generation-response.json"),
50+
"diagnostics_sha256": sha(args.artifacts / "generation-diagnostics.json"),
51+
}, sort_keys=True, indent=2) + "\n", encoding="utf-8")
52+
53+
54+
if __name__ == "__main__":
55+
main()

0 commit comments

Comments
 (0)