Skip to content

[0.4.0] univer execute --script can hang with no output during Sheet formatting #33

Description

@stan373

Summary

With Univer CLI 0.4.0, univer execute --script can remain running indefinitely with no stdout or stderr while applying style-only changes to an existing Sheet worktree.

Environment

  • Univer CLI: 0.4.0
  • macOS
  • Package: harbourline-q3-qbr-deep-ocean.univer
  • Unit: Ct1A0c
  • Worktree: wt-mshcgd6y-xpojxs
  • Target sheet: Sales Data

Command

univer execute harbourline-q3-qbr-deep-ocean.univer \\
  --worktree wt-mshcgd6y-xpojxs \\
  --unit Ct1A0c \\
  --script style-sales-data-semantic.js \\
  --json

Actual behavior

After earlier API validation errors were corrected, the execute call produced no output for more than two minutes. Polling the process also returned empty output. The process had to be interrupted manually and exited with code 130.

There was no success payload, failure payload, progress event, timeout, or indication whether the worktree commit was written.

A rewritten version of the same operation that reduced hundreds of per-cell formatting calls to bounded range operations completed successfully in about 29 seconds and committed as worktree commit 5. This suggests the original path may be hanging or taking unbounded time during command application/commit rather than failing fast.

Expected behavior

  1. Return a success/error JSON response within a bounded time.
  2. Emit progress or diagnostics during a long commit.
  3. Support an explicit timeout.
  4. Make commit state unambiguous after interruption.

Script operations

The script only:

  • sets backgrounds, font colors and font weights on Sales Data!A1:J73;
  • preserves three data-validation rules and changes only their render mode;
  • preserves three conditional-formatting rules;
  • hides default gridlines;
  • returns a small JSON summary.

No values, formulas, rows, columns, charts, or workbook structure are changed.

Additional verification

After the optimized execution completed:

  • formula errors: 0
  • data validation errors: 0
  • chart count: 18
  • key values remained $1,140,562 and $1,405,552

Original per-cell script

const sheet = workbook.getSheetByName('Sales Data');
if (!sheet) throw new Error('Sales Data sheet not found');

sheet.getRange('A1:J73').setFontColor('#111A2E').setVerticalAlignment('middle');

for (let row = 2; row <= 73; row += 1) {
  sheet.getRange(`A${row}:J${row}`).setBackground(row % 2 === 0 ? '#FFFFFF' : '#F7F9FC');

  const month = String(sheet.getRange(`A${row}`).getValue() ?? '');
  const region = String(sheet.getRange(`B${row}`).getValue() ?? '');

  // The full repro used direct per-cell semantic background/font calls here.
  sheet.getRange(`C${row}`).setBackground('#EEF2F7').setFontColor('#22365F').setFontWeight('bold');
  sheet.getRange(`J${row}`).setBackground('#E7F7F3').setFontColor('#2E7D6E').setFontWeight('bold');
}

sheet.getRange('A1:J1').setBackground('#22365F').setFontColor('#F5F7FF').setFontWeight('bold');

for (const validation of sheet.getDataValidations()) {
  validation.setOptions({ showDropDown: true, renderMode: 1 });
}

sheet.setHiddenGridlines(true);

return {
  validationsPreserved: sheet.getDataValidations().length,
  conditionalFormatsPreserved: sheet.getConditionalFormattingRules().length,
};

The complete .univer repro package is attached.

harbourline-q3-qbr-orphan-chart-repro.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions