Skip to content

Suppressed the 'git init' branch advice leaking into the installer output. - #3074

Merged
AlexSkrypnyk merged 2 commits into
mainfrom
feature/git-init-advice
Aug 31, 2026
Merged

Suppressed the 'git init' branch advice leaking into the installer output.#3074
AlexSkrypnyk merged 2 commits into
mainfrom
feature/git-init-advice

Conversation

@AlexSkrypnyk

@AlexSkrypnyk AlexSkrypnyk commented Aug 31, 2026

Copy link
Copy Markdown
Member

Summary

A vortex-release-docs CI run failed while generating the installer demo video: FileManager::prepareDestination() initialises the new project's git repository with git --work-tree=... --git-dir=... init > /dev/null, and when the host has no init.defaultBranch configured, git writes its 13-line "Using 'master' as the name for the initial branch" advice to stderr, which the > /dev/null redirect never touches and passthru() draws straight into the installer's TUI transcript. VideoRecorder::assertNoIssues() refuses to render a demo whose transcript contains a warning, so the advice text aborted the recording. The git init invocation now adds -c advice.defaultBranchName=false, which silences only that advice line, leaves real stderr output and the host's own branch-naming configuration untouched. update-videos.php also no longer lets a thrown exception surface as a raw PHP fatal error: the top-level exit(main($argv)) call is now wrapped in a try/catch that prints the exception message to stderr and exits 1.

Changes

  1. .vortex/installer/src/Utils/FileManager.php - Added -c advice.defaultBranchName=false to the git init command built in prepareDestination(), so git's initial-branch-name advice never reaches the installer output, regardless of the host's init.defaultBranch setting.
  2. .vortex/docs/.utils/update-videos.php - Wrapped the script's top-level exit(main($argv)) in a try/catch, so a thrown RuntimeException (for example a missing-dependency guard failure) prints its message on its own line and exits with status 1, instead of producing an uncaught-exception fatal error, a stack trace, and exit code 255.

The advice only ever reached the vortex-release-docs job: vortex-test-installer.yml configures init.defaultBranch for its own tests, which archive a main ref from local fixture repos, so its copy of the video-generation step never saw the warning; that configuration is a genuine requirement of the installer's own test suite and is left in place.

Verified locally: composer test -- --filter FileManagerTest in .vortex/installer passes (23 tests, 50 assertions); the patched git init command was run under an isolated git config and emits nothing on stderr; php -l is clean on update-videos.php.

Before / After

git init advice leaking into the installer TUI
────────────────────────────────────────────────────────────────────────
 BEFORE                              │ AFTER
─────────────────────────────────────┼────────────────────────────────────
 $ git --work-tree=... \             │ $ git -c advice.defaultBranchName=false \
     --git-dir=... init > /dev/null  │     --work-tree=... --git-dir=... init > /dev/null
                                      │
 stdout: (silenced)                  │ stdout: (silenced)
 stderr: hint: Using 'master' as     │ stderr: (empty)
   the name for the initial branch.  │
   This default branch name is       │
   subject to change. ... (13 lines) │
                                      │
 passthru() → drawn into installer   │ passthru() → nothing drawn into
   TUI transcript                    │   installer TUI transcript
                                      │
 VideoRecorder::assertNoIssues()     │ VideoRecorder::assertNoIssues()
   → transcript contains a warning   │   → transcript is clean
   → guard fails, recording aborts   │   → video renders normally
update-videos.php uncaught-exception handling
────────────────────────────────────────────────────────────────────────
 BEFORE                              │ AFTER
