Commit Graph

7932 Commits

Author SHA1 Message Date
Rafael Mendonça França
37fd0e7fe4
Development of Rails 8.0 starts now
🎉
2024-05-13 16:45:20 +00:00
Carlos Antonio da Silva
a6e2bb04dd
Merge pull request #51651 from heka1024/support-duration-in-xml
Support duration in `ActiveSupport::XmlMini`
2024-05-13 13:34:50 -03:00
Jean Boussier
06d3b358df Replace allocations count by GC time in request logs
Allocations count is often an interesting proxy for performance,
but not necessarily the most relevant thing to include in request
logs, given they aren't a per thread metric, so the reporting
is widely innacurate in multi-threaded environments.

Since Ruby 3.1 there is now `GC.total_time` which is a monotonically
increasing counter of time spent in GC. It still isn't really a per
thread metric, but is is more interesting because it uses the same
unit as the response time, allowing to better see when you have a GC
pause performance issue.
2024-05-08 23:02:35 +02:00
heka1024
b681bb6df2 Support duration in ActiveSupport::XmlMini 2024-05-04 21:37:45 +09:00
Rafael Mendonça França
c48aab17ce
Remove deprecated ActiveSupport::Notifications::Event#children and ActiveSupport::Notifications::Event#parent_of? 2024-05-01 18:45:46 +00:00
Rafael Mendonça França
fc2dc7c8d3
Remove deprecated support to call the following methods without passing a deprecator
- `deprecate`
  - `deprecate_constant`
  - `ActiveSupport::Deprecation::DeprecatedObjectProxy.new`
  - `ActiveSupport::Deprecation::DeprecatedInstanceVariableProxy.new`
  - `ActiveSupport::Deprecation::DeprecatedConstantProxy.new`
  - `assert_deprecated`
  - `assert_not_deprecated`
  - `collect_deprecations`
2024-05-01 18:45:45 +00:00
Rafael Mendonça França
c682bf2641
Remove deprecated ActiveSupport::Deprecation delegation to instance 2024-05-01 18:45:44 +00:00
Rafael Mendonça França
a45bfd9ee9
Remove deprecated SafeBuffer#clone_empty 2024-05-01 18:45:43 +00:00
Rafael Mendonça França
4d676ec0aa
Update deprecator horizon for 7.3
This change was never released on 7.1, so we can't remove it on 7.2.
2024-05-01 18:45:42 +00:00
Rafael Mendonça França
be211227a0
Remove deprecated #to_default_s from Array, Date, DateTime and Time 2024-05-01 18:45:41 +00:00
Rafael Mendonça França
c33e2d2e49
Remove deprecated support to passing Dalli::Client instances to MemCacheStore 2024-05-01 18:45:40 +00:00
Rafael Mendonça França
21f38d3d40
Remove deprecated config.active_support.use_rfc4122_namespaced_uuids 2024-05-01 18:45:37 +00:00
Rafael Mendonça França
e73e67ee99
Remove deprecated config.active_support.remove_deprecated_time_with_zone_name 2024-05-01 18:44:53 +00:00
Rafael Mendonça França
0e6859a237
Remove deprecated config.active_support.disable_to_s_conversion 2024-05-01 18:44:52 +00:00
Rafael Mendonça França
c4fdfc55fa
Remove deprecated support to bolding log text with positional boolean in ActiveSupport::LogSubscriber#color 2024-05-01 18:44:51 +00:00
Rafael Mendonça França
75981ade29
Remove deprecated constants ActiveSupport::LogSubscriber::CLEAR and ActiveSupport::LogSubscriber::BOLD 2024-05-01 18:44:50 +00:00
Rafael Mendonça França
38bfbcfbea
Remove deprecated support for config.active_support.cache_format_version = 6.1 2024-05-01 18:44:49 +00:00
Rafael Mendonça França
a3d6a9f5fc
Remove deprecated :pool_size and :pool_timeout options for the cache storage 2024-05-01 18:44:45 +00:00
Rafael Mendonça França
b1b2c6d59c
Remove deprecated support for the pre-Ruby 2.4 behavior of to_time
When `to_time_preserves_timezone` was set to `false`, `to_time`
would return a `Time` object with local timezone. This behavior
has been removed.
2024-05-01 18:44:31 +00:00
fatkodima
702638291c
Fix tests without assertions in the framework 2024-04-30 23:29:30 +00:00
Rafael Mendonça França
90b3f57f17
Merge pull request #51694 from Shopify/deduplicate-watched-files-in-FileUpdateChecker
Deduplicate watched filenames in `FileUpdateChecker`
2024-04-30 19:15:21 -03:00
Rafael Mendonça França
6a6c7e64f5
Remove configuration to control what we do with tests without assertions
This is too much complexity for something low value. Let's just always
warn when a test doesn't have any assertions.

