Skip to content

fix(ci): fix deps:tree publish failure and add publish resilience#35

Merged
carlos-alm merged 2 commits intomainfrom
fix/publish-resilience
Feb 23, 2026
Merged

fix(ci): fix deps:tree publish failure and add publish resilience#35
carlos-alm merged 2 commits intomainfrom
fix/publish-resilience

Conversation

@carlos-alm
Copy link
Copy Markdown
Contributor

Summary

  • Move deps:tree to scripts/gen-deps.cjs — the inline node -e command had backticks (markdown fences) that sh on Linux interpreted as command substitution (sh: 1: n+t+: not found), and npm ls non-zero exits on ELSPROBLEMS threw in execSync. The new script handles both with try/catch.
  • Make publish idempotent on re-runs — add npm view checks before each platform package publish (skip with continue if already on npm) and gate both publish steps on a check-main output so re-running a partially failed publish skips already-published packages instead of failing with 409 Conflict.

What was happening

  1. npm publish triggers preparedeps:tree
  2. The inline backticks ``` get interpreted by sh as command substitution
  3. npm ls --all fails with ELSPROBLEMS (native addon version mismatch) → execSync throws
  4. Publish aborts. Native packages are already on npm. Re-run fails with 409.

Test plan

  • Merge and re-trigger the 2.1.0 stable publish via workflow_dispatch
  • Verify native packages are skipped ("already published — skipping")
  • Verify main @optave/codegraph package publishes successfully

The inline node -e command had backticks that sh on Linux interpreted
as command substitution, causing `sh: 1: n+t+: not found`. Also,
npm ls exits non-zero on ELSPROBLEMS (version mismatches in optional
platform-specific deps), which made execSync throw during publish.

Fix: move to scripts/gen-deps.cjs with try/catch to handle npm ls
failures gracefully, and use --omit=dev to exclude devDependencies.
Add version-exists checks so re-running a failed publish skips
already-published packages instead of failing with 409 Conflict.

- Check main package before publish steps; if already on npm, skip
  both platform and main publish (post-publish steps still run)
- Check each platform package individually before npm publish;
  skip with continue if already published
@carlos-alm carlos-alm merged commit d281274 into main Feb 23, 2026
15 checks passed
@carlos-alm carlos-alm deleted the fix/publish-resilience branch February 23, 2026 02:20
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Feb 23, 2026

Greptile Summary

Fixes two critical publish workflow issues: the deps:tree command failing due to shell backtick interpretation and npm ls non-zero exits, and 409 conflicts when re-running partially failed publishes.

  • Moved deps:tree to scripts/gen-deps.cjs with try-catch to handle npm ls ELSPROBLEMS gracefully
  • Added check-main step that gates both publish steps, skipping if main package already exists
  • Added per-platform package checks with continue to skip already-published packages
  • Makes the workflow fully idempotent — safe to re-run without manual cleanup

Confidence Score: 5/5

  • Safe to merge — fixes critical CI issues with well-contained changes
  • The changes directly address documented CI failures with targeted fixes: extracting problematic inline command to a proper script with error handling, and adding idempotency checks to prevent 409 conflicts on re-runs
  • No files require special attention

Important Files Changed

Filename Overview
scripts/gen-deps.cjs New script extracts deps:tree logic from inline command, handles npm ls errors gracefully with try-catch
package.json Updated deps:tree script to call new scripts/gen-deps.cjs instead of inline node command
.github/workflows/publish.yml Added idempotency checks — skips publish steps if package already exists on npm, prevents 409 conflicts on re-runs

Last reviewed commit: 54a8ce0

Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

3 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

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