Skip to content

fix: some stubs of make commands are incorrect#1369

Merged
hwbrzzl merged 3 commits intov1.17.xfrom
bowen/fix-facades-import
Feb 3, 2026
Merged

fix: some stubs of make commands are incorrect#1369
hwbrzzl merged 3 commits intov1.17.xfrom
bowen/fix-facades-import

Conversation

@hwbrzzl
Copy link
Contributor

@hwbrzzl hwbrzzl commented Feb 3, 2026

Greptile Overview

Greptile Summary

Fixed stub generation for make:package and migration commands to support both new bootstrap structure and legacy config structure. The PR adds conditional logic using env.IsBootstrapSetup() to detect the project structure and generate appropriate stubs.

Key Changes:

  • Added env.IsBootstrapSetup() checks to detect whether project uses new foundation.Setup() pattern
  • Migration creator now uses correct facades import path based on project structure
  • Package make command generates different stub files for old vs new structures
  • Added OldConfig() and OldSetup() stub templates for backwards compatibility
  • Updated ProvidersInConfig documentation to clarify its usage

Issue Found:

  • In package_make_command.go, setup/setup.go is assigned twice - once unconditionally (line 82) and once in the else block (line 88), causing the first assignment to be overwritten

Confidence Score: 3/5

  • Cannot merge safely due to logic bug that overwrites setup.go assignment
  • The PR has good intent and proper backwards compatibility support, but contains a critical logic error where setup/setup.go gets assigned twice in the map (line 82 and 88), causing the first value to be overwritten. This will break the new bootstrap structure path.
  • Pay close attention to foundation/console/package_make_command.go - the duplicate map assignment must be fixed

Important Files Changed

Filename Overview
database/migration/migrator.go Added conditional logic to use correct facades import path based on bootstrap setup detection
foundation/console/package_make_command.go Fixed stub generation to conditionally create setup files based on bootstrap structure, with potential logic issue in setup.go overwrite
foundation/console/stubs.go Added main path tracking and new stub templates for backwards compatibility with old project structure

Sequence Diagram

sequenceDiagram
    participant User
    participant MakeCommand as make:package/migrate:make
    participant EnvCheck as env.IsBootstrapSetup()
    participant Stubs as Stub Generator
    participant FileSystem as File System

    User->>MakeCommand: Execute make command
    MakeCommand->>EnvCheck: Check project structure
    EnvCheck->>EnvCheck: Read bootstrap/app.go
    EnvCheck->>EnvCheck: Check for "foundation.Setup()."
    
    alt New Bootstrap Structure
        EnvCheck-->>MakeCommand: true (new structure)
        MakeCommand->>Stubs: Generate new structure stubs
        Stubs->>Stubs: Use packages.Paths().Facades().Import()
        Stubs->>Stubs: Generate setup/stubs.go with config()
        Stubs->>Stubs: Generate setup/setup.go with modify.RegisterProvider()
    else Old Config Structure
        EnvCheck-->>MakeCommand: false (old structure)
        MakeCommand->>Stubs: Generate old structure stubs
        Stubs->>Stubs: Use "github.com/goravel/framework/facades"
        Stubs->>Stubs: Generate setup/config/{name}.go with facades.Config()
        Stubs->>Stubs: Generate setup/setup.go with ProvidersInConfig()
    end
    
    Stubs->>FileSystem: Write generated files
    FileSystem-->>User: Files created successfully
Loading

@hwbrzzl hwbrzzl requested a review from a team as a code owner February 3, 2026 10:08
Copy link
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, 1 comment

Edit Code Review Agent Settings | Greptile

@codecov
Copy link

codecov bot commented Feb 3, 2026

Codecov Report

❌ Patch coverage is 19.56522% with 37 lines in your changes missing coverage. Please review.
✅ Project coverage is 68.53%. Comparing base (2649a5e) to head (db334bf).
⚠️ Report is 1 commits behind head on v1.17.x.

Files with missing lines Patch % Lines
foundation/console/stubs.go 15.00% 34 Missing ⚠️
foundation/console/package_make_command.go 50.00% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           v1.17.x    #1369      +/-   ##
===========================================
- Coverage    68.66%   68.53%   -0.14%     
===========================================
  Files          281      281              
  Lines        17698    17738      +40     
===========================================
+ Hits         12153    12156       +3     
- Misses        5043     5079      +36     
- Partials       502      503       +1     

☔ View full report in Codecov by Sentry.
📢 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.

@hwbrzzl hwbrzzl merged commit c067c6d into v1.17.x Feb 3, 2026
11 of 13 checks passed
@hwbrzzl hwbrzzl deleted the bowen/fix-facades-import branch February 3, 2026 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant