Skip to content

Commit 99eae33

Browse files
committed
test(core): reproduce the two shapes the canonical ingest refuses on real code
A frozen 21-repository benchmark could not run: the ingest oracle refused 18 of them, on documents this CLI produced. Neither shape existed in any fixture, which is why the path was never proven on data -- the wire-freeze corpus itself records that segment groups stayed 0 in the very corpus built to stop families rotting at zero rows. Both shapes now have a fixture and a pin. The singleton segment group is not a group the producer never made: all 378 measured singletons came from two or more raw windows that merge_overlapping_items folded, and the 67 groups that survived are exactly the gap-separated ones. The wire keeps no trace of the fold. The namespace-package endpoint refuses in the live producer-native path too, not only in the oracle, so the owner is the identity index rather than the grammar. Two markers stay strict-xfail: which of the two contracts is right is the maintainer's call, and the pins hold the refusal messages verbatim until it is made.
1 parent 127e0a5 commit 99eae33

9 files changed

Lines changed: 436 additions & 0 deletions

File tree

‎tests/conftest.py‎

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,33 @@
8080
# containers at once.
8181
_WIRE_FREEZE_CORPUS_F8 = Path(__file__).parent / "fixtures" / "wire_freeze_corpus_f8"
8282

83+
# The F8-singleton distinguishing stage (its own tree, its own CLI run).
84+
# Measured 2026-09-05 on 21 frozen external repositories: the segment lane
85+
# emits clone groups carrying exactly ONE item -- 378 of them, across 17 of
86+
# the 21 members -- and ``CloneGroupRow`` refuses a group of one, so those
87+
# documents cannot be ingested at all. No fixture in this suite had ever
88+
# carried the shape: the base corpus pins segment groups at zero and this
89+
# repository emits no clones family whatsoever, so the segment path was
90+
# never proven on data. The stage carries BOTH merge branches that produce
91+
# the shape -- overlapping windows and adjacent windows -- because
92+
# ``merge_overlapping_items`` reaches them through different comparisons and
93+
# a stage carrying one would leave the other unproven.
94+
_WIRE_FREEZE_CORPUS_F8_SINGLETON = (
95+
Path(__file__).parent / "fixtures" / "wire_freeze_corpus_f8_singleton"
96+
)
97+
98+
# The F7-namespace distinguishing stage (its own tree, its own CLI run).
99+
# Measured 2026-09-05: the dependency lane emits an edge whose endpoint is a
100+
# NAMESPACE PACKAGE -- ``packaging`` in kivy, ``pyglet.experimental`` in
101+
# pyglet -- which ``metrics.dependencies._is_internal_target`` admits as
102+
# internal precisely because it is a ``package_prefixes`` node, while
103+
# ``build_identity_index`` is assembled from file-bearing ``(path, module)``
104+
# pairs alone and so cannot resolve it. ``nsp/`` carries no ``__init__.py``:
105+
# that absence is the whole point of the stage, and adding one erases it.
106+
_WIRE_FREEZE_CORPUS_F7_NAMESPACE = (
107+
Path(__file__).parent / "fixtures" / "wire_freeze_corpus_f7_namespace"
108+
)
109+
83110
# The post-baseline stage: materialized only after the baseline is written,
84111
# so its clone pair is the corpus's one genuinely NEW novelty row.
85112
_WIRE_FREEZE_POST_BASELINE = "pkg/clones_three.py"
@@ -218,6 +245,42 @@ def corpus_f5_report(
218245
return _corpus_document(report_path)
219246

220247

248+
@pytest.fixture(scope="session")
249+
def corpus_f8_singleton_report(
250+
tmp_path_factory: pytest.TempPathFactory,
251+
) -> dict[str, object]:
252+
"""One single-stage F8-singleton corpus run (no baseline: the segment
253+
lane is an analysis-tier fact of the current run).
254+
255+
The stage exists to carry the one clone-group shape the ingest oracle
256+
refuses, so that the refusal is measured on a document this project's
257+
own CLI produced rather than on an external checkout.
258+
"""
259+
root = tmp_path_factory.mktemp("wire_freeze_corpus_f8_singleton")
260+
report_path = root / "corpus.report.json"
261+
_materialize_corpus_tree(_WIRE_FREEZE_CORPUS_F8_SINGLETON, root)
262+
_run_corpus_cli([str(root), "--json", str(report_path), "--no-progress"])
263+
return _corpus_document(report_path)
264+
265+
266+
@pytest.fixture(scope="session")
267+
def corpus_f7_namespace_report(
268+
tmp_path_factory: pytest.TempPathFactory,
269+
) -> dict[str, object]:
270+
"""One single-stage F7-namespace corpus run (no baseline: the dependency
271+
lane is an analysis-tier fact of the current run).
272+
273+
``_materialize_corpus_tree`` copies ``*.txt`` carriers only, so the
274+
namespace package stays a directory without ``__init__.py`` -- the
275+
condition the stage measures.
276+
"""
277+
root = tmp_path_factory.mktemp("wire_freeze_corpus_f7_namespace")
278+
report_path = root / "corpus.report.json"
279+
_materialize_corpus_tree(_WIRE_FREEZE_CORPUS_F7_NAMESPACE, root)
280+
_run_corpus_cli([str(root), "--json", str(report_path), "--no-progress"])
281+
return _corpus_document(report_path)
282+
283+
221284
# ---------------------------------------------------------------------------
222285
# The run-store serving corpus: what an MCP execution serves from RAM beside
223286
# the canonical run the same execution published.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
"""A module inside a namespace package: ``nsp/`` carries no ``__init__``."""
2+
3+
4+
def leaf_value() -> int:
5+
return 1
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[tool.codeclone]
2+
# The full-run ingest oracle refuses a document whose ``source_facts.semantic``
3+
# is null, so every stage meant to be ingested whole carries the switch.
4+
semantic_authority = true
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
"""Imports the namespace package itself.
2+
3+
``metrics.dependencies._is_internal_target`` admits the target because it
4+
is a ``package_prefixes`` node, so the producer emits the edge; the module
5+
registry has no file-bearing entry for ``nsp`` because a namespace package
6+
owns no ``__init__.py``.
7+
"""
8+
9+
from nsp import leaf
10+
11+
12+
def use_leaf() -> int:
13+
return leaf.leaf_value()
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"""Two segment hosts whose repeated run is no longer than the sliding window."""
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
"""A six-statement run repeated back-to-back: period == window size.
2+
3+
The two windows that carry one segment hash are ADJACENT (the second starts
4+
on the line after the first ends), so ``merge_overlapping_items`` folds them
5+
into one span too -- adjacency and overlap are separate merge branches, and
6+
a stage carrying only one of them would leave the other unproven.
7+
"""
8+
9+
10+
def adjacent_host(base: int) -> int:
11+
seed = base * 2
12+
limit = seed + 3
13+
scale = limit - 1
14+
step = scale + 4
15+
acc = step + 1
16+
if acc > 0:
17+
acc = acc - 1
18+
values = [acc]
19+
values.append(acc + 2)
20+
total = sum(values)
21+
label = str(total)
22+
acc = step + 1
23+
if acc > 0:
24+
acc = acc - 1
25+
values = [acc]
26+
values.append(acc + 2)
27+
total = sum(values)
28+
label = str(total)
29+
return len(label)
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
"""A three-statement run repeated three times: period < window size.
2+
3+
The two windows that carry one segment hash OVERLAP (the second starts
4+
inside the first), so ``merge_overlapping_items`` folds them into one span
5+
and the emitted group reaches the document carrying a single item.
6+
"""
7+
8+
9+
def overlap_host(base: int) -> int:
10+
seed = [base, base]
11+
limit = len(seed) + 3
12+
scale = max(limit, 1)
13+
values = list(seed)
14+
count = len(values)
15+
width = count * 2
16+
acc = scale + 1
17+
if acc > 0:
18+
acc = acc - 1
19+
values.append(acc)
20+
acc = scale + 1
21+
if acc > 0:
22+
acc = acc - 1
23+
values.append(acc)
24+
acc = scale + 1
25+
if acc > 0:
26+
acc = acc - 1
27+
values.append(acc)
28+
return len(values) + count + width
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[tool.codeclone]
2+
# The full-run ingest oracle refuses a document whose ``source_facts.semantic``
3+
# is null, so every stage meant to be ingested whole carries the switch.
4+
semantic_authority = true

0 commit comments

Comments
 (0)