Skip to content

feat(sqlserver): render seconds_between with DATEDIFF_BIG - #11

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 DATEDIFF_BIG(MILLISECOND, start, end) / 1000.0, which avoids the DATEDIFF overflow; below SQL Server 2016, where DATEDIFF_BIG does not exist, it refuses with UnsupportedFeatureError.

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/sqlserver/mixins/datetime.py (plus the version floor in .../sqlserver/dialect.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_sqlserver_test/feature/backend/expression/test_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 78.32%. Comparing base (ce1db88) to head (63a4e9d).
⚠️ Report is 1 commits behind head on release/v1.0.0.dev3.

Additional details and impacted files
@@                   Coverage Diff                   @@
##           release/v1.0.0.dev3      #11      +/-   ##
=======================================================
+ Coverage                77.87%   78.32%   +0.45%     
=======================================================
  Files                      144      144              
  Lines                     8306     8522     +216     
  Branches                  1289     1325      +36     
=======================================================
+ Hits                      6468     6675     +207     
+ Misses                    1408     1375      -33     
- Partials                   430      472      +42     
Flag Coverage Δ
python-3.14 78.32% <100.00%> (+0.45%) ⬆️
sqlserver-2025 78.32% <100.00%> (+0.45%) ⬆️
unittests 78.32% <100.00%> (+0.45%) ⬆️

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 merged commit 0958b82 into release/v1.0.0.dev3 Nov 8, 2026
12 of 13 checks passed
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.

1 participant