Skip to content

Fix shared-front boxes-items toggle - #2896

Merged
pylipp merged 13 commits into
masterfrom
fix-boi-shared-front
Sep 10, 2026
Merged

pylipp merged 13 commits into
masterfrom
fix-boi-shared-front

Conversation

@pylipp

@pylipp pylipp commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

https://trello.com/c/e4CviUgY

This fixes the non-functional boxes-items toggle in the public FE, and cleans up the usage of BoxesOrItems/BoxesOrItemsCount types.

@codecov

codecov Bot commented Sep 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.06%. Comparing base (c0b8ea6) to head (b4f1aa9).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2896      +/-   ##
==========================================
+ Coverage   73.70%   74.06%   +0.35%     
==========================================
  Files         330      330              
  Lines       25325    25383      +58     
  Branches     2486     2520      +34     
==========================================
+ Hits        18667    18800     +133     
+ Misses       6607     6533      -74     
+ Partials       51       50       -1     
Flag Coverage Δ
backend 99.61% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The new public selector lacks an accessible name.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Fixes the public statistics inventory-unit toggle and consolidates unit types.

Changes:

  • Synchronizes the public Boxes/Items selector with sboi.
  • Standardizes on BoxesOrItemsCount.
  • Removes obsolete selector and sharing-alert plumbing.
File summaries
File Description
shared-front/src/App.tsx Implements the public unit selector.
shared-components/statviz/hooks/useShareableLink.ts Removes obsolete unit state.
shared-components/statviz/dashboard/StockOverview.tsx Uses the shared count type.
shared-components/statviz/dashboard/MovedBoxes.tsx Uses the shared count type.
shared-components/statviz/components/visualizations/stock/StockOverviewRingFilterContainer.tsx Updates the unit prop type.
shared-components/statviz/components/visualizations/stock/StockOverviewRingDataContainer.tsx Updates the unit prop type.
shared-components/statviz/components/visualizations/stock/StockOverviewBarsFilterContainer.tsx Updates the unit prop type.
shared-components/statviz/components/visualizations/stock/StockOverviewBarsDataContainer.tsx Updates the unit prop type.
shared-components/statviz/components/visualizations/movedBoxes/ShipmentsPieChart.tsx Updates the unit prop type.
shared-components/statviz/components/visualizations/movedBoxes/ShipmentsOverTimeChart.tsx Updates the unit prop type.
shared-components/statviz/components/visualizations/movedBoxes/MovedBoxesFilterContainer.tsx Updates the unit prop type.
shared-components/statviz/components/visualizations/movedBoxes/MovedBoxesDataContainer.tsx Updates the unit prop type.
shared-components/statviz/components/visualizations/movedBoxes/MovedBoxesCharts.tsx Updates the unit prop type.
shared-components/statviz/components/visualizations/createdBoxes/BoxCreationCalendarFilterContainer.tsx Updates the unit prop type.
shared-components/statviz/components/visualizations/createdBoxes/BoxCreationCalendarDataContainer.tsx Updates the unit prop type.
shared-components/statviz/components/ShareableLinkAlert.tsx Removes unit-specific alert text.
shared-components/statviz/components/LinkSharingSection.tsx Removes the obsolete unit prop.
shared-components/statviz/components/filter/BoxesOrItemsSelect.tsx Deletes the superseded selector.
Review details
  • Files reviewed: 18/18 changed files
  • Comments generated: 1
  • Review effort level: Balanced

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Comment thread shared-front/src/App.tsx
@pylipp

pylipp commented Sep 10, 2026

Copy link
Copy Markdown
Contributor Author

@copilot I need tests for shared-front/src/App.tsx using vitest.

  • the test setup can be similar to the one in shared-components/
  • the tests should be automatically run in CI
  • mock the GraphQL response returned for the RESOLVE_LINK query
  • mock the nivo graph (like in StockOverview.test.tsx)

Cover the following test cases (for the first three, no data shall be displayed):

  1. GraphQL request errors with e.g. NetworkError. Expected error message: "An unexpected error happened."
  2. GraphQL response is { "data": { "resolveLink": { "__typename": "UnknownLinkError" } } }. Expected error message: "Unknown link."
  3. GraphQL response is { "data": { "resolveLink": { "__typename": "ExpiredLinkError" } } }. Expected error message: "The link has expired."
  4. GraphQL response is { "data": null, "errors": [ { "message": "Variable '$code' of non-null type 'String!' must not be null." } ] }. Expected error message: "The link must contain a code in the URL."
  5. GraphQL response is successful (mock data.resolveLink.data[0] with two facts and different categories, productNames, gender, sizes, and locations
    a. fact.urlParameters is empty. Expected: data display with boxes count in ring center. The ring chart shows the two categories. The organization and base name are shown on the page.
    b. fact.urlParameters is srg=g. Expected: data display with boxes count in ring center. The ring chart shows the two genders
    c. fact.urlParameters is srg=cn. Expected: data display with boxes count in ring center. The ring chart shows the two categories
    d. fact.urlParameters is srg=s. Expected: data display with boxes count in ring center. The ring chart shows the two sizes
    e. fact.urlParameters is srg=l. Expected: data display with boxes count in ring center. The ring chart shows the two locations
    e. fact.urlParameters is sboi=ic. Expected: data display with items count in ring center. The ring chart shows the two categories

Tell me the reasoning effort you applied.

Co-authored-by: pylipp <10617122+pylipp@users.noreply.github.com>

Copilot AI commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

@copilot I need tests for shared-front/src/App.tsx using vitest.

  • the test setup can be similar to the one in shared-components/
    ...

Added shared-front/src/App.test.tsx with vitest, mirroring the shared-components setup (vitest.config.ts + src/tests/setupTests.ts, registered as a project in the root vitest.config.ts). The nivo PieChart is mocked the same way as in StockOverview.test.tsx on master. All 10 requested scenarios are covered (network error, UnknownLinkError, ExpiredLinkError, missing $code, and the 6 successful-response groupings/boxesOrItems cases).

While writing the tests I found a real bug they exposed: data.resolveLink.data[0] was accessed without optional chaining before the index, which crashed for UnknownLinkError/ExpiredLinkError responses (since those union members have no data field). Fixed with data?.resolveLink?.data?.[0].

I did not wire the tests into .circleci/config.yml — repo instructions require explicit approval before touching CI config. The change would be adding a step to the test-front job, analogous to the existing shared-components step:

      - run:
          name: Test shared-front and create reports
          when: always
          command: |
            DEBUG_PRINT_LIMIT=10000 pnpm -C ../shared-front test:coverage --test-timeout=40000
      - store_test_results:
          path: ../shared-front/coverage/junit.xml
      - store_artifacts:
          path: ../shared-front/coverage
          destination: shared-front-coverage
      - codecov/upload:
          flags: sharedFront
          files: ../shared-front/coverage/coverage-final.json
          plugins: noop

Let me know if you'd like me to apply this and I will.

Reasoning effort applied: medium.

@pylipp
pylipp merged commit a295c89 into master Sep 10, 2026
12 of 14 checks passed
@pylipp
pylipp deleted the fix-boi-shared-front branch September 10, 2026 14:16
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.

3 participants