Skip to content

test(plm-ui): wait for search response#81

Merged
zensgit merged 13 commits intomainfrom
chore/plm-ui-search-wait
Jan 20, 2026
Merged

test(plm-ui): wait for search response#81
zensgit merged 13 commits intomainfrom
chore/plm-ui-search-wait

Conversation

@zensgit
Copy link
Copy Markdown
Owner

@zensgit zensgit commented Jan 20, 2026

Summary\n- wait for PLM search response before reading the results table in regression UI tests.\n- add verification reports and dev report.\n\n## Testing\n- AUTO_START=true PLM_BASE_URL=http://127.0.0.1:7910 bash scripts/verify-plm-ui-full.sh

Copilot AI review requested due to automatic review settings January 20, 2026 08:02
@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello @zensgit, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request focuses on enhancing the robustness of the PLM UI by stabilizing search-related regression tests and introducing a suite of advanced features to the attendance plugin. It also includes several improvements to PLM data federation, ensuring more accurate data mapping and better error visibility. The changes are accompanied by detailed documentation and updated verification scripts.

Highlights

  • PLM UI Test Stability: Implemented a wait mechanism for the PLM search response in UI regression tests, resolving potential race conditions and improving test reliability.
  • Expanded Attendance Plugin Features: Significantly extended the attendance plugin to include comprehensive leave and overtime request management, multi-step approval workflows, and employee rotation scheduling.
  • PLM Federation Enhancements: Improved BOM integration by supporting depth and effective dates, exposing reference designators (refdes), and refining substitute deletion. Error handling for upstream authentication issues has also been enhanced.
  • New Documentation and Verification Reports: Added several new markdown documents detailing the PLM UI search fix, PLM federation stages, and extensive development and verification reports for the new attendance plugin features.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR enhances PLM UI regression testing and extends the attendance plugin with leave, overtime, approval flow, and rotation features. It also improves PLM federation by adding BOM metadata support, product detail mapping, and error handling.

Changes:

  • Wait for PLM search API response before reading results table in UI regression tests
  • Add leave types, overtime rules, approval flows, and rotation rules to attendance plugin
  • Enhance PLM BOM adapter to support depth, effective date, find_num, and refdes fields
  • Add verification and development reports documenting changes

Reviewed changes

Copilot reviewed 32 out of 36 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
scripts/verify-plm-ui-regression.sh Added wait for search response to prevent race condition
scripts/verify-plm-bom-tools.sh Enhanced BOM seed with find_num/refdes and search reindex
scripts/verify-attendance-ui.mjs Extended UI tests with leave/overtime/request flows and debug support
plugins/plugin-attendance/index.cjs Major feature additions: leave types, overtime rules, approval flows, rotation scheduling
packages/core-backend/src/db/migrations/* New migrations for attendance feature tables
packages/openapi/src/paths/attendance.yml Added API endpoints for new attendance features
packages/core-backend/src/data-adapters/PLMAdapter.ts Enhanced BOM support with metadata fields and error handling
docs/* Added verification and development reports

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +69 to +90
async function waitForStatusChange(page, previousText, actionLabel) {
try {
await page.waitForFunction(
(prev) => {
const el = document.querySelector('.attendance__status')
if (!el) return false
const text = el.textContent ? el.textContent.trim() : ''
return text.length > 0 && text !== prev
},
previousText,
{ timeout: timeoutMs }
)
return getStatusText(page)
} catch (error) {
const currentText = await getStatusText(page)
await captureDebug(page, actionLabel, { previousText, currentText })
if (currentText && currentText === previousText) {
logInfo(`Status unchanged after ${actionLabel}; continuing with "${currentText}"`)
return currentText
}
throw error
}
Copy link

Copilot AI Jan 20, 2026

Choose a reason for hiding this comment

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

The waitForStatusChange function catches timeout errors but continues execution if the status hasn't changed. This could mask real timeout issues. The function should distinguish between "status unchanged" (which might be acceptable in some flows) and "status element disappeared" or other timeout scenarios. Consider logging a warning or throwing an error if the status element becomes unavailable during the wait.

Copilot uses AI. Check for mistakes.
Comment on lines +1985 to +1990
if (action === 'approve') {
const canApprove = await isApproverAllowed(trx, requesterId, currentStep, logger)
if (!canApprove) {
throw new HttpError(403, 'FORBIDDEN', 'Not authorized for this approval step')
}
}
Copy link

Copilot AI Jan 20, 2026

Choose a reason for hiding this comment

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

The approval step authorization check in line 1986 uses isApproverAllowed but only validates when action is 'approve'. However, the function should also validate authorization for 'reject' actions to ensure users can only reject requests they're authorized to approve. This could allow unauthorized users to reject requests.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a fix for a flaky PLM UI test by waiting for the search response, which is a great improvement for test stability. It also adds a significant amount of new functionality to the attendance plugin, including leave/overtime requests, approval flows, and rotation scheduling, along with corresponding database migrations, API endpoints, and tests.

While the added features and test improvements are valuable, this PR is very large and combines several unrelated changes. This makes it challenging to review thoroughly and increases the risk of introducing issues. In the future, please try to split large changes into smaller, focused pull requests. For example, the PLM test fix could have been a separate PR, and the attendance feature could have been broken down into multiple PRs (e.g., DB changes, backend API, tests).

I've provided a few suggestions for refactoring to improve code maintainability. Overall, the changes are positive, but the size and scope of the PR are a concern.

Comment on lines 911 to +931
const partNumber = String(
props.item_number || props.part_number || props.number || props.code || props.internal_reference || ''
item.item_number ||
props.item_number ||
props.part_number ||
props.number ||
props.code ||
props.internal_reference ||
''
)
const revision = String(props.revision || props.version || props.rev || props.version_label || '')
const status = String(item.state || props.state || '')
const description = props.description ? String(props.description) : undefined
const createdAt = this.toIsoString(item.created_on || props.created_at || props.created_on || props.create_date)
const updatedAt = this.toIsoString(item.modified_on || props.updated_at || props.modified_on || props.write_date) || createdAt
const itemType = item.type || (props.item_type as string | undefined) || (props.itemType as string | undefined) || (props.type as string | undefined)
const itemType =
item.type ||
item.item_type_id ||
(props.item_type_id as string | undefined) ||
(props.item_type as string | undefined) ||
(props.itemType as string | undefined) ||
(props.type as string | undefined)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The logic for resolving partNumber and itemType involves checking multiple fallback properties. This pattern is repeated in mapYuantusProductFields and mergeYuantusProductDetail. To improve code maintainability and reduce duplication, consider creating helper functions for resolving these properties from Yuantus items and their properties objects.

context.api.http.addRoute(
'POST',
'/api/attendance/requests',
withPermission('attendance:write', async (req, res) => {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The request handler for POST /api/attendance/requests has become quite large and complex due to handling multiple request types (missed_check_in, leave, overtime, etc.). To improve readability and maintainability, consider refactoring this logic. You could extract the logic for each request type into its own helper function. This would make the main handler a dispatcher and easier to follow.

@zensgit zensgit merged commit e933f9e into main Jan 20, 2026
9 checks passed
@zensgit zensgit deleted the chore/plm-ui-search-wait branch April 3, 2026 02:22
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.

2 participants