Skip to content

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

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

vistart merged 4 commits into
release/v1.0.0.dev2from
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_snowflake_test/feature/relation/ordering/test_has_many_order_by.py
pytest tests/rhosocial/activerecord_snowflake_test/feature/query/basic/test_find_one_or_create.py
pytest tests/rhosocial/activerecord_snowflake_test/feature/basic/readonly/test_readonly_models.py
pytest tests/rhosocial/activerecord_snowflake_test/feature/basic/nopk/test_keyless_models.py

CI runs against the configured Snowflake scenario; local collection verified 132 wrapper tests and no credentials were available for a live run.

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 90.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.92%. Comparing base (c6cfb4f) to head (7c845da).

Files with missing lines Patch % Lines
...al/activerecord/backend/impl/snowflake/cli/info.py 50.00% 2 Missing ⚠️
Additional details and impacted files
@@                   Coverage Diff                   @@
##           release/v1.0.0.dev2      #11      +/-   ##
=======================================================
- Coverage                81.71%   80.92%   -0.79%     
=======================================================
  Files                      117      118       +1     
  Lines                     5546     5694     +148     
  Branches                   804      829      +25     
=======================================================
+ Hits                      4532     4608      +76     
- Misses                     771      838      +67     
- Partials                   243      248       +5     
Flag Coverage Δ
python-3.12 80.92% <90.00%> (-0.79%) ⬇️
unittests 80.92% <90.00%> (-0.79%) ⬇️

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 5ae6038 into release/v1.0.0.dev2 Nov 10, 2026
11 of 12 checks passed
@vistart
vistart deleted the feature/logging-audit branch November 10, 2026 10:09
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