If people want to raise an error or ignore them, they can do so by
overriding `Warning.warn`.
2024-04-30 21:43:54 +00:00
Nikita Vasilevsky
3b5ab678fc
Deduplicate watched filenames in FileUpdateChecker 2024-04-30 18:23:11 +00:00
Joshua Young
35e3ff3667
Fix minor typo in ActiveSupport::ProxyObject deprecation logs (#51688) 2024-04-29 20:50:27 -07:00
Andrew Novoselac
3fc58e52de Fix ActiveSupport::TestCase being loaded too early
rails/rails@76966f9 implemented configuration to report assertionless tests. But the configuration causes ActiveSupport::TestCase to be loaded too early in the boot process. It causes issues when other engines define load hooks on :active_support_test_case because they are run immediately. Instead, we should wrap the configuration in a load hook so it gets set at the appropriate time.
2024-04-28 18:49:44 -04:00
fatkodima
76966f9cb5 Allow assertionless tests to be reported 2024-04-26 18:24:16 +03:00
heka1024
03c28c7595 Remove outdated comment 2024-04-24 14:49:24 +09:00
Rafael Mendonça França
4dbf7e3354
Merge pull request #51649 from andresakata/main
[ci skip] Use Ruby's official documentation urls
2024-04-23 18:40:11 -03:00
André Guimarães Sakata
f6cace4f83 Use Ruby's official documentation 2024-04-23 17:57:56 -03:00
Rafael Mendonça França
fa23f0fdd0
Merge pull request #51619 from Earlopain/ruby-3.4-backtraces
Filter internal frames in deprecation warnings for Ruby 3.4
2024-04-23 17:52:58 -03:00
Carlos Antonio da Silva
0927af90d1 Rename method to keep it consistent with others _parse_* versions
Follow-up of 46c41db8fd665735c72c1428a06c1d29a3ed7c36.
2024-04-23 09:35:24 -03:00
Miller
fb2e2f336f Support hexBinary format in XML 2024-04-23 21:20:53 +09:00
Rafael Mendonça França
8aa8de4991
Merge pull request #51271 from sato11/enable-compact-blank
Enable Hash#compact_blank inside ActiveSupport::LogSubscriber
2024-04-22 18:39:49 -03:00
Rafael Mendonça França
fee72c3aa0
Merge pull request #51640 from Shopify/prepend-to-include
Use `Module#include` rather than `prepend` for faster method lookup
2024-04-22 18:01:08 -03:00
Kevin Menard
8e251a0728 Use Module#include rather than prepend since we don't need prepend semantics here and include leads to faster method lookups. 2024-04-22 16:00:44 -04:00
Earlopain
ea7d3c5165
Deprecate ActiveSupport::ProxyObject
A historic leftover from when Ruby didn't have `BasicObject`
2024-04-22 18:51:38 +02:00
Earlopain
fb886ad464
Remove reference to BlankSlate
This has actually been removed from the builder gem in https://github.com/rails/builder/pull/15
Additionally, `BasicObject` will be more familiar to users.
2024-04-22 15:59:18 +02:00
fatkodima
0883ce1472 Fix ActiveSupport configurations deprecations 2024-04-21 19:36:36 +03:00
Earlopain
c85eca47f0
Filter internal frames in deprecation warnings for Ruby 3.4
Followup to #50923
2024-04-20 15:33:25 +02:00
Judeeeee
4ac5ee9350 docs: Fix ActiveSupport::TimeWithZone#change example [skip ci]
This Pull Request has been created because the documentation for  `ActiveSupport::TimeWithZone#change` wasn't correct.

The behavior of `:hour` and `:min` is different from the example in the documentation.
I checked with Rails 7.1.3.2 and all digits after nano seconds are 0.

```ruby
t = Time.zone.now   #=> Sat, 20 Apr 2024 14:55:55.688536000 JST +09:00
t.change(hour: 12)  #=> Sat, 20 Apr 2024 12:00:00.000000000 JST +09:00
t.change(min: 30)   #=> Sat, 20 Apr 2024 14:30:00.000000000 JST +09:00
```
2024-04-20 16:12:27 +09:00
Jean Boussier
aa84a783ee ruby-head: handle unused block warnings
Ref: https://bugs.ruby-lang.org/issues/15554

This new Ruby 3.4 warning is still being fined tuned to reduce false positives,
so we shouldn't fail builds on it just yet.

It however caught one mistake in the test suite which is valuable.
2024-04-17 12:24:12 +02:00
Jean Boussier
afa019835b Fix ActiveJob::EnqueueAfterTransactionCommit API
Fix: https://github.com/rails/rails/pull/51426#issuecomment-2042611790

`perform_later` is supposed to return the Job instance on success,
and `false` on error.

When the `enqueue` is automatically delayed, it's of course impossible
to predict if the actual queueing will succeed, but for backward compatibility
reasons, it's best to assume it will.

If necessary, you can hold onto the job instance and check for
`#successfully_enqueued?` after the transaction has completed.
2024-04-10 09:20:12 +02:00
Jean Boussier
cc0f0f9c44 Make ActiveSupport::BacktraceCleaner copy filters and silencers on dup and clone
Previously the copy would still share the internal silencers and filters array,
causing state to leak.
2024-03-29 12:13:32 +01:00
Damian Nelson
9bd8a621f7
Updating Astana with a Western Kazakhstan timezone
On March 1, 2024, Kazakhstan (all parts) switched to use UTC+5. This
updates Astana (captital of Kazakhstan) to use a Western Kazakhstan
TZInfo identifier.
2024-03-12 17:42:16 -07:00
Rosa Gutierrez
71a74ad035
Preserve encoding on truncate_bytes (#51313)
String.new with no arguments returns the empty string with ASCII-8BIT
encoding. Then, depending on each grapheme cluster of the string and
on the omission string, the resulting string might keep the ASCII-8BIT
encoding. With this change, we preserve the encoding of the original
string instead.

Note that String.new accepts an `encoding` keyword argument, like
```
String.new(encoding: Encoding::UTF_8)
```
However, instead of using that, we rely on `force_encoding` to set the
original encoding. This is so that String subclasses don't need to
preserve this keyword argument. For example, SafeBuffer doesn't.
Thanks to @jeremy for catching this!
2024-03-12 15:39:21 -07:00
Junichi Sato
ffbe6050b8
Enable Hash#compact_blank inside ActiveSupport::LogSubscriber
Using ActiveSupport::LogSubscriber#color inside a custom log subscriber
causes NoMethodError.

```ruby
require "bundler/inline"

gemfile(true) do
  source "https://rubygems.org"

  gem "activesupport"
end

require "active_support"

class TestLogSubscriber < ActiveSupport::LogSubscriber
  attach_to :test

  def hi(event)
    info(color(event.payload[:message], GREEN))
  end

  private
    def log_exception(name, e)
      super
      raise e
    end
end

ActiveSupport::LogSubscriber.logger = ActiveSupport::Logger.new(STDOUT)
ActiveSupport::Notifications.instrument("hi.test", message: "Hello!")
```

```
/rails/activesupport/lib/active_support/log_subscriber.rb:193:in `mode_from': undefined method `compact_blank' for an instance of Hash (NoMethodError)

      modes = MODES.values_at(*options.compact_blank.keys)
                                      ^^^^^^^^^^^^^^
```

For what it's worth, I have encountered this while using kredis locally, like;

```
$ cd kredis
$ bin/console
irb(main):001> Kredis.string "mystring"
Could not log "meta.kredis" event. NoMethodError: undefined method `compact_blank' for an instance of Hash
```
2024-03-07 10:31:01 +09:00
Rafael Mendonça França
88afcce1dd
Merge pull request #51198 from willnet/fix-wrong-documentation-for-logger_outputs_to
Fix documentation and sample code for `ActiveSupport::Logger.logger_outputs_to?`
2024-02-26 21:08:52 -05:00
Shinichi Maeshima
fc62f03ae3
[ci skip]Fix documentation and sample code for ActiveSupport::Logger.logger_outputs_to?
Fixed incorrect documentation for `ActiveSupport::Logger.logger_outputs_to?`. The method expects the first argument to be a Logger object and subsequent variadic arguments to be either IO objects or strings representing file paths.

Also corrected the sample code in CHANGELOG.md, which previously only passed a single argument, not reflecting the correct usage.

related PR: https://github.com/rails/rails/pull/51125
2024-02-27 10:56:53 +09:00
Rafael Mendonça França
ada3d775bd
Use Kernel#Array to wrap the default value 2024-02-27 01:37:54 +00:00
Rafael Mendonça França
d216d1ede7
Do not always mark the default translation as html safe
If the `_html` suffis isn't provided we should not mark the default
translation as html safe and escape it.
2024-02-27 01:36:40 +00:00