Skip to content

Conversation

snomiao
Copy link
Member

@snomiao snomiao commented Sep 2, 2025

This is approach 2 of fixing .github/workflows/i18n.yaml

see also approach 3 (remove declare): #5304

Summary

  • Replaces script-based litegraph preprocessing with integrated Playwright setup
  • Removes standalone prebuild/restore scripts in favor of integrated solution
  • Creates ComfyPageNoUser fixture to avoid user creation conflicts
  • Ensures pnpm collect-i18n works correctly

Changes

  • Removed: scripts/prebuild-litegraph.js and scripts/restore-litegraph.js
  • Added: browser_tests/i18nSetup.ts for integrated preprocessing
  • Added: browser_tests/fixtures/ComfyPageNoUser.ts to avoid user conflicts
  • Updated: playwright.i18n.config.ts to use new setup/teardown
  • Simplified: collect-i18n command no longer needs manual prebuild/restore

Test Plan

  • Verify pnpm collect-i18n command works correctly
  • Confirm litegraph files are preprocessed and restored properly
  • Ensure i18n files are generated successfully

🤖 Generated with Claude Code

┆Issue is synchronized with this Notion page by Unito

snomiao and others added 5 commits September 1, 2025 23:21
…elds in litegraph

- Add prebuild script that temporarily removes 'declare' keyword from litegraph TypeScript files
- Add restore script to revert files to original state after i18n collection
- Update collect-i18n script to use prebuild/restore workflow
- Add babel dependencies for TypeScript transformation
- Update playwright.i18n.config.ts with global setup/teardown

This fix addresses an issue where Playwright's Babel transformation couldn't handle TypeScript 'declare' fields in litegraph classes, causing the i18n collection to fail.

Fixes the issue where 'pnpm collect-i18n' would fail with:
"TypeScript 'declare' fields must first be transformed by @babel/plugin-transform-typescript"
…d Playwright setup

- Remove prebuild-litegraph.js and restore-litegraph.js scripts
- Add i18nSetup.ts module for litegraph TypeScript 'declare' keyword preprocessing
- Create ComfyPageNoUser fixture to avoid user creation conflicts in i18n tests
- Update playwright.i18n.config.ts to use integrated setup/teardown
- Simplify collect-i18n command to just run Playwright tests
- Ensure pnpm collect-i18n works correctly

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Copy link

github-actions bot commented Sep 2, 2025

🎭 Playwright Test Results

Tests completed successfully!

⏰ Completed at: 09/12/2025, 03:39:45 AM UTC

📊 Test Reports by Browser


🎉 Click on the links above to view detailed test results for each browser configuration.

Copy link

socket-security bot commented Sep 2, 2025

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License

View full report

snomiao and others added 5 commits September 2, 2025 13:54
The NoUser fixture doesn't work properly in CI. Tests will handle user creation properly with the standard fixture.
Instead of hardcoding the list of files, dynamically find all TypeScript files in litegraph that contain 'declare' keywords using glob pattern matching.
- Replace synchronous fs operations with async fs.promises
- Use Promise.all for parallel file processing
- Improves performance when processing multiple files
@snomiao
Copy link
Member Author

snomiao commented Sep 2, 2025

the playwright deploy link is here

@christian-byrne

"Can load audio" test failed by a small diff on node name

image

Maybe someone forgot to update playwright expectation or we set threshold too small?

@christian-byrne
Copy link
Contributor

The display name change from "LoadAudio" -> "Load Audio" was added 4 months ago comfyanonymous/ComfyUI@b4abca8. I wonder why the test only started failing now?

@snomiao snomiao marked this pull request as ready for review September 2, 2025 21:13
@dosubot dosubot bot added the size:XL This PR changes 500-999 lines, ignoring generated files. label Sep 2, 2025
@snomiao
Copy link
Member Author

snomiao commented Sep 2, 2025

its Ready for review, current CI Fails:

  1. lint-and-format -- fixed by PR - [bugfix] Fix lint-and-format workflow detached HEAD issue by snomiao · Pull Request #5305 · Comfy-Org/ComfyUI_frontend
  2. can-load-audio -- will be fixed by regenerate playwright expectation
image

@christian-byrne

@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:XL This PR changes 500-999 lines, ignoring generated files. labels Sep 3, 2025
@christian-byrne christian-byrne added area:i18n Anything related to translation area:CI/CD labels Sep 12, 2025
… FullConfig parameter for better integration with Playwright's testing framework
…on to ensure they are included in the build process
…etter clarity and maintainability

feat(knip.config.ts): add support for vite and vitest configurations to enhance project structure and testing capabilities
@snomiao
Copy link
Member Author

snomiao commented Sep 12, 2025

got tailwindcss unsed error

> knip --cache

Unused devDependencies (2)
tailwindcss          package.json:83:6
tailwindcss-primeui  package.json:84:6
 ELIFECYCLE  Command failed with exit code 1.
husky - pre-push script failed (code 1)
error: failed to push some refs to 'github.com:Comfy-Org/ComfyUI_frontend.git'

…plugins list to support Tailwind CSS integration in the project
@christian-byrne
Copy link
Contributor

got tailwindcss unsed error

Is it fixed if you rebase?

