Skip to content

v1.4.1#119

Merged
ds1sqe merged 8 commits intomasterfrom
develop
Mar 3, 2026
Merged

v1.4.1#119
ds1sqe merged 8 commits intomasterfrom
develop

Conversation

@ds1sqe
Copy link
Copy Markdown
Owner

@ds1sqe ds1sqe commented Mar 3, 2026

No description provided.

ds1sqe added 8 commits March 3, 2026 10:47
Add per-manager hook registration so cross-cutting concerns (audit
logging, validation, cache invalidation, auto-populated fields) can
be attached without wrapping every call site.

- CrudEvent enum (8 events: pre/post for insert, update, delete, put)
- HookCancelled exception for pre-hook abort
- CrudHook duck-typed protocol — implement only the methods you need
- HookRunner with registration-order pre-hooks, reverse-order post-hooks
- Zero overhead when no hooks registered (has_hooks guard)
- Instrumented all 8 write methods on TypeDBManager
- 39 unit tests covering runner isolation and manager integration
Add LifecycleHook trait with HookRunner engine for EntityManager and
RelationManager. Pre-hooks run in registration order and can reject
operations; post-hooks run in reverse order with non-fatal errors.
Batch methods run all pre-hooks before the transaction and post-hooks
after commit. Zero overhead when no hooks are registered.
Enrich the server interceptor pipeline with CRUD context so
interceptors can distinguish entity insert from relation delete from
raw query — enabling rate limiting, tenant filtering, and CRUD-aware
audit logging at the HTTP layer.

- CrudInfo struct with operation/type_name/type_kind/attribute_names/iid
- CrudInterceptor convenience trait + CrudInterceptorAdapter bridge
- RequestContext and QueryInput carry crud_info through the pipeline
- All 8 CRUD handlers populate CrudInfo; non-CRUD uses Default
- 13 new unit tests (CrudInfo + CrudInterceptorAdapter)
Enrich the server interceptor pipeline with CRUD context so
interceptors can distinguish entity insert from relation delete from
raw query — enabling rate limiting, tenant filtering, and CRUD-aware
audit logging at the HTTP layer.

- CrudInfo struct with operation/type_name/type_kind/attribute_names/iid
- CrudInterceptor convenience trait + CrudInterceptorAdapter bridge
- RequestContext and QueryInput carry crud_info through the pipeline
- All 8 CRUD handlers populate CrudInfo; non-CRUD uses Default
- PipelineBuilder::with_skip_validation() for tests needing schema without validation
- 100% MC/DC coverage on all changed files (regions/functions/lines)
  - crud_interceptor.rs branches at 87.5% (1 missed: generic monomorphization artifact)
- 295 tests total (25 new)
Enrich the server interceptor pipeline with CRUD context so
interceptors can distinguish entity insert from relation delete from
raw query — enabling rate limiting, tenant filtering, and CRUD-aware
audit logging at the HTTP layer.

- CrudInfo struct with operation/type_name/type_kind/attribute_names/iid
- CrudInterceptor convenience trait + CrudInterceptorAdapter bridge
- RequestContext and QueryInput carry crud_info through the pipeline
- All 8 CRUD handlers populate CrudInfo; non-CRUD uses Default
- PipelineBuilder::with_skip_validation() for tests needing schema without validation
- 100% MC/DC coverage on all changed files (regions/functions/lines)
  - crud_interceptor.rs branches at 87.5% (1 missed: generic monomorphization artifact)
- 295 tests total (25 new)
…rceptors (#116)

Expose test_helpers module via `test-helpers` feature flag for external
integration tests. Add 3 test files:

- pipeline_integration_tests.rs (17 tests): end-to-end pipeline flow
  with schema validation, skip_validation, database override,
  interceptor chains, executor errors, validate-only endpoint
- http_integration_tests.rs (18 tests): full HTTP request/response via
  axum tower::ServiceExt oneshot — health, schema, query success/error,
  validation, interceptor via HTTP, routing (404/405)
- interceptor_integration_tests.rs (10 tests): multi-interceptor chain
  ordering (request forward, response reverse), rejection short-circuit,
  metadata propagation, audit log file output through full pipeline
Bump Python packages (pyproject.toml, __init__.py) and all five Rust
crates from 1.4.0/1.4.0-rc0 to 1.4.1.

Docs:
- CHANGELOG: add [1.4.1] section covering lifecycle hooks (Python ORM,
  Rust ORM, Rust Server), Put clause, and server API simplification
- docs/guide/crud.md: add Lifecycle Hooks section with full API
  reference, examples (audit, validation, filtering, composition)
- docs/guide/index.md: add hooks to Quick Reference
- README.md: add Lifecycle Hooks to feature list
- CLAUDE.md: add hooks.py to project structure tree

Fix:
- Export missing CrudHook protocol from type_bridge top-level __all__
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 3, 2026

Codecov Report

❌ Patch coverage is 83.10502% with 37 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
type_bridge/crud/typedb_manager.py 47.45% 26 Missing and 5 partials ⚠️
type_bridge/crud/hooks.py 93.84% 1 Missing and 3 partials ⚠️
type-bridge-core/crates/core/src/query_parser.rs 92.00% 1 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@ds1sqe ds1sqe merged commit 54857d7 into master Mar 3, 2026
53 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