fix: [#589] Context in PrepareForValidation always nil #917
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughThe pull request makes widespread updates across the codebase. In tests, repeated timestamp calls have been streamlined for consistency. Multiple service provider files now remove local binding constants in favor of centralized identifiers from the contracts package, and receiver variable names have been updated for clarity. The console application’s constructor has been updated with an additional boolean flag for artisan mode. In the database layer, new methods and tests have been added for boolean and custom column types, with corresponding changes in schema grammars for several database drivers. Additionally, contracts and mocks have been extended, validation functions now accept a context parameter, and dependency versions have been updated in go.mod. Changes
Sequence Diagram(s)sequenceDiagram
participant App as Application
participant SP as ServiceProvider
participant Cont as Container
participant Con as Contracts
App->>SP: Call Register(app)
SP->>Cont: app.Singleton(Con.BindingX, func(app){...})
Cont-->>SP: Service bound
SP-->>App: Registration complete
sequenceDiagram
participant Dev as Developer
participant CA as ConsoleApplication
Dev->>CA: NewApplication(name, usage, usageText, version, useArtisan)
CA->>CA: Initialize instance with useArtisan flag
CA-->>Dev: Return configured application instance
Possibly related PRs
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
PR Overview
This PR fixes an issue where the context in PrepareForValidation was always nil and makes several related improvements. Key changes include:
- Updating service providers to use binding constants from the contracts package.
- Adding support for a boolean column type in MySQL and PostgreSQL grammars, with accompanying tests.
- Refactoring the console application to use a unified "useArtisan" flag.
Reviewed Changes
| File | Description |
|---|---|
| contracts/binding.go | Adds binding constants for various components. |
| config/service_provider.go | Updates singleton binding to use contracts.BindingConfig. |
| database/schema/grammars/*.go | Introduces a new TypeBoolean method for MySQL and PostgreSQL. |
| database/schema/blueprint*.go | Adds Boolean and Column methods to the blueprint, along with test coverage. |
| database/orm/orm.go | Refactors refresh call to use contracts.BindingOrm. |
| console/, crypt/, auth/, cache/ | Updates service providers to use binding constants and adjusts application signatures. |
| console/application.go | Replaces isArtisan with useArtisan and updates tests accordingly. |
Copilot reviewed 59 out of 59 changed files in this pull request and generated no comments.
Comments suppressed due to low confidence (2)
database/gorm/logger.go:14
- The removal of the env.IsArtisan() check may affect the log level configuration in certain contexts. Please confirm that this change is intentional and that it does not lead to unintended behavior in environments that previously relied on this condition.
- if env.IsArtisan() {
console/application_test.go:16
- Currently, tests only verify behavior for useArtisan=true. Consider adding test cases for useArtisan=false to ensure the application behaves as expected in non-artisan mode.
cliApp := NewApplication("test", "test", "test", "test", true)
There was a problem hiding this comment.
⚠️ 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: b8bf942 | Previous: e26aa18 | Ratio |
|---|---|---|---|
Benchmark_EncryptString |
6521 ns/op 2160 B/op 15 allocs/op |
2209 ns/op 2160 B/op 15 allocs/op |
2.95 |
Benchmark_EncryptString - ns/op |
6521 ns/op |
2209 ns/op |
2.95 |
Benchmark_DecryptString |
6770 ns/op 2040 B/op 17 allocs/op |
2042 ns/op 2040 B/op 17 allocs/op |
3.32 |
Benchmark_DecryptString - ns/op |
6770 ns/op |
2042 ns/op |
3.32 |
This comment was automatically generated by workflow using github-action-benchmark.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## v1.15.x #917 +/- ##
==========================================
Coverage ? 68.61%
==========================================
Files ? 218
Lines ? 18891
Branches ? 0
==========================================
Hits ? 12963
Misses ? 5258
Partials ? 670 ☔ View full report in Codecov by Sentry. |
📑 Description
Closes goravel/goravel#589
Summary by CodeRabbit
New Features
Refactoring
Tests
Chores
✅ Checks