Skip to content

fix(plot): align points array order with cluster labels#30

Merged
aGallea merged 2 commits into
masterfrom
fix-cluster-detail-wrong-items
Mar 17, 2026
Merged

fix(plot): align points array order with cluster labels#30
aGallea merged 2 commits into
masterfrom
fix-cluster-detail-wrong-items

Conversation

@aGallea

@aGallea aGallea commented Mar 17, 2026

Copy link
Copy Markdown
Owner

Summary

  • Bug: Selecting a cluster group from the bottom bar showed wrong products in the right sidebar. The points array was built grouped-by-cluster (all cluster 0 first, then cluster 1, etc.) while cluster_labels stayed in original data order, causing index mismatches in get_cluster_detail and sub_cluster endpoints.
  • Fix: Changed compute_plot_data() to build points in original data order so points[i], cluster_labels[i], and embeddings_standardized[i] all refer to the same item.
  • Tests: Added 3 regression tests (2 unit + 1 integration) verifying point-label alignment and correct cluster detail responses with interleaved labels.

Verification

  • 245 tests pass (98% coverage)
  • ruff check, ruff format, mypy all clean

aGallea and others added 2 commits March 17, 2026 09:31
Points were built grouped-by-cluster while cluster_labels stayed in original data order, causing get_cluster_detail and sub_cluster endpoints to return wrong items for each cluster group.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Verify points array aligns with cluster_labels and original ID order. Integration test uses interleaved labels to catch index mismatch between points and cluster_labels.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
@github-actions

Copy link
Copy Markdown

Tests Report 📄

Tests Succees ✅

JUnit Details

Total Tests Failures Errors Skipped Time ⏳
245 0 0 0 62.72s

Coverage Details (100% >= 90%) ✅

Diff Cover Details
FileCovered LinesMissing Lines
embedding_cluster/scatter_plot.py30/30100%
Total30/30100%

@aGallea aGallea merged commit 20c7405 into master Mar 17, 2026
3 checks passed
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