Skip to content

Read ActiveSupport's time precision when time_precision is not set - #562

Open
erikrozendaal wants to merge 1 commit into
masterfrom
improvement/time-precision-default
Open

erikrozendaal wants to merge 1 commit into
masterfrom
improvement/time-precision-default

Conversation

@erikrozendaal

Copy link
Copy Markdown
Member

Sequent read ActiveSupport::JSON::Encoding.time_precision once, when it was loaded, so an application that set ActiveSupport's precision later, for example in an initializer, kept the old value in Sequent. Without a value of its own, Sequent.configuration.time_precision now reads ActiveSupport's current value. This replaces #560: the setting stays, so a follow-up PR can use it for event JSON when Sequent moves from Oj to Ruby's json gem.

The default was read from ActiveSupport when Sequent was loaded, so an
application that set ActiveSupport's precision afterwards, for example
in an initializer, still used the old value in Sequent.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues are reported for the change to dynamically inherit ActiveSupport’s time precision while preserving explicit overrides.

No open issues 🎉

What changed in this PR

Updates Sequent’s time precision setting to read ActiveSupport’s current value when no explicit override is set, so configuration applied after Sequent loads is respected.

Changes:

  • Replaces the load-time default with a dynamic fallback while preserving explicit overrides.
  • Adds specs for the fallback and an explicit precision of zero.
  • Documents the behavior and removal of DEFAULT_TIME_PRECISION.
File Description
spec/​lib/​sequent/​configuration_spec.rb Tests dynamic fallback and explicit override behavior.
lib/​sequent/​configuration.rb Adds the fallback getter and removes the cached default.
docs/​docs/​concepts/​configuration.md Clarifies how the default precision is determined.
CHANGELOG.md Records the behavior change and constant removal.

Review effort: Balanced

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants