Files
cleveragents-core/features/decomposition_clustering_coverage_boost.feature

53 lines
2.5 KiB
Gherkin

Feature: Decomposition clustering — uncovered code paths
As a developer
I want to exercise the cluster_by_language method and the
estimate_tokens_for_path fallback in cluster_by_size
So that lines 122-131 and 160 of decomposition_clustering.py are covered
# ---- cluster_by_language (lines 122-131) --------------------------------
Scenario: cluster_by_language groups files by extension
Given a list of mixed-language file paths
When I cluster by language with max_per_cluster 10
Then the language clusters should separate Python and TypeScript files
And each language cluster should contain only one extension
Scenario: cluster_by_language splits oversized language buckets
Given a list of 8 Python file paths
When I cluster by language with max_per_cluster 3
Then the language clusters should contain at least 3 clusters
And no language cluster should exceed 3 files
Scenario: cluster_by_language with single language returns one cluster
Given a list of 4 Python file paths
When I cluster by language with max_per_cluster 10
Then exactly 1 language cluster should be returned
Scenario: cluster_by_language with empty list returns no clusters
Given an empty list of file paths
When I cluster by language with max_per_cluster 5
Then no language clusters should be returned
Scenario: cluster_by_language sorts files within each cluster
Given an unsorted list of mixed-language file paths
When I cluster by language with max_per_cluster 20
Then files within each language cluster should be in sorted order
Scenario: cluster_by_language orders clusters by extension
Given a list of files with js py and ts extensions
When I cluster by language with max_per_cluster 20
Then the language clusters should be ordered by extension alphabetically
# ---- cluster_by_size fallback to estimate_tokens_for_path (line 160) ----
Scenario: cluster_by_size falls back to estimate_tokens_for_path without token_map
Given a set of temporary files with known byte sizes
When I cluster by size with max_tokens 50 and no token_map
Then the size clusters should respect the estimated token limits
Scenario: cluster_by_size falls back for files missing from partial token_map
Given a set of temporary files with known byte sizes
And a partial token_map covering only some files
When I cluster by size with max_tokens 50 and the partial token_map
Then the size clusters should include all files