Skip to content

fix: eliminate parallel build races that can produce empty output dirs - #116

Merged
dprevost-LMI merged 2 commits into
webdriverio:mainfrom
dprevost-LMI:fix/build-script-race-condition
Sep 23, 2026
Merged

dprevost-LMI merged 2 commits into
webdriverio:mainfrom
dprevost-LMI:fix/build-script-race-condition

Conversation

@dprevost-LMI

Copy link
Copy Markdown
Collaborator
  • build: run-p clean compile -> run-s: rimraf and tsc wrote to the same packages/*/build dirs concurrently, so a slow filesystem could let clean delete output tsc had just emitted for one package.
  • cddl2ts cli-examples: run-p cli-examples:* -> run-s: local/remote each independently run the full pnpm -w run compile, so running them in parallel meant two concurrent tsc invocations writing to the same build output at once.

This class of race is the likely cause of cddl2ts@0.11.0 publishing to npm without its build/ directory, breaking both the package's main export and its CLI.

- build: run-p clean compile -> run-s: rimraf and tsc wrote to the same
  packages/*/build dirs concurrently, so a slow filesystem could let clean
  delete output tsc had just emitted for one package.
- cddl2ts cli-examples: run-p cli-examples:* -> run-s: local/remote each
  independently run the full `pnpm -w run compile`, so running them in
  parallel meant two concurrent tsc invocations writing to the same build
  output at once.

This class of race is the likely cause of cddl2ts@0.11.0 publishing to
npm without its build/ directory, breaking both the package's main
export and its CLI.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@greptile-apps

greptile-apps Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

The PR appears safe to merge; the build races are removed without leaving any outstanding findings.

Findings

  1. P2 Duplicate serial compilations ▶

Summary

This PR eliminates concurrent writes to shared build directories and avoids redundant workspace compilations.

  • Serializes cleanup before workspace compilation.
  • Compiles the workspace once before running the local and remote CLI examples sequentially.
  • Fully addresses the previous finding about duplicate serial compilations.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
    B[build] --> C[clean]
    C --> W[workspace compile]
    E[cli-examples] --> W
    W --> L[local CLI example]
    L --> R[remote CLI example]
Loading

Reviews (2) · Last reviewed commit: "fix: avoid duplicate workspace compiles ..."

Comment thread packages/cddl2ts/package.json Outdated
Per review feedback on PR webdriverio#116: run-s avoided the concurrent-write race
but each leaf script still ran the full `pnpm -w run compile`
independently, compiling the workspace twice in a row. Hoist the
compile into the parent script so it runs once before both generators.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@dprevost-LMI
dprevost-LMI merged commit c45cd9b into webdriverio:main Sep 23, 2026
4 checks passed
dprevost-LMI added a commit that referenced this pull request Sep 23, 2026
cddl2ts was the only workspace package without a "files" allowlist, so
npm/pnpm fell back to gitignore-based inclusion for publishing - and the
root .gitignore excludes build/. Every sibling package (cddl, cddl2java,
cddl2py, cddl2swift, cddl2kotlin) already has "files": ["build", "bin"];
cddl2ts never did, in its entire release history.

This is the actual cause of cddl2ts@0.11.0 and 0.12.0 publishing without
their build/ output - unrelated to the run-p/run-s race fix in #116,
which was a real but separate issue. Verified in a clean worktree: with
build/ compiled but no files field, `pnpm pack --dry-run` excluded
build/ entirely; adding the field fixes it.

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
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