add identity_column to AIGeneratedTableSettings#1732
Conversation
Co-authored-by: Copilot <copilot@github.com>
📝 WalkthroughWalkthroughThe AI-generated table settings schema is extended to include an Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 6✅ Passed checks (6 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Pull request overview
Updates the AI-driven table settings generation so the model can propose an identity_column (a human-readable identifier column) and the backend persists it into generated TableSettingsEntity records.
Changes:
- Added
identity_columnto theAIGeneratedTableSettingscontract used for parsing AI responses. - Extended the AI prompt and the required JSON response example to include
identity_column. - Mapped/validated
identity_columnfrom the AI response intoTableSettingsEntity.identity_column(restricted to existing columns, otherwisenull).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@backend/src/entities/ai/ai.service.ts`:
- Line 139: Remove the trailing space at the end of the prompt string in
backend/src/entities/ai/ai.service.ts (the prompt text ending with "use null.");
locate the string literal that contains "identity_column: The column that best
identifies a row in human-readable format... use null." and trim the trailing
whitespace (or apply .trim() where the prompt is constructed) so the prompt sent
to the model no longer includes the extra space.
🪄 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: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 328f0bb5-5669-4ad3-9f4e-724228063428
📒 Files selected for processing (1)
backend/src/entities/ai/ai.service.ts
| 5. ordering: Default sort order - either "ASC" or "DESC" (use "DESC" for tables with timestamps to show newest first) | ||
| 6. ordering_field: Column name to sort by default (prefer created_at, updated_at, or primary key) | ||
| 7. widgets: For each column, suggest the best widget type from: ${widgetTypes} | ||
| 8. identity_column: The column that best identifies a row in human-readable format. This is shown when other tables reference this table via foreign keys, so users see meaningful data instead of just IDs. Choose columns like: name, title, email, username, full_name, label, or any descriptive text field. If no good candidate exists, use null. |
There was a problem hiding this comment.
Minor: trailing whitespace in prompt string.
There is a trailing space after use null. at the end of line 139. Not functional, but it slightly bloats the prompt sent to the model. Consider trimming.
✂️ Proposed fix
-8. identity_column: The column that best identifies a row in human-readable format. This is shown when other tables reference this table via foreign keys, so users see meaningful data instead of just IDs. Choose columns like: name, title, email, username, full_name, label, or any descriptive text field. If no good candidate exists, use null.
+8. identity_column: The column that best identifies a row in human-readable format. This is shown when other tables reference this table via foreign keys, so users see meaningful data instead of just IDs. Choose columns like: name, title, email, username, full_name, label, or any descriptive text field. If no good candidate exists, use null.📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| 8. identity_column: The column that best identifies a row in human-readable format. This is shown when other tables reference this table via foreign keys, so users see meaningful data instead of just IDs. Choose columns like: name, title, email, username, full_name, label, or any descriptive text field. If no good candidate exists, use null. | |
| 8. identity_column: The column that best identifies a row in human-readable format. This is shown when other tables reference this table via foreign keys, so users see meaningful data instead of just IDs. Choose columns like: name, title, email, username, full_name, label, or any descriptive text field. If no good candidate exists, use null. |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@backend/src/entities/ai/ai.service.ts` at line 139, Remove the trailing space
at the end of the prompt string in backend/src/entities/ai/ai.service.ts (the
prompt text ending with "use null."); locate the string literal that contains
"identity_column: The column that best identifies a row in human-readable
format... use null." and trim the trailing whitespace (or apply .trim() where
the prompt is constructed) so the prompt sent to the model no longer includes
the extra space.
Co-authored-by: Copilot copilot@github.com
Summary by CodeRabbit
New Features
Chores