Repository navigation
Commit 7c5fff7
authored
release(v0.1.0-rc.2): framework stabilization, soft-delete, and lookup (#126)
## Description
This release candidate (`v0.1.0-rc.2`) introduces major architectural
stabilization, performance optimizations, and core feature additions to
prepare the framework for the upcoming `v1.0.0` stable milestone.
### Summary
- **Unified Exception Envelope & Normalization**: Implemented
standardized error normalization across all exception types
(`AppException`, `RequestValidationError`, `StarletteHTTPException`,
`ResponseValidationError`, and generic `Exception`) wrapping responses
in `ResponseWrapper[None]`, with Pydantic error sanitization
(`_sanitize_error_item`, `_format_error_location`), debug-gated response
details, and one-call registration via
`register_exception_handlers(app)`.
- **End-to-End Soft-Delete & Restoration Lifecycle**: Added declarative
soft-delete support across Repository, Service, and Router layers.
Includes `restore()` / `restore_multi()` with atomic SQL dialect-aware
`RETURNING` updates, lifecycle hooks (`pre/post_restore`), and `force:
bool = False` flag propagation for physical deletion via `DELETE
/resource/{id}?force=true`.
- **Field-Restricted `LOOKUP` Endpoint & Query Projections**: Introduced
`RouteKey.LOOKUP` (`POST /lookup`) with automatic schema-driven column
projection (`load_only`), relationship eager-loading (`selectinload` /
`joinedload`), allowed field validation, and `Actions.LOOKUP` RBAC
permission integration.
- **Search Engine Inversion & Logical NOT Groups**: Added inverted
comparison operators (`not_like`, `not_ilike`, `not_contains`,
`not_startswith`, `not_endswith`, `not_in`, `not_between`,
`is_not_null`) and logical `not` grouping to the AST query builder.
- **Re-entrant Unit of Work & Deferred Event Dispatching**: Added
depth-aware transaction coordination (`uow_depth`) for nested
`UnitOfWork` scopes, buffering domain events in
`session.info['uow_events']` to ensure atomic root-level dispatching.
- **Polymorphic Identifier Support**: Generalized user identity types
across `ZContext`, `UserProtocol`, `StreamManager`, and keyset
`CursorPagination` to seamlessly support `int`, `str`, and `UUID`
identifiers.
- **Optional Auth & Guest Field Shielding**: Added `auto_error=False`
support to `BaseAuth`, exported `get_optional_user_stub`, and introduced
`__private__` class attributes on `Zchema` to prune sensitive fields for
unauthenticated requests automatically.
- **Tunable Configuration & Parameter Bounding**: Added framework-wide
settings for pagination bounds, search depth, caching TTL/maxsize, and
stream queue limits, enforced dynamically via Pydantic model validators.
- **Logging Refinement & Context Isolation**: Implemented
status-code-aware log levels (DEBUG for `<500`, ERROR for `>=500`),
decoupled slow-query logging, preserved native Uvicorn console
formatting in dev mode vs JSON intercept in production, and hardened
Structlog contextvar isolation across background scopes.
- **Enhanced Test Harness & Fixtures**: Added `setup_test_database`,
`EventDispatcherSandbox`, custom engine/dependency overrides in
`DatabaseRollback`, and guest/superuser mocking in `ZTestClient`.
- **Tooling, Docs & CI**: Upgraded `zc run` with cascading configuration
(`CLI > .env > Defaults`) and transparent Uvicorn argument forwarding,
added dynamic test suite naming (`test_<app_name>.py`), restructured
`README.md` with the ZShop showcase, and split GitHub Actions CI into
quality check, cross-platform matrix, and smoke installation jobs.
### Impact
Standardizes error handling, transaction lifecycles, and data exposure
mechanisms across all layers of the framework. These changes resolve
multi-tenancy, typing, and background execution edge cases while
boosting serialization performance and providing developer tooling for
the stable `v1.0.0` release.
## Type of change
- [x] Bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [x] Refactoring (architectural or code cleanup with no functional
changes)
- [x] Documentation update
## How Has This Been Tested?
- [x] Unit/Integration tests (`hatch test`)
- Validated full test suite (515+ tests) across Python 3.11, 3.12, and
3.13 on Ubuntu, Windows, and macOS.
- Verified exception envelope conformity and header preservation across
all HTTP handlers.
- Tested single and bulk soft-delete, hard-delete (`force=True`), and
restoration lifecycles.
- Tested dynamic search operators, negation logic, and nested filter
depth validation.
- Verified `ZTestClient` savepoint rollbacks, polymorphic user IDs, and
optional auth mocking.
- Validated `Zchema` guest pruning (`__private__`) and role-based field
restrictions.
- [x] Static type check passing (`mypy src/`)
- Strict type checking passed with zero errors across all modules.
- [x] Code style and formatting checks (`ruff check src/`, `ruff format
--check src/`).
- [x] Smoke install build test (`pip install dist/*.whl` and CLI
verification).
## Checklist:
- [x] My code follows the style guidelines and architectural rules of
this project
- [x] I have performed a self-review of my own code
- [x] My changes pass strict static type analysis (`mypy src/` generates
no warnings)
- [x] I have commented my code, particularly in hard-to-understand areas
- [x] I have updated the documentation in `zcore-docs` if applicable
- [x] My changes generate no new runtime warnings
- [x] I have added tests that prove my fix is effective or that my
feature works69 files changed
Lines changed: 4498 additions & 1859 deletions
File tree
- .github/workflows
- src/zcore
- cache
- cli
- context
- db
- exceptions
- kernel
- logging
- security
- service
- storage
- testing
- utils
- web
- tests
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
6 | | - | |
7 | | - | |
| 5 | + | |
8 | 6 | | |
9 | | - | |
10 | | - | |
11 | | - | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
15 | | - | |
| 14 | + | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
30 | 30 | | |
31 | | - | |
| 31 | + | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
35 | | - | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | | - | |
4 | | - | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
5 | 8 | | |
6 | | - | |
7 | | - | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
8 | 14 | | |
9 | 15 | | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | 16 | | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
| 17 | + | |
26 | 18 | | |
| 19 | + | |
27 | 20 | | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
| 21 | + | |
36 | 22 | | |
| 23 | + | |
37 | 24 | | |
| 25 | + | |
38 | 26 | | |
39 | 27 | | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
44 | 43 | | |
45 | | - | |
46 | | - | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
0 commit comments