Skip to content

fix(ci): retry template scaffolding on transient network failures - #6039

Open
Grantmartin2002 wants to merge 1 commit into
wailsapp:masterfrom
Grantmartin2002:bugfix/6038_ci_retry_transient_template_failures
Open

fix(ci): retry template scaffolding on transient network failures#6039
Grantmartin2002 wants to merge 1 commit into
wailsapp:masterfrom
Grantmartin2002:bugfix/6038_ci_retry_transient_template_failures

Conversation

@Grantmartin2002

@Grantmartin2002 Grantmartin2002 commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Description

Test Templates scaffolds a new module on every leg, so all dependencies are re-resolved from sum.golang.org and the npm registry. Before this change one failed request reded the leg and the whole run. Now the scaffold-and-build step retries up to three times, gated on known transient signatures, so real breakage still fails on the first attempt.

Two classes hit this step on 2026-08-26:

reading https://sum.golang.org/tile/8/0/x178/138: stream error: stream ID 41; INTERNAL_ERROR; received from peer
Error: Cannot find native binding. npm has a bug related to optional dependencies

Warming the module cache doesn't help. The tile fetch comes from the template writing a new go.sum, not from the module download, and building v3 first verifies against its existing go.sum so it leaves the tile cache cold. GOSUMDB=off would work but drops verification.

Follows 55c8d9a, which hardened the same job against partial npm publishes. That doesn't cover transport errors.

Two notes for review:

  • Gated rather than blanket, so a genuinely broken template doesn't cost 3x across 24 legs.
  • set +e plus ${PIPESTATUS[0]} is deliberate. Bash suppresses set -e inside a subshell called as an if condition, so if generate_and_build would run past a failing wails3 init.

Fixes #6038

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

CI on this PR runs the new step across all 24 legs, since the workflow triggers on changes to itself.

Locally I stubbed generate_and_build and drove the loop: success gives 1 attempt and exit 0; transient then success gives 2 and 0; genuine error gives 1 and 1; always transient gives 3 and 1.

Classifier checked against real output. Retried: the sumdb error above, Cannot find native binding, 502 Bad Gateway, 503 Service Unavailable, i/o timeout. Not retried: added 504 packages, and audited 505 packages in 12s (an earlier draft matched a bare 50[234] and would have), undefined: SomeSymbol, error TS2304, Could not resolve.

  • Windows
  • macOS
  • Linux

macOS only because that is where the shell tests ran. The full matrix is the PR's CI run.

Test Configuration

Not applicable. Workflow-only change with no runtime or CLI code.

Checklist:

  • (v2 only) I have updated website/src/pages/changelog.mdx with details of this PR (v3 changelog entries are added automatically)
  • My code follows the general coding style of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Docs and tests unticked on purpose: no docs describe this workflow, and CI workflows have no test harness here.

Happy to drop the gating for a plain retry if you'd prefer the simpler step.

Each Test Templates leg scaffolds a fresh module and a fresh node_modules,
so every dependency is re-resolved from the Go checksum DB and the npm
registry. A single transient error there fails the whole matrix.

Retry the generate + build step up to three times, but only when the output
matches a known transient signature, so genuine template breakage still
fails on the first attempt.
@coderabbitai

coderabbitai Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 4c17e43c-eb5f-44b3-869d-4f907c2c2da8

📥 Commits

Reviewing files that changed from the base of the PR and between 45f4f9d and 04cdfd2.

📒 Files selected for processing (1)
  • .github/workflows/build-and-test-v3.yml

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


Walkthrough

The Test Templates workflow now runs template initialization and build commands through a retry loop. It retries recognized transient Go, npm, network, gateway, service, and native-binding errors up to three times while preserving other failure statuses.

Changes

Template Build Reliability

Layer / File(s) Summary
Retryable template initialization and build
.github/workflows/build-and-test-v3.yml
A fail-fast Bash function runs template initialization and build commands. Matching transient errors trigger up to three attempts with increasing delays. Non-transient and final-attempt failures retain their original status.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 04cdf

This localized CI change adds gated retries for known transient scaffolding failures without introducing an actionable merge-blocking risk; it is merge-ready after normal checks and review.

Suggested reviewers: leaanthony, taliesin-ai

Poem

A rabbit checks the build log bright
Three little tries hop through the night
Go and npm may stumble slow
Known network signs tell retries where to go
True failures still stop the show

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The implementation satisfies issue #6038 by retrying scaffold-and-build attempts for recognized transient checksum database, npm, proxy, and network failures while preserving immediate failure for gen…
Out of Scope Changes check ✅ Passed The change is limited to the Test Templates workflow and directly supports the requirements in issue #6038. No unrelated code or behavior changes are described.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Title check ✅ Passed The title clearly and concisely describes the main change: retrying template scaffolding for transient network failures.
Description check ✅ Passed The description is complete and relevant. It explains the problem, solution, retry conditions, issue reference, testing, environment, and checklist decisions.
Full details: Linked Issues check

Explanation

The implementation satisfies issue #6038 by retrying scaffold-and-build attempts for recognized transient checksum database, npm, proxy, and network failures while preserving immediate failure for genuine template errors.

Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0 files. (1 skipped: 1 unsupported.)

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI 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.

Pull request overview

This PR hardens the Test Templates CI job by adding a targeted retry loop around the template scaffold + build step, to reduce flaky failures from transient Go checksum DB and npm registry/network issues while still failing fast on real template breakage.

Changes:

  • Wraps template generation + build into a generate_and_build function and retries it up to 3 times.
  • Retries are gated on a regex of known transient failure signatures, with exponential-ish backoff (attempt * 15 seconds).

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

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.

Test Templates matrix goes red on transient Go checksum DB and npm registry errors

2 participants