Skip to content

feat(mariadb): render seconds_between with microsecond TIMESTAMPDIFF - #13

Merged
vistart merged 6 commits into
release/v1.0.0.dev3from
feature/extract-epoch
Nov 8, 2026
Merged

vistart merged 6 commits into
release/v1.0.0.dev3from
feature/extract-epoch

Conversation

@vistart

@vistart vistart commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

Description

Implements the backend half of the portable seconds_between expression added in
rhosocial/python-activerecord#129: format_seconds_between_expression() renders
end - start in signed, fractional seconds. The formatter renders TIMESTAMPDIFF(MICROSECOND, start, end) / 1000000, which keeps the fraction MariaDB stores.

The core raises UnsupportedFeatureError until a dialect adapts the hook, so this
change is what makes the expression usable on this engine. The implementation lives in
src/rhosocial/activerecord/backend/impl/mariadb/mixins/datetime.py.

Type of change

  • feat: A new feature
  • docs: Documentation for the new capability
  • test: Tests for the new capability
  • chore: CI installs the core from the feature branch (see below)
  • perf / ci / build / revert: not applicable

Breaking Change

  • Yes, for end-users (backward-incompatible API changes)
  • Yes, for backend developers (internal architectural changes that may affect custom implementations)
  • No breaking changes

Impact on End-Users:
No backward-incompatible changes are expected: the expression is new, and nothing
existing changes shape.

Impact on Backend Developers (Custom Implementations):
None. The dialect hook is additive; implementations that do not override it keep
inheriting the core refusal.

Related Repositories/Packages

Requires rhosocial/python-activerecord#129 (branch feature/extract-epoch).

.github/workflows/test.yml now installs the core from feature/extract-epoch
instead of release/v1.0.0.dev30, so CI exercises the core change and this backend
together (see the chore(ci) commit on this branch). That pin is temporary: it should
go back to the release branch once the core PR merges.

Testing

  • I have added new tests to cover my changes.
  • I have updated existing tests to reflect my changes.
  • All existing tests pass.
  • This change has been tested on the target engine.

Test Plan:

  • tests/rhosocial/activerecord_mariadb_test/feature/backend/test_mariadb_seconds_between.py

Checklist

  • My code follows the project's code style guidelines.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation (Docstrings, README.md, etc.).
  • My changes generate no new warnings.
  • I have added a Changelog fragment (added in a follow-up commit, once the PR number is known).
  • I have verified that my changes do not introduce SQL injection vulnerabilities.
  • I have checked for potential performance regressions.

Additional Notes

The changelog fragment is intentionally deferred until the PR number exists; it is
added as changelog.d/<pr_number>.added.md right after the PR opens.

@codecov

codecov Bot commented Nov 8, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.39%. Comparing base (03065cb) to head (fd50990).

Additional details and impacted files
@@                   Coverage Diff                   @@
##           release/v1.0.0.dev3      #13      +/-   ##
=======================================================
+ Coverage                75.38%   75.39%   +0.01%     
=======================================================
  Files                      139      139              
  Lines                     8852     8857       +5     
  Branches                  1232     1232              
=======================================================
+ Hits                      6673     6678       +5     
  Misses                    1805     1805              
  Partials                   374      374              
Flag Coverage Δ
mariadb-11.8 75.39% <100.00%> (+0.01%) ⬆️
python-3.14 75.39% <100.00%> (+0.01%) ⬆️
unittests 75.39% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@sonarqubecloud

sonarqubecloud Bot commented Nov 8, 2026

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
C Security Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@vistart vistart self-assigned this Nov 8, 2026
@vistart vistart added the enhancement New feature or request label Nov 8, 2026
@vistart
vistart merged commit 2a510e3 into release/v1.0.0.dev3 Nov 8, 2026
19 of 20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant