You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adds the pydemo1 eye-and-speech demo with Python processing, Pyodide/browser execution, workspace build and test wiring, coverage/type-check configuration, workflow lifecycle tracking, and updated speech recording UI and duration.
Changes
pydemo1 Demo Integration
Layer / File(s)
Summary
Python demo processing and contracts services/ws-modules/pydemo1/pydemo1/*, services/ws-modules/pydemo1/tests/*
Adds eye and speech capture result contracts, processing wrappers, WebSocket workflow orchestration, cleanup handling, and tests.
Browser runtime and demo interface services/ws-modules/pydemo1/pkg/*
Adds the ES module package, Pyodide initialization and wheel loading, demo UI, WebSocket bridge, and model setup.
Combined media capture and cleanup services/ws-modules/pydemo1/pkg/et_ws_pydemo1.js
Adds camera and microphone capture, eye and speech inference, rendering, storage uploads, event transmission, and teardown.
Workspace build, test, and analysis wiring .mise/*, config/*, pyproject.toml, services/ws-modules/pydemo1/pkg/.gitignore
Registers pydemo1 as a workspace module and adds build, test, prefetch, coverage, Pyrefly, and artifact-ignore configuration.
Workflow coordination and speech updates services/ws-server/static/*, services/ws-web-runner/tests/modules.rs, services/ws-modules/pyspeech1/*
Adds active-workflow stopping, GPU meter identification, Deno coverage cases, a 30-second speech capture window, and countdown/style helpers.
We reviewed changes in 3052768...cb6beb9 on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.
AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.
The reason will be displayed to describe this comment to others. Learn more.
Attribute 'crop' defined outside __init__
Defining an instance attribute outside __init__ affects the readability of code. It is expected to find all the attributes an instance may have by reading its __init__ method. If there is a need to initialize attribute via sub-initialization methods, it is recommended to assign attributes to None in the init then call the sub-initialization methods.
The reason will be displayed to describe this comment to others. Learn more.
Attribute 'last_analysis_ms' defined outside __init__
Defining an instance attribute outside __init__ affects the readability of code. It is expected to find all the attributes an instance may have by reading its __init__ method. If there is a need to initialize attribute via sub-initialization methods, it is recommended to assign attributes to None in the init then call the sub-initialization methods.
The reason will be displayed to describe this comment to others. Learn more.
Attribute 'analysis' defined outside __init__
Defining an instance attribute outside __init__ affects the readability of code. It is expected to find all the attributes an instance may have by reading its __init__ method. If there is a need to initialize attribute via sub-initialization methods, it is recommended to assign attributes to None in the init then call the sub-initialization methods.
The reason will be displayed to describe this comment to others. Learn more.
Attribute 'captured_for_episode' defined outside __init__
Defining an instance attribute outside __init__ affects the readability of code. It is expected to find all the attributes an instance may have by reading its __init__ method. If there is a need to initialize attribute via sub-initialization methods, it is recommended to assign attributes to None in the init then call the sub-initialization methods.
The reason will be displayed to describe this comment to others. Learn more.
Attribute 'captured_for_episode' defined outside __init__
Defining an instance attribute outside __init__ affects the readability of code. It is expected to find all the attributes an instance may have by reading its __init__ method. If there is a need to initialize attribute via sub-initialization methods, it is recommended to assign attributes to None in the init then call the sub-initialization methods.
The reason will be displayed to describe this comment to others. Learn more.
Attribute 'indicator_was_active' defined outside __init__
Defining an instance attribute outside __init__ affects the readability of code. It is expected to find all the attributes an instance may have by reading its __init__ method. If there is a need to initialize attribute via sub-initialization methods, it is recommended to assign attributes to None in the init then call the sub-initialization methods.
The reason will be displayed to describe this comment to others. Learn more.
Attribute 'last_periodic_capture_ms' defined outside __init__
Defining an instance attribute outside __init__ affects the readability of code. It is expected to find all the attributes an instance may have by reading its __init__ method. If there is a need to initialize attribute via sub-initialization methods, it is recommended to assign attributes to None in the init then call the sub-initialization methods.
The reason will be displayed to describe this comment to others. Learn more.
Method doesn't use the class instance and could be converted into a static method
The method doesn't use its bound instance. Decorate this method with @staticmethod decorator, so that Python does not have to instantiate a bound method for every instance of this class thereby saving memory and computation. Read more about staticmethods here.
The reason will be displayed to describe this comment to others. Learn more.
Method doesn't use the class instance and could be converted into a static method
The method doesn't use its bound instance. Decorate this method with @staticmethod decorator, so that Python does not have to instantiate a bound method for every instance of this class thereby saving memory and computation. Read more about staticmethods here.
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer TIP This summary will be updated as you push new changes.
The reason will be displayed to describe this comment to others. Learn more.
Attribute 'crop' defined outside __init__
Defining an instance attribute outside __init__ affects the readability of code. It is expected to find all the attributes an instance may have by reading its __init__ method. If there is a need to initialize attribute via sub-initialization methods, it is recommended to assign attributes to None in the init then call the sub-initialization methods.
The reason will be displayed to describe this comment to others. Learn more.
Attribute 'last_analysis_ms' defined outside __init__
Defining an instance attribute outside __init__ affects the readability of code. It is expected to find all the attributes an instance may have by reading its __init__ method. If there is a need to initialize attribute via sub-initialization methods, it is recommended to assign attributes to None in the init then call the sub-initialization methods.
The reason will be displayed to describe this comment to others. Learn more.
Attribute 'analysis' defined outside __init__
Defining an instance attribute outside __init__ affects the readability of code. It is expected to find all the attributes an instance may have by reading its __init__ method. If there is a need to initialize attribute via sub-initialization methods, it is recommended to assign attributes to None in the init then call the sub-initialization methods.
The reason will be displayed to describe this comment to others. Learn more.
Attribute 'captured_for_episode' defined outside __init__
Defining an instance attribute outside __init__ affects the readability of code. It is expected to find all the attributes an instance may have by reading its __init__ method. If there is a need to initialize attribute via sub-initialization methods, it is recommended to assign attributes to None in the init then call the sub-initialization methods.
The reason will be displayed to describe this comment to others. Learn more.
Attribute 'captured_for_episode' defined outside __init__
Defining an instance attribute outside __init__ affects the readability of code. It is expected to find all the attributes an instance may have by reading its __init__ method. If there is a need to initialize attribute via sub-initialization methods, it is recommended to assign attributes to None in the init then call the sub-initialization methods.
The reason will be displayed to describe this comment to others. Learn more.
Attribute 'indicator_was_active' defined outside __init__
Defining an instance attribute outside __init__ affects the readability of code. It is expected to find all the attributes an instance may have by reading its __init__ method. If there is a need to initialize attribute via sub-initialization methods, it is recommended to assign attributes to None in the init then call the sub-initialization methods.
The reason will be displayed to describe this comment to others. Learn more.
Attribute 'last_periodic_capture_ms' defined outside __init__
Defining an instance attribute outside __init__ affects the readability of code. It is expected to find all the attributes an instance may have by reading its __init__ method. If there is a need to initialize attribute via sub-initialization methods, it is recommended to assign attributes to None in the init then call the sub-initialization methods.
The reason will be displayed to describe this comment to others. Learn more.
Method doesn't use the class instance and could be converted into a static method
The method doesn't use its bound instance. Decorate this method with @staticmethod decorator, so that Python does not have to instantiate a bound method for every instance of this class thereby saving memory and computation. Read more about staticmethods here.
The reason will be displayed to describe this comment to others. Learn more.
Method doesn't use the class instance and could be converted into a static method
The method doesn't use its bound instance. Decorate this method with @staticmethod decorator, so that Python does not have to instantiate a bound method for every instance of this class thereby saving memory and computation. Read more about staticmethods here.
The reason will be displayed to describe this comment to others. Learn more.
Attribute 'crop' defined outside __init__
Defining an instance attribute outside __init__ affects the readability of code. It is expected to find all the attributes an instance may have by reading its __init__ method. If there is a need to initialize attribute via sub-initialization methods, it is recommended to assign attributes to None in the init then call the sub-initialization methods.
The reason will be displayed to describe this comment to others. Learn more.
Attribute 'last_analysis_ms' defined outside __init__
Defining an instance attribute outside __init__ affects the readability of code. It is expected to find all the attributes an instance may have by reading its __init__ method. If there is a need to initialize attribute via sub-initialization methods, it is recommended to assign attributes to None in the init then call the sub-initialization methods.
The reason will be displayed to describe this comment to others. Learn more.
Attribute 'analysis' defined outside __init__
Defining an instance attribute outside __init__ affects the readability of code. It is expected to find all the attributes an instance may have by reading its __init__ method. If there is a need to initialize attribute via sub-initialization methods, it is recommended to assign attributes to None in the init then call the sub-initialization methods.
The reason will be displayed to describe this comment to others. Learn more.
Attribute 'captured_for_episode' defined outside __init__
Defining an instance attribute outside __init__ affects the readability of code. It is expected to find all the attributes an instance may have by reading its __init__ method. If there is a need to initialize attribute via sub-initialization methods, it is recommended to assign attributes to None in the init then call the sub-initialization methods.
The reason will be displayed to describe this comment to others. Learn more.
Attribute 'captured_for_episode' defined outside __init__
Defining an instance attribute outside __init__ affects the readability of code. It is expected to find all the attributes an instance may have by reading its __init__ method. If there is a need to initialize attribute via sub-initialization methods, it is recommended to assign attributes to None in the init then call the sub-initialization methods.
The reason will be displayed to describe this comment to others. Learn more.
Attribute 'indicator_was_active' defined outside __init__
Defining an instance attribute outside __init__ affects the readability of code. It is expected to find all the attributes an instance may have by reading its __init__ method. If there is a need to initialize attribute via sub-initialization methods, it is recommended to assign attributes to None in the init then call the sub-initialization methods.
The reason will be displayed to describe this comment to others. Learn more.
Attribute 'last_periodic_capture_ms' defined outside __init__
Defining an instance attribute outside __init__ affects the readability of code. It is expected to find all the attributes an instance may have by reading its __init__ method. If there is a need to initialize attribute via sub-initialization methods, it is recommended to assign attributes to None in the init then call the sub-initialization methods.
The reason will be displayed to describe this comment to others. Learn more.
Method doesn't use the class instance and could be converted into a static method
The method doesn't use its bound instance. Decorate this method with @staticmethod decorator, so that Python does not have to instantiate a bound method for every instance of this class thereby saving memory and computation. Read more about staticmethods here.
The reason will be displayed to describe this comment to others. Learn more.
Method doesn't use the class instance and could be converted into a static method
The method doesn't use its bound instance. Decorate this method with @staticmethod decorator, so that Python does not have to instantiate a bound method for every instance of this class thereby saving memory and computation. Read more about staticmethods here.
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
🤖 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 `@services/ws-modules/pydemo1/pkg/et_ws_pydemo1.js`:
- Line 297: Replace the Unicode ellipsis character in the UI strings within the
relevant runtime setup messages, including the occurrences near
setLoadingMessage and the other referenced locations, with the ASCII sequence
"...". Preserve the surrounding wording and behavior while ensuring all
specified strings remain ASCII-only.
- Around line 109-116: Update loadPythonRuntime so the global py is assigned
only after pyodide.pyimport("pydemo1") and py.config().toJs(...) both succeed.
Use a local temporary for the imported module, then commit it to py after cfg is
initialized, while preserving the existing cleanup behavior and retry guard.
- Around line 755-792: Update runEyeDetection to use demo.captureSeconds when
calculating the elapsed capture duration instead of EYE_DETECTION_SECONDS,
keeping the existing timing, completion, and cleanup behavior unchanged.
🪄 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 Plus
Run ID: c83a2a15-764a-40ae-979f-048ebd1a2a78
📥 Commits
Reviewing files that changed from the base of the PR and between 3052768 and cb6beb9.
Partial runtime init leaves py set but cfg undefined, breaking retries.
py is assigned at Line 111 before cfg at Line 112. If config() fails, loadPythonRuntime still leaves the global py truthy, so its early if (py) return; (Line 79) short-circuits on the next attempt (e.g. after the preload .catch re-enables the Load button). cfg stays undefined and later cfg.eye.bundle_path in loadModels throws. Assign py only after cfg succeeds.
‼️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.
Suggested change
try{
setPreparationStatus("Importing the combined demo workflow...");
[error] 109-109: React's useState should not be directly called
Context: setPreparationStatus("Importing the combined demo workflow...")
Note: [CWE-710] Improper Adherence to Coding Standards. Security best practice.
(usestate-direct-usage)
🤖 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 `@services/ws-modules/pydemo1/pkg/et_ws_pydemo1.js` around lines 109 - 116,
Update loadPythonRuntime so the global py is assigned only after
pyodide.pyimport("pydemo1") and py.config().toJs(...) both succeed. Use a local
temporary for the imported module, then commit it to py after cfg is
initialized, while preserving the existing cleanup behavior and retry guard.
These UI strings use the Unicode ellipsis … (U+2026): also at Lines 424, 603, 665, 674, and 675. Use ... to stay ASCII-only. As per coding guidelines: "Write only ASCII characters, except in explicitly exempt generated, verification, help, license, and binary paths."
🤖 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 `@services/ws-modules/pydemo1/pkg/et_ws_pydemo1.js` at line 297, Replace the
Unicode ellipsis character in the UI strings within the relevant runtime setup
messages, including the occurrences near setLoadingMessage and the other
referenced locations, with the ASCII sequence "...". Preserve the surrounding
wording and behavior while ensuring all specified strings remain ASCII-only.
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bashset -euo pipefail
printf'\n== File outline ==\n'
ast-grep outline services/ws-modules/pydemo1/pkg/et_ws_pydemo1.js --view expanded | sed -n '1,220p'printf'\n== Search for capture timing symbols ==\n'
rg -n --no-heading 'EYE_DETECTION_SECONDS|captureSeconds|eyeComplete|speech|runEyeDetection|runSpeech|capture window|COMPLETE' services/ws-modules/pydemo1/pkg/et_ws_pydemo1.js
printf'\n== Relevant slice around runEyeDetection ==\n'
sed -n '720,820p' services/ws-modules/pydemo1/pkg/et_ws_pydemo1.js
printf'\n== Relevant slice around speech capture logic ==\n'
sed -n '620,720p' services/ws-modules/pydemo1/pkg/et_ws_pydemo1.js
Repository: edge-toolkit/core
Length of output: 17299
Use the shared capture duration for eye detection.runEyeDetection still stops after the hardcoded 30s constant, while speech capture and the countdown use demo.captureSeconds. Any value other than 30 makes the two panels finish at different times, so drive both from the same duration source.
[warning] 769-769: services/ws-modules/pydemo1/pkg/et_ws_pydemo1.js#L769
Avoid trailing commas in object or array literals
🤖 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 `@services/ws-modules/pydemo1/pkg/et_ws_pydemo1.js` around lines 755 - 792,
Update runEyeDetection to use demo.captureSeconds when calculating the elapsed
capture duration instead of EYE_DETECTION_SECONDS, keeping the existing timing,
completion, and cleanup behavior unchanged.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary by CodeRabbit
New Features
Improvements
Tests