Skip to content

test(exec): add ui-queue default limits integration test (MILAB-5798)#1491

Merged
vgpopov merged 11 commits intomainfrom
MILAB-5798-unlimited-bucket-hard-limit
Mar 11, 2026
Merged

test(exec): add ui-queue default limits integration test (MILAB-5798)#1491
vgpopov merged 11 commits intomainfrom
MILAB-5798-unlimited-bucket-hard-limit

Conversation

@vgpopov
Copy link
Copy Markdown
Contributor

@vgpopov vgpopov commented Mar 6, 2026

Summary

  • Adds echo_ui_queue_limits.tpl.tengo template that runs two bash commands in the ui-tasks queue (no explicit cpu/ram), echoing {system.cpu} and {system.ram.bytes}
  • Adds ui-queue-default-limits test in exec.test.ts verifying the resolved values equal the queue defaults: 1 CPU core and 100 MiB RAM

Test plan

  • pnpm build && pnpm test -- -t "ui-queue-default-limits" passes with cpu=1, ram=104857600

popoffvg added 4 commits March 5, 2026 16:51
Add `uiQueueUsesForBatchSetup` to feats.lib.tengo and update the fallback
runner selection logic in exec/limits.lib.tengo.

When the flag is false, the ui-tasks queue uses RunCommand/batch instead of
the default RunCommand/executor, enabling batch execution for UI tasks.
Verifies that commands run in the ui-tasks queue without explicit cpu/ram
receive the correct defaults: 1 CPU core and 100 MiB RAM.
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Mar 6, 2026

⚠️ No Changeset found

Latest commit: 1612997

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@notion-workspace
Copy link
Copy Markdown

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, 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 introduces a new integration test to validate the default resource limits for the ui-tasks queue, ensuring that tasks executed without explicit CPU or RAM requests correctly receive the predefined default allocations. It also adds a new feature flag to provide more granular control over the execution environment for UI-related tasks, allowing for better management of backend resources.

Highlights

  • New Integration Test: Added a new integration test (ui-queue-default-limits) to verify that the ui-tasks queue correctly applies default CPU (1 core) and RAM (100 MiB) limits when no explicit limits are specified.
  • New Tengo Template: Introduced a new Tengo template (echo_ui_queue_limits.tpl.tengo) that executes two bash commands within the ui-tasks queue to echo the system's allocated CPU and RAM values.
  • Feature Flag for UI Queue Runner Type: Implemented a new feature flag (uiQueueForceLocalExecutor) to control whether the ui-tasks queue uses the RunCommand/executor (local) or RunCommand/batch resource type, enhancing flexibility in backend resource allocation.
Changelog
  • .gitignore
    • Added new ignore patterns for agent tools artifacts (.mcp_*, .mcp.*).
  • .vscode/settings.json
    • Configured Vitest to disable workspace warnings by adding "vitest.disableWorkspaceWarning": true.
  • sdk/workflow-tengo/src/exec/limits.lib.tengo
    • Modified the logic for determining the runnerType to include a check for the new uiQueueForceLocalExecutor feature flag when processing the ui-tasks queue.
  • sdk/workflow-tengo/src/feats.lib.tengo
    • Introduced a new feature flag uiQueueForceLocalExecutor to explicitly control whether the ui-tasks queue is forced to use a local executor or can utilize batch processing.
  • tests/workflow-tengo/src/exec/exec.test.ts
    • Added a new tplTest.concurrent named ui-queue-default-limits to verify the default CPU and RAM limits for the ui-tasks queue.
  • tests/workflow-tengo/src/exec/run/echo_ui_queue_limits.tpl.tengo
    • Created a new Tengo template that defines 'cpu' and 'ram' outputs.
    • Implemented two exec.builder() calls, both configured inUiQueue(), to execute bash commands that echo {system.cpu} and {system.ram.bytes} respectively.
    • Returned the standard output content of these commands as the template's 'cpu' and 'ram' outputs.
Activity
  • No human activity (comments, reviews) has been recorded on this pull request yet.
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
Contributor

@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 adds an integration test to verify the default resource limits for the ui-tasks queue. The changes include a new feature flag to control the runner type for this queue, a new test template, and the corresponding test case. The implementation is correct, but I have a couple of suggestions to improve the new test code. First, the test case in exec.test.ts uses magic numbers for the expected limits, which should be extracted into constants for better readability and maintainability. Second, the new test template echo_ui_queue_limits.tpl.tengo executes two separate commands to fetch the CPU and RAM limits, which is inefficient. It can be refactored to use a single command execution.

Comment on lines +25 to +38
tplTest.concurrent("ui-queue-default-limits", async ({ helper, expect }) => {
const result = await helper.renderTemplate(
false,
"exec.run.echo_ui_queue_limits",
["cpu", "ram"],
(_tx) => ({}),
);

const cpu = await result.computeOutput("cpu", (a) => a?.getDataAsString()).awaitStableValue();
const ram = await result.computeOutput("ram", (a) => a?.getDataAsString()).awaitStableValue();

expect(Number(cpu)).eq(1); // QueueUITasksDefaultTaskCores
expect(Number(ram)).eq(100 * 1024 * 1024); // QueueUITasksDefaultTaskRAM = 100 MiB
});
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.

medium

The test uses magic numbers for the expected default CPU cores and RAM. It's better to define these as constants at the beginning of the test case. This improves readability and maintainability, as the values are documented in one place and can be easily updated if the defaults change.

tplTest.concurrent("ui-queue-default-limits", async ({ helper, expect }) => {
  const UI_QUEUE_DEFAULT_CPU_CORES = 1;
  const UI_QUEUE_DEFAULT_RAM_BYTES = 100 * 1024 * 1024;

  const result = await helper.renderTemplate(
    false,
    "exec.run.echo_ui_queue_limits",
    ["cpu", "ram"],
    (_tx) => ({}),
  );

  const cpu = await result.computeOutput("cpu", (a) => a?.getDataAsString()).awaitStableValue();
  const ram = await result.computeOutput("ram", (a) => a?.getDataAsString()).awaitStableValue();

  expect(Number(cpu)).eq(UI_QUEUE_DEFAULT_CPU_CORES);
  expect(Number(ram)).eq(UI_QUEUE_DEFAULT_RAM_BYTES);
});

Comment thread tests/workflow-tengo/src/exec/run/echo_ui_queue_limits.tpl.tengo
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 6, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 54.68%. Comparing base (3aa70e2) to head (1612997).
⚠️ Report is 20 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1491      +/-   ##
==========================================
- Coverage   54.71%   54.68%   -0.03%     
==========================================
  Files         242      242              
  Lines       13576    13576              
  Branches     2783     2783              
==========================================
- Hits         7428     7424       -4     
- Misses       5219     5224       +5     
+ Partials      929      928       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

popoffvg added 2 commits March 6, 2026 19:08
Replace bash command with hello-world software asset for echoing system limits in the ui-queue integration test.
popoffvg added 2 commits March 9, 2026 13:18
Replace the single ui-tasks queue test with a parameterized test covering
all four queues (ui-tasks, heavy, medium, light). Use a single shared template
that accepts a queue name input via inQueue(), asserting cpu/ram are > 0
and <= the queue's configured default.
@vgpopov vgpopov added this pull request to the merge queue Mar 11, 2026
Merged via the queue into main with commit 2e23cc0 Mar 11, 2026
17 checks passed
@vgpopov vgpopov deleted the MILAB-5798-unlimited-bucket-hard-limit branch March 11, 2026 13:19
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