Skip to content

refactor: optimize facades install/uninstall logic#1177

Merged
almas-x merged 4 commits intomasterfrom
almas/chore
Aug 28, 2025
Merged

refactor: optimize facades install/uninstall logic#1177
almas-x merged 4 commits intomasterfrom
almas/chore

Conversation

@almas-x
Copy link
Contributor

@almas-x almas-x commented Aug 27, 2025

📑 Description

Closes goravel/goravel#760

This PR refactors the logic for installing facades, addressing an issue where previously uninstalled facades could still be compiled into the binary. By restructuring the facade installation workflow, the build process now correctly excludes facades that have been removed, ensuring a cleaner and more accurate binary output.

Before:

19aaaede-cc67-430d-a141-0ff1e8a5b274

After:

ed34734c-c93e-4686-9965-2165d77744b9

✅ Checks

  • Added test cases for my code

Copilot AI review requested due to automatic review settings August 27, 2025 08:31
@almas-x almas-x requested a review from a team as a code owner August 27, 2025 08:31

This comment was marked as outdated.

@codecov
Copy link

codecov bot commented Aug 27, 2025

Codecov Report

❌ Patch coverage is 63.28125% with 47 lines in your changes missing coverage. Please review.
✅ Project coverage is 68.86%. Comparing base (030010c) to head (3f2e9b9).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
foundation/console/package_uninstall_command.go 81.25% 3 Missing and 3 partials ⚠️
http/service_provider.go 0.00% 5 Missing ⚠️
auth/service_provider.go 0.00% 4 Missing ⚠️
console/service_provider.go 0.00% 2 Missing ⚠️
crypt/service_provider.go 0.00% 2 Missing ⚠️
event/service_provider.go 0.00% 2 Missing ⚠️
filesystem/service_provider.go 0.00% 2 Missing ⚠️
foundation/application.go 75.00% 2 Missing ⚠️
grpc/service_provider.go 0.00% 2 Missing ⚠️
hash/service_provider.go 0.00% 2 Missing ⚠️
... and 10 more
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1177      +/-   ##
==========================================
+ Coverage   68.73%   68.86%   +0.12%     
==========================================
  Files         231      230       -1     
  Lines       14957    14879      -78     
==========================================
- Hits        10281    10246      -35     
+ Misses       4272     4235      -37     
+ Partials      404      398       -6     

☔ 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.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.50.

Benchmark suite Current: 3f2e9b9 Previous: 030010c Ratio
Benchmark_DecryptString 6253 ns/op 2032 B/op 16 allocs/op 2034 ns/op 2032 B/op 16 allocs/op 3.07
Benchmark_DecryptString - ns/op 6253 ns/op 2034 ns/op 3.07

This comment was automatically generated by workflow using github-action-benchmark.

@almas-x almas-x force-pushed the almas/chore branch 3 times, most recently from 87acc99 to b0d77bc Compare August 27, 2025 08:44
facadesSet = make(map[string]struct{})
)

r.bindings.Range(func(key, value interface{}) bool {
Copy link
Contributor

Choose a reason for hiding this comment

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

Good catch 👍

@almas-x almas-x marked this pull request as draft August 27, 2025 10:02
@almas-x almas-x marked this pull request as ready for review August 28, 2025 03:14
@almas-x almas-x marked this pull request as draft August 28, 2025 03:31
@almas-x almas-x marked this pull request as ready for review August 28, 2025 03:35
@hwbrzzl hwbrzzl requested a review from Copilot August 28, 2025 08:08
Copy link
Contributor

Copilot AI left a comment

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 refactors the facade installation and uninstalling logic to address an issue where previously uninstalled facades could still be compiled into the binary. The refactor centralizes facade dependency information into a single source of truth and dynamically retrieves dependencies, ensuring that removed facades are properly excluded from the build process.

  • Centralized facade metadata into contracts/binding/facades.go with a unified FacadeInfo structure
  • Updated service providers to reference dependencies from the centralized facade registry
  • Modified package install/uninstall commands to use the new facade system

Reviewed Changes

Copilot reviewed 32 out of 32 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
contracts/binding/facades.go Introduces centralized facade metadata structure with package paths, dependencies, and base facade flags
foundation/facades.go Removes legacy facade management code and helper functions
foundation/console/package_*_command.go Updates install/uninstall commands to use new facade system with binding-based naming
support/collect/collect.go Enhances Unique function to accept multiple collections for merging
*/service_provider.go Updates all service providers to reference dependencies from centralized facade registry

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

}{
{
name: "not found binding",
name: "not found Binding",
Copy link

Copilot AI Aug 28, 2025

Choose a reason for hiding this comment

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

The test name should use lowercase 'binding' for consistency with other test names and standard naming conventions.

Suggested change
name: "not found Binding",
name: "not found binding",

Copilot uses AI. Check for mistakes.
Comment on lines +180 to +181
Validation: {
PkgPath: "github.com/goravel/framework/validation",
Copy link

Copilot AI Aug 28, 2025

Choose a reason for hiding this comment

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

The Validation facade is missing a Dependencies field. For consistency with other facades, consider explicitly setting Dependencies: []string{} or adding a comment explaining why it has no dependencies.

Suggested change
Validation: {
PkgPath: "github.com/goravel/framework/validation",
PkgPath: "github.com/goravel/framework/validation",
Dependencies: []string{},

Copilot uses AI. Check for mistakes.
Copy link
Contributor

@hwbrzzl hwbrzzl left a comment

Choose a reason for hiding this comment

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

Awesome 👍

@almas-x almas-x merged commit f9cbddb into master Aug 28, 2025
15 of 17 checks passed
@almas-x almas-x deleted the almas/chore branch August 28, 2025 09:02
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.

package:uninstall support uninstall goravel/framework facades

3 participants