-
Notifications
You must be signed in to change notification settings - Fork 50
refactor(vector-stores/repository-item): extract getStatusLabel helper function #2003
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…r function Consolidate duplicate status label logic into a reusable helper function that handles all repository content status types (idle, running, queued, failed, completed, unknown) consistently across blob and pull request statuses. fix: https://github.com/giselles-ai/giselle/pull/1981/files#r2431220995 https://github.com/giselles-ai/giselle/pull/1981/files#r2427669906 https://github.com/giselles-ai/giselle/pull/1981/files#r2431229666
|
|
Finished running flow.
|
WalkthroughAdds a local getStatusLabel helper to compute user-facing status labels based on content status and enablement, and replaces inline conditional status rendering for code (blob) and pull request sections in repository-item.tsx to standardize display. Changes
Sequence Diagram(s)Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used📓 Path-based instructions (4)**/*.{ts,tsx}📄 CodeRabbit inference engine (.cursor/rules/development-guide.mdc)
Files:
**/*.tsx📄 CodeRabbit inference engine (.cursor/rules/development-guide.mdc)
Files:
**/*📄 CodeRabbit inference engine (.cursor/rules/naming-guide.mdc)
Files:
**/*.{js,jsx,ts,tsx}📄 CodeRabbit inference engine (.cursor/rules/naming-guide.mdc)
Files:
🧬 Code graph analysis (1)apps/studio.giselles.ai/app/(main)/settings/team/vector-stores/repository-item.tsx (1)
⏰ 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). (1)
🔇 Additional comments (3)
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 |
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Extracts duplicate status label logic into a reusable helper function to improve code maintainability and consistency.
- Created
getStatusLabelhelper function to consolidate status mapping logic - Replaced duplicate inline status label logic for both blob and pull request statuses
- Improved consistency in handling different repository content status types
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| const getStatusLabel = ( | ||
| status: RepositoryContentStatusValue | undefined, | ||
| enabled: boolean | undefined, | ||
| ) => { | ||
| const effectiveStatus = | ||
| isIngesting && enabled ? "running" : (status ?? "unknown"); | ||
| switch (effectiveStatus) { | ||
| case "idle": | ||
| return "Idle"; | ||
| case "running": | ||
| return "Running"; | ||
| case "queued": | ||
| return "Queued"; | ||
| case "failed": | ||
| return "Error"; | ||
| case "completed": | ||
| return "Completed"; | ||
| default: | ||
| return "Unknown"; | ||
| } | ||
| }; | ||
|
|
Copilot
AI
Oct 15, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The helper function should be extracted outside the component to avoid recreation on every render. Consider moving it above the component or creating it as a module-level function.
| const getStatusLabel = ( | |
| status: RepositoryContentStatusValue | undefined, | |
| enabled: boolean | undefined, | |
| ) => { | |
| const effectiveStatus = | |
| isIngesting && enabled ? "running" : (status ?? "unknown"); | |
| switch (effectiveStatus) { | |
| case "idle": | |
| return "Idle"; | |
| case "running": | |
| return "Running"; | |
| case "queued": | |
| return "Queued"; | |
| case "failed": | |
| return "Error"; | |
| case "completed": | |
| return "Completed"; | |
| default: | |
| return "Unknown"; | |
| } | |
| }; | |
| function getStatusLabel( | |
| status: (typeof githubRepositoryContentStatus.$inferSelect)["status"] | undefined, | |
| enabled: boolean | undefined, | |
| isIngesting: boolean, | |
| ) { | |
| const effectiveStatus = | |
| isIngesting && enabled ? "running" : (status ?? "unknown"); | |
| switch (effectiveStatus) { | |
| case "idle": | |
| return "Idle"; | |
| case "running": | |
| return "Running"; | |
| case "queued": | |
| return "Queued"; | |
| case "failed": | |
| return "Error"; | |
| case "completed": | |
| return "Completed"; | |
| default: | |
| return "Unknown"; | |
| } | |
| } |
| (typeof githubRepositoryContentStatus.$inferSelect)["status"]; | ||
| const getStatusLabel = ( | ||
| status: RepositoryContentStatusValue | undefined, | ||
| enabled: boolean | undefined, |
Copilot
AI
Oct 15, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The isIngesting variable is captured from component scope, making this function dependent on component state. Consider passing isIngesting as a parameter to make the function pure and more testable.
| enabled: boolean | undefined, | |
| enabled: boolean | undefined, | |
| isIngesting: boolean, |
PR Code Suggestions ✨Explore these optional code suggestions:
|
||||||||||||
|
## 🔍 QA Testing Assistant by Giselle ### 📋 Manual QA Checklist Based on the changes in this PR, here are the key areas to test manually:
### ✨ Prompt for AI Agents Use the following prompts with Cursor or Claude Code to automate E2E testing: 📝 E2E Test Generation Prompt``` Prompt for AI Agent: E2E Test Generation for Vector Store Status DisplayYou are an expert QA engineer tasked with writing automated E2E tests using Playwright. Your goal is to validate the changes introduced in a recent Pull Request. The PR refactors and enhances the UI component that displays the status of repository content within the "Vector Stores" settings page. Please follow the instructions below to generate a complete Playwright test suite. 1. Context Summary
2. Test ScenariosCreate a test suite that covers the following scenarios. Use API mocking to simulate the different data states required for each test. Test Suite:
3. Playwright Implementation Instructions
4. MCP Integration Guidelines
5. CI-Ready Code Requirements
--> --- ## Manual QA Here is the Manual QA checklist for the developer. Manual QA ChecklistThank you for your work on this refactor! The goal of this Pull Request is to consolidate the logic for displaying repository content status into a single helper function, ensuring consistent behavior for all possible statuses. Please perform the following manual checks to ensure that the status labels for repository content are displayed correctly and that there are no regressions. Testing Pre-conditions:
Note: It may be difficult to trigger every backend status naturally. Please feel free to mock the Happy PathRepository Content Status DisplayFor both the "Code" and "Pull Request" sections of a repository item, please verify that the status label updates correctly based on its status value:
--- ## Prompt for AI Agents Excellent! As an expert QA engineer, I will now analyze the provided PR information and generate a comprehensive prompt for an AI agent to create the necessary E2E tests. Here is the prompt: Prompt for AI Agent: E2E Test Generation for Vector Store Status DisplayYou are an expert QA engineer tasked with writing automated E2E tests using Playwright. Your goal is to validate the changes introduced in a recent Pull Request. The PR refactors and enhances the UI component that displays the status of repository content within the "Vector Stores" settings page. Please follow the instructions below to generate a complete Playwright test suite. 1. Context Summary
2. Test ScenariosCreate a test suite that covers the following scenarios. Use API mocking to simulate the different data states required for each test. Test Suite:
3. Playwright Implementation Instructions
4. MCP Integration Guidelines
5. CI-Ready Code Requirements
--> --- |
Summary
Extract getStatusLabel helper function.
Related Issue
fix:
https://github.com/giselles-ai/giselle/pull/1981/files#r2431220995
https://github.com/giselles-ai/giselle/pull/1981/files#r2427669906
https://github.com/giselles-ai/giselle/pull/1981/files#r2431229666
Changes
Consolidate duplicate status label logic into a reusable helper function that handles all repository content status types (idle, running, queued, failed, completed, unknown) consistently across blob and pull request statuses.
Testing
Other Information
Note
Consolidates status label rendering into a reusable helper used for both blob and pull request statuses in
repository-item.tsx.apps/studio.giselles.ai/app/(main)/settings/team/vector-stores/repository-item.tsx:getStatusLabelhelper (derives effective status consideringisIngestingand supportsidle,running,queued,failed→ "Error",completed,unknown).blobandpull_requestwith the helper.RepositoryContentStatusValuetype alias fromgithubRepositoryContentStatus.Written by Cursor Bugbot for commit 01d399b. This will update automatically on new commits. Configure here.
Summary by CodeRabbit