Skip to content

openspec: bunch-real-projects — make Bunch work on real repositories - #252

Merged
jeremiepas merged 1 commit into
mainfrom
spec/bunch-real-projects
Nov 12, 2026
Merged

jeremiepas merged 1 commit into
mainfrom
spec/bunch-real-projects

Conversation

@jeremiepas

Copy link
Copy Markdown
Owner

Why

Running --cluster-algorithm bunch on solario-core, the 57 dataset-discovery repositories and five Solario builds (2026-11-12) needed four workarounds outside Graphos. Each one hides a defect:

# Defect Measured effect
1 The community-size cap (5 % of nodes) also applies to Bunch nestjs-realworld (29 files): 29 one-file modules, MQ 0, instead of 9 modules, MQ 4.20. solario-core src/cli: MQ 16.66 instead of 18.37
2 Step 5 re-clusters on depends_on/inferred edges derived from Step 4, and the MDG also folds documents edges src/infrastructure: 1,490 inferred edges against 316 real imports
3 A search is intractable above ~600 files (> 28 min at 1,778), but the Leiden fallback only triggers at 5,000 No Bunch result for any real repository above ~600 files
4 resolveImport never sees the corpus Extension-less paths, @/ ~/ $lib/ aliases, tsconfig paths and JVM FQNs stay unresolved. taxonomy: 0 file-to-file imports; jhipster: −224 internal imports

What

openspec/changes/bunch-real-projects/ contains the proposal, the design (D1–D4, with a Mermaid flow), the tasks, and spec deltas for bunch-clustering, pipeline-clustering and import-resolution.

  • D1. No community-size cap on a Bunch partition.
  • D2.
    • The MDG uses a relation allowlist: imports, calls, references, extends, implements.
    • Step 5 reuses the Step-4 Bunch partition instead of searching again.
  • D3. Partitioned search over directory sub-trees (≤ 500 files), then a global refinement pass:
    • Bunch's single-file moves over the whole MDG, every import counted.
    • MQ strictly increases with every move, so the pass terminates.
    • Validated externally: pc26 (3,929 files) went from 1,579 singletons and MQ 149 to 1 singleton and MQ 376.
  • D4. Corpus-aware import resolution, with a uniqueness rule. Ambiguous targets stay external.

--edge-density sparse is left to the open cli-enum-flag-vocabulary change.

Verification

  • openspec validate bunch-real-projects --strict: valid.
  • Spec and design only; the implementation is in tasks.md §1–5.
  • The validation targets in design.md reproduce the numbers measured with the external workarounds.

The merged Bunch stage needed four external workarounds on solario-core,
the 57 dataset-discovery repositories and five Solario builds:

- the community-size cap (5 % of nodes) splits Bunch modules into single
  files on small graphs (nestjs-realworld: 29 modules of 1 file, MQ 0)
- Step 5 re-clusters a graph enriched with depends_on/inferred edges
  derived from the Step-4 partition; the MDG also folds documents edges
- above ~600 files a search is intractable (> 28 min at 1,778 files)
  while the Leiden fallback only triggers at 5,000
- resolveImport is syntactic: extension-less paths, @/ ~/ $lib/ aliases,
  tsconfig paths and JVM FQNs stay unresolved (taxonomy: 0 file imports)

Proposes: no size cap for Bunch; a relation allowlist for the MDG and
Step-5 reuse of the Step-4 partition; partitioned search over directory
sub-trees plus a global refinement pass (Bunch single-file moves over the
whole MDG, MQ strictly increasing; pc26: 1,579 -> 1 singleton, MQ 149 ->
376); corpus-aware import resolution with a uniqueness rule.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant