Found by pointing cgis suggest-packages at cgis's own query/ package, which is the tool's strongest structural opinion about its own code — and which turns out to be computed over a broken partition.
What it reports
cgis suggest-packages cgis.query
✂️ SPLIT cgis.query Q=0.492 divergence=0.319 direction=under_split
with 14 communities over 27 members, 26 of them distinct.
Two defects, one cause
Members are keyed by basename over the whole subtree, not by the package's direct children. cgis/query/ actually contains four sub-packages (analysis/, context/, drift/, render/) and two modules (engine.py, fqn.py).
1. A sub-package is listed as a peer of its own contents. analysis sits in community 0 while analyzer, anomaly, health (community 1) and cohesion, suggest_service (community 2) — every one of them a file inside analysis/ — sit in others. Same for render against its graph_json, mermaid, metrics. The graph being partitioned therefore mixes two levels of the tree.
2. Basenames collide, so the partition is not disjoint. drift appears in two communities:
6 │ drift
7 │ drift, drift_service, ontology_init, quotient
because cgis/query/drift/ is a directory and cgis/query/drift/drift.py is a module inside it. Modularity is defined over a partition; computed over a multiset it does not mean what the verdict reads it as.
Scope of the collision in this repository: exactly one occurrence —
find src -type d | while read d; do b=$(basename "$d"); [ -f "$d/$b.py" ] && echo "$d/$b.py"; done
src/cgis/query/drift/drift.py
— but pkg/sub/sub.py is an ordinary Python layout, and the keying makes any repository using it produce a non-partition. Checked the other packages at 529b2e2: cgis.guardian (26/26), cgis.extractors (10/10), cgis.core (4/4) are clean, so only the nested-package case is affected.
Why it matters
This is the one verdict in the tool that tells a maintainer to restructure their code, and on the only package here that is already subdivided it says under_split — a conclusion drawn from counting a package and its own children as siblings. Acting on it would be acting on a number that does not describe the thing it names.
Shape of a fix
The question "should this package be split" is about its direct children: four sub-packages and two modules for cgis.query, not twenty-seven basenames. Keying members by the path segment directly under the analysed prefix — and treating a sub-package as one node whose edges are the union of its contents' — would make the partition disjoint by construction and put the modularity back on the level the verdict claims to be about.
Acceptance should be that no member appears twice, on this repository and on the #179 dogfooding set, plus a re-read of cgis.query's verdict once the members are its actual children.
Related
The feature shipped in #242 (closed). This is the first time its output was checked against a package containing sub-packages.
Found by pointing
cgis suggest-packagesat cgis's ownquery/package, which is the tool's strongest structural opinion about its own code — and which turns out to be computed over a broken partition.What it reports
with 14 communities over 27 members, 26 of them distinct.
Two defects, one cause
Members are keyed by basename over the whole subtree, not by the package's direct children.
cgis/query/actually contains four sub-packages (analysis/,context/,drift/,render/) and two modules (engine.py,fqn.py).1. A sub-package is listed as a peer of its own contents.
analysissits in community 0 whileanalyzer,anomaly,health(community 1) andcohesion,suggest_service(community 2) — every one of them a file insideanalysis/— sit in others. Same forrenderagainst itsgraph_json,mermaid,metrics. The graph being partitioned therefore mixes two levels of the tree.2. Basenames collide, so the partition is not disjoint.
driftappears in two communities:because
cgis/query/drift/is a directory andcgis/query/drift/drift.pyis a module inside it. Modularity is defined over a partition; computed over a multiset it does not mean what the verdict reads it as.Scope of the collision in this repository: exactly one occurrence —
— but
pkg/sub/sub.pyis an ordinary Python layout, and the keying makes any repository using it produce a non-partition. Checked the other packages at529b2e2:cgis.guardian(26/26),cgis.extractors(10/10),cgis.core(4/4) are clean, so only the nested-package case is affected.Why it matters
This is the one verdict in the tool that tells a maintainer to restructure their code, and on the only package here that is already subdivided it says
under_split— a conclusion drawn from counting a package and its own children as siblings. Acting on it would be acting on a number that does not describe the thing it names.Shape of a fix
The question "should this package be split" is about its direct children: four sub-packages and two modules for
cgis.query, not twenty-seven basenames. Keying members by the path segment directly under the analysed prefix — and treating a sub-package as one node whose edges are the union of its contents' — would make the partition disjoint by construction and put the modularity back on the level the verdict claims to be about.Acceptance should be that no member appears twice, on this repository and on the #179 dogfooding set, plus a re-read of
cgis.query's verdict once the members are its actual children.Related
The feature shipped in #242 (closed). This is the first time its output was checked against a package containing sub-packages.