Skip to content

Conversation

@tisnik
Copy link
Contributor

@tisnik tisnik commented Sep 10, 2025

Description

Refactoring: do not loose models ordering

Type of change

  • Refactor
  • New feature
  • Bug fix
  • CVE fix
  • Optimization
  • Documentation Update
  • Configuration Update
  • Bump-up service version
  • Bump-up dependent library
  • Bump-up library or tool used for development (does not change the final image)
  • CI configuration change
  • Konflux configuration change
  • Unit tests improvement
  • Integration tests improvement
  • End to end tests improvement

Summary by CodeRabbit

  • Bug Fixes
    • Category lists in feedback now remove duplicates without changing the original order. This preserves the sequence you enter for display, filtering, and reporting. Submission behavior for empty or null inputs is unchanged.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 10, 2025

Walkthrough

Deduplication in FeedbackRequest.validate_categories changed from set-based to dict.fromkeys to remove duplicates while preserving the original input order. None and empty-list handling remain unchanged, the inline comment was updated, and no public signatures were modified.

Changes

Cohort / File(s) Summary
Validation logic update
src/models/requests.py
Replaced set(value) deduplication with dict.fromkeys(value) to preserve input order; updated inline comment; no signature changes.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Pre-merge checks (3 passed)

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title succinctly indicates that the refactor prevents loss of ordering which directly relates to the change of using dict.fromkeys to preserve input order during deduplication, thus capturing the primary change in a concise phrase.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

Pre-merge checks (3 passed)

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title indicates that this PR refactors code to preserve ordering, which aligns with the main change of switching to an order-preserving deduplication approach in the models layer; it thus relates directly to the intent of the changeset, even though it could be more precise about what is being ordered and contains a minor typo.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

Poem

I hop through lists, removing repeat,
Keeping every first step neat.
No tumble now, no order lost,
I trim the tails but count no cost.
A carrot nod for line preserved. 🥕

Tip

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Please see the documentation for more information.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.


📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3e6db29 and e88ed25.

📒 Files selected for processing (1)
  • src/models/requests.py (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/models/requests.py
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: build-pr
  • GitHub Check: e2e_tests
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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 and usage tips.

@tisnik tisnik force-pushed the refactoring-dont-loose-models-ordering branch from 34d4fcc to 3e6db29 Compare September 10, 2025 07:14
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
src/models/requests.py (1)

369-371: Nit: fix typo in the inline comment ("loose" → "lose").

Apply:

-        unique_categories = list(dict.fromkeys(value))  # don't loose ordering
+        unique_categories = list(dict.fromkeys(value))  # don't lose ordering
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e4c7aa1 and 3e6db29.

📒 Files selected for processing (1)
  • src/models/requests.py (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: build-pr
  • GitHub Check: e2e_tests
🔇 Additional comments (1)
src/models/requests.py (1)

369-371: Order-preserving de-duplication: LGTM.

Switching to dict.fromkeys(...) removes duplicates while keeping first-seen order, matching the PR goal.

@tisnik tisnik force-pushed the refactoring-dont-loose-models-ordering branch from 3e6db29 to e88ed25 Compare September 10, 2025 07:21
@tisnik tisnik merged commit 7f52cd8 into lightspeed-core:main Sep 10, 2025
19 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