Skip to content

Release Collector: Fix default API ordering within releases in viewers #71

@hdamker

Description

@hdamker

Issue: Fix default API ordering within releases in viewers

Description

The default viewer display order (by repository → release) shows APIs within each release in incorrect order. When users click column headers to sort alphabetically, the order is correct, but the default view has APIs out of order within releases.

Current Behavior

  • Alphabetical sorting (clicking column headers): Works correctly
  • Default order (by repository → release): APIs within a release appear in wrong order

Example: Within a single release (e.g., SIM-Swap r1.1), the APIs might appear as:

  • sim-swap-subscriptions (initial, v0.1.0)
  • sim-swap (stable, v1.1.0)

This is backwards - the stable base API should appear before the initial subscriptions variant.

Root Cause

In enrichment.js:334-339, the createFlattenedAPIView function sorts the flattened API list by:

  1. Repository name
  2. Canonical API name

This destroys the release grouping structure. APIs from different releases in the same repository get interleaved based on their names, breaking the "by repository then release" order.

Current sorting code:

// Sort by repository and API name for consistent ordering
flatApis.sort((a, b) => {
  const repoCompare = a.repository.localeCompare(b.repository);
  if (repoCompare !== 0) return repoCompare;
  return (a.canonical_name || a.api_name).localeCompare(b.canonical_name || b.api_name);
});

Proposed Solution

Modify the sorting in createFlattenedAPIView to:

  1. Preserve repository grouping (keep current behavior)
  2. Preserve release grouping within repositories (fix: don't sort across releases)
  3. Within each release, sort by:
    • Maturity level: stable → initial → rc → alpha → beta
    • Then by canonical_name (alphabetically)

Implementation approach:

  • Group APIs by repository + release_tag
  • Sort within each group by maturity then name
  • Flatten while preserving group order

This ensures stable APIs appear before initial APIs within the same release, making the default view more intuitive for users scanning the API portfolio.

Affected Files

Context

Identified in PR review: #68 (comment)

Priority

Low - UX polish, not blocking functionality. The interactive sorting works correctly, so users can reorder as needed.

Labels

viewer, enhancement, low-priority

Metadata

Metadata

Assignees

No one assigned

    Labels

    backlogPostponed issue for later considerationenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions