Skip to content

Scaffold UIHTML Console Error Rerouter - #3

Merged
PVDecker1 merged 11 commits into
mainfrom
scaffold-uihtml-console-rerouter-12349836404906975249
Mar 11, 2026
Merged

Scaffold UIHTML Console Error Rerouter#3
PVDecker1 merged 11 commits into
mainfrom
scaffold-uihtml-console-rerouter-12349836404906975249

Conversation

@PVDecker1

Copy link
Copy Markdown
Owner

Implemented the core functionality for intercepting JavaScript console.error calls within MATLAB uihtml components and routing them to the MATLAB Command Window.

Files added:

  • src/js/consoleShim.js: ES5-compatible JavaScript shim for intercepting console methods and sending payloads to MATLAB.
  • src/ConsoleErrorRerouter.m: Main MATLAB class handling the HTMLEventReceived events and formatting the output.
  • examples/html/example_page.html: Sample HTML page with inline shim for manual testing.
  • examples/basic_usage.m: Minimal example demonstrating how to use the rerouter.
  • tests/html/test_page.html: HTML fixture for integration testing.
  • tests/tConsoleErrorRerouter.m: Unit test suite for the MATLAB class.

PR created automatically by Jules for task 12349836404906975249 started by @PVDecker1

Implemented the initial project structure as described in AGENTS.md,
including the ES5-compatible JS shim, the MATLAB ConsoleErrorRerouter
class, minimal HTML and script examples, and a MATLAB unit test suite
covering constructor behavior, property toggling, error levels filtering,
custom formatting, and clean teardown.

Co-authored-by: PVDecker1 <89765682+PVDecker1@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

PVDecker1 and others added 10 commits March 9, 2026 21:00
Updated the ConsoleErrorRerouter class to dynamically inject consoleShim.js.
The constructor now copies the shim to the target directory, reads the original HTMLSource,
prepends the script tag, and writes the injected content to a temporary file.
The temporary file is then assigned to the HTMLSource property.
On destruction, the original HTMLSource is restored and both the temporary HTML file and copied shim are deleted.
Cleaned up examples and tests by removing manual shim inclusions. Added tests for auto-delivery.

Co-authored-by: PVDecker1 <89765682+PVDecker1@users.noreply.github.com>
Removed the ErrorLevels property entirely. The JavaScript shim now unconditionally
intercepts error, warn, info, log, and debug. The default formatter routes
these levels to native MATLAB streams:
- error -> stderr (red text)
- warn -> native warning()
- info/log/debug -> stdout

Updated FormatFcn signature to return void, putting output responsibility on the
formatter itself. Removed outdated ErrorLevels code from tests and examples.

Co-authored-by: PVDecker1 <89765682+PVDecker1@users.noreply.github.com>
Evaluated the use of `htmlTree` for HTML manipulation. Confirmed that it
requires the Text Analytics Toolbox, which violates the strict constraint in
AGENTS.md against introducing new MATLAB toolbox dependencies. The current
implementation using `regexpi` and string manipulation is robust and relies
only on base MATLAB functions.

Co-authored-by: PVDecker1 <89765682+PVDecker1@users.noreply.github.com>
Extracted `MockUihtmlComponent` and `MockHTMLEventData` out of
`tests/tConsoleErrorRerouter.m` into their own separate `.m` files to
comply with MATLAB's rule against multiple `classdef` blocks in a single
file.

Added `.github/workflows/matlab-tests.yml` using `matlab-actions`
to run automated unit tests on push and pull request events.

Co-authored-by: PVDecker1 <89765682+PVDecker1@users.noreply.github.com>
Investigated the GitHub Actions CI failure (`MathWorks Licensing Error 1`).
Confirmed that `matlab-actions/setup-matlab` fails on private repositories
without explicit license tokens because the free cloud license is only
automatically provisioned for public repositories.

No code changes are required. The CI will pass once the repository is made public.

Co-authored-by: PVDecker1 <89765682+PVDecker1@users.noreply.github.com>
Investigated the GitHub Actions CI failure (`MathWorks Licensing Error 1`).
Confirmed that `matlab-actions/setup-matlab` fails on private repositories
without explicit license tokens because the free cloud license is only
automatically provisioned for public repositories.

No code changes are required. The CI will pass once the repository is made public.

Co-authored-by: PVDecker1 <89765682+PVDecker1@users.noreply.github.com>
Investigated the GitHub Actions CI failure (`MathWorks Licensing Error 1`).
Confirmed that `matlab-actions/setup-matlab` fails on private repositories
without explicit license tokens because the free cloud license is only
automatically provisioned for public repositories.

No code changes are required. The CI will pass once the repository is made public.

Co-authored-by: PVDecker1 <89765682+PVDecker1@users.noreply.github.com>
@PVDecker1
PVDecker1 merged commit f850ee0 into main Mar 11, 2026
1 check failed
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.

1 participant