Skip to content

feat: Missing items are now automatically removed from personal selections once catalogue data is available - #4301

Merged
jy95 merged 11 commits into
masterfrom
jy95-patch-1
Oct 30, 2026
Merged

jy95 merged 11 commits into
masterfrom
jy95-patch-1

Conversation

@jy95

@jy95 jy95 commented Oct 29, 2026 •

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • Changes
    • Missing items are now automatically removed from personal selections once catalogue data is available. Cleanup is skipped while selections are loading, when catalogue data has an error, or when storage is unavailable.
    • The warning about unavailable items and its per-item removal controls have been removed.
    • Shared selections are imported with unavailable items retained; personal selections are not changed while viewing shared selections.

@vercel

vercel Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
gpfr Ready Ready Preview Oct 30, 2026 1:25am UTC

@coderabbitai

coderabbitai Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 371d896a-4ffb-49b1-9739-aa2f725c3bf9
Commits

Reviewing files that changed from the base of the PR and between 454fc01 and b7688ab.

Files selected for processing: 11
  • README.md
  • messages/en.json
  • messages/fr.json
  • src/features/selection/components/SelectionPage.test.tsx
  • src/features/selection/components/SelectionPage.tsx
  • src/features/selection/components/page/MissingEntriesNotice.tsx
  • src/features/selection/components/page/SelectionContent.tsx
  • src/features/selection/components/page/SelectionNotices.tsx
  • src/features/selection/components/page/useMissingSelectionCleanup.ts
  • src/features/selection/storage/store.test.ts
  • src/features/selection/storage/store.ts
Files with no reviewable changes: 5
  • src/features/selection/components/SelectionPage.tsx
  • messages/en.json
  • messages/fr.json
  • src/features/selection/components/page/MissingEntriesNotice.tsx
  • README.md

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

Walkthrough

The selection page now removes unavailable personal selections from storage after catalogue data resolves. A batch storage operation removes matching category and identifier pairs. The missing-entry notice and its English and French messages were removed.

Changes: Selection cleanup

