Skip to content

Added @property:ImportFormat annotation to id property of UserEntity#1039

Open
SzBeni2003 wants to merge 1 commit into
stagingfrom
feature/user-id-in-export
Open

Added @property:ImportFormat annotation to id property of UserEntity#1039
SzBeni2003 wants to merge 1 commit into
stagingfrom
feature/user-id-in-export

Conversation

@SzBeni2003

@SzBeni2003 SzBeni2003 commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • Chores
    • Updated internal annotations for improved data handling consistency.

@coderabbitai

coderabbitai Bot commented Jun 7, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The pull request adds a single @property:ImportFormat annotation to the id property of the UserEntity class. This enables import format metadata handling for the User ID field during data import operations.

Changes

User ID Import Format Annotation

Layer / File(s) Summary
User ID import format annotation
backend/src/main/kotlin/hu/bme/sch/cmsch/model/UserEntity.kt
UserEntity.id property is annotated with @property:ImportFormat to support import format metadata handling.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

A rabbit hops through code so neat,
One annotation, a tiny treat,
The User's ID now formatted bright,
For imports dancing in the night! 🐰✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding the @property:ImportFormat annotation to the id property of UserEntity.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/user-id-in-export

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@backend/src/main/kotlin/hu/bme/sch/cmsch/model/UserEntity.kt`:
- Around line 90-91: The id field in UserEntity is annotated for import/export
(ImportFormat) despite being `@GeneratedValue`, which lets imported non-zero IDs
overwrite or conflict when CsvParserUtil + repo.saveAll persists; remove or mark
the id as export-only (i.e., stop treating it as an importable field) OR add
validation in the import flow (CsvParserUtil or the service that calls
repo.saveAll) to reject/zero-out any incoming id values unless running in a
privileged "preserve-ids" mode and ensure sequence safety before persisting;
update UserEntity's id ImportFormat usage or add a strict check in the import
path so only new/zero IDs are saved to avoid PK collisions.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 56aaf52c-fa4f-4ccb-a172-c1ee66eb9a9c

📥 Commits

Reviewing files that changed from the base of the PR and between d07af8a and 7ec772c.

📒 Files selected for processing (1)
  • backend/src/main/kotlin/hu/bme/sch/cmsch/model/UserEntity.kt

Comment on lines +90 to 91
@property:ImportFormat
override var id: Int = 0,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | 🏗️ Heavy lift

Importing generated primary key enables accidental overwrite/collision paths.

id is @GeneratedValue, but this annotation now makes it part of CSV import/export selection. In the current import flow (CsvParserUtil + repo.saveAll), non-zero incoming IDs can map to existing rows and mutate the wrong user or cause PK conflicts. Please gate this (export-only, privileged mode, or strict validation that imported IDs are absent/new and sequence-safe) before persisting.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@backend/src/main/kotlin/hu/bme/sch/cmsch/model/UserEntity.kt` around lines 90
- 91, The id field in UserEntity is annotated for import/export (ImportFormat)
despite being `@GeneratedValue`, which lets imported non-zero IDs overwrite or
conflict when CsvParserUtil + repo.saveAll persists; remove or mark the id as
export-only (i.e., stop treating it as an importable field) OR add validation in
the import flow (CsvParserUtil or the service that calls repo.saveAll) to
reject/zero-out any incoming id values unless running in a privileged
"preserve-ids" mode and ensure sequence safety before persisting; update
UserEntity's id ImportFormat usage or add a strict check in the import path so
only new/zero IDs are saved to avoid PK collisions.

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