@christian-byrne christian-byrne added the claude-review Add to trigger a PR code review from Claude Code label Sep 12, 2025
Copy link

@claude claude bot left a comment

Choose a reason for hiding this comment

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

Comprehensive PR Review

This review is generated by Claude. It may not always be accurate, as with human reviewers. If you believe that any of the comments are invalid or incorrect, please state why for each. For others, please implement the changes in one way or another.

Review Summary

PR: refactor: Improve litegraph preprocessing for i18n collection (#5297)
Impact: 423 additions, 296 deletions across 7 files

Issue Distribution

  • Critical: 0
  • High: 0
  • Medium: 3
  • Low: 3

Category Breakdown

  • Architecture: 0 issues
  • Security: 0 issues
  • Performance: 1 issues
  • Code Quality: 5 issues

Key Findings

Architecture & Design

The PR introduces a well-structured approach to litegraph preprocessing by consolidating functionality into dedicated modules. The integration with Playwright's global setup/teardown lifecycle is architecturally sound. The approach of replacing standalone scripts with integrated Playwright setup follows good practices for test infrastructure.

Security Considerations

No security vulnerabilities identified. The file preprocessing operations are contained within the test environment and don't expose any security risks.

Performance Impact

The solution includes a performance consideration noted in comments (70ms for 90+ file reads). While functional, there's room for optimization in the file scanning approach through batching or streaming operations.

Integration Points

The changes properly integrate with the existing Playwright configuration and don't break existing test infrastructure. The knip.config.ts updates ensure build tools are properly recognized.

Positive Observations

  • Clean modular design with proper separation of concerns
  • Good error handling with informative messages
  • Proper use of TypeScript types and modern async/await patterns
  • Integration with existing toolchain (Playwright, knip)
  • Memory-based backup strategy avoids filesystem pollution

References

Next Steps

  1. Address medium priority issues for better maintainability
  2. Consider performance optimizations for file scanning
  3. Ensure consistent TypeScript import patterns
  4. Review global state management approach

This is a comprehensive automated review. For architectural decisions requiring human judgment, please request additional manual review.

@snomiao
Copy link
Member Author

snomiao commented Sep 12, 2025

got tailwindcss unsed error

Is it fixed if you rebase?

I've got it because rebased

Refactored preprocessLitegraph() to read each file only once instead of twice.
Previously files were read once to check for 'declare' keywords and again to
process them. Now files are read once and processed inline if they contain
'declare' keywords, improving performance.
… import for FullConfig to improve clarity and maintainability
Copy link
Contributor

@christian-byrne christian-byrne left a comment

Choose a reason for hiding this comment

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

LGTM!

@snomiao snomiao marked this pull request as draft September 12, 2025 02:19
@snomiao
Copy link
Member Author

snomiao commented Sep 12, 2025

LGTM!

In the final-test PR - Test: Update locales workflow for sno-fix-playwright-babel-test branch by snomiao · Pull Request #5503 · Comfy-Org/ComfyUI_frontend, I've got a new error never seen before, working on it now @christian-byrne

> @comfyorg/[email protected] collect-i18n /home/runner/work/ComfyUI_frontend/ComfyUI_frontend/ComfyUI_frontend
> npx playwright test --config=playwright.i18n.config.ts

GitCommitInfo: timeout of 3000ms exceeded while running "git fetch origin dfcbbec2b95ba4392365ce9418618e1017b82240"
Preprocessing litegraph files for i18n collection...
  ✓ Processed LGraphNode.ts
  ✓ Processed subgraph/SubgraphOutput.ts
  ✓ Processed widgets/BaseWidget.ts
  ✓ Processed subgraph/SubgraphNode.ts
  ✓ Processed subgraph/SubgraphInput.ts
  ✓ Processed subgraph/EmptySubgraphInput.ts
  ✓ Processed subgraph/EmptySubgraphOutput.ts
  Processed 7 files with declare keywords
TypeError: Module "file:///home/runner/work/ComfyUI_frontend/ComfyUI_frontend/ComfyUI_frontend/src/locales/ar/commands.json" needs an import attribute of "type: json"
Restoring original litegraph files...
  ✓ Restored LGraphNode.ts
  ✓ Restored widgets/BaseWidget.ts
  ✓ Restored subgraph/SubgraphOutput.ts
  ✓ Restored subgraph/SubgraphNode.ts
  ✓ Restored subgraph/SubgraphInput.ts
  ✓ Restored subgraph/EmptySubgraphOutput.ts
  ✓ Restored subgraph/EmptySubgraphInput.ts**

pending - fix: Add JSON import assertions for Node.js ESM compatibility by snomiao · Pull Request #5507 · Comfy-Org/ComfyUI_frontend

@snomiao
Copy link
Member Author

snomiao commented Sep 26, 2025

close this as not necessary anymore because we solved locale workflow problem here: - fix(collect-i18n-node-defs): refactor to run ComfyNodeDefImpl only in browser context by snomiao · Pull Request #5775 · Comfy-Org/ComfyUI_frontend

@snomiao snomiao closed this Sep 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:CI/CD area:i18n Anything related to translation claude-review Add to trigger a PR code review from Claude Code size:L This PR changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants