Skip to content

KZN-18921 - Harden the expression worker - #51

Merged
keegandonley merged 4 commits into
mainfrom
bug/KZN-18921-expression-worker-hardening
Oct 28, 2026
Merged

keegandonley merged 4 commits into
mainfrom
bug/KZN-18921-expression-worker-hardening

Conversation

@keegandonley

Copy link
Copy Markdown
Member

Protect against exceptions, parse errors, and timeouts.

Jira: https://kizen.atlassian.net/browse/KZN-18921

Copilot AI balanced review requested due to automatic review settings October 26, 2026 16:18

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Error handling still permits sensitive diagnostic exposure, and nullable failures conflict with public return types and field visibility behavior.

3 open issues
What changed in this PR

This PR hardens expression evaluation by handling worker failures and bounding execution time while preserving diagnostic details in debug mode.

Changes:

  • Extracts evaluation logic and returns structured errors for parsing, evaluation, and serialization failures.
  • Adds a 20-second timeout, worker cleanup, and host-side error handling.
  • Adds tests for failure handling, diagnostics, and worker lifecycle behavior.
File Description
src/​workers/​expression.worker.ts Delegates messages to the response builder.
src/​workers/​expression.ts Adds guarded evaluation and error categorization.
src/​workers/​expression.test.ts Tests evaluation, invalid inputs, serialization, and diagnostics.
src/​run.ts Adds timeouts, cleanup, and failure handling.
src/​run.test.ts Tests worker lifecycle and host-side failure behavior.

Review effort: Balanced

Comment thread src/run.ts
Comment thread src/run.ts Outdated
Comment thread src/workers/expression.ts Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

Static review identified no new blocking defects, and the added tests cover the principal failure and cleanup paths.

No open issues 🎉

3 resolved since last review

Review effort: Balanced

@mauricebecnel400 mauricebecnel400 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@keegandonley
keegandonley merged commit a77d2c7 into main Oct 28, 2026
4 checks passed
@keegandonley
keegandonley deleted the bug/KZN-18921-expression-worker-hardening branch October 28, 2026 17:03
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.

3 participants