Skip to content

feat(logging): adapt execution logging and shared contracts - #16

Merged
vistart merged 5 commits into
release/v1.0.0.dev3from
feature/logging-audit
Nov 10, 2026
Merged

vistart merged 5 commits into
release/v1.0.0.dev3from
feature/logging-audit

Conversation

@vistart

@vistart vistart commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

Description

Aligns this backend with the core execution-logging contract introduced in rhosocial/python-activerecord#137.

  • execute_many accepts keyword-only options: ExecutionOptions | None and forwards it to the shared helpers; backends without overrides inherit the core implementation.
  • Single and batch executions use log_execution_start, log_batch_start, log_execution_summary, log_batch_summary and log_execution_error from core. Raw SQL/parameter logging and duplicate batch summaries are removed.
  • Sync and async backends share the canonical rhosocial.activerecord.backend.<type> logger.
  • Narrow backend log() overrides that dropped extra= are removed where present; CLI modules use the configured library logger.
  • INFO SQL and lifecycle chatter is downgraded to DEBUG; ERROR records logged immediately before a re-raise are downgraded to DEBUG, while swallowed recovery failures stay WARNING.
  • Adds the four shared-contract bridges: ordered-has-many, find-one-or-create, read-only models, keyless models.
  • Backend-specific test/schema gaps exposed by those contracts are fixed in this branch (for example orderable text columns and integrity-error normalization).

Depends on the core branch feature/logging-execution (PR rhosocial/python-activerecord#137); the temporary CI core reference points there.

No tracking issue.

Type of change

  • feat: A new feature
  • changed: A change in existing functionality
  • docs: Documentation only changes
  • test: Adding missing tests or correcting existing tests
  • perf: A code change that improves performance
  • chore: Changes to the build process or auxiliary tools and libraries
  • ci: Changes to our CI core reference
  • build: Changes that affect the build system or external dependencies
  • revert: Reverts a previous commit

Breaking Change

  • Yes, for end-users
  • Yes, for backend developers
  • No breaking changes

Impact on End-Users:

INFO output no longer contains raw SQL or parameter values; the backend now emits the core dml.* / dql.* / ddl.* / transaction.* summaries.

Impact on Backend Developers (Custom Implementations):

Custom overrides of execute_many, fetch_all or fetch_one must accept the new options / log_context keywords.

Applicable rhosocial-activerecord Version Range:

rhosocial-activerecord>=1.0.0.dev30,<2.0.0 once the core PR is released; CI currently tracks the core branch.

Related Repositories/Packages

Testing

  • I have added new tests to cover my changes.
  • I have updated existing tests to reflect my changes.
  • All existing tests pass in CI.
  • This change has been tested on the backend's CI matrix.

Test Plan:

pytest tests/rhosocial/activerecord_mariadb_test/feature/relation/ordering/test_has_many_order_by.py
pytest tests/rhosocial/activerecord_mariadb_test/feature/query/basic/test_find_one_or_create.py
pytest tests/rhosocial/activerecord_mariadb_test/feature/basic/readonly/test_readonly_models.py
pytest tests/rhosocial/activerecord_mariadb_test/feature/basic/nopk/test_keyless_models.py

Live runs against mariadb_1011 and mariadb_105 / mariadb_131rc: 220+ wrapper tests passed, including the async execute_many path.

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 where needed.
  • My changes generate no new warnings.
  • I have added a changelog fragment (changelog.d/<issue_number>.<type>.md).
  • 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 added after the PR number is known. The CI core reference will be switched to the next core release after PR rhosocial/python-activerecord#137 merges.

@vistart vistart self-assigned this Nov 10, 2026
@codecov

codecov Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.92308% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.46%. Comparing base (19b77b6) to head (b62b763).

Files with missing lines Patch % Lines
...cord/backend/impl/mariadb/backend/async_backend.py 95.23% 0 Missing and 1 partial ⚠️
...tiverecord/backend/impl/mariadb/backend/backend.py 94.73% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@                   Coverage Diff                   @@
##           release/v1.0.0.dev3      #16      +/-   ##
=======================================================
+ Coverage                76.50%   77.46%   +0.96%     
=======================================================
  Files                      140      140              
  Lines                     9754     9757       +3     
  Branches                  1385     1385              
=======================================================
+ Hits                      7462     7558      +96     
+ Misses                    1861     1772      -89     
+ Partials                   431      427       -4     
Flag Coverage Δ
mariadb-11.8 77.46% <96.92%> (+0.96%) ⬆️
python-3.14 77.46% <96.92%> (+0.96%) ⬆️
unittests 77.46% <96.92%> (+0.96%) ⬆️

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

Copy link
Copy Markdown

@vistart
vistart merged commit 625a655 into release/v1.0.0.dev3 Nov 10, 2026
20 checks passed
@vistart
vistart deleted the feature/logging-audit branch November 10, 2026 10:08
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