─────────────────────────────────────┼────────────────────────────────────
 exit(main($argv));                  │ try {
                                      │   exit(main($argv));
 main() throws RuntimeException      │ }
   → no top-level handler            │ catch (Throwable $exception) {
   → PHP Fatal error: Uncaught       │   fwrite(STDERR, $exception->getMessage() . "\n");
     RuntimeException: ...           │   exit(1);
     #0 {main}                       │ }
   → exit code 255                   │
                                      │ main() throws RuntimeException
                                      │   → message printed to stderr only
                                      │   → exit code 1

Summary by CodeRabbit

  • Bug Fixes
    • Improved error handling for video update operations by reporting failures clearly and returning an appropriate failure status.
    • Reduced unnecessary Git setup messages during installation.

@coderabbitai

coderabbitai Bot commented Aug 31, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Team

Run ID: d905b489-1639-4052-83c8-9424d6f89e47

📥 Commits

Reviewing files that changed from the base of the PR and between 367929b and 4368e34.

📒 Files selected for processing (2)
  • .vortex/docs/.utils/update-videos.php
  • .vortex/installer/src/Utils/FileManager.php

Included review availability: 9 reviews are currently available. Your included PR review attempts over the past 7 days set your current allowance at 10 reviews per hour.


Walkthrough

The video update utility now handles uncaught throwables at the top level. The installer now suppresses Git default-branch advice during repository initialization.

Changes

Tooling robustness

Layer / File(s) Summary
CLI error reporting
.vortex/docs/.utils/update-videos.php
Top-level execution catches uncaught throwables, writes only the message to stderr, and exits with status 1.
Git initialization output
.vortex/installer/src/Utils/FileManager.php
git init runs with default-branch advice disabled. Repository and destination paths remain shell-escaped.

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

Merge Risk: ⚪ Minimal · up to 4368e

The changes clean up installer output and provide clearer failure handling for video generation without introducing an actionable merge-blocking risk; the PR is merge-ready after normal checks and review.

Poem

A rabbit saw errors leap,
And sent their messages where shadows sleep.
Git grew quiet at the start,
Clean paths held their careful part.
The tools now hop with steady feet.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the primary change: suppressing Git branch advice from installer output. The additional PHP error-handling change is secondary and does not need to appear in …
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title clearly and concisely describes the primary change: suppressing Git branch advice from installer output. The additional PHP error-handling change is secondary and does not need to appear in the title.

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/git-init-advice

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

@github-actions

Copy link
Copy Markdown

Code coverage (threshold: 90%)

  Classes: 100.00% (1/1)
  Methods: 100.00% (2/2)
  Lines:   98.56% (206/209)
Per-class coverage
Drupal\ys_demo\Plugin\Block\CounterBlock
  Methods: 100.00% ( 2/ 2)   Lines: 100.00% ( 10/ 10)

@AlexSkrypnyk

This comment has been minimized.

2 similar comments
@AlexSkrypnyk

This comment has been minimized.

@AlexSkrypnyk

Copy link
Copy Markdown
Member Author

Code coverage (threshold: 90%)

  Classes: 100.00% (1/1)
  Methods: 100.00% (2/2)
  Lines:   98.56% (206/209)
Per-class coverage
Drupal\ys_demo\Plugin\Block\CounterBlock
  Methods: 100.00% ( 2/ 2)   Lines: 100.00% ( 10/ 10)

@codecov

codecov Bot commented Aug 31, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.00%. Comparing base (367929b) to head (4368e34).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3074      +/-   ##
==========================================
- Coverage   87.36%   87.00%   -0.36%     
==========================================
  Files         107      100       -7     
  Lines        5088     4925     -163     
  Branches       49        3      -46     
==========================================
- Hits         4445     4285     -160     
+ Misses        643      640       -3     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

Copy link
Copy Markdown

📖 Documentation preview for this pull request has been deployed to Netlify:

https://6a960bb2425d948d5bb3fb97--vortex-docs.netlify.app

This preview is rebuilt on every commit and is not the production documentation site.

@AlexSkrypnyk AlexSkrypnyk added the Needs review Pull request needs a review from assigned developers label Aug 31, 2026
@AlexSkrypnyk
AlexSkrypnyk merged commit 2bf1dad into main Aug 31, 2026
36 checks passed
@AlexSkrypnyk
AlexSkrypnyk deleted the feature/git-init-advice branch August 31, 2026 23:19
@github-project-automation github-project-automation Bot moved this from BACKLOG to Release queue in Vortex 1.x Aug 31, 2026
@AlexSkrypnyk AlexSkrypnyk added this to the 1.41.0 milestone Sep 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs review Pull request needs a review from assigned developers

Projects

Status: Released in 1.41.0

Development

Successfully merging this pull request may close these issues.

1 participant