Layer / File(s) Summary
Batch storage removal
src/features/selection/storage/store.ts, src/features/selection/storage/store.test.ts
removeSelections removes matching category and identifier pairs in one mutation. Tests cover latest stored data, no-op removals, and storage failures.
Page cleanup and notice removal
src/features/selection/components/page/*, src/features/selection/components/SelectionPage.tsx, src/features/selection/components/SelectionPage.test.tsx, messages/en.json, messages/fr.json
The page invokes cleanup only for personal, valid selections when storage is available. Tests cover loader states, shared selections, and cleanup results. The missing-entry notice and its localized messages were removed.
Unidentified README deletion
README.md
One line was deleted. The supplied change summary does not identify its content.

Priority: Normal

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant SelectionContent
  participant useMissingSelectionCleanup
  participant removeSelections
  participant SelectionStorage
  SelectionContent->>useMissingSelectionCleanup: Pass missing entries and cleanup condition
  useMissingSelectionCleanup->>removeSelections: Remove missing category and identifier pairs
  removeSelections->>SelectionStorage: Read latest data and apply matching removals
  SelectionStorage-->>removeSelections: Return storage operation result
Loading
Merge Risk: Minimal · up to b7688

The change appears mergeable after normal checks.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Title check Passed The title says missing items are now removed automatically from personal selections once catalogue data is available. The changeset matches this. It adds a useMissingSelectionCleanup hook that calls r…
Full details: Title check

Explanation

The title says missing items are now removed automatically from personal selections once catalogue data is available. The changeset matches this. It adds a useMissingSelectionCleanup hook that calls removeSelections for missing entries, adds a batch removeSelections in store.ts, removes the MissingEntriesNotice component and its prop plumbing, and updates the tests to expect silent cleanup. The title is specific and describes the primary change. Its length (107 characters) is on the long side but still readable.

Full details: Docstring Coverage

Explanation

Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 3 functions across 6 files.

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@jy95

jy95 commented Oct 29, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai In my selection page, delete the UX for removing not found entries & warning about them, but keep in background the logic of cleaning up things

@codacy-production

codacy-production Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 13 complexity · 0 duplication

Metric Results
Complexity 13
Duplication 0

View in Codacy

🟢 Coverage 100.00% diff coverage · +0.00% coverage variation

Metric Results
Coverage variation ✅ +0.00% coverage variation (-1.00%)
Diff coverage ✅ 100.00% diff coverage

View coverage diff in Codacy

Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (454fc01) 2937 2834 96.49%
Head commit (95841e6) 2938 (+1) 2835 (+1) 96.49% (+0.00%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#4301) 14 14 100.00%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@coderabbitai

coderabbitai Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
fd -i 'selection|select'
rg -n -i -C 3 'not found|notFound|not_found|remove missing|missing entries' --glob '!package-lock.json' --glob '!yarn.lock' --glob '!pnpm-lock.yaml' . | head -250

Length of output: 21624


🏁 Script executed:

#!/bin/bash
ast-grep outline src/features/selection --items all --type function --match 'Selection|useSelection'
rg -n -i -C 3 'missing|notfound|not.found|cleanup|prune|unresolved' src/features/selection src/domain/selection src/redux/services/selectionAPI.tsx
for file in src/features/selection/components/page/SelectionNotices.tsx src/features/selection/components/page/SelectionContent.tsx src/features/selection/components/page/useSelectionDocument.ts src/features/selection/components/grid/SelectionResults.tsx src/features/selection/components/grid/SelectionCard.tsx; do
  ast-grep outline "$file"
  sed -n '1,240p' "$file"
done

Length of output: 47074


🏁 Script executed:

#!/bin/bash
for file in src/features/selection/components/page/MissingEntriesNotice.tsx src/features/selection/storage/store.ts; do
  ast-grep outline "$file"
  sed -n '1,260p' "$file"
done

Length of output: 8079


@jy95 I’ll remove the not-found entry warning, entry list, and removal buttons. Cleanup will run silently in the background.

The current cleanup runs only when a removal button is clicked. I’ll move that behavior out of MissingEntriesNotice before removing the component.

  • Remove the not-found entry UI and its unused props.
  • Add silent cleanup for missing entries in personal selections.
  • Keep shared selections read-only.
  • Update tests for the UI removal and background cleanup.

  • ✅ Pull request created - (🔄 Check again to retry)

You are interacting with an AI system.

…tions in the background

<!-- coderabbit-ai-generated:v1 -->
@coderabbitai

coderabbitai Bot commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

✅ The requested changes have been implemented and a pull request has been created: View PR

📝 CodeRabbit Chat: Silently clean missing entries from personal selections in the background
@jy95

jy95 commented Oct 30, 2026 •

Copy link
Copy Markdown
Owner Author

@coderabbitai Simplify that, still too complex (and dead code must be deleted)

@coderabbitai

coderabbitai Bot commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

Code simplification is not enabled for this repository.

@jy95

jy95 commented Oct 30, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai Simplify this MR, still too complex (and dead code must be deleted)

@coderabbitai

coderabbitai Bot commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

Code simplification is not enabled for this repository.

@jy95

jy95 commented Oct 30, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai Reduce this MR, still too complex (and dead code must be deleted)

@coderabbitai

coderabbitai Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Tip

For best results, initiate chat on the files or code changes.

@jy95 I’ll reduce the implementation and delete dead code. I’ll keep silent background cleanup and the existing safeguards.

  • Reduce cleanup to the smallest clear implementation.
  • Delete unused components, functions, types, imports, props, and translation keys.
  • Keep focused tests without duplicate coverage.

  • ✅ Pull request created - (🔄 Check again to retry)

You are interacting with an AI system.

@coderabbitai

coderabbitai Bot commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

✅ The requested changes have been implemented and a pull request has been created: View PR

📝 CodeRabbit Chat: Simplify selection cleanup and remove obsolete code
@jy95

jy95 commented Oct 30, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai Reduce this MR, still too complex (and dead code must be deleted)

@coderabbitai

coderabbitai Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
git status --short
git diff --stat
for file in src/features/selection/components/page/SelectionContent.tsx src/features/selection/storage/store.ts src/domain/selection/selection-mutations.ts src/domain/selection/resolution.ts; do
  if test -f "$file"; then
    ast-grep outline "$file"
    sed -n '1,220p' "$file"
  fi
done
fd -i 'MissingEntriesNotice|useMissingSelectionCleanup'
rg -n -C2 '\b(removeSelection|removeSelections|removeId|useMissingSelectionCleanup|SelectionIdentifier)\b' --glob '*.{ts,tsx}' .

Length of output: 16816


@jy95 The current branch already removes the standalone cleanup hook, removeSelection, and removeId. I’ll reduce the remaining implementation rather than repeat those changes.

  • Simplify batch removal to one pass with a lazy document copy.
  • Remove verified unused code and redundant data.
  • Keep silent cleanup and focused regression tests.

  • ✅ Pull request created - (🔄 Check again to retry)

You are interacting with an AI system.

…solution code

<!-- coderabbit-ai-generated:v1 -->
@coderabbitai

coderabbitai Bot commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

✅ The requested changes have been implemented and a pull request has been created: View PR

📝 CodeRabbit Chat: Simplify selection cleanup and remove redundant resolution code
@codacy-production

codacy-production Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity · 0 duplication

Metric Results
Complexity 0
Duplication 0

View in Codacy

🟢 Coverage 100.00% diff coverage · 0.00% coverage variation

Metric Results
Coverage variation ✅ 0.00% coverage variation (-1.00%)
Diff coverage ✅ 100.00% diff coverage

View coverage diff in Codacy

Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (454fc01) 2937 2834 96.49%
Head commit (3b4762c) 2936 (-1) 2833 (-1) 96.49% (0.00%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#4301) 13 13 100.00%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@jy95

jy95 commented Oct 30, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai I don't like current code that rely too much on "if" paths, run cleanup anyway so code is less complex

@coderabbitai

coderabbitai Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Tip

For best results, initiate chat on the files or code changes.

@jy95 I’ll let cleanup run instead of adding checks to avoid harmless calls. I’ll remove the attempt tracking and cleanup-specific optimization branches.

I’ll keep the shared-selection boundary and storage validation. These prevent cleanup from deleting unrelated personal entries or overwriting invalid data.

  • Call cleanup directly from the effect, including when the missing-entry list is empty.
  • Remove attempt tracking, lazy-copy logic, and redundant checks.
  • Delete code and tests made obsolete by this change.

  • ✅ Pull request created - (🔄 Check again to retry)

You are interacting with an AI system.

@coderabbitai

coderabbitai Bot commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

✅ The requested changes have been implemented and a pull request has been created: View PR

📝 CodeRabbit Chat: Simplify selection cleanup and update tests
@jy95

jy95 commented Oct 30, 2026 •

Copy link
Copy Markdown
Owner Author

@coderabbitai

⎯⎯⎯⎯⎯⎯⎯ Failed Tests 1 ⎯⎯⎯⎯⎯⎯⎯

FAIL src/features/selection/components/SelectionPage.test.tsx > reports cleanup setItem failures without an unbounded render loop
Error: Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops.
❯ getRootForUpdatedFiber node_modules/react-dom/cjs/react-dom-client.development.js:4919:11
❯ enqueueConcurrentHookUpdate node_modules/react-dom/cjs/react-dom-client.development.js:4879:14
❯ dispatchSetStateInternal node_modules/react-dom/cjs/react-dom-client.development.js:9553:18
❯ dispatchSetState node_modules/react-dom/cjs/react-dom-client.development.js:9513:7
❯ node_modules/@mui/material/InputBase/InputBase.mjs:473:22
❯ Object.react_stack_bottom_frame node_modules/react-dom/cjs/react-dom-client.development.js:28656:20
❯ runWithFiberInDEV node_modules/react-dom/cjs/react-dom-client.development.js:1048:13
❯ commitHookEffectListMount node_modules/react-dom/cjs/react-dom-client.development.js:13748:29
❯ commitHookPassiveMountEffects node_modules/react-dom/cjs/react-dom-client.development.js:13835:11
❯ commitPassiveMountOnFiber node_modules/react-dom/cjs/react-dom-client.development.js:16906:13

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/1]⎯

Test Files 1 failed | 228 passed (229)
Tests 1 failed | 1778 passed (1779)
Start at 01:00:18
Duration 139.47s (environment 54%, tests 20%, import 14%, setup 7%, worker 3%, transform 2%)

Repository owner deleted a comment from coderabbitai Bot Oct 30, 2026
Repository owner deleted a comment from coderabbitai Bot Oct 30, 2026
Repository owner deleted a comment from coderabbitai Bot Oct 30, 2026
Repository owner deleted a comment from coderabbitai Bot Oct 30, 2026
@coderabbitai

coderabbitai Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
for file in src/features/selection/storage/store.ts src/features/selection/components/page/SelectionContent.tsx src/features/selection/components/page/useSelectionDocument.ts src/features/selection/components/SelectionPage.test.tsx; do
  ast-grep outline "$file"
done
sed -n '1,210p' src/features/selection/storage/store.ts
sed -n '1,140p' src/features/selection/components/page/SelectionContent.tsx
sed -n '1,180p' src/features/selection/components/page/useSelectionDocument.ts
rg -n -C 15 'unbounded render loop|beforeEach|afterEach' src/features/selection/components/SelectionPage.test.tsx

Length of output: 14305


@jy95 This is a regression in my last simplification. The storage code causes the loop, even though the stack ends in MUI.

When setItem fails:

  1. load() publishes storageAvailable: true with a newly parsed document.
  2. The failed write publishes storageAvailable: false.
  3. The new document reference changes missing, so the cleanup effect runs again.

publish() compares the whole snapshot. It does not preserve the document reference when only storage status changes.

  • Preserve the document reference when its contents have not changed.
  • Keep the direct cleanup effect without attempt tracking.
  • Strengthen the storage-failure regression tests.

I inspected the code but did not run tests in this sandbox. The fix remains unverified until the coding workflow runs them.


  • ✅ Pull request created - (🔄 Check again to retry)

You are interacting with an AI system.

@coderabbitai

coderabbitai Bot commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

✅ The requested changes have been implemented and a pull request has been created: View PR

📝 CodeRabbit Chat: Preserve document references on storage metadata updates
@jy95 jy95 changed the title Update README.md feat: Missing items are now automatically removed from personal selections once catalogue data is available Oct 30, 2026
@jy95
jy95 merged commit 6d23d9b into master Oct 30, 2026
16 checks passed
@jy95
jy95 deleted the jy95-patch-1 branch October 30, 2026 01:42

This branch was successfully deployed

1 active deployment
Preview — 3b4762c9 Deployed Oct 30, 2026 by vercel[bot]
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